problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k ⌀ | fixed_code stringlengths 12 526k ⌀ | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M ⌀ | fixed_submission_id int64 2 1.54M ⌀ | user_id stringlengths 10 10 ⌀ | language stringclasses 9
values |
|---|---|---|---|---|---|---|---|
p03169 |
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <cstring>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <utility>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define dump(c) \
{ \
for (auto it = c.begin(); it != c.end(); ++it) \
if (it == c.begin()) \
cout << *it; \
else \
cout << ' ' << *it; \
cout << endl; \
}
#define dumpMap(m) \
{ \
for (auto it : m) \
cout << it.first << "=>" << it.second << ' '; \
}
const int MOD = 1000000007;
double dp[301][301][301]; // dish with 3 sushi's - dish with 2 sushi's - dish
// with 1 sushi => expected # of moves
int main() {
int N;
cin >> N;
vector<int> s(4);
rep(i, N) {
int a;
cin >> a;
++s[a];
}
dump(s);
double dN = (double)N;
dp[0][0][0] = 0;
for (int i = 1; i <= N; ++i) {
dp[0][0][i] = dp[0][0][i - 1] + dN / i;
// cout << "dp[0][0][" << i << "] = " << dp[0][0][i] << endl;
}
for (int j = 1; j <= N; ++j) {
for (int i = 0; i + j <= N; ++i) {
dp[0][j][i] = dp[0][j - 1][i + 1] * j / (i + j) + dN / (i + j);
if (0 < i) {
dp[0][j][i] += dp[0][j][i - 1] * i / (i + j);
}
// cout << "dp[0][" << j << "][" << i << "] = " << dp[0][j][i] << endl;
}
}
for (int k = 1; k <= s[3]; ++k) {
for (int j = 0; j + k <= N; ++j) {
for (int i = 0; i + j + k <= N; ++i) {
dp[k][j][i] = dp[k - 1][j + 1][i] * k / (i + j + k) + dN / (i + j + k);
if (0 < j) {
dp[k][j][i] += dp[k][j - 1][i + 1] * j / (i + j + k);
}
if (0 < i) {
dp[k][j][i] += dp[k][j][i - 1] * i / (i + j + k);
}
// cout << "dp[" << k << "][" << j << "][" << i << "] = " << dp[k][j][i]
// << endl;
}
}
}
cout << setprecision(12) << dp[s[3]][s[2]][s[1]] << endl;
return 0;
}
|
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <cstring>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <utility>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define dump(c) \
{ \
for (auto it = c.begin(); it != c.end(); ++it) \
if (it == c.begin()) \
cout << *it; \
else \
cout << ' ' << *it; \
cout << endl; \
}
#define dumpMap(m) \
{ \
for (auto it : m) \
cout << it.first << "=>" << it.second << ' '; \
}
const int MOD = 1000000007;
double dp[301][301][301]; // dish with 3 sushi's - dish with 2 sushi's - dish
// with 1 sushi => expected # of moves
int main() {
int N;
cin >> N;
vector<int> s(4);
rep(i, N) {
int a;
cin >> a;
++s[a];
}
double dN = (double)N;
dp[0][0][0] = 0;
for (int i = 1; i <= N; ++i) {
dp[0][0][i] = dp[0][0][i - 1] + dN / i;
// cout << "dp[0][0][" << i << "] = " << dp[0][0][i] << endl;
}
for (int j = 1; j <= N; ++j) {
for (int i = 0; i + j <= N; ++i) {
dp[0][j][i] = dp[0][j - 1][i + 1] * j / (i + j) + dN / (i + j);
if (0 < i) {
dp[0][j][i] += dp[0][j][i - 1] * i / (i + j);
}
// cout << "dp[0][" << j << "][" << i << "] = " << dp[0][j][i] << endl;
}
}
for (int k = 1; k <= s[3]; ++k) {
for (int j = 0; j + k <= N; ++j) {
for (int i = 0; i + j + k <= N; ++i) {
dp[k][j][i] = dp[k - 1][j + 1][i] * k / (i + j + k) + dN / (i + j + k);
if (0 < j) {
dp[k][j][i] += dp[k][j - 1][i + 1] * j / (i + j + k);
}
if (0 < i) {
dp[k][j][i] += dp[k][j][i - 1] * i / (i + j + k);
}
// cout << "dp[" << k << "][" << j << "][" << i << "] = " << dp[k][j][i]
// << endl;
}
}
}
cout << setprecision(12) << dp[s[3]][s[2]][s[1]] << endl;
return 0;
}
| [
"call.remove"
] | 978,110 | 978,111 | u851470173 | cpp |
p03169 |
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <cstring>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <utility>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define dump(c) \
{ \
for (auto it = c.begin(); it != c.end(); ++it) \
if (it == c.begin()) \
cout << *it; \
else \
cout << ' ' << *it; \
cout << endl; \
}
#define dumpMap(m) \
{ \
for (auto it : m) \
cout << it.first << "=>" << it.second << ' '; \
}
const int MOD = 1000000007;
double dp[301][301][301]; // dish with 3 sushi's - dish with 2 sushi's - dish
// with 1 sushi => expected # of moves
int main() {
int N;
cin >> N;
vector<int> s(4);
rep(i, N) {
int a;
cin >> a;
++s[a];
}
dump(s);
double dN = (double)N;
dp[0][0][0] = 0;
for (int i = 1; i <= N; ++i) {
dp[0][0][i] = dp[0][0][i - 1] + dN / i;
// cout << "dp[0][0][" << i << "] = " << dp[0][0][i] << endl;
}
for (int j = 1; j <= N; ++j) {
for (int i = 0; i + j <= N; ++i) {
dp[0][j][i] = dp[0][j - 1][i + 1] * j / (i + j) + dN / (i + j);
if (0 < i) {
dp[0][j][i] += dp[0][j][i - 1] * i / (i + j);
}
// cout << "dp[0][" << j << "][" << i << "] = " << dp[0][j][i] << endl;
}
}
for (int k = 1; k <= s[3]; ++k) {
for (int j = 0; j + k <= N; ++j) {
for (int i = 0; i + j + k <= N; ++i) {
dp[k][j][i] = dp[k - 1][j + 1][i] * k / (i + j + k) + dN / (i + j + k);
if (0 < j) {
dp[k][j][i] += dp[k][j - 1][i + 1] * j / (i + j + k);
}
if (0 < i) {
dp[k][j][i] += dp[k][j][i - 1] * i / (i + j + k);
}
// cout << "dp[" << k << "][" << j << "][" << i << "] = " << dp[k][j][i]
// << endl;
}
}
}
cout << setprecision(10) << dp[s[3]][s[2]][s[1]] << endl;
return 0;
}
|
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <cstring>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <utility>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define dump(c) \
{ \
for (auto it = c.begin(); it != c.end(); ++it) \
if (it == c.begin()) \
cout << *it; \
else \
cout << ' ' << *it; \
cout << endl; \
}
#define dumpMap(m) \
{ \
for (auto it : m) \
cout << it.first << "=>" << it.second << ' '; \
}
const int MOD = 1000000007;
double dp[301][301][301]; // dish with 3 sushi's - dish with 2 sushi's - dish
// with 1 sushi => expected # of moves
int main() {
int N;
cin >> N;
vector<int> s(4);
rep(i, N) {
int a;
cin >> a;
++s[a];
}
double dN = (double)N;
dp[0][0][0] = 0;
for (int i = 1; i <= N; ++i) {
dp[0][0][i] = dp[0][0][i - 1] + dN / i;
// cout << "dp[0][0][" << i << "] = " << dp[0][0][i] << endl;
}
for (int j = 1; j <= N; ++j) {
for (int i = 0; i + j <= N; ++i) {
dp[0][j][i] = dp[0][j - 1][i + 1] * j / (i + j) + dN / (i + j);
if (0 < i) {
dp[0][j][i] += dp[0][j][i - 1] * i / (i + j);
}
// cout << "dp[0][" << j << "][" << i << "] = " << dp[0][j][i] << endl;
}
}
for (int k = 1; k <= s[3]; ++k) {
for (int j = 0; j + k <= N; ++j) {
for (int i = 0; i + j + k <= N; ++i) {
dp[k][j][i] = dp[k - 1][j + 1][i] * k / (i + j + k) + dN / (i + j + k);
if (0 < j) {
dp[k][j][i] += dp[k][j - 1][i + 1] * j / (i + j + k);
}
if (0 < i) {
dp[k][j][i] += dp[k][j][i - 1] * i / (i + j + k);
}
// cout << "dp[" << k << "][" << j << "][" << i << "] = " << dp[k][j][i]
// << endl;
}
}
}
cout << setprecision(12) << dp[s[3]][s[2]][s[1]] << endl;
return 0;
}
| [
"call.remove",
"literal.number.change",
"io.output.change"
] | 978,112 | 978,111 | u851470173 | cpp |
p03169 | #pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <x86intrin.h>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag,
tree_order_statistics_node_update>;
#define pb push_back
#define mp make_pair
#define in insert
#define f first
#define s second
#define ll long long
#define ld long double
const int mod = 1e9 + 7;
const int N = 2e5 + 7;
const int inf = 2e9;
const ll INF = 1e18;
ld dp[303][303][303];
int cnt[303];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("*.in", "r", stdin);freopen("*.out", "w", stdout);
ld n;
cin >> n;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
cnt[a]++;
}
for (int k = 0; k <= n; k++) {
for (int j = 0; j <= n; j++) {
for (int i = 0; i <= n; i++) {
if (i + j + k == 0 || i + j + k > n)
continue;
dp[i][j][k] = 1;
if (i)
dp[i][j][k] += dp[i - 1][j][k] * i / n;
if (j)
dp[i][j][k] += dp[i + 1][j - 1][k] * j / n;
if (k)
dp[i][j][k] += dp[i][j + 1][k - 1] * k / n;
dp[i][j][k] *= n / (i + j + k);
}
}
}
printf("%0.11lf", dp[cnt[1]][cnt[2]][cnt[3]]);
} | #pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <x86intrin.h>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag,
tree_order_statistics_node_update>;
#define pb push_back
#define mp make_pair
#define in insert
#define f first
#define s second
#define ll long long
#define dd double
const int mod = 1e9 + 7;
const int N = 2e5 + 7;
const int inf = 2e9;
const ll INF = 1e18;
double dp[303][303][303];
int cnt[303];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("*.in", "r", stdin);freopen("*.out", "w", stdout);
double n;
cin >> n;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
cnt[a]++;
}
for (int k = 0; k <= n; k++) {
for (int j = 0; j <= n; j++) {
for (int i = 0; i <= n; i++) {
if (i + j + k == 0 || i + j + k > n)
continue;
dp[i][j][k] = 1;
if (i)
dp[i][j][k] += dp[i - 1][j][k] * i / n;
if (j)
dp[i][j][k] += dp[i + 1][j - 1][k] * j / n;
if (k)
dp[i][j][k] += dp[i][j + 1][k - 1] * k / n;
dp[i][j][k] *= n / (i + j + k);
}
}
}
printf("%0.11lf", dp[cnt[1]][cnt[2]][cnt[3]]);
} | [
"identifier.change",
"variable_declaration.type.change"
] | 978,123 | 978,124 | u637534849 | cpp |
p03169 | #include <bits/stdc++.h>
using namespace std;
long double dp[310][310][310];
int n, c[3];
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
c[x - 1]++;
}
for (int k = 0; k <= c[2]; k++) {
for (int j = 0; j < n; j++) {
for (int i = 0; i <= n; i++) {
int tc = i + j + k;
if (tc == 0 || tc > n)
continue;
dp[i][j][k] = 1;
if (i)
dp[i][j][k] += dp[i - 1][j][k] * i / n;
if (j)
dp[i][j][k] += dp[i + 1][j - 1][k] * j / n;
if (k)
dp[i][j][k] += dp[i][j + 1][k - 1] * k / n;
dp[i][j][k] *= (long double)n / tc;
}
}
}
cout << fixed << setprecision(16) << dp[c[0]][c[1]][c[2]] << '\n';
}
| #include <bits/stdc++.h>
using namespace std;
long double dp[310][310][310];
int n, c[3];
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
c[x - 1]++;
}
for (int k = 0; k <= c[2]; k++) {
for (int j = 0; j <= n; j++) {
for (int i = 0; i <= n; i++) {
int tc = i + j + k;
if (tc == 0 || tc > n)
continue;
dp[i][j][k] = 1;
if (i)
dp[i][j][k] += dp[i - 1][j][k] * i / n;
if (j)
dp[i][j][k] += dp[i + 1][j - 1][k] * j / n;
if (k)
dp[i][j][k] += dp[i][j + 1][k - 1] * k / n;
dp[i][j][k] *= (long double)n / tc;
}
}
}
cout << fixed << setprecision(16) << dp[c[0]][c[1]][c[2]] << '\n';
}
| [
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 978,129 | 978,130 | u543921019 | cpp |
p03169 | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
double dp[310][310][310];
int n;
double rec(int n1, int n2, int n3) {
if (dp[n1][n2][n3] >= 0)
return dp[n1][n2][n3];
if (n1 == 0 && n2 == 0 && n3 == 0)
return 0.0;
double res = 0.0;
if (n1 > 0)
res += rec(n1 - 1, n2, n3) * n1;
if (n2 > 0)
res += rec(n1, n2 - 1, n3) * n2;
if (n3 > 0)
res += rec(n1, n2, n3 - 1) * n3;
res += n;
res *= 1.0 / (n1 + n2 + n3);
return dp[n1][n2][n3] = res;
}
int main() {
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
memset(dp, -1, sizeof(dp));
int one = 0, two = 0, three = 0;
rep(i, n) {
if (a[i] == 1)
one++;
else if (a[i] == 2)
two++;
else
three++;
}
cout << fixed << setprecision(10) << rec(one, two, three) << endl;
return 0;
} | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
double dp[310][310][310];
int n;
double rec(int n1, int n2, int n3) {
if (dp[n1][n2][n3] >= 0)
return dp[n1][n2][n3];
if (n1 == 0 && n2 == 0 && n3 == 0)
return 0.0;
double res = 0.0;
if (n1 > 0)
res += rec(n1 - 1, n2, n3) * n1;
if (n2 > 0)
res += rec(n1 + 1, n2 - 1, n3) * n2;
if (n3 > 0)
res += rec(n1, n2 + 1, n3 - 1) * n3;
res += n;
res *= 1.0 / (n1 + n2 + n3);
return dp[n1][n2][n3] = res;
}
int main() {
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
memset(dp, -1, sizeof(dp));
int one = 0, two = 0, three = 0;
rep(i, n) {
if (a[i] == 1)
one++;
else if (a[i] == 2)
two++;
else
three++;
}
cout << fixed << setprecision(10) << rec(one, two, three) << endl;
return 0;
} | [
"assignment.change"
] | 978,141 | 978,142 | u270681687 | cpp |
p03169 | #include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define p(s) std::cout << s;
#define pl(s) std::cout << s << endl;
#define printIf(j, s1, s2) cout << (j ? s1 : s2) << endl;
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
#define all(v) v.begin(), v.end()
#define showVector(v) \
REP(i, v.size()) { \
p(v[i]); \
p(" ") \
} \
pl("")
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
typedef long long int ll;
typedef pair<int, int> P_ii;
typedef pair<double, double> P_dd;
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t)
fill_v(e, v);
}
const int mod = 1000000007;
const int MOD = 1000000007;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
void addM(long long &a, long long b) {
a += b;
if (a >= MOD)
a -= MOD;
}
void mulM(long long &a, long long b) { a = ((a % MOD) * (b % MOD)) % MOD; }
// a^b mod M
long myPow(long a, long b, int M) {
long ret = 1;
long tmp = a;
while (b > 0) {
if ((b & 1) == 1)
ret = (ret * tmp) % M;
tmp = (tmp * tmp) % M;
b = b >> 1;
}
return ret;
}
// nCk mod M
int nCk(int n, int k, int M) {
long ret = 1;
int mi = min(k, n - k);
for (int i = 1; i <= mi; i++) {
ret = (ret * myPow(i, M - 2, M)) % M;
}
for (int i = n - mi + 1; i <= n; i++) {
ret = (ret * i) % M;
}
return (int)ret;
}
int N;
auto dp = make_vec<double>(310, 310, 310);
// あと1枚がi種、あと2枚がj種、あと3枚がk種、
double solve(int i, int j, int k) {
if (dp[i][j][k] >= 0)
return dp[i][j][k];
double ret = 0.0;
if (i > 0)
ret += solve(i - 1, j, k) * i;
if (j > 0)
ret += solve(i + 1, j - 1, k) * j;
if (k > 0)
ret += solve(i, j + 1, k - 1) * k;
ret += N;
ret *= 1.0 / (i + j + k);
return dp[i][j][k] = ret;
}
int main() {
cin >> N;
fill_v(dp, -1);
dp[0][0][0] = 0;
map<int, int> mp;
REP(i, 3) mp[i + 1] = 0;
REP(i, N) {
int tmp;
cin >> tmp;
mp[tmp]++;
}
printf("%l.12f\n", solve(mp[1], mp[2], mp[3]));
return 0;
} | #include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define p(s) std::cout << s;
#define pl(s) std::cout << s << endl;
#define printIf(j, s1, s2) cout << (j ? s1 : s2) << endl;
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
#define all(v) v.begin(), v.end()
#define showVector(v) \
REP(i, v.size()) { \
p(v[i]); \
p(" ") \
} \
pl("")
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
typedef long long int ll;
typedef pair<int, int> P_ii;
typedef pair<double, double> P_dd;
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t)
fill_v(e, v);
}
const int mod = 1000000007;
const int MOD = 1000000007;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
void addM(long long &a, long long b) {
a += b;
if (a >= MOD)
a -= MOD;
}
void mulM(long long &a, long long b) { a = ((a % MOD) * (b % MOD)) % MOD; }
// a^b mod M
long myPow(long a, long b, int M) {
long ret = 1;
long tmp = a;
while (b > 0) {
if ((b & 1) == 1)
ret = (ret * tmp) % M;
tmp = (tmp * tmp) % M;
b = b >> 1;
}
return ret;
}
// nCk mod M
int nCk(int n, int k, int M) {
long ret = 1;
int mi = min(k, n - k);
for (int i = 1; i <= mi; i++) {
ret = (ret * myPow(i, M - 2, M)) % M;
}
for (int i = n - mi + 1; i <= n; i++) {
ret = (ret * i) % M;
}
return (int)ret;
}
int N;
auto dp = make_vec<double>(310, 310, 310);
// あと1枚がi種、あと2枚がj種、あと3枚がk種、
double solve(int i, int j, int k) {
if (dp[i][j][k] >= 0)
return dp[i][j][k];
double ret = 0.0;
if (i > 0)
ret += solve(i - 1, j, k) * i;
if (j > 0)
ret += solve(i + 1, j - 1, k) * j;
if (k > 0)
ret += solve(i, j + 1, k - 1) * k;
ret += N;
ret *= 1.0 / (i + j + k);
return dp[i][j][k] = ret;
}
int main() {
cin >> N;
fill_v(dp, -1);
dp[0][0][0] = 0;
map<int, int> mp;
REP(i, 3) mp[i + 1] = 0;
REP(i, N) {
int tmp;
cin >> tmp;
mp[tmp]++;
}
printf("%.12f\n", solve(mp[1], mp[2], mp[3]));
return 0;
}
| [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 978,143 | 978,144 | u491550356 | cpp |
p03169 | #include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define p(s) std::cout << s;
#define pl(s) std::cout << s << endl;
#define printIf(j, s1, s2) cout << (j ? s1 : s2) << endl;
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
#define all(v) v.begin(), v.end()
#define showVector(v) \
REP(i, v.size()) { \
p(v[i]); \
p(" ") \
} \
pl("")
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
typedef long long int ll;
typedef pair<int, int> P_ii;
typedef pair<double, double> P_dd;
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t)
fill_v(e, v);
}
const int mod = 1000000007;
const int MOD = 1000000007;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
void addM(long long &a, long long b) {
a += b;
if (a >= MOD)
a -= MOD;
}
void mulM(long long &a, long long b) { a = ((a % MOD) * (b % MOD)) % MOD; }
// a^b mod M
long myPow(long a, long b, int M) {
long ret = 1;
long tmp = a;
while (b > 0) {
if ((b & 1) == 1)
ret = (ret * tmp) % M;
tmp = (tmp * tmp) % M;
b = b >> 1;
}
return ret;
}
// nCk mod M
int nCk(int n, int k, int M) {
long ret = 1;
int mi = min(k, n - k);
for (int i = 1; i <= mi; i++) {
ret = (ret * myPow(i, M - 2, M)) % M;
}
for (int i = n - mi + 1; i <= n; i++) {
ret = (ret * i) % M;
}
return (int)ret;
}
int N;
auto dp = make_vec<double>(310, 310, 310);
// あと1枚がi種、あと2枚がj種、あと3枚がk種、
double solve(int i, int j, int k) {
if (dp[i][j][k] >= 0)
return dp[i][j][k];
double ret = 0.0;
if (i > 0)
ret += solve(i - 1, j, k) * i;
if (j > 0)
ret += solve(i + 1, j - 1, k) * j;
if (k > 0)
ret += solve(i, j + 1, k - 1) * k;
ret += N;
ret *= 1.0 / (i + j + k);
return dp[i][j][k] = ret;
}
int main() {
cin >> N;
fill_v(dp, -1);
dp[0][0][0] = 0;
map<int, int> mp;
REP(i, 3) mp[i + 1] = 0;
REP(i, N) {
int tmp;
cin >> tmp;
mp[tmp]++;
}
printf("%l.12f\n", solve(mp[1], mp[2], mp[3]));
return 0;
} | #include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define p(s) std::cout << s;
#define pl(s) std::cout << s << endl;
#define printIf(j, s1, s2) cout << (j ? s1 : s2) << endl;
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
#define all(v) v.begin(), v.end()
#define showVector(v) \
REP(i, v.size()) { \
p(v[i]); \
p(" ") \
} \
pl("")
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
typedef long long int ll;
typedef pair<int, int> P_ii;
typedef pair<double, double> P_dd;
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
for (auto &e : t)
fill_v(e, v);
}
const int mod = 1000000007;
const int MOD = 1000000007;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
void addM(long long &a, long long b) {
a += b;
if (a >= MOD)
a -= MOD;
}
void mulM(long long &a, long long b) { a = ((a % MOD) * (b % MOD)) % MOD; }
// a^b mod M
long myPow(long a, long b, int M) {
long ret = 1;
long tmp = a;
while (b > 0) {
if ((b & 1) == 1)
ret = (ret * tmp) % M;
tmp = (tmp * tmp) % M;
b = b >> 1;
}
return ret;
}
// nCk mod M
int nCk(int n, int k, int M) {
long ret = 1;
int mi = min(k, n - k);
for (int i = 1; i <= mi; i++) {
ret = (ret * myPow(i, M - 2, M)) % M;
}
for (int i = n - mi + 1; i <= n; i++) {
ret = (ret * i) % M;
}
return (int)ret;
}
int N;
auto dp = make_vec<double>(310, 310, 310);
// あと1枚がi種、あと2枚がj種、あと3枚がk種、
double solve(int i, int j, int k) {
if (dp[i][j][k] >= 0)
return dp[i][j][k];
double ret = 0.0;
if (i > 0)
ret += solve(i - 1, j, k) * i;
if (j > 0)
ret += solve(i + 1, j - 1, k) * j;
if (k > 0)
ret += solve(i, j + 1, k - 1) * k;
ret += N;
ret *= 1.0 / (i + j + k);
return dp[i][j][k] = ret;
}
int main() {
cin >> N;
fill_v(dp, -1);
dp[0][0][0] = 0;
map<int, int> mp;
REP(i, 3) mp[i + 1] = 0;
REP(i, N) {
int tmp;
cin >> tmp;
mp[tmp]++;
}
printf("%.12f\n", solve(mp[1], mp[2], mp[3]));
return 0;
} | [
"literal.string.change",
"call.arguments.change",
"io.output.change"
] | 978,143 | 978,146 | u491550356 | cpp |
p03169 | #include <bits/stdc++.h>
using namespace std;
bool FLAG = true;
#define debug(x) \
if (FLAG) { \
cout << #x << " = " << x << endl; \
}
#define debug_vec(x) \
if (FLAG) { \
cout << #x << " = {"; \
for (auto a : x) \
cout << a << ","; \
cout << "}" << endl; \
}
#define debug_pair(x) ...
int n, cnt[4];
double p[301][301][301], ev[301][301][301];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
int a;
cin >> a;
cnt[a]++;
}
p[cnt[3]][cnt[2]][cnt[1]] = 1;
for (int i = cnt[3]; i >= 0; i--) {
for (int j = cnt[2] + (cnt[3] - i); j >= 0; j--) {
for (int t = cnt[1] + (cnt[2] + (cnt[3] - i) - j); t >= 0; t--) {
if (i == 0 && j == 0 && t == 0) {
continue;
}
double p_w = (double)(n - i - j - t) / n;
double ev_w = p_w / (1 - p_w) + 1;
ev[i][j][t] += (p[i][j][t] * ev_w);
if (t - 1 >= 0) {
double p_go = (double)t / (i + j + t);
p[i][j][t - 1] += p[i][j][t] * p_go;
ev[i][j][t - 1] += ev[i][j][t] * p_go;
}
if (j - 1 >= 0) {
double p_go = (double)j / (i + j + t);
p[i][j - 1][t + 1] += p[i][j][t] * p_go;
ev[i][j - 1][t + 1] += ev[i][j][t] * p_go;
}
if (i - 1 >= 0) {
double p_go = (double)i / (i + j + t);
p[i - 1][j + 1][t] += p[i][j][t] * p_go;
ev[i - 1][j + 1][t] += ev[i][j][t] * p_go;
}
}
}
}
cout << fixed << setprecision(1) << ev[0][0][0];
}
| #include <bits/stdc++.h>
using namespace std;
bool FLAG = true;
#define debug(x) \
if (FLAG) { \
cout << #x << " = " << x << endl; \
}
#define debug_vec(x) \
if (FLAG) { \
cout << #x << " = {"; \
for (auto a : x) \
cout << a << ","; \
cout << "}" << endl; \
}
#define debug_pair(x) ...
int n, cnt[4];
double p[301][301][301], ev[301][301][301];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
int a;
cin >> a;
cnt[a]++;
}
p[cnt[3]][cnt[2]][cnt[1]] = 1;
for (int i = cnt[3]; i >= 0; i--) {
for (int j = cnt[2] + (cnt[3] - i); j >= 0; j--) {
for (int t = cnt[1] + (cnt[2] + (cnt[3] - i) - j); t >= 0; t--) {
if (i == 0 && j == 0 && t == 0) {
continue;
}
double p_w = (double)(n - i - j - t) / n;
double ev_w = p_w / (1 - p_w) + 1;
ev[i][j][t] += (p[i][j][t] * ev_w);
if (t - 1 >= 0) {
double p_go = (double)t / (i + j + t);
p[i][j][t - 1] += p[i][j][t] * p_go;
ev[i][j][t - 1] += ev[i][j][t] * p_go;
}
if (j - 1 >= 0) {
double p_go = (double)j / (i + j + t);
p[i][j - 1][t + 1] += p[i][j][t] * p_go;
ev[i][j - 1][t + 1] += ev[i][j][t] * p_go;
}
if (i - 1 >= 0) {
double p_go = (double)i / (i + j + t);
p[i - 1][j + 1][t] += p[i][j][t] * p_go;
ev[i - 1][j + 1][t] += ev[i][j][t] * p_go;
}
}
}
}
cout << fixed << setprecision(9) << ev[0][0][0];
}
| [
"literal.number.change",
"io.output.change"
] | 978,147 | 978,148 | u505802099 | cpp |
p03169 | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
#define PI 3.141592653589793
double dp[310][310][310];
int main() {
int N;
cin >> N;
int a[3] = {0};
rep(i, N) {
int x;
cin >> x;
x--;
a[x]++;
}
double tmp = 1.0;
rep(k, N + 1) {
rep(j, N + 1) {
rep(i, N + 1) {
if (i + j + k > N)
continue;
if (i > 0)
dp[i][j][k] += dp[i - 1][j][k] * i / N;
if (j > 0)
dp[i][j][k] += dp[i + 1][j - 1][k] * j / N;
if (k > 0)
dp[i][j][k] += dp[i][j + 1][k - 1] * k / N;
if (i + j + k > 0) {
(dp[i][j][k] += 1) *= 1.0 * N / (i + j + k);
}
}
}
}
printf("%.12lf\n", dp[a[0]][a[1]][0]);
} | #include <algorithm>
#include <assert.h>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
#define PI 3.141592653589793
double dp[310][310][310];
int main() {
int N;
cin >> N;
int a[3] = {0};
rep(i, N) {
int x;
cin >> x;
x--;
a[x]++;
}
double tmp = 1.0;
rep(k, N + 1) {
rep(j, N + 1) {
rep(i, N + 1) {
if (i + j + k > N)
continue;
if (i > 0)
dp[i][j][k] += dp[i - 1][j][k] * i / N;
if (j > 0)
dp[i][j][k] += dp[i + 1][j - 1][k] * j / N;
if (k > 0)
dp[i][j][k] += dp[i][j + 1][k - 1] * k / N;
if (i + j + k > 0) {
(dp[i][j][k] += 1) *= 1.0 * N / (i + j + k);
}
}
}
}
printf("%.12lf\n", dp[a[0]][a[1]][a[2]]);
} | [
"identifier.replace.add",
"literal.replace.remove",
"variable_access.subscript.index.change",
"call.arguments.change",
"io.output.change"
] | 978,155 | 978,156 | u841131859 | cpp |
p03169 | #include <bits/stdc++.h>
using namespace std;
double dp[305][305][305];
int cnt[10];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int x;
scanf("%d", &x);
cnt[x]++;
}
for (int k = 0; k <= n; k++)
for (int j = 0; j <= n; j++)
for (int i = 0; i <= n; i++)
if (i || j || j) {
int sum = i + j + k;
if (i)
dp[i][j][k] += dp[i - 1][j][k] * i / sum;
if (j)
dp[i][j][k] += dp[i + 1][j - 1][k] * j / sum;
if (k)
dp[i][j][k] += dp[i][j + 1][k - 1] * k / sum;
dp[i][j][k] += (double)n / sum;
}
printf("%.15lf\n", dp[cnt[1]][cnt[2]][cnt[3]]);
}
| #include <bits/stdc++.h>
using namespace std;
double dp[305][305][305];
int cnt[10];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int x;
scanf("%d", &x);
cnt[x]++;
}
for (int k = 0; k <= n; k++)
for (int j = 0; j <= n; j++)
for (int i = 0; i <= n; i++)
if (i || j || k) {
int sum = i + j + k;
if (i)
dp[i][j][k] += dp[i - 1][j][k] * i / sum;
if (j)
dp[i][j][k] += dp[i + 1][j - 1][k] * j / sum;
if (k)
dp[i][j][k] += dp[i][j + 1][k - 1] * k / sum;
dp[i][j][k] += (double)n / sum;
}
printf("%.15lf\n", dp[cnt[1]][cnt[2]][cnt[3]]);
}
| [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 978,159 | 978,160 | u474561608 | cpp |
p03169 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// まずは状態を定義。寿司の順番に意味が無いことに気づくので、状態としては、残りの寿司の個数がk枚の皿がそれぞれ何枚あるかということになる。
// 状態遷移は、サイコロを一回降った時にどうなるかを考える。遷移式はそのままだと0個の皿を引いたときに無限ループになるので式変形する必要あり。
// dp[x][y][z] 残り一個のものがx, 残り二個のものがy,
// 残り三個のものがzのときの期待値
const int maxn = 7;
long double dp[maxn][maxn][maxn];
bool done[maxn][maxn][maxn];
int n;
long double dfs(int x, int y, int z) {
if ((x == 0 && y == 0 && z == 0) || (x < 0 || y < 0 || z < 0))
return 0.0;
if (done[x][y][z])
return dp[x][y][z];
long double s = x + y + z;
dp[x][y][z] = dfs(x - 1, y, z) * x / s + dfs(x + 1, y - 1, z) * y / s +
dfs(x, y + 1, z - 1) * z / s + n / s;
done[x][y][z] = true;
return dp[x][y][z];
}
int main() {
cin >> n;
int one = 0, two = 0, three = 0, tmp;
for (int i = 1; i <= n; i++) {
cin >> tmp;
if (tmp == 1)
one++;
if (tmp == 2)
two++;
if (tmp == 3)
three++;
}
for (int i = 0; i < maxn; i++) {
for (int j = 0; j < maxn; j++) {
for (int k = 0; k < maxn; k++) {
done[i][j][k] = false;
}
}
}
long double res = 0.0;
res = dfs(one, two, three);
cout << fixed << setprecision(10);
cout << res << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// まずは状態を定義。寿司の順番に意味が無いことに気づくので、状態としては、残りの寿司の個数がk枚の皿がそれぞれ何枚あるかということになる。
// 状態遷移は、サイコロを一回降った時にどうなるかを考える。遷移式はそのままだと0個の皿を引いたときに無限ループになるので式変形する必要あり。
// dp[x][y][z] 残り一個のものがx, 残り二個のものがy,
// 残り三個のものがzのときの期待値
const int maxn = 301;
long double dp[maxn][maxn][maxn];
bool done[maxn][maxn][maxn];
int n;
long double dfs(int x, int y, int z) {
if ((x == 0 && y == 0 && z == 0) || (x < 0 || y < 0 || z < 0))
return 0.0;
if (done[x][y][z])
return dp[x][y][z];
long double s = x + y + z;
dp[x][y][z] = dfs(x - 1, y, z) * x / s + dfs(x + 1, y - 1, z) * y / s +
dfs(x, y + 1, z - 1) * z / s + n / s;
done[x][y][z] = true;
return dp[x][y][z];
}
int main() {
cin >> n;
int one = 0, two = 0, three = 0, tmp;
for (int i = 1; i <= n; i++) {
cin >> tmp;
if (tmp == 1)
one++;
if (tmp == 2)
two++;
if (tmp == 3)
three++;
}
for (int i = 0; i < maxn; i++) {
for (int j = 0; j < maxn; j++) {
for (int k = 0; k < maxn; k++) {
done[i][j][k] = false;
}
}
}
long double res = 0.0;
res = dfs(one, two, three);
cout << fixed << setprecision(10);
cout << res << endl;
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change"
] | 978,175 | 978,176 | u917793793 | cpp |
p03169 | #include <bits/stdc++.h> // [PRIMES] 1777 ~2^10.80
using namespace std; // 10333 ~2^13.33
using ll = long long; // seq 1 128 | factor 100333 ~2^16.61
using vl = vector<ll>; // | grep -v ' .* ' 1300111 ~2^20.31
using vvl = vector<vl>; // 10300777 ~2^23.30
using vb = vector<bool>; // 100400999 ~2^26.58
using vs = vector<string>; // 1300400999 ~2^30.28
using pll = pair<ll, ll>; // 10200500333 ~2^33.25
const ll oo = 0x3f3f3f3f3f3f3f3fLL; // 100200400777 ~2^36.54
const double eps = 1e-9; // 1200300700111 ~2^40.13
#define sz(c) ll((c).size()) // 10200300500777 ~2^43.21
#define all(c) begin(c), end(c) // 100200300400777 ~2^46.51
#define mp make_pair // 1200300400600999 ~2^50.09
#define mt make_tuple // 10200300400600111 ~2^53.18
#define pb push_back // 100200300400600333 ~2^56.48
#define eb emplace_back // 1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i, a, b) for (ll i = (a); i < (ll)(b); i++)
#define FORD(i, a, b) for (ll i = ll(b) - 1; i >= (a); i--)
#define TR(X) \
({ \
if (1) \
cerr << "TR: " << (#X) << " = " << (X) << endl; \
})
ll N;
vector<vector<vector<double>>> dp;
double r(double p, ll d) {
if (d == 100)
return p;
return p + (1 - p) * r(p, d + 1);
}
double f(vl in) {
if (in[0] == N)
return 0;
double *dpp = &dp[in[1]][in[2]][in[3]];
if (*dpp > -0.5)
return *dpp;
double p_null = (double)in[0] / (double)N;
double acc = (1.0 / (1.0 - p_null));
FOR(i, 1, sz(in)) {
if (in[i] == 0)
continue;
double p = ((double)in[i] / (double)(N - in[0]));
vl newin = in;
newin[i]--;
newin[i - 1]++;
acc += f(newin) * p;
}
*dpp = acc;
return acc;
}
int main() {
ll n;
cin >> n;
N = 0;
vl a;
dp.resize(900 + 1,
vector<vector<double>>(600 + 1, vector<double>(300 + 1, -1)));
a.resize(4, 0);
FOR(i, 0, n) {
ll in;
cin >> in;
a[in]++;
N = n;
}
cout << fixed << setprecision(10) << f(a) << endl;
} // cin.tie(0) bei schnellem Wechseln
| #include <bits/stdc++.h> // [PRIMES] 1777 ~2^10.80
using namespace std; // 10333 ~2^13.33
using ll = long long; // seq 1 128 | factor 100333 ~2^16.61
using vl = vector<ll>; // | grep -v ' .* ' 1300111 ~2^20.31
using vvl = vector<vl>; // 10300777 ~2^23.30
using vb = vector<bool>; // 100400999 ~2^26.58
using vs = vector<string>; // 1300400999 ~2^30.28
using pll = pair<ll, ll>; // 10200500333 ~2^33.25
const ll oo = 0x3f3f3f3f3f3f3f3fLL; // 100200400777 ~2^36.54
const double eps = 1e-9; // 1200300700111 ~2^40.13
#define sz(c) ll((c).size()) // 10200300500777 ~2^43.21
#define all(c) begin(c), end(c) // 100200300400777 ~2^46.51
#define mp make_pair // 1200300400600999 ~2^50.09
#define mt make_tuple // 10200300400600111 ~2^53.18
#define pb push_back // 100200300400600333 ~2^56.48
#define eb emplace_back // 1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i, a, b) for (ll i = (a); i < (ll)(b); i++)
#define FORD(i, a, b) for (ll i = ll(b) - 1; i >= (a); i--)
#define TR(X) \
({ \
if (1) \
cerr << "TR: " << (#X) << " = " << (X) << endl; \
})
ll N;
vector<vector<vector<double>>> dp;
double r(double p, ll d) {
if (d == 100)
return p;
return p + (1 - p) * r(p, d + 1);
}
double f(vl in) {
if (in[0] == N)
return 0;
double *dpp = &dp[in[1]][in[2]][in[3]];
if (*dpp > -0.5)
return *dpp;
double p_null = (double)in[0] / (double)N;
double acc = (1.0 / (1.0 - p_null));
FOR(i, 1, sz(in)) {
if (in[i] == 0)
continue;
double p = ((double)in[i] / (double)(N - in[0]));
vl newin = in;
newin[i]--;
newin[i - 1]++;
acc += f(newin) * p;
}
*dpp = acc;
return acc;
}
int main() {
ll n;
cin >> n;
N = 0;
vl a;
dp.resize(300 + 1,
vector<vector<double>>(300 + 1, vector<double>(300 + 1, -1)));
a.resize(4, 0);
FOR(i, 0, n) {
ll in;
cin >> in;
a[in]++;
N = n;
}
cout << fixed << setprecision(10) << f(a) << endl;
} // cin.tie(0) bei schnellem Wechseln
| [
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,179 | 978,180 | u117403499 | cpp |
p03169 | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
const int maxn = 200001;
int n, m, x, y, z;
int a[301], dp[301][301][301];
long double sol(int x, int y, int z) {
if (dp[x][y][z] > 0.5)
return dp[x][y][z];
long double q = 0;
if (x + y + z == 0)
return q;
if (x > 0)
q += sol(x - 1, y, z) * x;
if (y > 0)
q += sol(x + 1, y - 1, z) * y;
if (z > 0)
q += sol(x, y + 1, z - 1) * z;
q /= (long double)(x + y + z);
q += n / (long double)(x + y + z);
dp[x][y][z] = q;
return q;
}
void solve() {
cin >> n;
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 1)
x++;
else if (a[i] == 2)
y++;
else
z++;
}
rep(i, 0, 301) rep(j, 0, 301) rep(k, 0, 301) dp[i][j][k] = -1;
cout << setprecision(15) << sol(x, y, z);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
solve();
}
return 0;
} | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
const int maxn = 200001;
int n, m, x, y, z;
long double a[301], dp[301][301][301];
long double sol(int x, int y, int z) {
if (dp[x][y][z] != -1)
return dp[x][y][z];
long double q = 0;
if (x + y + z == 0)
return q;
if (x > 0)
q += sol(x - 1, y, z) * x;
if (y > 0)
q += sol(x + 1, y - 1, z) * y;
if (z > 0)
q += sol(x, y + 1, z - 1) * z;
q /= (long double)(x + y + z);
q += n / (long double)(x + y + z);
dp[x][y][z] = q;
return q;
}
void solve() {
cin >> n;
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 1)
x++;
else if (a[i] == 2)
y++;
else
z++;
}
rep(i, 0, 301) rep(j, 0, 301) rep(k, 0, 301) dp[i][j][k] = -1;
cout << setprecision(15) << sol(x, y, z);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
solve();
}
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"control_flow.branch.if.condition.change"
] | 978,185 | 978,186 | u722378116 | cpp |
p03169 | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
const int maxn = 200001;
int n, m, x, y, z;
int a[301], dp[301][301][301];
long double sol(int x, int y, int z) {
if (dp[x][y][z] != -1)
return dp[x][y][z];
long double q = 0;
if (x + y + z == 0)
return q;
if (x > 0)
q += sol(x - 1, y, z) * x;
if (y > 0)
q += sol(x + 1, y - 1, z) * y;
if (z > 0)
q += sol(x, y + 1, z - 1) * z;
q /= (long double)(x + y + z);
q += n / (long double)(x + y + z);
dp[x][y][z] = q;
return q;
}
void solve() {
cin >> n;
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 1)
x++;
else if (a[i] == 2)
y++;
else
z++;
}
rep(i, 0, 301) rep(j, 0, 301) rep(k, 0, 301) dp[i][j][k] = -1;
cout << setprecision(15) << sol(x, y, z);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
solve();
}
return 0;
} | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
const int maxn = 200001;
int n, m, x, y, z;
long double a[301], dp[301][301][301];
long double sol(int x, int y, int z) {
if (dp[x][y][z] != -1)
return dp[x][y][z];
long double q = 0;
if (x + y + z == 0)
return q;
if (x > 0)
q += sol(x - 1, y, z) * x;
if (y > 0)
q += sol(x + 1, y - 1, z) * y;
if (z > 0)
q += sol(x, y + 1, z - 1) * z;
q /= (long double)(x + y + z);
q += n / (long double)(x + y + z);
dp[x][y][z] = q;
return q;
}
void solve() {
cin >> n;
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 1)
x++;
else if (a[i] == 2)
y++;
else
z++;
}
rep(i, 0, 301) rep(j, 0, 301) rep(k, 0, 301) dp[i][j][k] = -1;
cout << setprecision(15) << sol(x, y, z);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
solve();
}
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 978,187 | 978,186 | u722378116 | cpp |
p03169 | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
const int maxn = 200001;
int n, m, x, y, z;
int a[301], dp[301][301][301];
long double sol(int x, int y, int z) {
if (dp[x][y][z] > 0.5)
return dp[x][y][z];
long double q = 0;
if (x + y + z == 0)
return q;
if (x > 0)
q += sol(x - 1, y, z) * x;
if (y > 0)
q += sol(x + 1, y - 1, z) * y;
if (z > 0)
q += sol(x, y + 1, z - 1) * z;
q /= (long double)(x + y + z);
q += n / (long double)(x + y + z);
dp[x][y][z] = q;
return q;
}
void solve() {
cin >> n;
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 1)
x++;
else if (a[i] == 2)
y++;
else
z++;
}
rep(i, 0, 301) rep(j, 0, 301) rep(k, 0, 301) dp[i][j][k] = -1;
cout << setprecision(15) << sol(x, y, z);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
solve();
}
return 0;
} | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
const int maxn = 200001;
int n, m, x, y, z;
long double a[301], dp[301][301][301];
long double sol(int x, int y, int z) {
if (dp[x][y][z] > 0.5)
return dp[x][y][z];
long double q = 0;
if (x + y + z == 0)
return q;
if (x > 0)
q += sol(x - 1, y, z) * x;
if (y > 0)
q += sol(x + 1, y - 1, z) * y;
if (z > 0)
q += sol(x, y + 1, z - 1) * z;
q /= (long double)(x + y + z);
q += n / (long double)(x + y + z);
dp[x][y][z] = q;
return q;
}
void solve() {
cin >> n;
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 1)
x++;
else if (a[i] == 2)
y++;
else
z++;
}
rep(i, 0, 301) rep(j, 0, 301) rep(k, 0, 301) dp[i][j][k] = -1;
cout << setprecision(15) << sol(x, y, z);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
solve();
}
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 978,185 | 978,188 | u722378116 | cpp |
p03169 | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
const int maxn = 200001;
int n, m, x, y, z;
int a[301], dp[301][301][301];
long double sol(int x, int y, int z) {
if (dp[x][y][z] != -1)
return dp[x][y][z];
long double q = 0;
if (x + y + z == 0)
return q;
if (x > 0)
q += sol(x - 1, y, z) * x;
if (y > 0)
q += sol(x + 1, y - 1, z) * y;
if (z > 0)
q += sol(x, y + 1, z - 1) * z;
q /= (long double)(x + y + z);
q += n / (long double)(x + y + z);
dp[x][y][z] = q;
return q;
}
void solve() {
cin >> n;
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 1)
x++;
else if (a[i] == 2)
y++;
else
z++;
}
rep(i, 0, 301) rep(j, 0, 301) rep(k, 0, 301) dp[i][j][k] = -1;
cout << setprecision(15) << sol(x, y, z);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
solve();
}
return 0;
} | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int, int>
#define mii map<pii, int>
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define endl '\n'
#define hell 1000000007
#define rep(i, a, b) for (int i = a; i < b; i++)
using namespace std;
const int maxn = 200001;
int n, m, x, y, z;
long double a[301], dp[301][301][301];
long double sol(int x, int y, int z) {
if (dp[x][y][z] > 0.5)
return dp[x][y][z];
long double q = 0;
if (x + y + z == 0)
return q;
if (x > 0)
q += sol(x - 1, y, z) * x;
if (y > 0)
q += sol(x + 1, y - 1, z) * y;
if (z > 0)
q += sol(x, y + 1, z - 1) * z;
q /= (long double)(x + y + z);
q += n / (long double)(x + y + z);
dp[x][y][z] = q;
return q;
}
void solve() {
cin >> n;
rep(i, 0, n) {
cin >> a[i];
if (a[i] == 1)
x++;
else if (a[i] == 2)
y++;
else
z++;
}
rep(i, 0, 301) rep(j, 0, 301) rep(k, 0, 301) dp[i][j][k] = -1;
cout << setprecision(15) << sol(x, y, z);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
solve();
}
return 0;
} | [
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change",
"control_flow.branch.if.condition.change"
] | 978,187 | 978,188 | u722378116 | cpp |
p03169 | #include <bits/stdc++.h>
#ifdef _DEBUG
#define debug(x) \
cout << "line: " << __LINE__ << ", func: " << __func__ << " -> " << #x \
<< " = " << x << endl
#define INFILE freopen("input.txt", "r", stdin)
#else
#define debug(x)
#define INFILE
#endif
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
static constexpr ll LL9_MOD = 1000000009LL;
static constexpr ll LL7_MOD = 1000000007LL;
static constexpr ll INF = 1LL << 60;
static constexpr double PI =
static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static map<type_index, const char *const> scanType = {{typeid(int), "%d"},
{typeid(ll), "%lld"},
{typeid(double), "%lf"},
{typeid(char), "%c"}};
template <class T> static void scan(vector<T> &v);
[[maybe_unused]] static void scan(vector<string> &v, bool isWord = true);
template <class T> static inline bool chmax(T &a, T b);
template <class T> static inline bool chmin(T &a, T b);
template <class A, size_t N, class T>
static void Fill(A (&arr)[N], const T &val);
double dp[310][310][310];
int main(int argc, char *argv[]) {
INFILE;
ll n;
cin >> n;
vector<ll> sushis(n, 0);
scan(sushis);
int one = count(ALL(sushis), 1);
int two = count(ALL(sushis), 2);
int three = count(ALL(sushis), 3);
REP(i, 0, one + 1) {
REP(j, 0, two + 1) {
REP(k, 0, three + 1) {
if (i == 0 && j == 0 && k == 0) {
dp[i][j][k] = 0.0;
continue;
}
double res = 0.0;
res += (i == 0 ? 0 : dp[i - 1][j][k] * i);
res += (j == 0 ? 0 : dp[i + 1][j - 1][k] * j);
res += (k == 0 ? 0 : dp[i][j + 1][k - 1] * k);
res += n;
res *= 1.0 / (i + j + k);
dp[i][j][k] = res;
}
}
}
cout << fixed << setprecision(10) << dp[one][two][three] << endl;
return 0;
}
template <class T> static void scan(vector<T> &v) {
auto tFormat = scanType[typeid(T)];
for (T &n : v) {
scanf(tFormat, &n);
}
}
static void scan(vector<string> &v, bool isWord) {
if (isWord) {
for (auto &n : v) {
cin >> n;
}
return;
}
int i = 0, size = v.size();
string s;
getline(cin, s);
if (s.size() != 0) {
i++;
v[0] = s;
}
for (; i < size; ++i) {
getline(cin, v[i]);
}
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class A, size_t N, class T> void Fill(A (&arr)[N], const T &val) {
std::fill((T *)arr, (T *)(arr + N), val);
}
| #include <bits/stdc++.h>
#ifdef _DEBUG
#define debug(x) \
cout << "line: " << __LINE__ << ", func: " << __func__ << " -> " << #x \
<< " = " << x << endl
#define INFILE freopen("input.txt", "r", stdin)
#else
#define debug(x)
#define INFILE
#endif
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
static constexpr ll LL9_MOD = 1000000009LL;
static constexpr ll LL7_MOD = 1000000007LL;
static constexpr ll INF = 1LL << 60;
static constexpr double PI =
static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static map<type_index, const char *const> scanType = {{typeid(int), "%d"},
{typeid(ll), "%lld"},
{typeid(double), "%lf"},
{typeid(char), "%c"}};
template <class T> static void scan(vector<T> &v);
[[maybe_unused]] static void scan(vector<string> &v, bool isWord = true);
template <class T> static inline bool chmax(T &a, T b);
template <class T> static inline bool chmin(T &a, T b);
template <class A, size_t N, class T>
static void Fill(A (&arr)[N], const T &val);
double dp[310][310][310];
int main(int argc, char *argv[]) {
INFILE;
ll n;
cin >> n;
vector<ll> sushis(n, 0);
scan(sushis);
int one = count(ALL(sushis), 1);
int two = count(ALL(sushis), 2);
int three = count(ALL(sushis), 3);
REP(k, 0, n + 1) {
REP(j, 0, n + 1) {
REP(i, 0, n + 1) {
if (i == 0 && j == 0 && k == 0) {
dp[i][j][k] = 0.0;
continue;
}
double res = 0.0;
res += (i == 0 ? 0 : dp[i - 1][j][k] * i);
res += (j == 0 ? 0 : dp[i + 1][j - 1][k] * j);
res += (k == 0 ? 0 : dp[i][j + 1][k - 1] * k);
res += n;
res *= 1.0 / (i + j + k);
dp[i][j][k] = res;
}
}
}
cout << fixed << setprecision(10) << dp[one][two][three] << endl;
return 0;
}
template <class T> static void scan(vector<T> &v) {
auto tFormat = scanType[typeid(T)];
for (T &n : v) {
scanf(tFormat, &n);
}
}
static void scan(vector<string> &v, bool isWord) {
if (isWord) {
for (auto &n : v) {
cin >> n;
}
return;
}
int i = 0, size = v.size();
string s;
getline(cin, s);
if (s.size() != 0) {
i++;
v[0] = s;
}
for (; i < size; ++i) {
getline(cin, v[i]);
}
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <class A, size_t N, class T> void Fill(A (&arr)[N], const T &val) {
std::fill((T *)arr, (T *)(arr + N), val);
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,202 | 978,203 | u209647862 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
//
typedef long double ld;
typedef long long int ll;
//
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
//
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define prq priority_queue<ll>;
#define vbs(xx, x) binary_search(all(xx), x)
#define vlb(xx, x) lower_bound(all(xx), x)
#define vub(xx, x) upper_bound(all(xx), x)
//
ll MOD = 998244353;
ll M = 1e9 + 7;
#define PI 3.1415926535897932384626433832795
ll llMAX = 1000000000000000008;
ll llMIN = -1000000000000000008;
//
#define forx(i, j, n) for (ll i = j; i < n; i++)
#define fory(i, j, n) for (ll i = j; i >= n; i--)
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define fs first
#define sn second
#define MEM(xx, yy) memset(xx, yy, sizeof(xx))
//
#define in(x) cin >> x
#define op(x) cout << x
#define opnl(x) cout << x << "\n"
#define ops(x) cout << x << " "
#define nl cout << "\n"
#define sp cout << " "
#define flush fflush(stdout)
clock_t tim;
void showtime() {
tim = clock() - tim;
cout << " ===> " << (ld)tim / CLOCKS_PER_SEC << " seconds\n";
}
//
ll mul(ll mul_1, ll mul_2) {
ll mul_t = ((mul_1 % MOD) * (mul_2 % MOD) + MOD) % MOD;
return mul_t;
}
ll mul3(ll mul_1, ll mul_2, ll mul_3) {
ll mul_t = mul(mul(mul_1, mul_2), mul_3) % MOD;
return mul_t;
}
ll add(ll add_1, ll add_2) {
ll add_t = ((add_1 % MOD) + (add_2 % MOD) + MOD + MOD) % MOD;
return add_t;
}
ll sub(ll sub_1, ll sub_2) {
ll sub_r = 1e15;
ll sub_t = (((sub_1 + sub_r) % MOD) - ((sub_2 + sub_r) % MOD) + sub_r) % MOD;
return sub_t;
}
ll pwm(ll x, ll y, ll p = M) {
ll res = 1;
x = x % p;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y / 2;
x = (x * x) % p;
}
return res;
}
ll pw(ll x, ll y) {
ll res = 1;
while (y > 0) {
if (y & 1)
res = (res * x);
y = y / 2;
x = (x * x);
}
return res;
}
ll modinv(ll n) { return pwm(n, M - 2, M); }
ll gcd(ll num1, ll num2) { return (num2 ? gcd(num2, num1 % num2) : num1); }
ll lcm(ll num1, ll num2) { return 1LL * ((num1 * num2) / __gcd(num1, num2)); }
ll myceil(ll x, ll y) { return (x + y - 1) / y; }
long long int my_log(ll n, long long int b) {
ll i = 1;
long long int ans = 0;
while (1) {
if (i > n) {
ans--;
break;
}
if (i == n)
break;
i *= b;
ans++;
}
return ans;
}
//
ll countbit(ll num) { return 1LL * (__builtin_popcountll(num)); }
ll setbit(ll num, ll kk) { return 1LL * (num | (1LL << kk)); }
ll unsetbit(ll num, ll kk) { return 1LL * (num & ~(1LL << kk)); }
ll invertbit(ll num, ll kk) { return 1LL * (num ^ (1LL << kk)); }
bool kthbit(ll num, ll kk) { return num & (1LL << kk); }
ll zerotrail(ll num) { return 1LL * (__builtin_ctzll(num)); }
ll zerobegin(ll num) { return 1LL * (__builtin_clzll(num)); }
//
ll prime[1000005];
void sieve() { // spf
forx(i, 0, 1000005) prime[i] = i;
for (ll p = 2; 1LL * p * p < 1000005; p++) {
if (prime[p] == p) {
for (ll i = 1LL * p * p; i < 1000005; i += p)
if (prime[i] == i)
prime[i] = p;
}
}
return;
}
bool isPrime(ll pri) {
if (pri == 1 || pri == 0)
return 0;
if (prime[pri] == pri)
return 1;
return 0;
}
vl alldiv(ll num) {
vl prDiv;
for (ll i = 1; 1LL * i * i <= num; i++) {
if (num % i == 0) {
prDiv.pb(i);
if (i != (num / i))
prDiv.pb(num / i);
}
}
sort(all(prDiv));
return prDiv;
}
vl prdiv(ll num) {
vl prDiv;
while (num != 1) {
prDiv.pb(prime[num]);
ll prtemp = prime[num];
while (num % prtemp == 0)
num /= prtemp;
}
return prDiv;
}
//
const int maxn = 1e5 + 1, maxm = 1e2 + 1;
vector<int> a(maxm);
vector<bool> dp(maxn);
// vector<vector<int>>adj(MAX);
// vector<int>eu(MAX),ev(MAX);
// bool used[MAX];
// vvl dp(MAX, vector<ll>(2));
// void dfs(int s=0,int p=-1){
// dp[s][0]=1,dp[s][1]=1;
// for(auto i : adj[s]){
// if(i!=p){
// dfs(i,s);
// dp[s][0]=(dp[s][0]%M*(dp[i][0]+dp[i][1])%M)%M;
// dp[s][1]=(dp[s][1]%M*dp[i][0]%M)%M;
// }
// }
// }
void solve() {
int n, k, m, x, y;
cin >> n >> k;
// forx(i,0,n-1) {
// cin>>x>>y;
// x--,y--;
// adj[x].push_back(y);
// adj[y].push_back(x);
// }
// dfs();
// cout<<(dp[0][0]+dp[0][1])%M<<"\n";
for (int i = 0; i < n; i++)
cin >> a[i];
dp[0] = 0;
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j])
dp[i] = dp[i] | (!dp[i - a[j]]);
}
}
if (dp[k])
cout << "first\n";
else
cout << "second\n";
}
//
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int x = 1;
// in(x);
forx(u, 0, x) {
// cout<<"Case #"<<h+1<<":"<<" ";
solve();
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
//
typedef long double ld;
typedef long long int ll;
//
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
//
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define prq priority_queue<ll>;
#define vbs(xx, x) binary_search(all(xx), x)
#define vlb(xx, x) lower_bound(all(xx), x)
#define vub(xx, x) upper_bound(all(xx), x)
//
ll MOD = 998244353;
ll M = 1e9 + 7;
#define PI 3.1415926535897932384626433832795
ll llMAX = 1000000000000000008;
ll llMIN = -1000000000000000008;
//
#define forx(i, j, n) for (ll i = j; i < n; i++)
#define fory(i, j, n) for (ll i = j; i >= n; i--)
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define fs first
#define sn second
#define MEM(xx, yy) memset(xx, yy, sizeof(xx))
//
#define in(x) cin >> x
#define op(x) cout << x
#define opnl(x) cout << x << "\n"
#define ops(x) cout << x << " "
#define nl cout << "\n"
#define sp cout << " "
#define flush fflush(stdout)
clock_t tim;
void showtime() {
tim = clock() - tim;
cout << " ===> " << (ld)tim / CLOCKS_PER_SEC << " seconds\n";
}
//
ll mul(ll mul_1, ll mul_2) {
ll mul_t = ((mul_1 % MOD) * (mul_2 % MOD) + MOD) % MOD;
return mul_t;
}
ll mul3(ll mul_1, ll mul_2, ll mul_3) {
ll mul_t = mul(mul(mul_1, mul_2), mul_3) % MOD;
return mul_t;
}
ll add(ll add_1, ll add_2) {
ll add_t = ((add_1 % MOD) + (add_2 % MOD) + MOD + MOD) % MOD;
return add_t;
}
ll sub(ll sub_1, ll sub_2) {
ll sub_r = 1e15;
ll sub_t = (((sub_1 + sub_r) % MOD) - ((sub_2 + sub_r) % MOD) + sub_r) % MOD;
return sub_t;
}
ll pwm(ll x, ll y, ll p = M) {
ll res = 1;
x = x % p;
while (y > 0) {
if (y & 1)
res = (res * x) % p;
y = y / 2;
x = (x * x) % p;
}
return res;
}
ll pw(ll x, ll y) {
ll res = 1;
while (y > 0) {
if (y & 1)
res = (res * x);
y = y / 2;
x = (x * x);
}
return res;
}
ll modinv(ll n) { return pwm(n, M - 2, M); }
ll gcd(ll num1, ll num2) { return (num2 ? gcd(num2, num1 % num2) : num1); }
ll lcm(ll num1, ll num2) { return 1LL * ((num1 * num2) / __gcd(num1, num2)); }
ll myceil(ll x, ll y) { return (x + y - 1) / y; }
long long int my_log(ll n, long long int b) {
ll i = 1;
long long int ans = 0;
while (1) {
if (i > n) {
ans--;
break;
}
if (i == n)
break;
i *= b;
ans++;
}
return ans;
}
//
ll countbit(ll num) { return 1LL * (__builtin_popcountll(num)); }
ll setbit(ll num, ll kk) { return 1LL * (num | (1LL << kk)); }
ll unsetbit(ll num, ll kk) { return 1LL * (num & ~(1LL << kk)); }
ll invertbit(ll num, ll kk) { return 1LL * (num ^ (1LL << kk)); }
bool kthbit(ll num, ll kk) { return num & (1LL << kk); }
ll zerotrail(ll num) { return 1LL * (__builtin_ctzll(num)); }
ll zerobegin(ll num) { return 1LL * (__builtin_clzll(num)); }
//
ll prime[1000005];
void sieve() { // spf
forx(i, 0, 1000005) prime[i] = i;
for (ll p = 2; 1LL * p * p < 1000005; p++) {
if (prime[p] == p) {
for (ll i = 1LL * p * p; i < 1000005; i += p)
if (prime[i] == i)
prime[i] = p;
}
}
return;
}
bool isPrime(ll pri) {
if (pri == 1 || pri == 0)
return 0;
if (prime[pri] == pri)
return 1;
return 0;
}
vl alldiv(ll num) {
vl prDiv;
for (ll i = 1; 1LL * i * i <= num; i++) {
if (num % i == 0) {
prDiv.pb(i);
if (i != (num / i))
prDiv.pb(num / i);
}
}
sort(all(prDiv));
return prDiv;
}
vl prdiv(ll num) {
vl prDiv;
while (num != 1) {
prDiv.pb(prime[num]);
ll prtemp = prime[num];
while (num % prtemp == 0)
num /= prtemp;
}
return prDiv;
}
//
const int maxn = 1e5 + 1, maxm = 1e2 + 1;
vector<int> a(maxm);
vector<bool> dp(maxn);
// vector<vector<int>>adj(MAX);
// vector<int>eu(MAX),ev(MAX);
// bool used[MAX];
// vvl dp(MAX, vector<ll>(2));
// void dfs(int s=0,int p=-1){
// dp[s][0]=1,dp[s][1]=1;
// for(auto i : adj[s]){
// if(i!=p){
// dfs(i,s);
// dp[s][0]=(dp[s][0]%M*(dp[i][0]+dp[i][1])%M)%M;
// dp[s][1]=(dp[s][1]%M*dp[i][0]%M)%M;
// }
// }
// }
void solve() {
int n, k, m, x, y;
cin >> n >> k;
// forx(i,0,n-1) {
// cin>>x>>y;
// x--,y--;
// adj[x].push_back(y);
// adj[y].push_back(x);
// }
// dfs();
// cout<<(dp[0][0]+dp[0][1])%M<<"\n";
for (int i = 0; i < n; i++)
cin >> a[i];
dp[0] = 0;
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j])
dp[i] = dp[i] | (!dp[i - a[j]]);
}
}
if (dp[k])
cout << "First\n";
else
cout << "Second\n";
}
//
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int x = 1;
// in(x);
forx(u, 0, x) {
// cout<<"Case #"<<h+1<<":"<<" ";
solve();
}
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,206 | 978,207 | u363823725 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int dp[200005];
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i <= k; i++) {
if (dp[i] != true) {
for (int j = 0; j < n; j++) {
dp[i + a[j]] = true;
// if(dp[])
}
}
}
if (dp[k] == true) {
cout << "First" << endl;
} else {
cout << "False" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int dp[200005];
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i <= k; i++) {
if (dp[i] != true) {
for (int j = 0; j < n; j++) {
dp[i + a[j]] = true;
// if(dp[])
}
}
}
if (dp[k] == true) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| [
"literal.string.change",
"io.output.change"
] | 978,210 | 978,211 | u181739580 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int dp[100005];
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i <= k; i++) {
if (dp[i] != true) {
for (int j = 0; j < n; j++) {
dp[i + a[j]] = true;
// if(dp[])
}
}
}
if (dp[k] == true) {
cout << "First" << endl;
} else {
cout << "False" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int dp[200005];
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i <= k; i++) {
if (dp[i] != true) {
for (int j = 0; j < n; j++) {
dp[i + a[j]] = true;
// if(dp[])
}
}
}
if (dp[k] == true) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"literal.string.change",
"io.output.change"
] | 978,212 | 978,211 | u181739580 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
void test(vector<int> &a, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
int n = a.size();
for (int j = 1; j <= k; j++) {
for (int i = 1; i < a.size(); i++) {
if (j >= a[i]) {
dp[j] = dp[j] || !dp[j - a[i]];
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return;
}
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
test(a, k);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
void test(vector<int> &a, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
int n = a.size();
for (int j = 1; j <= k; j++) {
for (int i = 0; i < a.size(); i++) {
if (j >= a[i]) {
dp[j] = dp[j] || !dp[j - a[i]];
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return;
}
int main() { // no changes here
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
test(a, k);
return 0;
} | [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 978,215 | 978,216 | u107584330 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
void test(vector<int> &a, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
int n = a.size();
for (int j = 1; j <= k; j++) {
for (int i = 1; i < a.size(); i++) {
if (j >= a[i]) {
dp[j] = dp[j] || !dp[j - a[i]];
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return;
}
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
test(a, k);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
void test(vector<int> &a, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
int n = a.size();
for (int j = 1; j <= k; j++) {
for (int i = 0; i < a.size(); i++) {
if (j >= a[i]) {
dp[j] = dp[j] || !dp[j - a[i]];
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return;
}
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
test(a, k);
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one"
] | 978,215 | 978,217 | u107584330 | cpp |
p03170 | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> dp(k + 1, 1);
dp[0] = 1;
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] >= 0) {
int p = !(dp[i - a[j]]);
dp[i] = min(dp[i], p);
}
if (dp[i] == 0)
break;
}
}
if (dp[k] == 0) {
cout << "FIRST" << endl;
} else {
cout << "SECOND" << endl;
}
return;
}
int main() {
// your code goes here
solve();
return 0;
}
| #include <bits/stdc++.h>
#include <iostream>
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> dp(k + 1, 1);
dp[0] = 1;
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] >= 0) {
int p = !(dp[i - a[j]]);
dp[i] = min(dp[i], p);
}
if (dp[i] == 0)
break;
}
}
if (dp[k] == 0) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return;
}
int main() {
// your code goes here
solve();
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,218 | 978,219 | u956355198 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define FASTIO \
ios_base::sync_with_stdio(NULL); \
cin.tie(NULL);
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORE(i, a, b) for (int i = a; i <= b; i++)
#define pb push_back
#define MOD 1000000007
using namespace std;
void init() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
// code from below
void solve() {
int n, k;
cin >> n >> k;
vi arr(n);
vector<bool> dp(k + 1);
// dp[i] means who will win if k stones are remaining , true if first player
// wins we have formulazid the problem in a better way we dont care how we
// reached a particular state and then we have to calculate which player can
// win with this state who win if we have 0 stones, who win if we have 1
// stones, if we have 2 stones,.... ... k stones
FOR(i, n)
cin >> arr[i];
for (int i = 0; i <= k; i++) {
for (int x : arr) {
// if first player has not won with i-x stones then it will win by i
// stones, because players would win alternatively, because they are
// playing alternatively
if (i >= x and !dp[i - x])
dp[i] = true;
}
}
dp[k] ? cout << "First\n" : cout << "Second\n";
}
int main() {
int t = 1;
cin >> t;
// cin.ignore(numeric_limits<streamsize>::max(),'\n');
while (t--)
solve();
} | #include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define FASTIO \
ios_base::sync_with_stdio(NULL); \
cin.tie(NULL);
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FORE(i, a, b) for (int i = a; i <= b; i++)
#define pb push_back
#define MOD 1000000007
using namespace std;
void init() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
// code from below
void solve() {
int n, k;
cin >> n >> k;
vi arr(n);
vector<bool> dp(k + 1);
// dp[i] means who will win if k stones are remaining , true if first player
// wins we have formulazid the problem in a better way we dont care how we
// reached a particular state and then we have to calculate which player can
// win with this state who win if we have 0 stones, who win if we have 1
// stones, if we have 2 stones,.... ... k stones
FOR(i, n)
cin >> arr[i];
for (int i = 0; i <= k; i++) {
for (int x : arr) {
// if first player has not won with i-x stones then it will win by i
// stones, because players would win alternatively, because they are
// playing alternatively
if (i >= x and !dp[i - x])
dp[i] = true;
}
}
dp[k] ? cout << "First\n" : cout << "Second\n";
}
int main() {
int t = 1;
// cin>>t;
// cin.ignore(numeric_limits<streamsize>::max(),'\n');
while (t--)
solve();
} | [] | 978,222 | 978,223 | u372662491 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
int n, k;
cin >> n >> k;
vector<int> A(n);
for (int i = 0; i < n; i++)
cin >> A[i];
vector<int> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (auto val : A) {
if (val <= i && dp[i - val] == 0) {
dp[i] = 1;
break;
}
}
}
if (dp[k])
cout << "Second";
else
cout << "First";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
int n, k;
cin >> n >> k;
vector<int> A(n);
for (int i = 0; i < n; i++)
cin >> A[i];
vector<int> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (auto val : A) {
if (val <= i && dp[i - val] == 0) {
dp[i] = 1;
break;
}
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
} | [
"control_flow.branch.else.remove",
"control_flow.branch.else_if.replace.remove",
"control_flow.branch.if.replace.add"
] | 978,224 | 978,225 | u700138719 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> choices(n, 0);
for (int i = 0; i < n; i++) {
cin >> choices[i];
}
vector<bool> dp(k + 1, false);
for (int i = 1; i < k + 1; i++) {
for (int j = 0; j < n; j++) {
if (i - choices[j] >= 0) {
dp[i] = dp[i] || !(dp[i - choices[j]]);
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "second" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> choices(n, 0);
for (int i = 0; i < n; i++) {
cin >> choices[i];
}
vector<bool> dp(k + 1, false);
for (int i = 1; i < k + 1; i++) {
for (int j = 0; j < n; j++) {
if (i - choices[j] >= 0) {
dp[i] = dp[i] || !(dp[i - choices[j]]);
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,228 | 978,229 | u650716766 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
bool dp[k + 1];
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
dp[0] = false;
for (int i = 1; i < k + 1; i++) {
dp[i] = false;
for (int j = 0; j < n; j++) {
if (a[j] <= k) {
if (!dp[i - a[j]])
dp[i] = !dp[i - a[j]];
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
bool dp[k + 1];
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
dp[0] = false;
for (int i = 1; i < k + 1; i++) {
dp[i] = false;
for (int j = 0; j < n; j++) {
if (a[j] <= i) {
if (!dp[i - a[j]])
dp[i] = !dp[i - a[j]];
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"identifier.change",
"control_flow.branch.if.condition.change"
] | 978,237 | 978,238 | u695206817 | cpp |
p03170 | #include <bits/stdc++.h>
#define int long long
#define float long double
#define endl '\n'
#define IOS \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \
c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
signed main() {
IOS;
int n, k;
cin >> n >> k;
vector<bool> dp(k + 1, false);
int stone[n];
for (int &i : stone)
cin >> i;
for (int i = 0; i <= k; i++) {
for (int j : stone) {
if (i - j >= 0 and !dp[i - j])
dp[i] = true;
}
}
cout << (dp[k] ? "FIRST" : "SECOND") << endl;
return 0;
}
| #include <bits/stdc++.h>
#define int long long
#define float long double
#define endl '\n'
#define IOS \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<( \
c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c &) { ris; }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
signed main() {
IOS;
int n, k;
cin >> n >> k;
vector<bool> dp(k + 1, false);
int stone[n];
for (int &i : stone)
cin >> i;
for (int i = 0; i <= k; i++) {
for (int j : stone) {
if (i - j >= 0 and !dp[i - j])
dp[i] = true;
}
}
cout << (dp[k] ? "First" : "Second") << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"expression.operation.binary.change"
] | 978,239 | 978,240 | u287226050 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<pi>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for (ll(i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for (ll(i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin >>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout << (p) << endl;
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
void sonic() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
void setp(const ll n) { cout << fixed << setprecision(n); }
const ll INF = 1e9 + 1;
const ll LINF = 1e18 + 1;
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <typename T> void co(T e) { cout << e << "\n"; }
template <typename T> void co(const vector<T> &v) {
for (const auto &e : v) {
cout << e << " ";
}
cout << "\n";
}
ll gcd(ll a, ll b) {
if (a < b)
swap(a, b);
if (b == 0)
return a;
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
ll lcm(ll a, ll b) {
ll g = gcd(a, b);
return a * b / g;
}
bool prime(ll n) {
for (ll i = 2; i <= sqrt(n); i++) {
if (n % i == 0)
return false;
}
return n != 1;
}
Vec fac, finv;
ll PowMod(ll a, ll n) {
if (n == 1)
return a;
if (n % 2 == 0)
return PowMod(a * a % MOD, n / 2);
return a * PowMod(a * a % MOD, n / 2) % MOD;
}
ll combi(ll n, ll k) {
if (k > n)
return 0;
return fac[n] * finv[k] % MOD * finv[n - k] % MOD;
}
int n, k;
vvi memo;
int A[100];
bool f(int l, int x) {
if (memo[l][x] != -1)
return memo[l][x];
bool res = 0;
rep(i, n) if (A[i] <= l) res |= 1 ^ f(l - A[i], x ^ 1);
memo[l][x] = res;
return res;
}
int main() {
cin >> n >> k;
rep(i, n) cin >> A[i];
memo.resize(k + 1, vi(n, -1));
if (f(k, 1))
co("First");
else
co("Second");
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<pi>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for (ll(i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for (ll(i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin >>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout << (p) << endl;
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
void sonic() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
void setp(const ll n) { cout << fixed << setprecision(n); }
const ll INF = 1e9 + 1;
const ll LINF = 1e18 + 1;
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <typename T> void co(T e) { cout << e << "\n"; }
template <typename T> void co(const vector<T> &v) {
for (const auto &e : v) {
cout << e << " ";
}
cout << "\n";
}
ll gcd(ll a, ll b) {
if (a < b)
swap(a, b);
if (b == 0)
return a;
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
ll lcm(ll a, ll b) {
ll g = gcd(a, b);
return a * b / g;
}
bool prime(ll n) {
for (ll i = 2; i <= sqrt(n); i++) {
if (n % i == 0)
return false;
}
return n != 1;
}
Vec fac, finv;
ll PowMod(ll a, ll n) {
if (n == 1)
return a;
if (n % 2 == 0)
return PowMod(a * a % MOD, n / 2);
return a * PowMod(a * a % MOD, n / 2) % MOD;
}
ll combi(ll n, ll k) {
if (k > n)
return 0;
return fac[n] * finv[k] % MOD * finv[n - k] % MOD;
}
int n, k;
vvi memo;
int A[100];
bool f(int l, int x) {
if (memo[l][x] != -1)
return memo[l][x];
bool res = 0;
rep(i, n) if (A[i] <= l) res |= 1 ^ f(l - A[i], x ^ 1);
memo[l][x] = res;
return res;
}
int main() {
cin >> n >> k;
rep(i, n) cin >> A[i];
memo.resize(k + 1, vi(2, -1));
if (f(k, 0))
co("First");
else
co("Second");
}
| [
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change",
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 978,246 | 978,247 | u499381410 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG
/**
* For DEBUG
* https://github.com/ta7uw/cpp-pyprint
*/
#include "cpp-pyprint/pyprint.h"
#endif
void Main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
rep(i, N) cin >> A[i];
vector<ll> dp(K + 1, false);
rep(i, K + 1) {
rep(j, N) {
ll a = A[j];
if (i - a >= 0) {
dp[i] |= dp[i - a];
}
}
}
if (dp[K]) {
cout << "First" << '\n';
} else {
cout << "Second" << '\n';
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG
/**
* For DEBUG
* https://github.com/ta7uw/cpp-pyprint
*/
#include "cpp-pyprint/pyprint.h"
#endif
void Main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
rep(i, N) cin >> A[i];
vector<ll> dp(K + 1, false);
rep(i, K + 1) {
rep(j, N) {
ll a = A[j];
if (i - a >= 0) {
dp[i] |= !dp[i - a];
}
}
}
if (dp[K]) {
cout << "First" << '\n';
} else {
cout << "Second" << '\n';
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
| [
"expression.operation.unary.add"
] | 978,253 | 978,254 | u427344224 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG
/**
* For DEBUG
* https://github.com/ta7uw/cpp-pyprint
*/
#include "cpp-pyprint/pyprint.h"
#endif
void Main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
rep(i, N) cin >> A[i];
vector<ll> dp(K + 1, false);
rep(i, K + 1) {
rep(j, N) {
ll a = A[j];
if (i - a >= 0) {
dp[i] |= dp[i - a];
}
}
}
if (dp[K]) {
cout << "First" << '\n';
} else {
cout << "Second" << '\n';
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG
/**
* For DEBUG
* https://github.com/ta7uw/cpp-pyprint
*/
#include "cpp-pyprint/pyprint.h"
#endif
void Main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
rep(i, N) cin >> A[i];
vector<ll> dp(K + 1, false);
rep(i, K + 1) {
rep(j, N) {
ll a = A[j];
if (i - a >= 0) {
dp[i] |= !dp[i - a];
}
}
}
if (dp[K]) {
cout << "First" << '\n';
} else {
cout << "Second" << '\n';
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
| [
"expression.operation.unary.add"
] | 978,253 | 978,255 | u427344224 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG
/**
* For DEBUG
* https://github.com/ta7uw/cpp-pyprint
*/
#include "cpp-pyprint/pyprint.h"
#endif
void Main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
rep(i, N) cin >> A[i];
vector<ll> dp(K + 1, false);
rep(i, K + 1) {
rep(j, N) {
ll a = A[j];
if (i - a >= 0) {
dp[i] |= dp[i - a];
}
}
}
if (dp[K]) {
cout << "First" << '\n';
} else {
cout << "Second" << '\n';
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG
/**
* For DEBUG
* https://github.com/ta7uw/cpp-pyprint
*/
#include "cpp-pyprint/pyprint.h"
#endif
void Main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
rep(i, N) cin >> A[i];
vector<ll> dp(K + 1, false);
rep(i, K + 1) {
rep(j, N) {
ll a = A[j];
if (i - a >= 0) {
dp[i] |= !dp[i - a];
}
}
}
if (dp[K]) {
cout << "First" << '\n';
} else {
cout << "Second" << '\n';
}
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
}
| [
"expression.operation.unary.add"
] | 978,253 | 978,256 | u427344224 | cpp |
p03170 | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
int mod = pow(10, 9) + 7;
int MAXK = 1e5 + 10;
int MAXN = 1e3 + 10;
int N, K;
vector<int> dp(MAXK, -1);
vector<int> a(MAXN);
int solve(int k) {
if (dp[k] != -1)
return dp[k];
if (k == 0)
return dp[k] = 0;
int ans = 0;
for (int i = 0; i < N; i++) {
if (a[i] > k)
continue;
if (solve(k - a[i]) == 0) {
ans = 1;
break;
}
}
return dp[k] = ans;
}
int main() {
cin >> N >> K;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
if (solve(K))
cout << "first";
else
cout << "second";
return 0;
} | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
int mod = pow(10, 9) + 7;
int MAXK = 1e5 + 10;
int MAXN = 1e3 + 10;
int N, K;
vector<int> dp(MAXK, -1);
vector<int> a(MAXN);
int solve(int k) {
if (dp[k] != -1)
return dp[k];
if (k == 0)
return dp[k] = 0;
int ans = 0;
for (int i = 0; i < N; i++) {
if (a[i] > k)
continue;
if (solve(k - a[i]) == 0) {
ans = 1;
break;
}
}
return dp[k] = ans;
}
int main() {
cin >> N >> K;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
if (solve(K))
cout << "First";
else
cout << "Second";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,259 | 978,260 | u583063982 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename x>
using ordered_set =
tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>;
#define sorta(a, n) sort(a, a + n)
#define sortad(a, n) sort(a, a + n, greater<__typeof(a[0])>())
#define all(x) (x).begin(), (x).end()
#define ms0(x) memset((x), 0, sizeof((x)))
#define ms1(x) memset((x), -1, sizeof((x)))
typedef pair<int, int> pi;
#define inarr(arr, n) \
for (int i = 0; i < n; i++) \
cin >> arr[i];
#define prinarr(arr) \
{ \
for (int x : arr) \
cout << x << " "; \
} \
cout << "\n";
#define cout1(a) cout << a << "\n";
#define cout2(a, b) cout << a << " " << b << "\n";
#define cout3(a, b, c) cout << a << " " << b << " " << c << "\n";
#define setpre(n) cout << fixed << setprecision(8) << n << "\n";
#define filldp(arr, n, m, k) \
for (int i = 0; i < n; i++) { \
for (int j = 0; j < m; j++) \
arr[i][j] = k; \
}
#define mod 1000000007
#define mod1 998244353
vector<vector<int>> adj;
vector<int> dis;
vector<int> parent;
vector<bool> visited;
void newgr(int n) {
n += 10;
adj = vector<vector<int>>(n);
dis = vector<int>(n, 0);
// parent=vector<int>(n,-1);
visited = vector<bool>(n, false);
}
void dfs(int s) {
visited[s] = true;
for (auto u : adj[s]) {
if (!visited[u]) {
// parent[u]=s;
dis[u] = dis[s] + 1;
dfs(u);
}
}
}
void bfs(int s) {
queue<int> q;
q.push(s);
visited[s] = true;
dis[s] = 0;
while (!q.empty()) {
auto u = q.front();
q.pop();
for (auto x : adj[u]) {
if (!visited[x]) {
// parent[x]=u;
visited[x] = true;
dis[x] = dis[u] + 1;
q.push(x);
}
}
}
}
long long power(long long x, long long y) {
long long ans = 1;
x %= mod;
while (y > 0) {
if (y & 1)
ans = (ans * x) % mod;
y >>= 1;
x = (x * x) % mod;
}
return ans;
}
long long modinv(long long b) { return power(b, mod - 2); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
int arr[n];
inarr(arr, n);
int dp[k + 1] = {};
for (int i = 0; i <= k; i++) {
for (int x : arr) {
if ((i - x) >= 0 and dp[i - x] != 1) {
dp[i] = 1;
}
}
}
if (dp[k] == 0) {
cout1("First")
} else {
cout1("Second")
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename x>
using ordered_set =
tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>;
#define sorta(a, n) sort(a, a + n)
#define sortad(a, n) sort(a, a + n, greater<__typeof(a[0])>())
#define all(x) (x).begin(), (x).end()
#define ms0(x) memset((x), 0, sizeof((x)))
#define ms1(x) memset((x), -1, sizeof((x)))
typedef pair<int, int> pi;
#define inarr(arr, n) \
for (int i = 0; i < n; i++) \
cin >> arr[i];
#define prinarr(arr) \
{ \
for (int x : arr) \
cout << x << " "; \
} \
cout << "\n";
#define cout1(a) cout << a << "\n";
#define cout2(a, b) cout << a << " " << b << "\n";
#define cout3(a, b, c) cout << a << " " << b << " " << c << "\n";
#define setpre(n) cout << fixed << setprecision(8) << n << "\n";
#define filldp(arr, n, m, k) \
for (int i = 0; i < n; i++) { \
for (int j = 0; j < m; j++) \
arr[i][j] = k; \
}
#define mod 1000000007
#define mod1 998244353
vector<vector<int>> adj;
vector<int> dis;
vector<int> parent;
vector<bool> visited;
void newgr(int n) {
n += 10;
adj = vector<vector<int>>(n);
dis = vector<int>(n, 0);
// parent=vector<int>(n,-1);
visited = vector<bool>(n, false);
}
void dfs(int s) {
visited[s] = true;
for (auto u : adj[s]) {
if (!visited[u]) {
// parent[u]=s;
dis[u] = dis[s] + 1;
dfs(u);
}
}
}
void bfs(int s) {
queue<int> q;
q.push(s);
visited[s] = true;
dis[s] = 0;
while (!q.empty()) {
auto u = q.front();
q.pop();
for (auto x : adj[u]) {
if (!visited[x]) {
// parent[x]=u;
visited[x] = true;
dis[x] = dis[u] + 1;
q.push(x);
}
}
}
}
long long power(long long x, long long y) {
long long ans = 1;
x %= mod;
while (y > 0) {
if (y & 1)
ans = (ans * x) % mod;
y >>= 1;
x = (x * x) % mod;
}
return ans;
}
long long modinv(long long b) { return power(b, mod - 2); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
int arr[n];
inarr(arr, n);
int dp[k + 1] = {};
for (int i = 0; i <= k; i++) {
for (int x : arr) {
if ((i - x) >= 0 and dp[i - x] != 1) {
dp[i] = 1;
}
}
}
if (dp[k]) {
cout1("First")
} else {
cout1("Second")
}
return 0;
} | [
"expression.operation.binary.remove"
] | 978,268 | 978,269 | u237399952 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename x>
using ordered_set =
tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>;
#define sorta(a, n) sort(a, a + n)
#define sortad(a, n) sort(a, a + n, greater<__typeof(a[0])>())
#define all(x) (x).begin(), (x).end()
#define ms0(x) memset((x), 0, sizeof((x)))
#define ms1(x) memset((x), -1, sizeof((x)))
typedef pair<int, int> pi;
#define inarr(arr, n) \
for (int i = 0; i < n; i++) \
cin >> arr[i];
#define prinarr(arr) \
{ \
for (int x : arr) \
cout << x << " "; \
} \
cout << "\n";
#define cout1(a) cout << a << "\n";
#define cout2(a, b) cout << a << " " << b << "\n";
#define cout3(a, b, c) cout << a << " " << b << " " << c << "\n";
#define setpre(n) cout << fixed << setprecision(8) << n << "\n";
#define filldp(arr, n, m, k) \
for (int i = 0; i < n; i++) { \
for (int j = 0; j < m; j++) \
arr[i][j] = k; \
}
#define mod 1000000007
#define mod1 998244353
vector<vector<int>> adj;
vector<int> dis;
vector<int> parent;
vector<bool> visited;
void newgr(int n) {
n += 10;
adj = vector<vector<int>>(n);
dis = vector<int>(n, 0);
// parent=vector<int>(n,-1);
visited = vector<bool>(n, false);
}
void dfs(int s) {
visited[s] = true;
for (auto u : adj[s]) {
if (!visited[u]) {
// parent[u]=s;
dis[u] = dis[s] + 1;
dfs(u);
}
}
}
void bfs(int s) {
queue<int> q;
q.push(s);
visited[s] = true;
dis[s] = 0;
while (!q.empty()) {
auto u = q.front();
q.pop();
for (auto x : adj[u]) {
if (!visited[x]) {
// parent[x]=u;
visited[x] = true;
dis[x] = dis[u] + 1;
q.push(x);
}
}
}
}
long long power(long long x, long long y) {
long long ans = 1;
x %= mod;
while (y > 0) {
if (y & 1)
ans = (ans * x) % mod;
y >>= 1;
x = (x * x) % mod;
}
return ans;
}
long long modinv(long long b) { return power(b, mod - 2); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
int arr[n];
inarr(arr, n);
int dp[k + 1] = {};
for (int i = 0; i <= k; i++) {
for (int x : arr) {
if ((i - x) >= 0 and dp[i - x] != 1) {
dp[i - x] = 1;
}
}
}
if (dp[k]) {
cout1("First")
} else {
cout1("Second")
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename x>
using ordered_set =
tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>;
#define sorta(a, n) sort(a, a + n)
#define sortad(a, n) sort(a, a + n, greater<__typeof(a[0])>())
#define all(x) (x).begin(), (x).end()
#define ms0(x) memset((x), 0, sizeof((x)))
#define ms1(x) memset((x), -1, sizeof((x)))
typedef pair<int, int> pi;
#define inarr(arr, n) \
for (int i = 0; i < n; i++) \
cin >> arr[i];
#define prinarr(arr) \
{ \
for (int x : arr) \
cout << x << " "; \
} \
cout << "\n";
#define cout1(a) cout << a << "\n";
#define cout2(a, b) cout << a << " " << b << "\n";
#define cout3(a, b, c) cout << a << " " << b << " " << c << "\n";
#define setpre(n) cout << fixed << setprecision(8) << n << "\n";
#define filldp(arr, n, m, k) \
for (int i = 0; i < n; i++) { \
for (int j = 0; j < m; j++) \
arr[i][j] = k; \
}
#define mod 1000000007
#define mod1 998244353
vector<vector<int>> adj;
vector<int> dis;
vector<int> parent;
vector<bool> visited;
void newgr(int n) {
n += 10;
adj = vector<vector<int>>(n);
dis = vector<int>(n, 0);
// parent=vector<int>(n,-1);
visited = vector<bool>(n, false);
}
void dfs(int s) {
visited[s] = true;
for (auto u : adj[s]) {
if (!visited[u]) {
// parent[u]=s;
dis[u] = dis[s] + 1;
dfs(u);
}
}
}
void bfs(int s) {
queue<int> q;
q.push(s);
visited[s] = true;
dis[s] = 0;
while (!q.empty()) {
auto u = q.front();
q.pop();
for (auto x : adj[u]) {
if (!visited[x]) {
// parent[x]=u;
visited[x] = true;
dis[x] = dis[u] + 1;
q.push(x);
}
}
}
}
long long power(long long x, long long y) {
long long ans = 1;
x %= mod;
while (y > 0) {
if (y & 1)
ans = (ans * x) % mod;
y >>= 1;
x = (x * x) % mod;
}
return ans;
}
long long modinv(long long b) { return power(b, mod - 2); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
int arr[n];
inarr(arr, n);
int dp[k + 1] = {};
for (int i = 0; i <= k; i++) {
for (int x : arr) {
if ((i - x) >= 0 and dp[i - x] != 1) {
dp[i] = 1;
}
}
}
if (dp[k]) {
cout1("First")
} else {
cout1("Second")
}
return 0;
} | [
"expression.operation.binary.remove"
] | 978,270 | 978,269 | u237399952 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define ar array
#define endl '\n'
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define Rep(i, a, b) for (int i = a; i <= b; i++)
#define Rev(i, a, b) for (ll i = a; i >= b; i--)
#define FOR(m) Rep(i, 1, m)
#define For(m) Rep(i, 0, m - 1)
#define Rbl(x, a) for (auto &x : a)
#define FIO \
ios::sync_with_stdio(0); \
cin.tie(0);
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
const ll INF = 1e7;
#define mod 1000000007
const int mxN = 1e5 + 1;
ll n, k;
ll dp[mxN], a[mxN];
int main() {
FIO
cin >>
n >> k;
FOR(n) cin >> a[i];
dp[0] = 0;
Rep(j, 1, k) {
Rep(i, 1, n) {
if (j >= a[i])
dp[j] |= dp[j - a[i]];
}
}
cout << (dp[k] ? "First" : "Second") << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define ar array
#define endl '\n'
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define Rep(i, a, b) for (int i = a; i <= b; i++)
#define Rev(i, a, b) for (ll i = a; i >= b; i--)
#define FOR(m) Rep(i, 1, m)
#define For(m) Rep(i, 0, m - 1)
#define Rbl(x, a) for (auto &x : a)
#define FIO \
ios::sync_with_stdio(0); \
cin.tie(0);
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
const ll INF = 1e7;
#define mod 1000000007
const int mxN = 1e5 + 1;
ll n, k;
ll dp[mxN], a[mxN];
int main() {
FIO
cin >>
n >> k;
FOR(n) cin >> a[i];
dp[0] = 0;
Rep(j, 1, k) {
Rep(i, 1, n) {
if (j >= a[i])
dp[j] |= !dp[j - a[i]];
}
}
cout << (dp[k] ? "First" : "Second") << endl;
}
| [
"expression.operation.unary.add"
] | 978,274 | 978,275 | u735052662 | cpp |
p03170 | #include "bits/stdc++.h"
using namespace std;
#define Fast_IO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define int long long
int32_t main() {
Fast_IO int n, k;
cin >> n >> k;
vector<int> a(n);
for (auto &i : a)
cin >> i;
vector<bool> dp(n + 1, false);
dp[0] = 0;
// for (auto c : a) {
// dp[c] = 1;
// }
for (int i = 1; i <= k; i++) {
bool canwin = false;
for (auto &c : a) {
if (i - c >= 0) {
if (dp[i - c] == 0)
canwin = true;
}
}
if (canwin)
dp[i] = true;
}
if (dp[k]) {
cout << "First\n";
} else {
cout << "Second\n";
}
} | #include "bits/stdc++.h"
using namespace std;
#define Fast_IO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define int long long
int32_t main() {
Fast_IO int n, k;
cin >> n >> k;
vector<int> a(n);
for (auto &i : a)
cin >> i;
vector<bool> dp(k + 1, false);
dp[0] = 0;
// for (auto c : a) {
// dp[c] = 1;
// }
for (int i = 1; i <= k; i++) {
bool canwin = false;
for (auto &c : a) {
if (i - c >= 0) {
if (dp[i - c] == 0)
canwin = true;
}
}
if (canwin)
dp[i] = true;
}
if (dp[k]) {
cout << "First\n";
} else {
cout << "Second\n";
}
} | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,278 | 978,279 | u961487195 | cpp |
p03170 | #include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define nl cout << "\n"
#define pb push_back
#define se second
#define fi first
#define int long long
#define pi pair<int, int>
#define vpi vector<pi>
#define vvpi vector<vpi>
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define For(i, n) for (int i = 0; i < n; i++)
#define Forn(i, a, n) for (int i = a; i < n; i++)
#define pie = 3.14159265358979323846264338327950;
const int mod = 1e9 + 7;
void solve() {
fio;
int n, k;
cin >> n >> k;
int ar[n];
For(i, n) cin >> ar[i];
bool dp[k + 1];
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - ar[j] >= 0 && !dp[i - ar[j]]) {
dp[i] = true;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
int32_t main() {
fio;
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int t = 1;
// cin>>t;
for (int i = 1; i <= t; i++) {
// cout<<"Case #"<<i<<":\n";
solve();
}
return 0;
}
| #include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define nl cout << "\n"
#define pb push_back
#define se second
#define fi first
#define int long long
#define pi pair<int, int>
#define vpi vector<pi>
#define vvpi vector<vpi>
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define For(i, n) for (int i = 0; i < n; i++)
#define Forn(i, a, n) for (int i = a; i < n; i++)
#define pie = 3.14159265358979323846264338327950;
const int mod = 1e9 + 7;
void solve() {
fio;
int n, k;
cin >> n >> k;
int ar[n];
For(i, n) cin >> ar[i];
vector<bool> dp(k + 1);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - ar[j] >= 0 && !dp[i - ar[j]]) {
dp[i] = true;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
int32_t main() {
fio;
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int t = 1;
// cin>>t;
for (int i = 1; i <= t; i++) {
// cout<<"Case #"<<i<<":\n";
solve();
}
return 0;
}
| [] | 978,280 | 978,281 | u002457022 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define AC ios::sync_with_stdio(0), cin.tie(0);
int dp[100001];
int main() {
AC int n;
cin >> n;
int k;
cin >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
dp[a[i]] = 1;
}
dp[0] = 0;
for (int i = 1; i <= n; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] < 0)
dp[i] = 0;
else {
dp[i] = !dp[a[j]];
if (!dp[i])
break;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define AC ios::sync_with_stdio(0), cin.tie(0);
bool dp[100001];
int main() {
AC int n;
cin >> n;
int k;
cin >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
dp[a[i]] = 1;
}
dp[0] = 0;
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] < 0)
dp[i] = 0;
else {
dp[i] = !dp[i - a[j]];
if (dp[i])
break;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
| [
"variable_declaration.type.primitive.change",
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change",
"assignment.change",
"expression.operation.unary.logical.remove",
"control_flow.branch.if.condition.change"
] | 978,282 | 978,283 | u723744542 | cpp |
p03170 |
#include <bits/stdc++.h>
#define size 100000
#define ll long long
using namespace std;
int grundy[size + 1];
int a[size];
void init(int min) {
for (int i = 0; i <= size; i++) {
if (i >= min)
grundy[i] = -1;
else
grundy[i] = 0;
}
}
int solve(int k, int n) {
if (k < 0)
return 0;
if (grundy[k] != -1)
return grundy[k];
int s = 1;
for (int i = 0; i < n; i++) {
s *= solve(k - a[i], n);
}
if (s == 0)
return grundy[k] = 1;
else
return grundy[k] = 0;
}
int main() {
int n, k;
cin >> n >> k;
int m = INT_MAX;
for (int i = 0; i < n; i++) {
cin >> a[i];
m = min(a[i], m);
}
init(m);
ll ans = 0;
if (n == 1) {
if ((k / a[0]) & 1)
cout << "First";
else
cout << "Second";
exit(0);
}
ans = solve(k, n);
if (ans)
cout << "First";
else
cout << "Second";
return 0;
}
|
#include <bits/stdc++.h>
#define size 100000
#define ll long long
using namespace std;
int grundy[size + 1];
int a[size];
void init(int min) {
for (int i = 0; i <= size; i++) {
if (i >= min)
grundy[i] = -1;
else
grundy[i] = 0;
}
}
int solve(int k, int n) {
if (k < 0)
return 1;
if (grundy[k] != -1)
return grundy[k];
int s = 1;
for (int i = 0; i < n; i++) {
s *= solve(k - a[i], n);
}
if (s == 0)
return grundy[k] = 1;
else
return grundy[k] = 0;
}
int main() {
int n, k;
cin >> n >> k;
int m = INT_MAX;
for (int i = 0; i < n; i++) {
cin >> a[i];
m = min(a[i], m);
}
init(m);
ll ans = 0;
if (n == 1) {
if ((k / a[0]) & 1)
cout << "First";
else
cout << "Second";
exit(0);
}
ans = solve(k, n);
if (ans)
cout << "First";
else
cout << "Second";
return 0;
}
| [
"literal.number.change",
"function.return_value.change"
] | 978,287 | 978,288 | u175104711 | cpp |
p03170 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) { cin >> a[i]; }
int dp[101];
memset(dp, 0, sizeof(dp));
dp[0] = -1;
for (int i = 1; i <= k; i++) {
bool f = true;
rep(j, n) {
if (i >= a[j]) {
if (dp[i - a[j]] == -1) {
dp[i] = a[j];
f = false;
break;
}
}
}
if (f)
dp[i] = -1;
// rep(i, k+1)cout<<dp[i]<<' ';cout<<endl;
}
if (dp[k] != -1)
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) { cin >> a[i]; }
int dp[100001];
memset(dp, 0, sizeof(dp));
dp[0] = -1;
for (int i = 1; i <= k; i++) {
bool f = true;
rep(j, n) {
if (i >= a[j]) {
if (dp[i - a[j]] == -1) {
dp[i] = a[j];
f = false;
break;
}
}
}
if (f)
dp[i] = -1;
// rep(i, k+1)cout<<dp[i]<<' ';cout<<endl;
}
if (dp[k] != -1)
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,289 | 978,291 | u021358975 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
string winner(int arr[], int N, int k) {
bool dp[N + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= k; i++) {
for (int j = 0; j < N; j++) {
if (arr[j] > i)
continue;
if (dp[i - arr[j]] == 0)
dp[i] = 1;
}
}
if (dp[k] == 1)
return "First";
else
return "Second";
}
int main() {
int N, K;
cin >> N >> K;
int arr[N + 1];
for (int i = 0; i < N; i++)
cin >> arr[i];
cout << winner(arr, N, K);
} | #include <bits/stdc++.h>
using namespace std;
string winner(int arr[], int N, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= k; i++) {
for (int j = 0; j < N; j++) {
if (arr[j] > i)
continue;
if (dp[i - arr[j]] == 0)
dp[i] = 1;
}
}
if (dp[k] == 1)
return "First";
else
return "Second";
}
int main() {
int N, K;
cin >> N >> K;
int arr[K + 1];
for (int i = 0; i < K; i++)
cin >> arr[i];
cout << winner(arr, N, K);
} | [
"identifier.change",
"expression.operation.binary.change",
"control_flow.loop.for.condition.change"
] | 978,294 | 978,295 | u257699577 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define M (int)1e9
#define pi 3.1415926536
#define all(a) a.begin(), a.end()
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define flp(i, x, y) for (long long int i = x; i < y; i++)
#define ll long long int
#define MOD (long long int)(1000000007)
#define pb push_back
vector<int> SieveOfEratosthenes(int n) {
vector<int> ans;
bool prime[n + 1];
memset(prime, true, sizeof(prime));
for (int p = 2; p * p <= n; p++)
if (prime[p] == true)
for (int i = p * p; i <= n; i += p)
prime[i] = false;
for (int p = 2; p <= n; p++)
if (prime[p])
ans.push_back(p);
return ans;
}
vector<int> fib(int n) {
vector<int> ans;
int x = 0, y = 1, l = 1;
ans.push_back(x);
ans.push_back(y);
while (l < n) {
l = x + y;
x = y;
y = l;
ans.push_back(l);
}
return ans;
}
bool isPrime(ll n) {
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (ll i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
long long power(int n, int k) {
if (k == 0)
return 1;
else
return (n * power(n, k - 1) % 1000000007);
}
long long nCr(int n, int r) {
if (n == r)
return 1;
else if (r == 0)
return 1;
else
return ((nCr(n - 1, r - 1) + nCr(n - 1, r)) % 998244353);
}
int sdigit(int x) {
int ans = 0;
while (x) {
ans += x % 10;
x /= 10;
}
return ans;
}
long long lcm(int a, int b) {
return ((long long)a * (long long)b) / __gcd(a, b);
}
pair<int, int> subArraySum(int arr[], int n, int sum) {
int curr_sum = arr[0], start = 0, i;
for (i = 1; i <= n; i++) {
while (curr_sum > sum && start < i - 1) {
curr_sum = curr_sum - arr[start];
start++;
}
if (curr_sum == sum) {
// cout << "Sum found between indexes "
// << start << " and " << i - 1;
return make_pair(start, i - 1);
}
if (i < n)
curr_sum = curr_sum + arr[i];
}
return make_pair(-1, -1);
}
int bs(int a[], int b, int l, int r) {
int mid = (l + r) / 2;
if (l > r)
return -1;
if (a[mid] == b || l == r)
return mid;
if (a[mid] > b)
return bs(a, b, l, mid - 1);
else
return bs(a, b, mid + 1, r);
}
int divideandconquerbc(int a[], int l, int r) {
if (l >= r)
return 0;
int mid = (l + r) / 2, ans = 0;
ans += divideandconquerbc(a, l, mid);
ans += divideandconquerbc(a, mid + 1, r);
int x = r - l + 1, y = mid - l + 1;
int c[x];
int i = 0, j = 0;
for (int k = 0; k < x; k++) {
if ((a[l + i] <= a[mid + 1 + j] && i < y) || j >= x - y) {
c[k] = a[l + i];
i++;
} else {
c[k] = a[mid + 1 + j];
j++;
ans += y - i;
}
// cout<<c[k]<<" "<<ans<<endl;
}
for (int k = l; k <= r; k++)
a[k] = c[k - l];
return ans;
}
void explore(bool a[], vector<vector<int>> adj, int u) {
if (a[u - 1])
return;
else
a[u - 1] = true;
for (int i = 0; i < adj[u - 1].size(); i++) {
explore(a, adj, adj[u - 1][i] + 1);
}
}
long long gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
double startTime;
double getCurrentTime() {
return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
/*int dfs(int u,int f)
{
depth[u]=depth[f]+1;size[u]=1;
for (int i=0;i<conj[u].size();++i)
{
if ((v=conj[u][i])==f)continue;
size[u]+=dfs(v,u);
}
det[u]=size[u]-depth[u];return size[u];*/
void out(ll n) {
string a, b;
cin >> a >> b;
vector<int> v1, v2;
a += '0';
b += '0';
flp(i, 1, n + 1) {
if (a[i] != a[i - 1])
v1.push_back(i);
if (b[i] != b[i - 1])
v2.push_back(i);
}
cout << v1.size() + v2.size() << " ";
flp(i, 0, v1.size()) cout << v1[i] << " ";
flp(i, 0, v2.size()) cout << v2[v2.size() - i - 1] << " ";
cout << "\n";
}
int point(char A, char B) {
if (A == B)
return 0;
if (A == 'R') {
if (B == 'P')
return -1;
else
return 1;
}
if (A == 'P') {
if (B == 'R')
return 1;
else
return -1;
}
else {
if (B == 'R')
return -1;
else
return 1;
}
}
/*int mex(int r[])
{
int n=sizeof(r)/sizeof(r[0]);
int b[n+1]={};
int st=0;
flp(i,0,n)
{
b[a[i]]=1;
while(b[st]==1)
st++;
}
return st;
}*/
/*ll modInverse(ll n, ll p)
{
return power(n, p-2, p);
}*/
int good(int n, string s, char ch) {
if (n == 1) {
if (s[0] == ch)
return 0;
else
return 1;
} else {
int f1 = 0, f2 = 0;
for (int i = 0; i < n / 2; i++) {
if (s[i] == ch)
f1++;
if (s[n - i - 1] == ch)
f2++;
}
string s1 = s.substr(n / 2, n);
int ans1 = (n / 2) - f1 + good(n / 2, s1, ch + 1);
string s2 = s.substr(0, n / 2);
int ans2 = (n / 2) - f2 + good(n / 2, s2, ch + 1);
return min(ans1, ans2);
}
}
int main() {
//#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("ou.txt","w",stdout);
//#endif
fastio long long int T, i, r, c0 = 0, c1 = 0, c2 = 0, ctr, m, n, a, b, c, d,
t, mx = 1, g, f, q, l1, l2, sum = 0, o, m1, m2,
x, x2, y1, y2, x1, y, k, p, num = 1, step, l, z;
// long double ar;
int k1, k2, k3, p1 = -1, p2 = -1, p3 = -1, p5 = -1, p4 = -1, j, pd = 0,
U = -1e9;
T = 1;
// cin>>T;
bool res = false;
// ctr=1;
while (T--) {
res = true;
cin >> n >> k;
ll dp[k + 1];
ll ar[n];
flp(i, 0, n) cin >> ar[i];
dp[0] = 0;
flp(i, 1, k + 1) {
dp[i] = 0;
flp(j, 0, n) {
if (i >= ar[j] && dp[i - x] == 0)
dp[i] = 1;
}
}
if (dp[k] == 1)
cout << "First\n";
else
cout << "Second\n";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define M (int)1e9
#define pi 3.1415926536
#define all(a) a.begin(), a.end()
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define flp(i, x, y) for (long long int i = x; i < y; i++)
#define ll long long int
#define MOD (long long int)(1000000007)
#define pb push_back
vector<int> SieveOfEratosthenes(int n) {
vector<int> ans;
bool prime[n + 1];
memset(prime, true, sizeof(prime));
for (int p = 2; p * p <= n; p++)
if (prime[p] == true)
for (int i = p * p; i <= n; i += p)
prime[i] = false;
for (int p = 2; p <= n; p++)
if (prime[p])
ans.push_back(p);
return ans;
}
vector<int> fib(int n) {
vector<int> ans;
int x = 0, y = 1, l = 1;
ans.push_back(x);
ans.push_back(y);
while (l < n) {
l = x + y;
x = y;
y = l;
ans.push_back(l);
}
return ans;
}
bool isPrime(ll n) {
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (ll i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
long long power(int n, int k) {
if (k == 0)
return 1;
else
return (n * power(n, k - 1) % 1000000007);
}
long long nCr(int n, int r) {
if (n == r)
return 1;
else if (r == 0)
return 1;
else
return ((nCr(n - 1, r - 1) + nCr(n - 1, r)) % 998244353);
}
int sdigit(int x) {
int ans = 0;
while (x) {
ans += x % 10;
x /= 10;
}
return ans;
}
long long lcm(int a, int b) {
return ((long long)a * (long long)b) / __gcd(a, b);
}
pair<int, int> subArraySum(int arr[], int n, int sum) {
int curr_sum = arr[0], start = 0, i;
for (i = 1; i <= n; i++) {
while (curr_sum > sum && start < i - 1) {
curr_sum = curr_sum - arr[start];
start++;
}
if (curr_sum == sum) {
// cout << "Sum found between indexes "
// << start << " and " << i - 1;
return make_pair(start, i - 1);
}
if (i < n)
curr_sum = curr_sum + arr[i];
}
return make_pair(-1, -1);
}
int bs(int a[], int b, int l, int r) {
int mid = (l + r) / 2;
if (l > r)
return -1;
if (a[mid] == b || l == r)
return mid;
if (a[mid] > b)
return bs(a, b, l, mid - 1);
else
return bs(a, b, mid + 1, r);
}
int divideandconquerbc(int a[], int l, int r) {
if (l >= r)
return 0;
int mid = (l + r) / 2, ans = 0;
ans += divideandconquerbc(a, l, mid);
ans += divideandconquerbc(a, mid + 1, r);
int x = r - l + 1, y = mid - l + 1;
int c[x];
int i = 0, j = 0;
for (int k = 0; k < x; k++) {
if ((a[l + i] <= a[mid + 1 + j] && i < y) || j >= x - y) {
c[k] = a[l + i];
i++;
} else {
c[k] = a[mid + 1 + j];
j++;
ans += y - i;
}
// cout<<c[k]<<" "<<ans<<endl;
}
for (int k = l; k <= r; k++)
a[k] = c[k - l];
return ans;
}
void explore(bool a[], vector<vector<int>> adj, int u) {
if (a[u - 1])
return;
else
a[u - 1] = true;
for (int i = 0; i < adj[u - 1].size(); i++) {
explore(a, adj, adj[u - 1][i] + 1);
}
}
long long gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
double startTime;
double getCurrentTime() {
return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
/*int dfs(int u,int f)
{
depth[u]=depth[f]+1;size[u]=1;
for (int i=0;i<conj[u].size();++i)
{
if ((v=conj[u][i])==f)continue;
size[u]+=dfs(v,u);
}
det[u]=size[u]-depth[u];return size[u];*/
void out(ll n) {
string a, b;
cin >> a >> b;
vector<int> v1, v2;
a += '0';
b += '0';
flp(i, 1, n + 1) {
if (a[i] != a[i - 1])
v1.push_back(i);
if (b[i] != b[i - 1])
v2.push_back(i);
}
cout << v1.size() + v2.size() << " ";
flp(i, 0, v1.size()) cout << v1[i] << " ";
flp(i, 0, v2.size()) cout << v2[v2.size() - i - 1] << " ";
cout << "\n";
}
int point(char A, char B) {
if (A == B)
return 0;
if (A == 'R') {
if (B == 'P')
return -1;
else
return 1;
}
if (A == 'P') {
if (B == 'R')
return 1;
else
return -1;
}
else {
if (B == 'R')
return -1;
else
return 1;
}
}
/*int mex(int r[])
{
int n=sizeof(r)/sizeof(r[0]);
int b[n+1]={};
int st=0;
flp(i,0,n)
{
b[a[i]]=1;
while(b[st]==1)
st++;
}
return st;
}*/
/*ll modInverse(ll n, ll p)
{
return power(n, p-2, p);
}*/
int good(int n, string s, char ch) {
if (n == 1) {
if (s[0] == ch)
return 0;
else
return 1;
} else {
int f1 = 0, f2 = 0;
for (int i = 0; i < n / 2; i++) {
if (s[i] == ch)
f1++;
if (s[n - i - 1] == ch)
f2++;
}
string s1 = s.substr(n / 2, n);
int ans1 = (n / 2) - f1 + good(n / 2, s1, ch + 1);
string s2 = s.substr(0, n / 2);
int ans2 = (n / 2) - f2 + good(n / 2, s2, ch + 1);
return min(ans1, ans2);
}
}
int main() {
//#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("ou.txt","w",stdout);
//#endif
fastio long long int T, i, r, c0 = 0, c1 = 0, c2 = 0, ctr, m, n, a, b, c, d,
t, mx = 1, g, f, q, l1, l2, sum = 0, o, m1, m2,
x, x2, y1, y2, x1, y, k, p, num = 1, step, l, z;
// long double ar;
int k1, k2, k3, p1 = -1, p2 = -1, p3 = -1, p5 = -1, p4 = -1, j, pd = 0,
U = -1e9;
T = 1;
// cin>>T;
bool res = false;
// ctr=1;
while (T--) {
res = true;
cin >> n >> k;
ll dp[k + 1];
ll ar[n];
flp(i, 0, n) cin >> ar[i];
dp[0] = 0;
flp(i, 1, k + 1) {
dp[i] = 0;
flp(j, 0, n) {
if (i >= ar[j] && dp[i - ar[j]] == 0)
dp[i] = 1;
}
}
if (dp[k] == 1)
cout << "First\n";
else
cout << "Second\n";
}
return 0;
}
| [
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 978,296 | 978,297 | u496612088 | cpp |
p03170 | #include <iostream>
#include <vector>
using namespace std;
bool dp[110000];
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] >= 0)
dp[i] |= !dp[i - a[j]];
//右辺はi-a[j]が個の時負けの状態なら 1(勝ちの状態)になる みたいな感じ
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "second" << endl;
} | #include <iostream>
#include <vector>
using namespace std;
bool dp[110000];
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] >= 0)
dp[i] |= !dp[i - a[j]];
//右辺はi-a[j]が個の時負けの状態なら 1(勝ちの状態)になる みたいな感じ
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,300 | 978,301 | u000212387 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> P;
int INF = 1e9 + 7;
int mod = 100000;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool dp[100005];
signed main() {
int N, K;
cin >> N >> K;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
for (int i = 0; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == false) {
dp[i] = true;
}
}
}
}
if (dp[K]) {
cout << "first" << endl;
} else {
cout << "second" << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> P;
int INF = 1e9 + 7;
int mod = 100000;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool dp[100005];
signed main() {
int N, K;
cin >> N >> K;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
for (int i = 0; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == false) {
dp[i] = true;
}
}
}
}
if (dp[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,309 | 978,310 | u237390401 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
void Fast() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main() {
Fast();
int n, i, k;
cin >> n >> k;
int *v = new int[n];
bool **dp = new bool *[k];
for (i = 0; i <= k; i++)
dp[i] = new bool[2];
for (i = 0; i < n; i++)
cin >> v[i];
for (i = 0; i <= k; i++) {
dp[i][0] = 1, dp[i][1] = 0;
for (int j = 0; j < n; j++) {
if (i - v[j] >= 0)
dp[i][1] |= dp[i - v[j]][0];
if (i - v[j] >= 0)
dp[i][0] &= dp[i - v[j]][1];
}
}
cout << (dp[k][1] ? "First" : "Second");
delete[] v;
for (i = 0; i <= k; i++)
delete[] dp[i];
delete[] dp;
} | #include <bits/stdc++.h>
using namespace std;
void Fast() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main() {
Fast();
int n, i, k;
cin >> n >> k;
int *v = new int[n];
bool **dp = new bool *[k + 1];
for (i = 0; i <= k; i++)
dp[i] = new bool[2];
for (i = 0; i < n; i++)
cin >> v[i];
for (i = 0; i <= k; i++) {
dp[i][0] = 1, dp[i][1] = 0;
for (int j = 0; j < n; j++) {
if (i - v[j] >= 0)
dp[i][1] |= dp[i - v[j]][0];
if (i - v[j] >= 0)
dp[i][0] &= dp[i - v[j]][1];
}
}
cout << (dp[k][1] ? "First" : "Second");
delete[] v;
for (i = 0; i <= k; i++)
delete[] dp[i];
delete[] dp;
} | [
"expression.operation.binary.add"
] | 978,317 | 978,318 | u388127021 | cpp |
p03170 | /*
Author: Qaseem Hasan alias Mikepayne14(Codeforces,Atcoder)
qaseem_hasan_ (Codechef,HackerRank,HackerEarth)
*/
#include <bits/stdc++.h>
using namespace std;
//---------------------------------------------------------
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef priority_queue<int, vector<int>, greater<int>> revpq;
const int INF = (int)1e9;
const int EPS = 1e-6;
const int mod = 1000000007;
const long double PI = 3.14159265359;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
#define acc accumulate
#define eb emplace_back
#define F first
#define S second
#define MP make_pair
#define filcon(v, x) iota(all(v), x)
#define repi(n) for (int i = 0; i < n; ++i)
//#define erase(v,e) v.erase(std::remove(v.begin(), v.end(), e), v.end())
#define sqr(x) ((x) * (x))
#define MEM(a, b) memset(a, b, sizeof(a))
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define inrange(i, a, b) ((i >= min(a, b)) && (i <= max(a, b)))
// #define min_all(a,b,c,d,...) min({a,b,c,d,...})
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(nullptr);
#define make_unique(v) \
sort(all(v)); \
v.erase(unique(all(v)), v.end());
#define printv(v) \
for (auto i : v) \
cout << i << " "
#define trace(x) cout << #x << " = { " << x << " }" << khatam
#define khatam '\n'
#define test \
int t; \
cin >> t; \
repi(t) { \
solve(); \
cout << khatam; \
}
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) \
for (auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
blockTime.second; \
debug("%s: %ld ms\n", d, \
chrono::duration_cast<chrono::milliseconds>( \
chrono::high_resolution_clock::now() - blockTime.first) \
.count()), \
blockTime.second = false)
//--------------------------------------------------------
inline bool grid_inside(int x, int y, int n, int m) {
return x >= 1 && x <= n && y >= 1 && y <= m;
}
template <typename T> T lcm(T a, T b) { return (a * b) / __gcd(a, b); }
template <typename T> T Dis(T x1, T y1, T x2, T y2) {
return sqrt(sqr(x1 - x2) + sqr(y1 - y2));
}
template <typename T> T Angle(T x1, T y1, T x2, T y2) {
return atan((double)(y1 - y2) / (double)(x1 - x2));
}
inline int Set(int N, int pos) { return N = N | (1 << pos); }
inline int Reset(int N, int pos) { return N = N & ~(1 << pos); }
inline bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
template <class T, class X> inline T togglebit(T a, X i) {
T t = 1;
return (a ^ (t << i));
}
//--------------------------------------------------------
bool compare(const pair<int, int> &i, const pair<int, int> &j) {
return i.F < j.F;
}
int LSOne(ll n) { return log2(n & -n) + 1; }
int rangeClear(int n, int i, int j) {
int ones = ~0;
int a = ones << (j + 1);
int b = (i << 2) - 1;
int mask = a | b;
int ans = n & mask;
return ans;
}
ll mul_mod(ll x, ll y, ll mod) {
ll i = 0, j = x;
while (y > 0) {
if (y & 1) {
i = (i + j) % mod;
}
j = (j + j) % mod;
y >>= 1;
}
return i;
}
ll fast_power(int a, int x) {
if (x == 0)
return 1;
else if (x == 1)
return a;
else {
ll R = fast_power(a, x >> 1);
if (!(x & 1))
return R * R;
else
return R * a * R;
}
}
ll fast_power_unlocked(ll a, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1) {
res = mul_mod(res, a, mod);
}
a = mul_mod(a, a, mod);
n = n >> 1;
}
return res;
}
ll modInverse(ll A, ll M) { return fast_power_unlocked(A, M - 2, M); }
/*const int MAX_N=10000;
bitset<MAX_N> isPrime;
void sieve()
{
isPrime.set();
isPrime[0]=isPrime[1]=0;
for(ll i=2;i*i<=MAX_N;i++)
{
if(isPrime[i])
{
for(ll j=i*i;j<=MAX_N;j+=i)
{
isPrime[j] = 0;
}
}
}
}*/
const int maxn = 1e5 + 5;
bool dp[maxn];
void solve() {
int n, k;
cin >> n >> k;
int a[n];
MEM(dp, 0);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (dp[i - a[j]] < 0)
continue;
if (dp[i - a[j]] == 0)
dp[i] = 1;
}
// cout << dp[i] << khatam;
}
if (dp[k])
cout << "First";
else
cout << "Second";
}
int main() {
FAST_IO;
//-------------------------------------------------------
time__("Time Taken") { solve(); }
}
| /*
Author: Qaseem Hasan alias Mikepayne14(Codeforces,Atcoder)
qaseem_hasan_ (Codechef,HackerRank,HackerEarth)
*/
#include <bits/stdc++.h>
using namespace std;
//---------------------------------------------------------
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef priority_queue<int, vector<int>, greater<int>> revpq;
const int INF = (int)1e9;
const int EPS = 1e-6;
const int mod = 1000000007;
const long double PI = 3.14159265359;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
#define acc accumulate
#define eb emplace_back
#define F first
#define S second
#define MP make_pair
#define filcon(v, x) iota(all(v), x)
#define repi(n) for (int i = 0; i < n; ++i)
//#define erase(v,e) v.erase(std::remove(v.begin(), v.end(), e), v.end())
#define sqr(x) ((x) * (x))
#define MEM(a, b) memset(a, b, sizeof(a))
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define inrange(i, a, b) ((i >= min(a, b)) && (i <= max(a, b)))
// #define min_all(a,b,c,d,...) min({a,b,c,d,...})
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(nullptr);
#define make_unique(v) \
sort(all(v)); \
v.erase(unique(all(v)), v.end());
#define printv(v) \
for (auto i : v) \
cout << i << " "
#define trace(x) cout << #x << " = { " << x << " }" << khatam
#define khatam '\n'
#define test \
int t; \
cin >> t; \
repi(t) { \
solve(); \
cout << khatam; \
}
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) \
for (auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
blockTime.second; \
debug("%s: %ld ms\n", d, \
chrono::duration_cast<chrono::milliseconds>( \
chrono::high_resolution_clock::now() - blockTime.first) \
.count()), \
blockTime.second = false)
//--------------------------------------------------------
inline bool grid_inside(int x, int y, int n, int m) {
return x >= 1 && x <= n && y >= 1 && y <= m;
}
template <typename T> T lcm(T a, T b) { return (a * b) / __gcd(a, b); }
template <typename T> T Dis(T x1, T y1, T x2, T y2) {
return sqrt(sqr(x1 - x2) + sqr(y1 - y2));
}
template <typename T> T Angle(T x1, T y1, T x2, T y2) {
return atan((double)(y1 - y2) / (double)(x1 - x2));
}
inline int Set(int N, int pos) { return N = N | (1 << pos); }
inline int Reset(int N, int pos) { return N = N & ~(1 << pos); }
inline bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
template <class T, class X> inline T togglebit(T a, X i) {
T t = 1;
return (a ^ (t << i));
}
//--------------------------------------------------------
bool compare(const pair<int, int> &i, const pair<int, int> &j) {
return i.F < j.F;
}
int LSOne(ll n) { return log2(n & -n) + 1; }
int rangeClear(int n, int i, int j) {
int ones = ~0;
int a = ones << (j + 1);
int b = (i << 2) - 1;
int mask = a | b;
int ans = n & mask;
return ans;
}
ll mul_mod(ll x, ll y, ll mod) {
ll i = 0, j = x;
while (y > 0) {
if (y & 1) {
i = (i + j) % mod;
}
j = (j + j) % mod;
y >>= 1;
}
return i;
}
ll fast_power(int a, int x) {
if (x == 0)
return 1;
else if (x == 1)
return a;
else {
ll R = fast_power(a, x >> 1);
if (!(x & 1))
return R * R;
else
return R * a * R;
}
}
ll fast_power_unlocked(ll a, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1) {
res = mul_mod(res, a, mod);
}
a = mul_mod(a, a, mod);
n = n >> 1;
}
return res;
}
ll modInverse(ll A, ll M) { return fast_power_unlocked(A, M - 2, M); }
/*const int MAX_N=10000;
bitset<MAX_N> isPrime;
void sieve()
{
isPrime.set();
isPrime[0]=isPrime[1]=0;
for(ll i=2;i*i<=MAX_N;i++)
{
if(isPrime[i])
{
for(ll j=i*i;j<=MAX_N;j+=i)
{
isPrime[j] = 0;
}
}
}
}*/
const int maxn = 1e5 + 5;
bool dp[maxn];
void solve() {
int n, k;
cin >> n >> k;
int a[n];
MEM(dp, 0);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] < 0)
continue;
if (dp[i - a[j]] == 0)
dp[i] = 1;
// if(dp[i]) break;
}
// cout << dp[i] << khatam;
}
if (dp[k])
cout << "First";
else
cout << "Second";
}
int main() {
FAST_IO;
//-------------------------------------------------------
time__("Time Taken") { solve(); }
}
| [
"control_flow.loop.for.condition.change",
"control_flow.branch.if.condition.change"
] | 978,326 | 978,327 | u649440112 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[n];
bool dp[m + 1];
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= m; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j] && !dp[i - a[j]]) {
dp[i] = true;
break;
}
}
}
if (dp[m])
cout << "First" << endl;
else
cout << "Second" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[n];
bool dp[m + 1] = {0};
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= m; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j] && !dp[i - a[j]]) {
dp[i] = true;
break;
}
}
}
if (dp[m])
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"variable_declaration.value.change"
] | 978,336 | 978,337 | u022311705 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[n];
bool dp[m];
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= m; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j] && !dp[i - a[j]]) {
dp[i] = true;
break;
}
}
}
if (dp[m])
cout << "First" << endl;
else
cout << "Second" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int a[n];
bool dp[m + 1] = {0};
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= m; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j] && !dp[i - a[j]]) {
dp[i] = true;
break;
}
}
}
if (dp[m])
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"variable_declaration.value.change"
] | 978,338 | 978,337 | u022311705 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int winner(vector<int> v, int k, int n) {
int *dp = new int[k + 1];
for (int i = 0; i < k + 1; i++)
dp[i] = 0;
for (int i = 1; i <= k; i++) {
for (auto x : v) {
if (x >= i && dp[i - x] == 0)
dp[i] = 1;
break;
}
}
return dp[k];
}
int main() {
// your code goes here
int n, k;
cin >> n >> k;
vector<int> v;
for (int i = 0; i < n; i++) {
int c;
cin >> c;
v.push_back(c);
}
if (winner(v, k, n) == 1)
cout << "First\n";
else
cout << "Second\n";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int winner(vector<int> v, int k, int n) {
int *dp = new int[k + 1];
for (int i = 0; i < k + 1; i++)
dp[i] = 0;
for (int i = 1; i <= k; i++) {
for (auto x : v) {
if (i >= x && dp[i - x] == 0) {
dp[i] = 1;
break;
}
}
}
return dp[k];
}
int main() {
// your code goes here
int n, k;
cin >> n >> k;
vector<int> v;
for (int i = 0; i < n; i++) {
int c;
cin >> c;
v.push_back(c);
}
if (winner(v, k, n) == 1)
cout << "First\n";
else
cout << "Second\n";
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 978,347 | 978,348 | u814458681 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
int a[n];
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
int p[k + 1];
for (int i = 0; i < k + 1; i++)
p[i] = -1;
int t = 0;
for (int i = 0; i < k + 1 && t < 1; i++) {
for (int j = 0; j < n && t < 1; j++) {
if (i + a[j] <= k)
if (p[i + a[j]] != 1)
p[i + a[j]] = -1 * p[i];
if (p[k] == 1)
t++;
}
}
if (p[k] == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
int a[n];
scanf("%d%d", &n, &k);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
int p[k + 1];
for (int i = 0; i < k + 1; i++)
p[i] = -1;
int t = 0;
for (int i = 0; i < k + 1 && t < 1; i++) {
for (int j = 0; j < n && t < 1; j++) {
if (i + a[j] <= k)
if (p[i + a[j]] != 1)
p[i + a[j]] = -1 * p[i];
if (p[k] == 1)
t++;
}
}
if (p[k] == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 978,349 | 978,350 | u387025271 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int &x : a) {
cin >> x;
}
int dp[k + 1];
dp[0] = 0;
for (int i = 1; i <= k; i++) {
dp[i] = 0;
for (int x : a) {
if (i >= x && dp[i - x] == 0) {
dp[i] = 1;
break;
}
}
}
if (dp[k] == 1)
cout << "First" << endl;
else
cout << "second" << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int &x : a) {
cin >> x;
}
int dp[k + 1];
dp[0] = 0;
for (int i = 1; i <= k; i++) {
dp[i] = 0;
for (int x : a) {
if (i >= x && dp[i - x] == 0) {
dp[i] = 1;
break;
}
}
}
if (dp[k] == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,355 | 978,356 | u777959702 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int A[110];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
bool dp[101000];
for (int i = 1; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (i - A[j] >= 0)
dp[i] |= !(dp[i - A[j]]);
}
}
if (dp[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int A[110];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
bool dp[101000] = {};
for (int i = 1; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (i - A[j] >= 0)
dp[i] |= !(dp[i - A[j]]);
}
}
if (dp[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| [
"variable_declaration.value.change"
] | 978,358 | 978,359 | u469315559 | cpp |
p03170 | #include <bits/stdc++.h>
#include <iomanip>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
bool dp[k + 1];
for (int i = 0; i <= k; ++i) {
dp[i] = false;
}
vector<int> arr(n);
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
for (int i = 0; i <= k; ++i) {
for (int j = 0; j < n; ++j) {
if (arr[j] <= i) {
dp[i] = !(dp[i - arr[j]]);
if (dp[i]) {
break;
}
}
}
}
if (dp[k]) {
cout << "FIRST" << endl;
} else {
cout << "SECOND" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
#include <iomanip>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
bool dp[k + 1];
for (int i = 0; i <= k; ++i) {
dp[i] = false;
}
vector<int> arr(n);
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
for (int i = 1; i <= k; ++i) {
for (int j = 0; j < n; ++j) {
if (arr[j] <= i) {
dp[i] = !(dp[i - arr[j]]);
if (dp[i]) {
break;
}
}
}
}
if (dp[k]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| [
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,370 | 978,371 | u747883255 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vector<bool> dp(k + 1);
for (int stones = 0; stones <= n; stones++) {
for (int x : a) {
if (stones >= x && dp[stones - x] == false)
dp[stones] = true;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vector<bool> dp(k + 1);
for (int stones = 0; stones <= k; stones++) {
for (int x : a) {
if (stones >= x && dp[stones - x] == false)
dp[stones] = true;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 978,376 | 978,377 | u193875150 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define D double
#define lli long long int
#define testcase \
int t; \
cin >> t; \
while (t--)
#define fast_io \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define P pair<int, int>
/*bool isprime(lli n)
{
if(n==1) return 0;
for(lli i=2;i<=n/2;i++)
{
if(n%i==0) return 0;
}
return 1;
}
bool issemiprime(lli n)
{
for(int i=2;i<n;i++)
{
if(isprime(i)&&isprime(n/i)&&n%i==0&&i!=n/i){
return 1;
}
}
return 0;
}
lli extendedgcd(lli q,lli r1,lli r2,lli r,lli s1,lli s2,lli s,lli t1,lli t2,lli
t)
{
if(r2==0) return r1;
r1=r2;
r2=r;
s1=s2;
s2=s;
t1=t2;
t2=t;
q=r1/r2;
r=r1%r2;
s=s1-(s2*q);
t=t1-(t2*q);
return extendedgcd(q,r1,r2,r,s1,s2,s,t1,t2,t);
}
lli gcd(lli a,lli b)
{
if(b==0) return a;
return gcd(b,a%b);
}
void SOE()
{
for(lli i=2;i<=100000;i++)
{
if(sieve[i]) continue;
for(lli x=i;x<=100000;x+=i)
{
sieve[x]+=1;
}
}
}*/
/*bool func(pair<int,int> a,pair<int,int> b)
{
return a.first<b.first;
}
int dfs(vector<vector<int>> g,int n)
{
if(g[n].size()==0) return 0;
if(dp[n]!=-1) return dp[n];
for(auto x:g[n])
{
dp[n]=max(dp[n],1+dfs(g,x));
}
return dp[n];
}*/
void solve() {
int n, k;
cin >> n >> k;
bool dp[k + 1];
memset(dp, false, sizeof(dp));
set<int> s;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
s.insert(a);
}
dp[0] = false;
for (int i = 1; i < k + 1; i++) {
for (auto x : s) {
if ((i - x) >= 0 && dp[i - x] == false) {
dp[i] = true;
break;
}
}
}
if (dp[k] == true)
cout << "first";
else
cout << "second";
}
int main() {
fast_io;
solve();
}
| #include <bits/stdc++.h>
using namespace std;
#define D double
#define lli long long int
#define testcase \
int t; \
cin >> t; \
while (t--)
#define fast_io \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define P pair<int, int>
/*bool isprime(lli n)
{
if(n==1) return 0;
for(lli i=2;i<=n/2;i++)
{
if(n%i==0) return 0;
}
return 1;
}
bool issemiprime(lli n)
{
for(int i=2;i<n;i++)
{
if(isprime(i)&&isprime(n/i)&&n%i==0&&i!=n/i){
return 1;
}
}
return 0;
}
lli extendedgcd(lli q,lli r1,lli r2,lli r,lli s1,lli s2,lli s,lli t1,lli t2,lli
t)
{
if(r2==0) return r1;
r1=r2;
r2=r;
s1=s2;
s2=s;
t1=t2;
t2=t;
q=r1/r2;
r=r1%r2;
s=s1-(s2*q);
t=t1-(t2*q);
return extendedgcd(q,r1,r2,r,s1,s2,s,t1,t2,t);
}
lli gcd(lli a,lli b)
{
if(b==0) return a;
return gcd(b,a%b);
}
void SOE()
{
for(lli i=2;i<=100000;i++)
{
if(sieve[i]) continue;
for(lli x=i;x<=100000;x+=i)
{
sieve[x]+=1;
}
}
}*/
/*bool func(pair<int,int> a,pair<int,int> b)
{
return a.first<b.first;
}
int dfs(vector<vector<int>> g,int n)
{
if(g[n].size()==0) return 0;
if(dp[n]!=-1) return dp[n];
for(auto x:g[n])
{
dp[n]=max(dp[n],1+dfs(g,x));
}
return dp[n];
}*/
void solve() {
int n, k;
cin >> n >> k;
bool dp[k + 1];
memset(dp, false, sizeof(dp));
set<int> s;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
s.insert(a);
}
dp[0] = false;
for (int i = 1; i < k + 1; i++) {
for (auto x : s) {
if ((i - x) >= 0 && (dp[i - x] == false)) {
dp[i] = true;
break;
}
}
}
if (dp[k] == true)
cout << "First";
else
cout << "Second";
}
int main() {
fast_io;
solve();
}
| [
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,378 | 978,379 | u391557570 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define D double
#define lli long long int
#define testcase \
int t; \
cin >> t; \
while (t--)
#define fast_io \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define P pair<int, int>
/*bool isprime(lli n)
{
if(n==1) return 0;
for(lli i=2;i<=n/2;i++)
{
if(n%i==0) return 0;
}
return 1;
}
bool issemiprime(lli n)
{
for(int i=2;i<n;i++)
{
if(isprime(i)&&isprime(n/i)&&n%i==0&&i!=n/i){
return 1;
}
}
return 0;
}
lli extendedgcd(lli q,lli r1,lli r2,lli r,lli s1,lli s2,lli s,lli t1,lli t2,lli
t)
{
if(r2==0) return r1;
r1=r2;
r2=r;
s1=s2;
s2=s;
t1=t2;
t2=t;
q=r1/r2;
r=r1%r2;
s=s1-(s2*q);
t=t1-(t2*q);
return extendedgcd(q,r1,r2,r,s1,s2,s,t1,t2,t);
}
lli gcd(lli a,lli b)
{
if(b==0) return a;
return gcd(b,a%b);
}
void SOE()
{
for(lli i=2;i<=100000;i++)
{
if(sieve[i]) continue;
for(lli x=i;x<=100000;x+=i)
{
sieve[x]+=1;
}
}
}*/
/*bool func(pair<int,int> a,pair<int,int> b)
{
return a.first<b.first;
}
int dfs(vector<vector<int>> g,int n)
{
if(g[n].size()==0) return 0;
if(dp[n]!=-1) return dp[n];
for(auto x:g[n])
{
dp[n]=max(dp[n],1+dfs(g,x));
}
return dp[n];
}*/
void solve() {
int n, k;
cin >> n >> k;
bool dp[k + 1];
memset(dp, false, sizeof(dp));
set<int> s;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
s.insert(a);
}
dp[0] = false;
for (int i = 1; i < k + 1; i++) {
for (auto x : s) {
if ((i - x) < 0) {
break;
}
if ((dp[i - x] == false)) {
dp[i] = true;
break;
}
}
}
if (dp[k] == true)
cout << "first";
else
cout << "second";
}
int main() {
fast_io;
solve();
}
| #include <bits/stdc++.h>
using namespace std;
#define D double
#define lli long long int
#define testcase \
int t; \
cin >> t; \
while (t--)
#define fast_io \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pb push_back
#define P pair<int, int>
/*bool isprime(lli n)
{
if(n==1) return 0;
for(lli i=2;i<=n/2;i++)
{
if(n%i==0) return 0;
}
return 1;
}
bool issemiprime(lli n)
{
for(int i=2;i<n;i++)
{
if(isprime(i)&&isprime(n/i)&&n%i==0&&i!=n/i){
return 1;
}
}
return 0;
}
lli extendedgcd(lli q,lli r1,lli r2,lli r,lli s1,lli s2,lli s,lli t1,lli t2,lli
t)
{
if(r2==0) return r1;
r1=r2;
r2=r;
s1=s2;
s2=s;
t1=t2;
t2=t;
q=r1/r2;
r=r1%r2;
s=s1-(s2*q);
t=t1-(t2*q);
return extendedgcd(q,r1,r2,r,s1,s2,s,t1,t2,t);
}
lli gcd(lli a,lli b)
{
if(b==0) return a;
return gcd(b,a%b);
}
void SOE()
{
for(lli i=2;i<=100000;i++)
{
if(sieve[i]) continue;
for(lli x=i;x<=100000;x+=i)
{
sieve[x]+=1;
}
}
}*/
/*bool func(pair<int,int> a,pair<int,int> b)
{
return a.first<b.first;
}
int dfs(vector<vector<int>> g,int n)
{
if(g[n].size()==0) return 0;
if(dp[n]!=-1) return dp[n];
for(auto x:g[n])
{
dp[n]=max(dp[n],1+dfs(g,x));
}
return dp[n];
}*/
void solve() {
int n, k;
cin >> n >> k;
bool dp[k + 1];
memset(dp, false, sizeof(dp));
set<int> s;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
s.insert(a);
}
dp[0] = false;
for (int i = 1; i < k + 1; i++) {
for (auto x : s) {
if ((i - x) < 0) {
break;
}
if ((dp[i - x] == false)) {
dp[i] = true;
break;
}
}
}
if (dp[k] == true)
cout << "First";
else
cout << "Second";
}
int main() {
fast_io;
solve();
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,381 | 978,382 | u391557570 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
void solve() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int dp[k + 1];
dp[0] = 0;
for (int i = 1; i <= k; i++) {
dp[i] = 0;
for (int j = 0; j < n; j++) {
if (i - a[j] >= 0) {
dp[i] = max(dp[i], 1 - dp[i - a[j]]);
}
}
}
(dp[k] == 1) ? cout << "first" : cout << "second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
t = 1;
while (t--) {
solve();
cout << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
void solve() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int dp[k + 1];
dp[0] = 0;
for (int i = 1; i <= k; i++) {
dp[i] = 0;
for (int j = 0; j < n; j++) {
if (i - a[j] >= 0) {
dp[i] = max(dp[i], 1 - dp[i - a[j]]);
}
}
}
(dp[k] == 1) ? cout << "First" : cout << "Second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
t = 1;
while (t--) {
solve();
cout << endl;
}
}
| [
"literal.string.change",
"literal.string.case.change",
"expression.operation.binary.change"
] | 978,389 | 978,390 | u180171323 | cpp |
p03170 |
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define mod 1000000007
#define N 500043
#define mp(a, b) make_pair(a, b)
#define loop(a, b) for (int i = a; i < b; i++)
#define test \
int t; \
cin >> t; \
while (t--)
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n;
vector<int> vec(n);
loop(0, n) cin >> vec[i];
vector<bool> dp(k + 1, false);
for (int i = 1; i <= k; i++) {
if (dp[i] == true)
continue;
bool ans = false;
for (int j = 0; j < n; j++) {
if (i - vec[j] >= 0) {
if (dp[i - vec[j]] == false) {
ans = true;
}
}
}
if (ans)
dp[i] = true;
}
if (dp[k])
cout << "First";
else
cout << "Second";
} |
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define mod 1000000007
#define N 500043
#define mp(a, b) make_pair(a, b)
#define loop(a, b) for (int i = a; i < b; i++)
#define test \
int t; \
cin >> t; \
while (t--)
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
vector<int> vec(n);
loop(0, n) cin >> vec[i];
vector<bool> dp(k + 1, false);
for (int i = 1; i <= k; i++) {
if (dp[i] == true)
continue;
bool ans = false;
for (int j = 0; j < n; j++) {
if (i - vec[j] >= 0) {
if (dp[i - vec[j]] == false) {
ans = true;
}
}
}
if (ans)
dp[i] = true;
}
if (dp[k])
cout << "First";
else
cout << "Second";
} | [
"expression.operation.binary.add"
] | 978,391 | 978,392 | u044430581 | cpp |
p03170 | // SHIVANSH BHAT
// IIT ROORKEE
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
ll mod1 = pow(10, 9) + 7;
int mod2 = 998244353;
ll inf = 1e9;
ll maxxy = 1e6 + 9;
typedef long double ld;
const double PI = 3.141592653589793238;
// NUMBER THEORY
//(a-b)%c=((a%c)-((b%c))+c)%c;
// to find gcd use function __gcd(x,y);
// Seive of erathonesis(finding prime numbers till n)
/*
*
*
************************************************************************
vector<bool> isPrime(n+1,true);
isPrime[0] = false;
isPrime[1] = false;
for(int i = 2; i * i <= N; ++i) {
if(isPrime[i] == true) {
for(int j = i * i; j <= N ;j += i)
isPrime[j] = false;
}
}
*************************************************************************
*/
// Prime Factorisation of numbers of large orders like 1e9,1e12 in O(sqrt(N))
/*
*
**********************************************************************
vector<ll> res;
for (int i = 2; i * i <= n; ++i) {
while (n % i == 0) {
res.push_back(i);
n /= i;
}
}
if (n != 1) {
res.push_back(n);
}
***********************************************************************
*/
// Prime Factors of numbers of order 1e5,1e6 in O(logn) using seive
/*
*
***********************************************************************
//max_value is upper limit of elements we have to factorise
vector<ll> minPrime(max_value + 1,0);
for (int i = 2; i * i <= max_value; ++i) {
if (minPrime[i] == 0) { //If i is prime
for (int j = i * i; j <= max_value; j += i) {
if (minPrime[j] == 0) {
minPrime[j] = i;
}
}
}
}
for (int i = 2; i <= max_value; ++i) {
if (minPrime[i] == 0) {
minPrime[i] = i;
}
}
//factorising array of elements in log(n)
for(int i=0;i<n;i++){
vector<ll> res;
while (a[i] != 1) {
res.push_back(minPrime[a[i]]);
a[i] /= minPrime[a[i]];
}
}
****************************************************************
*/
// to get sum of b consecutive non negative integers starting from a
ull sumcons(ull a, ull b) {
if (a == 0) {
return (b * (b - 1)) / 2;
} else {
ull zzz = (b * (b + 1)) / 2;
zzz += ((a - 1) * b);
return zzz;
}
}
ll power(ll x, ll y, ll pp) {
ll res = 1;
x = x % pp;
while (y > 0) {
if (y & 1)
res = (res * x) % pp;
y = y >> 1;
x = (x * x) % pp;
}
return res;
}
ll modInverse(ll n, ll pp) { return power(n, pp - 2, pp); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll k;
cin >> k;
vector<ll> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
// we have k total stones , both player can pull any amount of stones at one
// chace present in an array dp[i]-> True if the player who moves then wins
// when there are i stones remaining
vector<bool> dp(k + 1);
for (int stones = 0; stones <= k; ++stones) {
for (auto x : a) {
if (stones >= x && !dp[stones - x]) {
dp[stones] = true;
}
}
}
if (dp[k])
cout << "FIRST"
<< "\n";
else
cout << "SECOND"
<< "\n";
return 0;
}
| // SHIVANSH BHAT
// IIT ROORKEE
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
ll mod1 = pow(10, 9) + 7;
int mod2 = 998244353;
ll inf = 1e9;
ll maxxy = 1e6 + 9;
typedef long double ld;
const double PI = 3.141592653589793238;
// NUMBER THEORY
//(a-b)%c=((a%c)-((b%c))+c)%c;
// to find gcd use function __gcd(x,y);
// Seive of erathonesis(finding prime numbers till n)
/*
*
*
************************************************************************
vector<bool> isPrime(n+1,true);
isPrime[0] = false;
isPrime[1] = false;
for(int i = 2; i * i <= N; ++i) {
if(isPrime[i] == true) {
for(int j = i * i; j <= N ;j += i)
isPrime[j] = false;
}
}
*************************************************************************
*/
// Prime Factorisation of numbers of large orders like 1e9,1e12 in O(sqrt(N))
/*
*
**********************************************************************
vector<ll> res;
for (int i = 2; i * i <= n; ++i) {
while (n % i == 0) {
res.push_back(i);
n /= i;
}
}
if (n != 1) {
res.push_back(n);
}
***********************************************************************
*/
// Prime Factors of numbers of order 1e5,1e6 in O(logn) using seive
/*
*
***********************************************************************
//max_value is upper limit of elements we have to factorise
vector<ll> minPrime(max_value + 1,0);
for (int i = 2; i * i <= max_value; ++i) {
if (minPrime[i] == 0) { //If i is prime
for (int j = i * i; j <= max_value; j += i) {
if (minPrime[j] == 0) {
minPrime[j] = i;
}
}
}
}
for (int i = 2; i <= max_value; ++i) {
if (minPrime[i] == 0) {
minPrime[i] = i;
}
}
//factorising array of elements in log(n)
for(int i=0;i<n;i++){
vector<ll> res;
while (a[i] != 1) {
res.push_back(minPrime[a[i]]);
a[i] /= minPrime[a[i]];
}
}
****************************************************************
*/
// to get sum of b consecutive non negative integers starting from a
ull sumcons(ull a, ull b) {
if (a == 0) {
return (b * (b - 1)) / 2;
} else {
ull zzz = (b * (b + 1)) / 2;
zzz += ((a - 1) * b);
return zzz;
}
}
ll power(ll x, ll y, ll pp) {
ll res = 1;
x = x % pp;
while (y > 0) {
if (y & 1)
res = (res * x) % pp;
y = y >> 1;
x = (x * x) % pp;
}
return res;
}
ll modInverse(ll n, ll pp) { return power(n, pp - 2, pp); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll k;
cin >> k;
vector<ll> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
// we have k total stones , both player can pull any amount of stones at one
// chace present in an array dp[i]-> True if the player who moves then wins
// when there are i stones remaining
vector<bool> dp(k + 1);
for (int stones = 0; stones <= k; ++stones) {
for (auto x : a) {
if (stones >= x && !dp[stones - x]) {
dp[stones] = true;
}
}
}
if (dp[k])
cout << "First"
<< "\n";
else
cout << "Second"
<< "\n";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,393 | 978,394 | u741487428 | cpp |
p03170 | // SHIVANSH BHAT
// IIT ROORKEE
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
ll mod1 = pow(10, 9) + 7;
int mod2 = 998244353;
ll inf = 1e9;
ll maxxy = 1e6 + 9;
typedef long double ld;
const double PI = 3.141592653589793238;
// NUMBER THEORY
//(a-b)%c=((a%c)-((b%c))+c)%c;
// to find gcd use function __gcd(x,y);
// Seive of erathonesis(finding prime numbers till n)
/*
*
*
************************************************************************
vector<bool> isPrime(n+1,true);
isPrime[0] = false;
isPrime[1] = false;
for(int i = 2; i * i <= N; ++i) {
if(isPrime[i] == true) {
for(int j = i * i; j <= N ;j += i)
isPrime[j] = false;
}
}
*************************************************************************
*/
// Prime Factorisation of numbers of large orders like 1e9,1e12 in O(sqrt(N))
/*
*
**********************************************************************
vector<ll> res;
for (int i = 2; i * i <= n; ++i) {
while (n % i == 0) {
res.push_back(i);
n /= i;
}
}
if (n != 1) {
res.push_back(n);
}
***********************************************************************
*/
// Prime Factors of numbers of order 1e5,1e6 in O(logn) using seive
/*
*
***********************************************************************
//max_value is upper limit of elements we have to factorise
vector<ll> minPrime(max_value + 1,0);
for (int i = 2; i * i <= max_value; ++i) {
if (minPrime[i] == 0) { //If i is prime
for (int j = i * i; j <= max_value; j += i) {
if (minPrime[j] == 0) {
minPrime[j] = i;
}
}
}
}
for (int i = 2; i <= max_value; ++i) {
if (minPrime[i] == 0) {
minPrime[i] = i;
}
}
//factorising array of elements in log(n)
for(int i=0;i<n;i++){
vector<ll> res;
while (a[i] != 1) {
res.push_back(minPrime[a[i]]);
a[i] /= minPrime[a[i]];
}
}
****************************************************************
*/
// to get sum of b consecutive non negative integers starting from a
ull sumcons(ull a, ull b) {
if (a == 0) {
return (b * (b - 1)) / 2;
} else {
ull zzz = (b * (b + 1)) / 2;
zzz += ((a - 1) * b);
return zzz;
}
}
ll power(ll x, ll y, ll pp) {
ll res = 1;
x = x % pp;
while (y > 0) {
if (y & 1)
res = (res * x) % pp;
y = y >> 1;
x = (x * x) % pp;
}
return res;
}
ll modInverse(ll n, ll pp) { return power(n, pp - 2, pp); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll k;
cin >> k;
vector<ll> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
// we have k total stones , both player can pull any amount of stones at one
// chace present in an array dp[i]-> True if the player who moves then wins
// when there are i stones remaining
vector<bool> dp(k + 1, false);
for (int stones = 0; stones <= k; ++stones) {
for (auto x : a) {
if (stones >= x && !dp[stones - x]) {
dp[stones] = true;
}
}
}
if (dp[k])
cout << "FIRST"
<< "\n";
else
cout << "SECOND"
<< "\n";
return 0;
}
| // SHIVANSH BHAT
// IIT ROORKEE
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
ll mod1 = pow(10, 9) + 7;
int mod2 = 998244353;
ll inf = 1e9;
ll maxxy = 1e6 + 9;
typedef long double ld;
const double PI = 3.141592653589793238;
// NUMBER THEORY
//(a-b)%c=((a%c)-((b%c))+c)%c;
// to find gcd use function __gcd(x,y);
// Seive of erathonesis(finding prime numbers till n)
/*
*
*
************************************************************************
vector<bool> isPrime(n+1,true);
isPrime[0] = false;
isPrime[1] = false;
for(int i = 2; i * i <= N; ++i) {
if(isPrime[i] == true) {
for(int j = i * i; j <= N ;j += i)
isPrime[j] = false;
}
}
*************************************************************************
*/
// Prime Factorisation of numbers of large orders like 1e9,1e12 in O(sqrt(N))
/*
*
**********************************************************************
vector<ll> res;
for (int i = 2; i * i <= n; ++i) {
while (n % i == 0) {
res.push_back(i);
n /= i;
}
}
if (n != 1) {
res.push_back(n);
}
***********************************************************************
*/
// Prime Factors of numbers of order 1e5,1e6 in O(logn) using seive
/*
*
***********************************************************************
//max_value is upper limit of elements we have to factorise
vector<ll> minPrime(max_value + 1,0);
for (int i = 2; i * i <= max_value; ++i) {
if (minPrime[i] == 0) { //If i is prime
for (int j = i * i; j <= max_value; j += i) {
if (minPrime[j] == 0) {
minPrime[j] = i;
}
}
}
}
for (int i = 2; i <= max_value; ++i) {
if (minPrime[i] == 0) {
minPrime[i] = i;
}
}
//factorising array of elements in log(n)
for(int i=0;i<n;i++){
vector<ll> res;
while (a[i] != 1) {
res.push_back(minPrime[a[i]]);
a[i] /= minPrime[a[i]];
}
}
****************************************************************
*/
// to get sum of b consecutive non negative integers starting from a
ull sumcons(ull a, ull b) {
if (a == 0) {
return (b * (b - 1)) / 2;
} else {
ull zzz = (b * (b + 1)) / 2;
zzz += ((a - 1) * b);
return zzz;
}
}
ll power(ll x, ll y, ll pp) {
ll res = 1;
x = x % pp;
while (y > 0) {
if (y & 1)
res = (res * x) % pp;
y = y >> 1;
x = (x * x) % pp;
}
return res;
}
ll modInverse(ll n, ll pp) { return power(n, pp - 2, pp); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll k;
cin >> k;
vector<ll> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
// we have k total stones , both player can pull any amount of stones at one
// chace present in an array dp[i]-> True if the player who moves then wins
// when there are i stones remaining
vector<bool> dp(k + 1);
for (int stones = 0; stones <= k; ++stones) {
for (auto x : a) {
if (stones >= x && !dp[stones - x]) {
dp[stones] = true;
}
}
}
if (dp[k])
cout << "First"
<< "\n";
else
cout << "Second"
<< "\n";
return 0;
}
| [
"call.arguments.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,395 | 978,394 | u741487428 | cpp |
p03170 | // SHIVANSH BHAT
// IIT ROORKEE
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
ll mod1 = pow(10, 9) + 7;
int mod2 = 998244353;
ll inf = 1e9;
ll maxxy = 1e6 + 9;
typedef long double ld;
const double PI = 3.141592653589793238;
// NUMBER THEORY
//(a-b)%c=((a%c)-((b%c))+c)%c;
// to find gcd use function __gcd(x,y);
// Seive of erathonesis(finding prime numbers till n)
/*
*
*
************************************************************************
vector<bool> isPrime(n+1,true);
isPrime[0] = false;
isPrime[1] = false;
for(int i = 2; i * i <= N; ++i) {
if(isPrime[i] == true) {
for(int j = i * i; j <= N ;j += i)
isPrime[j] = false;
}
}
*************************************************************************
*/
// Prime Factorisation of numbers of large orders like 1e9,1e12 in O(sqrt(N))
/*
*
**********************************************************************
vector<ll> res;
for (int i = 2; i * i <= n; ++i) {
while (n % i == 0) {
res.push_back(i);
n /= i;
}
}
if (n != 1) {
res.push_back(n);
}
***********************************************************************
*/
// Prime Factors of numbers of order 1e5,1e6 in O(logn) using seive
/*
*
***********************************************************************
//max_value is upper limit of elements we have to factorise
vector<ll> minPrime(max_value + 1,0);
for (int i = 2; i * i <= max_value; ++i) {
if (minPrime[i] == 0) { //If i is prime
for (int j = i * i; j <= max_value; j += i) {
if (minPrime[j] == 0) {
minPrime[j] = i;
}
}
}
}
for (int i = 2; i <= max_value; ++i) {
if (minPrime[i] == 0) {
minPrime[i] = i;
}
}
//factorising array of elements in log(n)
for(int i=0;i<n;i++){
vector<ll> res;
while (a[i] != 1) {
res.push_back(minPrime[a[i]]);
a[i] /= minPrime[a[i]];
}
}
****************************************************************
*/
// to get sum of b consecutive non negative integers starting from a
ull sumcons(ull a, ull b) {
if (a == 0) {
return (b * (b - 1)) / 2;
} else {
ull zzz = (b * (b + 1)) / 2;
zzz += ((a - 1) * b);
return zzz;
}
}
ll power(ll x, ll y, ll pp) {
ll res = 1;
x = x % pp;
while (y > 0) {
if (y & 1)
res = (res * x) % pp;
y = y >> 1;
x = (x * x) % pp;
}
return res;
}
ll modInverse(ll n, ll pp) { return power(n, pp - 2, pp); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll k;
cin >> k;
vector<ll> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
// we have k total stones , both player can pull any amount of stones at one
// chace present in an array dp[i]-> True if the player who moves then wins
// when there are i stones remaining
vector<bool> dp(k + 1, false);
for (int stones = 0; stones <= k; ++stones) {
for (auto x : a) {
if (stones >= x && !dp[stones - x]) {
dp[stones] = true;
}
}
}
if (dp[k])
cout << "YES"
<< "\n";
else
cout << "NO"
<< "\n";
return 0;
}
| // SHIVANSH BHAT
// IIT ROORKEE
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
ll mod1 = pow(10, 9) + 7;
int mod2 = 998244353;
ll inf = 1e9;
ll maxxy = 1e6 + 9;
typedef long double ld;
const double PI = 3.141592653589793238;
// NUMBER THEORY
//(a-b)%c=((a%c)-((b%c))+c)%c;
// to find gcd use function __gcd(x,y);
// Seive of erathonesis(finding prime numbers till n)
/*
*
*
************************************************************************
vector<bool> isPrime(n+1,true);
isPrime[0] = false;
isPrime[1] = false;
for(int i = 2; i * i <= N; ++i) {
if(isPrime[i] == true) {
for(int j = i * i; j <= N ;j += i)
isPrime[j] = false;
}
}
*************************************************************************
*/
// Prime Factorisation of numbers of large orders like 1e9,1e12 in O(sqrt(N))
/*
*
**********************************************************************
vector<ll> res;
for (int i = 2; i * i <= n; ++i) {
while (n % i == 0) {
res.push_back(i);
n /= i;
}
}
if (n != 1) {
res.push_back(n);
}
***********************************************************************
*/
// Prime Factors of numbers of order 1e5,1e6 in O(logn) using seive
/*
*
***********************************************************************
//max_value is upper limit of elements we have to factorise
vector<ll> minPrime(max_value + 1,0);
for (int i = 2; i * i <= max_value; ++i) {
if (minPrime[i] == 0) { //If i is prime
for (int j = i * i; j <= max_value; j += i) {
if (minPrime[j] == 0) {
minPrime[j] = i;
}
}
}
}
for (int i = 2; i <= max_value; ++i) {
if (minPrime[i] == 0) {
minPrime[i] = i;
}
}
//factorising array of elements in log(n)
for(int i=0;i<n;i++){
vector<ll> res;
while (a[i] != 1) {
res.push_back(minPrime[a[i]]);
a[i] /= minPrime[a[i]];
}
}
****************************************************************
*/
// to get sum of b consecutive non negative integers starting from a
ull sumcons(ull a, ull b) {
if (a == 0) {
return (b * (b - 1)) / 2;
} else {
ull zzz = (b * (b + 1)) / 2;
zzz += ((a - 1) * b);
return zzz;
}
}
ll power(ll x, ll y, ll pp) {
ll res = 1;
x = x % pp;
while (y > 0) {
if (y & 1)
res = (res * x) % pp;
y = y >> 1;
x = (x * x) % pp;
}
return res;
}
ll modInverse(ll n, ll pp) { return power(n, pp - 2, pp); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll k;
cin >> k;
vector<ll> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
// we have k total stones , both player can pull any amount of stones at one
// chace present in an array dp[i]-> True if the player who moves then wins
// when there are i stones remaining
vector<bool> dp(k + 1);
for (int stones = 0; stones <= k; ++stones) {
for (auto x : a) {
if (stones >= x && !dp[stones - x]) {
dp[stones] = true;
}
}
}
if (dp[k])
cout << "First"
<< "\n";
else
cout << "Second"
<< "\n";
return 0;
}
| [
"call.arguments.change",
"literal.string.change",
"io.output.change"
] | 978,396 | 978,394 | u741487428 | cpp |
p03170 | #include <iostream>
const int MAX_N = 305;
bool dp
[10000025]
[2]; // dp[i][j]代表还剩i个石头,当前为k进行操作时会输还是会赢,0代表第一个人first,1代表第二个人second
int arr[MAX_N], n;
bool dfs(int k, int t) {
//初始条件为dp[0][0]=0,dp[0][1]=0
if (dp[k][t] > 0)
return dp[k][t];
bool ans = 0;
for (int i = 1; i <= n; ++i) //遍历n个可以移除石子的数量
if (k >= arr[i]) //只要当前剩余石子数量大于可以移除石子的数量
ans = !dfs(
k - arr[i],
!t); //若上一状态对手赢(1),则当前状态自己输(0),上一状态对手输(0)则当前状态自己赢(1)
return dp[k][t] = ans;
}
int main() {
int k;
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; ++i)
scanf("%d", &arr[i]);
if (dfs(k, 0) == false)
printf("Second\n");
else
printf("First\n");
return 0;
} | #include <iostream>
const int MAX_N = 305;
bool dp
[10000025]
[2]; // dp[i][j]代表还剩i个石头,当前为k进行操作时会输还是会赢,0代表第一个人first,1代表第二个人second
int arr[MAX_N], n;
bool dfs(int k, int t) {
//初始条件为dp[0][0]=0,dp[0][1]=0
if (dp[k][t] > 0)
return dp[k][t];
bool ans = 0;
for (int i = 1; i <= n; ++i) //遍历n个可以移除石子的数量
if (k >= arr[i]) //只要当前剩余石子数量大于可以移除石子的数量
ans |= !dfs(
k - arr[i],
!t); //若上一状态对手赢(1),则当前状态自己输(0),上一状态对手输(0)则当前状态自己赢(1)
//这里用或运算,因为只要有能赢的情况就会选择能赢的情况
return dp[k][t] = ans;
}
int main() {
int k;
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; ++i)
scanf("%d", &arr[i]);
if (dfs(k, 0) == false)
printf("Second\n");
else
printf("First\n");
return 0;
} | [
"assignment.value.change"
] | 978,399 | 978,400 | u353919145 | cpp |
p03170 | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define MAX 100000
int main() {
int n, k;
cin >> n >> k;
vector<int> dp(MAX, 0);
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
dp[arr[i]] = 1;
}
for (int i = 0; i <= k; i++) {
if (!dp[i]) {
for (int j = 0; j < n; j++) {
if (i - arr[j] >= 0)
dp[i] = dp[i] || !dp[i - arr[j]];
}
}
}
if (dp[k])
cout << "first" << endl;
else
cout << "second" << endl;
return 0;
} | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define MAX 100000
int main() {
int n, k;
cin >> n >> k;
vector<int> dp(MAX, 0);
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
dp[arr[i]] = 1;
}
for (int i = 0; i <= k; i++) {
if (!dp[i]) {
for (int j = 0; j < n; j++) {
if (i - arr[j] >= 0)
dp[i] = dp[i] || !dp[i - arr[j]];
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,401 | 978,402 | u314936326 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N);
rep(i, N) cin >> A[i];
vector<bool> dp(K + 10, false); // dp[i]=falseとは石がi個あると必ず負ける
// bool dp[110000];
rep1(i, K) {
rep(j, N) {
// if(i>=A[j]) dp[i] |= !dp[i-A[j]];
if (i >= A[j])
dp[i] = dp[i] || (!dp[i - A[j]]);
}
}
if (dp[K])
cout << "First" << endl;
else
cout << "Second" << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N);
rep(i, N) cin >> A[i];
vector<bool> dp(K + 10, false); // dp[i]=falseとは石がi個あると必ず負ける
// bool dp[110000];
rep1(i, K) {
rep(j, N) {
// if(i>=A[j]) dp[i] |= !dp[i-A[j]];
if (i >= A[j])
dp[i] = dp[i] || (!dp[i - A[j]]);
}
// cout<<dp[i]<<i<<endl;
}
// cout<<dp[K]<<endl;
if (dp[K])
cout << "First" << endl;
else
cout << "Second" << endl;
}
| [
"expression.operator.compare.change",
"preprocessor.define.value.change"
] | 978,406 | 978,407 | u779216084 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int dp[k + 1] = {};
for (int stones = 0; stones <= k; stones++) {
for (int wt : arr) {
if (stones >= wt and !dp[stones - wt]) {
dp[stones] = 1;
}
}
}
cout << (!dp[k] ? "First" : "Second") << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int dp[k + 1] = {};
for (int stones = 0; stones <= k; stones++) {
for (int wt : arr) {
if (stones >= wt and !dp[stones - wt]) {
dp[stones] = 1;
}
}
}
cout << (dp[k] ? "First" : "Second") << endl;
return 0;
} | [
"expression.operation.unary.logical.remove"
] | 978,410 | 978,411 | u396785540 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int n, k;
int a[101];
bool dp[101];
bool b() {
dp[0] = 0;
int i = 1;
while (i <= k) {
bool gh = false;
int index = 0;
while (index < n && (i - a[index]) >= 0) {
if (dp[i - a[index]] == 0) {
gh = true;
break;
}
index++;
}
dp[i] = gh;
i++;
}
return dp[k];
}
int32_t main() {
cin >> n >> k;
memset(dp, 1, sizeof dp);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
sort(a, a + n);
if (!b()) {
cout << "Second";
} else {
cout << "First";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int n, k;
int a[101];
bool dp[100001];
bool b() {
dp[0] = 0;
int i = 1;
while (i <= k) {
bool gh = false;
int index = 0;
while (index < n && (i - a[index]) >= 0) {
if (dp[i - a[index]] == 0) {
gh = true;
break;
}
index++;
}
dp[i] = gh;
i++;
}
return dp[k];
}
int32_t main() {
cin >> n >> k;
memset(dp, 1, sizeof dp);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
sort(a, a + n);
if (!b()) {
cout << "Second";
} else {
cout << "First";
}
return 0;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,412 | 978,413 | u103697897 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define MOD 1000000007
void solve() {
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int dp[k];
memset(dp, 0, sizeof(dp));
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= arr[j] and dp[i - arr[j]] == 0) {
dp[i] = 1;
break;
}
}
}
cout << (dp[k] == 1 ? "First" : "Second");
}
int main() {
int t;
t = 1;
while (t--) {
solve();
}
}
| #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define MOD 1000000007
void solve() {
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= arr[j] and dp[i - arr[j]] == 0) {
dp[i] = 1;
break;
}
}
}
cout << (dp[k] == 1 ? "First" : "Second");
}
int main() {
int t;
t = 1;
while (t--) {
solve();
}
}
| [
"variable_declaration.array_dimensions.change",
"expression.operation.binary.add"
] | 978,416 | 978,417 | u244121551 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int dp[100005];
int n;
int a[105];
int cal(int k) {
if (dp[k] != -1)
return dp[k];
for (int i = 0; i < n; i++) {
if (a[i] <= k) {
if (cal(k - a[i]) == 2)
dp[k] = 1;
return dp[k];
}
}
dp[k] = 2;
return dp[k];
}
void solve() {
int k;
cin >> n >> k;
memset(dp, -1, sizeof(dp));
for (int i = 0; i < n; i++) {
cin >> a[i];
}
dp[0] = 2;
dp[k] = cal(k);
if (dp[k] == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
}
int main() { solve(); }
| #include <bits/stdc++.h>
#define ll long long
using namespace std;
int dp[100005];
int n;
int a[100005];
int cal(int k) {
if (dp[k] != -1)
return dp[k];
for (int i = 0; i < n; i++) {
if (a[i] <= k) {
if (cal(k - a[i]) == 2) {
dp[k] = 1;
return dp[k];
}
}
}
dp[k] = 2;
return dp[k];
}
void solve() {
int k;
cin >> n >> k;
memset(dp, -1, sizeof(dp));
for (int i = 0; i < n; i++) {
cin >> a[i];
}
dp[0] = 2;
dp[k] = cal(k);
if (dp[k] == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
}
int main() { solve(); }
| [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,418 | 978,419 | u500482384 | cpp |
p03170 | // Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define xx first
#define yy second
#define sci(n) scanf("%d", &n)
#define scii(n, m) scanf("%d%d", &n, &m)
#define sciii(n, m, w) scanf("%d%d%d", &n, &m, &w)
#define scl(n) scanf("%lld", &n)
#define scll(n, m) scanf("%lld%lld", &n, &m)
#define sclll(n, m, w) scanf("%lld%lld%lld", &n, &m, &w)
#define pf(a) printf("%d\n", a)
#define CASE(a) printf("Case %d: ", a)
#define dbg(i) printf("yo %d\n", i)
#define endl '\n'
#define READ freopen("input.txt", "r", stdin)
#define WRITE freopen("output.txt", "w", stdout);
#define pi acos(-1)
#define mem(a, b) memset(a, b, sizeof(a))
#define SQR(a) (a) * (a)
#define all(v) v.begin(), v.end()
#define pb push_back
#define pri priority_queue<int>
#define rev_pri priority_queue<int, vector<int>, greater<int>>
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define mod 1000000007
#define inf INT_MAX
#define eps 1e-9
using namespace __gnu_pbds;
using namespace std;
// int dx[] = {0,1,0,-1,1,1,-1,-1};
// int dy[] = {1,0,-1,0,1,-1,-1,1};
// ll ncr(ll n,ll r){if(n==r)return 1;if(r==1)return n;if(dp[n][r]!=-1)return
// dp[n][r];return dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);}
// bit manipulations
// bool checkbit(int mask,int bit){return mask & (1<<bit);}
// int setbit(int mask,int bit){ return mask | (1<<bit) ; }
// int clearbit(int mask,int bit){return mask & ~(1<<bit);}
// int togglebit(int mask,int bit){return mask ^ (1<<bit);}
// int bitno(int mask) {return (int)__builtin_popcount(mask);}
template <typename T> T BigMod(T b, T p, T m) {
if (p == 0)
return 1;
if (p % 2 == 0) {
T s = BigMod(b, p / 2, m);
return ((s % m) * (s % m)) % m;
}
return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T> T ModInv(T b, T m) { return BigMod(b, m - 2, m); }
template <typename T> T in() {
char ch;
T n = 0;
bool ng = false;
while (1) {
ch = getchar();
if (ch == '-') {
ng = true;
ch = getchar();
break;
}
if (ch >= '0' && ch <= '9')
break;
}
while (1) {
n = n * 10 + (ch - '0');
ch = getchar();
if (ch < '0' || ch > '9')
break;
}
return (ng ? -n : n);
}
template <typename T> T POW(T B, T P) {
if (P == 0)
return 1;
if (P & 1)
return B * POW(B, P - 1);
else
return SQR(POW(B, P / 2));
}
template <typename T> T Bigmod(T b, T p, T m) {
if (p == 0)
return 1;
else if (!(p & 1))
return SQR(Bigmod(b, p / 2, m)) % m;
else
return ((b % m) * Bigmod(b, p - 1, m)) % m;
}
template <typename T> T Dis(T x1, T y1, T x2, T y2) {
return sqrt(SQR(x1 - x2) + SQR(y1 - y2));
}
template <typename T> T Angle(T x1, T y1, T x2, T y2) {
return atan(double(y1 - y2) / double(x1 - x2));
}
template <typename T> T DIFF(T a, T b) {
T d = a - b;
if (d < 0)
return -d;
else
return d;
}
template <typename T> T ABS(T a) {
if (a < 0)
return -a;
else
return a;
}
template <typename T> T gcd(T a, T b) {
if (a < 0)
return gcd(-a, b);
if (b < 0)
return gcd(a, -b);
return (b == 0) ? a : gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) {
if (a < 0)
return lcm(-a, b);
if (b < 0)
return lcm(a, -b);
return a * (b / gcd(a, b));
}
template <typename T> T euclide(T a, T b, T &x, T &y) {
if (a < 0) {
T d = euclide(-a, b, x, y);
x = -x;
return d;
}
if (b < 0) {
T d = euclide(a, -b, x, y);
y = -y;
return d;
}
if (b == 0) {
x = 1;
y = 0;
return a;
} else {
T d = euclide(b, a % b, x, y);
T t = x;
x = y;
y = t - (a / b) * y;
return d;
}
}
template <typename T> void ia(T a[], int n) {
for (int i = 0; i < n; i++)
cin >> a[i];
}
template <typename T> void pa(T a[], int n) {
for (int i = 0; i < n - 1; i++)
cout << a[i] << " ";
cout << a[n - 1] << endl;
}
template <typename T> ll isLeft(T a, T b, T c) {
return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
///********************************MY CODE STARTS
///HERE********************************///
#define mxn 100005
int n, k;
int arr[mxn];
int mn;
int mx;
int main() {
// IOS;
cin >> n >> k;
mn = 1e9;
mx = -1;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
bool dp[k + 5];
dp[0] = false;
for (int i = 1; i <= k; i++) {
bool ok = false;
dp[i] = false;
for (int j = 0; j < n; j++) {
if (i >= arr[j]) {
ok |= dp[i - arr[j]];
}
}
if (ok == false)
dp[i] = true;
}
if (dp[k] == false) {
cout << "Second" << endl;
} else
cout << "First" << endl;
return 0;
}
| // Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define xx first
#define yy second
#define sci(n) scanf("%d", &n)
#define scii(n, m) scanf("%d%d", &n, &m)
#define sciii(n, m, w) scanf("%d%d%d", &n, &m, &w)
#define scl(n) scanf("%lld", &n)
#define scll(n, m) scanf("%lld%lld", &n, &m)
#define sclll(n, m, w) scanf("%lld%lld%lld", &n, &m, &w)
#define pf(a) printf("%d\n", a)
#define CASE(a) printf("Case %d: ", a)
#define dbg(i) printf("yo %d\n", i)
#define endl '\n'
#define READ freopen("input.txt", "r", stdin)
#define WRITE freopen("output.txt", "w", stdout);
#define pi acos(-1)
#define mem(a, b) memset(a, b, sizeof(a))
#define SQR(a) (a) * (a)
#define all(v) v.begin(), v.end()
#define pb push_back
#define pri priority_queue<int>
#define rev_pri priority_queue<int, vector<int>, greater<int>>
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define mod 1000000007
#define inf INT_MAX
#define eps 1e-9
using namespace __gnu_pbds;
using namespace std;
// int dx[] = {0,1,0,-1,1,1,-1,-1};
// int dy[] = {1,0,-1,0,1,-1,-1,1};
// ll ncr(ll n,ll r){if(n==r)return 1;if(r==1)return n;if(dp[n][r]!=-1)return
// dp[n][r];return dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);}
// bit manipulations
// bool checkbit(int mask,int bit){return mask & (1<<bit);}
// int setbit(int mask,int bit){ return mask | (1<<bit) ; }
// int clearbit(int mask,int bit){return mask & ~(1<<bit);}
// int togglebit(int mask,int bit){return mask ^ (1<<bit);}
// int bitno(int mask) {return (int)__builtin_popcount(mask);}
template <typename T> T BigMod(T b, T p, T m) {
if (p == 0)
return 1;
if (p % 2 == 0) {
T s = BigMod(b, p / 2, m);
return ((s % m) * (s % m)) % m;
}
return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T> T ModInv(T b, T m) { return BigMod(b, m - 2, m); }
template <typename T> T in() {
char ch;
T n = 0;
bool ng = false;
while (1) {
ch = getchar();
if (ch == '-') {
ng = true;
ch = getchar();
break;
}
if (ch >= '0' && ch <= '9')
break;
}
while (1) {
n = n * 10 + (ch - '0');
ch = getchar();
if (ch < '0' || ch > '9')
break;
}
return (ng ? -n : n);
}
template <typename T> T POW(T B, T P) {
if (P == 0)
return 1;
if (P & 1)
return B * POW(B, P - 1);
else
return SQR(POW(B, P / 2));
}
template <typename T> T Bigmod(T b, T p, T m) {
if (p == 0)
return 1;
else if (!(p & 1))
return SQR(Bigmod(b, p / 2, m)) % m;
else
return ((b % m) * Bigmod(b, p - 1, m)) % m;
}
template <typename T> T Dis(T x1, T y1, T x2, T y2) {
return sqrt(SQR(x1 - x2) + SQR(y1 - y2));
}
template <typename T> T Angle(T x1, T y1, T x2, T y2) {
return atan(double(y1 - y2) / double(x1 - x2));
}
template <typename T> T DIFF(T a, T b) {
T d = a - b;
if (d < 0)
return -d;
else
return d;
}
template <typename T> T ABS(T a) {
if (a < 0)
return -a;
else
return a;
}
template <typename T> T gcd(T a, T b) {
if (a < 0)
return gcd(-a, b);
if (b < 0)
return gcd(a, -b);
return (b == 0) ? a : gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) {
if (a < 0)
return lcm(-a, b);
if (b < 0)
return lcm(a, -b);
return a * (b / gcd(a, b));
}
template <typename T> T euclide(T a, T b, T &x, T &y) {
if (a < 0) {
T d = euclide(-a, b, x, y);
x = -x;
return d;
}
if (b < 0) {
T d = euclide(a, -b, x, y);
y = -y;
return d;
}
if (b == 0) {
x = 1;
y = 0;
return a;
} else {
T d = euclide(b, a % b, x, y);
T t = x;
x = y;
y = t - (a / b) * y;
return d;
}
}
template <typename T> void ia(T a[], int n) {
for (int i = 0; i < n; i++)
cin >> a[i];
}
template <typename T> void pa(T a[], int n) {
for (int i = 0; i < n - 1; i++)
cout << a[i] << " ";
cout << a[n - 1] << endl;
}
template <typename T> ll isLeft(T a, T b, T c) {
return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
///********************************MY CODE STARTS
///HERE********************************///
#define mxn 100005
int n, k;
int arr[mxn];
int mn;
int mx;
int main() {
// IOS;
cin >> n >> k;
mn = 1e9;
mx = -1;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
bool dp[k + 5];
dp[0] = false;
for (int i = 1; i <= k; i++) {
bool ok = true;
dp[i] = false;
for (int j = 0; j < n; j++) {
if (i >= arr[j]) {
ok &= dp[i - arr[j]];
}
}
if (ok == false)
dp[i] = true;
}
if (dp[k] == false) {
cout << "Second" << endl;
} else
cout << "First" << endl;
return 0;
}
| [
"misc.opposites",
"variable_declaration.value.change",
"expression.operator.change"
] | 978,423 | 978,424 | u880622797 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
const int m = 1e9 + 7;
using ll = long long;
void rec(vector<int> &seg, vector<int> v, int pos, int tl, int tr) {
if (tl == tr) {
seg[pos] = v[tl];
return;
}
int mid = (tl + tr) / 2;
rec(seg, v, 2 * pos + 1, tl, mid);
rec(seg, v, 2 * pos + 2, mid + 1, tr);
seg[pos] = seg[2 * pos + 1] + seg[2 * pos + 2];
// cout<<pos<<" "<<seg[pos]<<endl;
}
int find(vector<int> &seg, int pos, int tl, int tr, int l, int r) {
// cout<<tl<<" "<<tr<<" "<<l<<" "<<r<<endl;
if (l > r) {
return 0;
}
if (l == tl && r == tr) {
return seg[pos];
}
int mid = (tl + tr) / 2;
return find(seg, 2 * pos + 1, tl, mid, l, min(r, mid)) +
find(seg, 2 * pos + 2, mid + 1, tr, max(mid + 1, l), r);
}
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n, 0);
bool dp[k + 1][2];
for (int i = 0; i <= k; i++) {
dp[i][0] = false;
dp[i][1] = false;
}
for (int i = 0; i < n; i++) {
cin >> a[i];
dp[a[i]][0] = true;
dp[a[i]][1] = true;
// cout<<dp[a[i]][1]<<endl;
}
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
dp[i][0] = dp[i][0] || ((i - a[j] >= 0) ? (!(dp[i - a[j]][1])) : false);
dp[i][1] = dp[i][1] || ((i - a[j]) >= 0 ? (!(dp[i - a[j]][0])) : false);
}
// cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<i<<" "<<endl;
}
if (dp[k][0]) {
cout << "first" << endl;
return 0;
}
cout << "second" << endl;
} | #include <bits/stdc++.h>
using namespace std;
const int m = 1e9 + 7;
using ll = long long;
void rec(vector<int> &seg, vector<int> v, int pos, int tl, int tr) {
if (tl == tr) {
seg[pos] = v[tl];
return;
}
int mid = (tl + tr) / 2;
rec(seg, v, 2 * pos + 1, tl, mid);
rec(seg, v, 2 * pos + 2, mid + 1, tr);
seg[pos] = seg[2 * pos + 1] + seg[2 * pos + 2];
// cout<<pos<<" "<<seg[pos]<<endl;
}
int find(vector<int> &seg, int pos, int tl, int tr, int l, int r) {
// cout<<tl<<" "<<tr<<" "<<l<<" "<<r<<endl;
if (l > r) {
return 0;
}
if (l == tl && r == tr) {
return seg[pos];
}
int mid = (tl + tr) / 2;
return find(seg, 2 * pos + 1, tl, mid, l, min(r, mid)) +
find(seg, 2 * pos + 2, mid + 1, tr, max(mid + 1, l), r);
}
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n, 0);
bool dp[k + 1][2];
for (int i = 0; i <= k; i++) {
dp[i][0] = false;
dp[i][1] = false;
}
for (int i = 0; i < n; i++) {
cin >> a[i];
dp[a[i]][0] = true;
dp[a[i]][1] = true;
// cout<<dp[a[i]][1]<<endl;
}
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
dp[i][0] = dp[i][0] || ((i - a[j] >= 0) ? (!(dp[i - a[j]][1])) : false);
dp[i][1] = dp[i][1] || ((i - a[j]) >= 0 ? (!(dp[i - a[j]][0])) : false);
}
// cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<i<<" "<<endl;
}
if (dp[k][0]) {
cout << "First" << endl;
return 0;
}
cout << "Second" << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,425 | 978,426 | u696268811 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define debug(x) cout << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template <typename T> struct V : vector<T> { using vector<T>::vector; };
V()->V<int>;
V(size_t)->V<int>;
template <typename T> V(size_t, T) -> V<T>;
template <typename T> vector<T> make_vec(size_t n, T a) {
return vector<T>(n, a);
}
template <typename... Ts> auto make_vec(size_t n, Ts... ts) {
return vector<decltype(make_vec(ts...))>(n, make_vec(ts...));
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
for (auto &e : v)
os << e << ' ';
return os;
}
struct fast_ios {
fast_ios() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
};
} fast_ios_;
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const ll MOD = 1000000007;
int main() {
int n, k;
cin >> n >> k;
V a(n);
rep(i, n) cin >> a[i];
V dp(k + 1); // 0:必敗 1:必勝
for (int i = 1; i <= k; i++) {
int f = false; // 遷移先に必敗が存在しないならば、必敗
for (auto t : a) {
int ni = i - t;
if (ni < 0)
continue;
if (dp[ni] == 0)
f = 1;
}
dp[i] = f;
}
debug(dp);
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define rep2(i, m, n) for (int i = (m); i < (n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define debug(x) cout << x << endl
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template <typename T> struct V : vector<T> { using vector<T>::vector; };
V()->V<int>;
V(size_t)->V<int>;
template <typename T> V(size_t, T) -> V<T>;
template <typename T> vector<T> make_vec(size_t n, T a) {
return vector<T>(n, a);
}
template <typename... Ts> auto make_vec(size_t n, Ts... ts) {
return vector<decltype(make_vec(ts...))>(n, make_vec(ts...));
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
for (auto &e : v)
os << e << ' ';
return os;
}
struct fast_ios {
fast_ios() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
};
} fast_ios_;
template <typename T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <typename T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const ll MOD = 1000000007;
int main() {
int n, k;
cin >> n >> k;
V a(n);
rep(i, n) cin >> a[i];
V dp(k + 1); // 0:必敗 1:必勝
for (int i = 1; i <= k; i++) {
int f = false; // 遷移先に必敗が存在しないならば、必敗
for (auto t : a) {
int ni = i - t;
if (ni < 0)
continue;
if (dp[ni] == 0)
f = 1;
}
dp[i] = f;
}
// debug(dp);
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | [
"call.remove"
] | 978,427 | 978,428 | u389007679 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i = j; i < k; i += in)
#define RFOR(i, j, k, in) for (int i = j; i >= k; i -= in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
int n, k, min_;
VI nums, dp;
void solve() {
cin >> n >> k;
nums.resize(n);
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
dp.resize(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int num : nums) {
if (i - num < 0)
continue;
if (dp[i - num] == 0) {
dp[i] = 1;
}
}
}
if (dp[k])
cout << "FIRST";
else
cout << "SECOND";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i = j; i < k; i += in)
#define RFOR(i, j, k, in) for (int i = j; i >= k; i -= in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int, int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
int n, k, min_;
VI nums, dp;
void solve() {
cin >> n >> k;
nums.resize(n);
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
dp.resize(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int num : nums) {
if (i - num < 0)
continue;
if (dp[i - num] == 0) {
dp[i] = 1;
}
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,436 | 978,437 | u148047956 | cpp |
p03170 | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
/*#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;*/
using namespace __gnu_pbds;
using namespace std;
#define ff first
#define ss second
#define int long long int
#define pb push_back
#define mp12 make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pq1 priority_queue<int>
#define pqr1 priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x) \
int x; \
cin >> x; \
while (x--)
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
pbds;
void fast() {
// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
void file() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int modInv(int a, int b, int m) {
int res = 1;
a = a % m;
while (b > 0) {
if (b & 1) {
res = (res * a) % m;
}
a = (a * a) % m;
b = b >> 1;
}
return res;
}
int p[1000006];
vi prime;
// int mrp[1000000];
void seive() {
for (int i = 2; i < 1000006; i++) {
if (p[i]) {
prime.pb(i);
for (int j = i * i; j <= 1000006; j = j + i) {
p[j] = 0;
}
}
}
}
// int c;
int dp[300001];
int32_t main() {
// memset(prime,0,sizeof(prime));
// memset(p,1,sizeof(p));
// seive();
// file();
fast();
// int mo=1000000007;
int n;
cin >> n;
int k;
cin >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
memset(dp, 0, sizeof(dp));
dp[0] = 0;
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == 0) {
dp[i] = 1;
break;
}
}
}
}
// for(int i=0;i<k;i++) cout<<dp[i]<<" ";
if (dp[k - 1])
cout << "First";
else
cout << "Second";
return 0;
}
| #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
/*#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;*/
using namespace __gnu_pbds;
using namespace std;
#define ff first
#define ss second
#define int long long int
#define pb push_back
#define mp12 make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pq1 priority_queue<int>
#define pqr1 priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x) \
int x; \
cin >> x; \
while (x--)
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
pbds;
void fast() {
// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
void file() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int modInv(int a, int b, int m) {
int res = 1;
a = a % m;
while (b > 0) {
if (b & 1) {
res = (res * a) % m;
}
a = (a * a) % m;
b = b >> 1;
}
return res;
}
int p[1000006];
vi prime;
// int mrp[1000000];
void seive() {
for (int i = 2; i < 1000006; i++) {
if (p[i]) {
prime.pb(i);
for (int j = i * i; j <= 1000006; j = j + i) {
p[j] = 0;
}
}
}
}
// int c;
int dp[300001];
int32_t main() {
// memset(prime,0,sizeof(prime));
// memset(p,1,sizeof(p));
// seive();
// file();
fast();
// int mo=1000000007;
int n;
cin >> n;
int k;
cin >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
memset(dp, 0, sizeof(dp));
dp[0] = 0;
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == 0) {
dp[i] = 1;
break;
}
}
}
}
// for(int i=0;i<k;i++) cout<<dp[i]<<" ";
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
}
| [
"expression.operation.binary.remove"
] | 978,438 | 978,439 | u263500220 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
// dp[i] : TRUE if first player wins with i stones left
vector<bool> dp(k + 1);
for (int i = 0; i <= k; i++) {
for (int x : a) {
if (i >= x && !dp[i - k])
dp[i] = true;
}
}
cout << (dp[k] ? "First" : "Second") << '\n';
return 0;
} | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
// dp[i] : TRUE if first player wins with i stones left
vector<bool> dp(k + 1);
for (int i = 0; i <= k; i++) {
for (int x : a) {
if (i >= x && !dp[i - x])
dp[i] = true;
}
}
cout << (dp[k] ? "First" : "Second") << '\n';
return 0;
} | [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 978,440 | 978,441 | u940210918 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define mk make_pair
#define prDouble(x) cout << fixed << setprecision(10) << x
typedef long long ll;
const ll mod = 1e9 + 7;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "first" : "second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
int k;
cin >> k;
vector<int> A(n);
for (int i = 0; i < n; i++)
cin >> A[i];
cout << solve(A, k);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define mk make_pair
#define prDouble(x) cout << fixed << setprecision(10) << x
typedef long long ll;
const ll mod = 1e9 + 7;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "First" : "Second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
int k;
cin >> k;
vector<int> A(n);
for (int i = 0; i < n; i++)
cin >> A[i];
cout << solve(A, k);
return 0;
}
/*
dp[0] =0 means losing state
dp[i]=1 if dp[x-ai]=0 for all ai
else
dp[i]=0 lossing state
Since Iam playing first,here I am checking that if I can reach lossing state
from any ith state then I can make second person lose,so i will win dp[i]=1, if
I can't then i am losing dp[i]=0
*/
| [
"literal.string.change",
"literal.string.case.change",
"function.return_value.change"
] | 978,449 | 978,450 | u294187638 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define mk make_pair
#define prDouble(x) cout << fixed << setprecision(10) << x
typedef long long ll;
const ll mod = 1e9 + 7;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "first" : "second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
int k;
cin >> k;
vector<int> A(n);
for (int i = 0; i <= n; i++)
cin >> A[i];
cout << solve(A, k);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define mk make_pair
#define prDouble(x) cout << fixed << setprecision(10) << x
typedef long long ll;
const ll mod = 1e9 + 7;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "First" : "Second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
int k;
cin >> k;
vector<int> A(n);
for (int i = 0; i < n; i++)
cin >> A[i];
cout << solve(A, k);
return 0;
}
/*
dp[0] =0 means losing state
dp[i]=1 if dp[x-ai]=0 for all ai
else
dp[i]=0 lossing state
Since Iam playing first,here I am checking that if I can reach lossing state
from any ith state then I can make second person lose,so i will win dp[i]=1, if
I can't then i am losing dp[i]=0
*/
| [
"literal.string.change",
"literal.string.case.change",
"function.return_value.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 978,451 | 978,450 | u294187638 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define mk make_pair
#define prDouble(x) cout << fixed << setprecision(10) << x
typedef long long ll;
const ll mod = 1e9 + 7;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "first" : "second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
int k;
cin >> k;
vector<int> A(n);
for (int i = 0; i < n; i++)
cin >> A[i];
cout << solve(A, k);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define mk make_pair
#define prDouble(x) cout << fixed << setprecision(10) << x
typedef long long ll;
const ll mod = 1e9 + 7;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "First" : "Second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
int k;
cin >> k;
vector<int> A(n);
for (int i = 0; i < n; i++)
cin >> A[i];
cout << solve(A, k);
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"function.return_value.change"
] | 978,449 | 978,452 | u294187638 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define mk make_pair
#define prDouble(x) cout << fixed << setprecision(10) << x
typedef long long ll;
const ll mod = 1e9 + 7;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "first" : "second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
int k;
cin >> k;
vector<int> A(n);
for (int i = 0; i <= n; i++)
cin >> A[i];
cout << solve(A, k);
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define w(t) \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define mk make_pair
#define prDouble(x) cout << fixed << setprecision(10) << x
typedef long long ll;
const ll mod = 1e9 + 7;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "First" : "Second";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
int k;
cin >> k;
vector<int> A(n);
for (int i = 0; i < n; i++)
cin >> A[i];
cout << solve(A, k);
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"function.return_value.change",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.off_by_one",
"expression.operation.binary.change"
] | 978,451 | 978,452 | u294187638 | cpp |
p03170 | #include <iostream>
#include <string>
#include <vector>
using namespace std;
string getWinner(vector<int> pickOptions, int stones) {
vector<vector<bool>> dp(stones + 1, vector<bool>(2, false));
for (int i = 1; i <= stones; i++) {
for (int stone : pickOptions) {
if (i - stone >= 0) {
if (dp[i - stone][0] == -1) {
dp[i][0] = true;
dp[i][1] = false;
break;
}
}
}
if (dp[i][0] == -1) {
dp[i][1] = true;
}
}
/*
for(vector<int> row:dp) {
for(int val:row) {
cout<<val<<" ";
}
cout<<endl;
}
*/
if (dp[stones][0] != false)
return "First";
else
return "Second";
}
int main() {
int setSize = 0, stones = 0;
cin >> setSize >> stones;
vector<int> pickOptions(setSize, 0);
for (int i = 0; i < setSize; i++)
cin >> pickOptions[i];
cout << getWinner(pickOptions, stones) << endl;
return 0;
} | #include <iostream>
#include <string>
#include <vector>
using namespace std;
string getWinner(vector<int> pickOptions, int stones) {
vector<vector<bool>> dp(stones + 1, vector<bool>(2, false));
for (int i = 1; i <= stones; i++) {
for (int stone : pickOptions) {
if (i - stone >= 0) {
if (dp[i - stone][0] == false) {
dp[i][0] = true;
dp[i][1] = false;
break;
}
}
}
if (dp[i][0] == false) {
dp[i][1] = true;
}
}
/*
for(vector<int> row:dp) {
for(int val:row) {
cout<<val<<" ";
}
cout<<endl;
}
*/
if (dp[stones][0] != false)
return "First";
else
return "Second";
}
int main() {
int setSize = 0, stones = 0;
cin >> setSize >> stones;
vector<int> pickOptions(setSize, 0);
for (int i = 0; i < setSize; i++)
cin >> pickOptions[i];
cout << getWinner(pickOptions, stones) << endl;
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 978,455 | 978,456 | u309984532 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
void solve(int ar[], int n, int k) {
int dp[k + 1];
dp[0] = 0;
for (int i = 1; i <= k; i++) {
int c = 1;
for (int j = 1; j <= n; j++) {
if (i >= ar[j]) {
if (dp[i - ar[j]] == 0) {
c = 0;
break;
}
}
}
if (c == 0) {
dp[i] = 1;
} else
dp[i] = 0;
}
/*for(auto i:dp){
cout<<i<<" ";
}
cout<<endl;
*/
if (dp[k] == 1) {
cout << "first";
} else
cout << "second";
}
int main() {
int n, k;
cin >> n >> k;
int ar[n + 1];
for (int i = 1; i <= n; i++) {
cin >> ar[i];
}
solve(ar, n, k);
}
| #include <bits/stdc++.h>
using namespace std;
void solve(int ar[], int n, int k) {
int dp[k + 1];
dp[0] = 0;
for (int i = 1; i <= k; i++) {
int c = 1;
for (int j = 1; j <= n; j++) {
if (i >= ar[j]) {
if (dp[i - ar[j]] == 0) {
c = 0;
break;
}
}
}
if (c == 0) {
dp[i] = 1;
} else
dp[i] = 0;
}
/*for(auto i:dp){
cout<<i<<" ";
}
cout<<endl;
*/
if (dp[k] == 1) {
cout << "First";
} else
cout << "Second";
}
int main() {
int n, k;
cin >> n >> k;
int ar[n + 1];
for (int i = 1; i <= n; i++) {
cin >> ar[i];
}
solve(ar, n, k);
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,463 | 978,464 | u383141964 | cpp |
p03170 | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define ll long long
int main() {
int n, k;
cin >> n >> k;
int arr[n];
int dp[k];
for (int i = 0; i < n; i++)
cin >> arr[i];
sort(arr, arr + n);
dp[0] = 0;
for (int i = 1; i <= k; i++)
dp[i] = 0;
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (arr[j] <= i) {
if (dp[i - arr[j]] == 0) {
dp[i] = 1;
break;
}
} else {
continue;
}
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define ll long long
int main() {
int n, k;
cin >> n >> k;
int arr[n];
int dp[k + 1];
for (int i = 0; i < n; i++)
cin >> arr[i];
sort(arr, arr + n);
dp[0] = 0;
for (int i = 1; i <= k; i++)
dp[i] = 0;
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (arr[j] <= i) {
if (dp[i - arr[j]] == 0) {
dp[i] = 1;
break;
}
} else {
continue;
}
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
} | [
"variable_declaration.array_dimensions.change",
"expression.operation.binary.add"
] | 978,467 | 978,468 | u385782352 | cpp |
p03170 | /* Simplicity and Goodness */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
void my_dbg() { cout << endl; }
template <typename Arg, typename... Args> void my_dbg(Arg A, Args... B) {
cout << ' ' << A;
my_dbg(B...);
}
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)
#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9 + 7;
const int N = 2e5 + 2;
void solve() {
int n, k;
scn(n);
scn(k);
vi a(n);
for (auto &i : a)
scn(i);
vector<bool> dp(k + 1, 0);
// dp[i] = TRUE if first player wins when i stones are left.
for (int stones = 0; stones <= k; stones++) {
for (auto x : a) {
if (stones >= x and ~dp[stones - x])
dp[stones] = 1;
}
}
puts(dp[k] ? "First" : "Second");
}
int main() {
int t = 1;
// scn(t);
while (t--) {
solve();
}
return 0;
} | /* Simplicity and Goodness */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
void my_dbg() { cout << endl; }
template <typename Arg, typename... Args> void my_dbg(Arg A, Args... B) {
cout << ' ' << A;
my_dbg(B...);
}
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)
#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9 + 7;
const int N = 2e5 + 2;
void solve() {
int n, k;
scn(n);
scn(k);
vi a(n);
for (int &i : a)
scn(i);
vector<bool> dp(k + 1, 0);
// dp[i] = TRUE if first player wins when i stones are left.
for (int stones = 0; stones <= k; stones++) {
for (int x : a) {
if (stones >= x and !dp[stones - x])
dp[stones] = 1;
}
}
puts(dp[k] ? "First" : "Second");
}
int main() {
int t = 1;
// scn(t);
while (t--) {
solve();
}
return 0;
} | [
"control_flow.branch.if.condition.change"
] | 978,471 | 978,472 | u777549027 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, K;
vector<int> a;
vector<bool> dp;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> N >> K;
a.resize(N);
dp.resize(K + 1, false);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
for (int i = 0; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (dp[i]) {
continue;
}
if (i < a[j]) {
continue;
}
if (!dp[j - a[i]]) {
dp[i] = true;
}
}
}
(dp[K]) ? cout << "First" : cout << "Second";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, K;
vector<int> a;
vector<bool> dp;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> N >> K;
a.resize(N);
dp.resize(K + 1, false);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
for (int i = 0; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (dp[i]) {
continue;
}
if (i < a[j]) {
continue;
}
if (!dp[i - a[j]]) {
dp[i] = true;
}
}
}
(dp[K]) ? cout << "First" : cout << "Second";
return 0;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 978,478 | 978,479 | u793977489 | cpp |
p03170 | /* _
_oo0oo_
o8888888o
88" . "88
(| -_- |)
0\ = /0
____/`---'\____
/ \\| |// \
/ \\||| /:\ |||// \
/ _||||| -:- |||||- \
| | \\\ \-/ /// | |
| \_| ''\---/'' |_/ |
\ .-\__ '-' ___/-. /
____'. .' /--.--\ `. .'_____
/"" '< `.___\_<|>_/___.' >' "" \
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `_. \_ __\ /__ _/ .-` / _/
`-.____`.___ \_____/___.-`___.-'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JENISH MONPARA S. IIT PATNA I_LOVE_ADITI_GOEL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793;
const long double DEL = 1e-12;
const int mod = 1000000007;
const int LIM = 100005;
#define fio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define mpq priority_queue<int, vector<int>, greater<int>>
#define deb(a) cerr << #a << ": " << a << endl
#define ftt \
cin >> t; \
for (int tt = 1; tt <= t; ++tt)
#define forr(i, n) for ((i) = 1; (i) <= (n); (i)++)
#define Rev(v) reverse(v.begin(), v.end())
#define Sort(v) sort(v.begin(), v.end())
#define mem(a, b) memset(a, b, sizeof(a))
#define umii unordered_map<int, int>
#define all(a) a.begin(), a.end()
#define vvi vector<vector<int>>
#define pq priority_queue<int>
#define sqr(a) (((a) * (a)))
#define double long double
#define dbg cout << "\nhi\n"
#define pii pair<int, int>
#define mii map<int, int>
#define vb vector<bool>
#define eb emplace_back
#define vi vector<int>
#define nl cout << "\n"
#define pb push_back
#define int long long
#define sp << " " <<
#define se second
#define fi first
int fpow(int x, int n) {
int res = 1;
while (n) {
if (n & 1) {
res = res * x % mod;
}
x = x * x % mod;
n >>= 1;
}
return res;
}
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
void sieve(int n) {
bool prime[5 * LIM];
memset(prime, true, sizeof(prime));
int rootn = (int)sqrt(n);
for (int p = 2; p <= rootn; p++)
if (prime[p] == true)
for (int i = p * p; i <= n; i += p)
prime[i] = false;
prime[1] = 0;
}
int cnt, sum, mid, mx = -1e17, mn = 1e17, a[2 * LIM];
int n, m, d, t, i, j, k, l, r, x, y, z;
bool f, f1, f2;
string s;
//******************************************* CHECK CONSTRAINTS
//**************************************************
int32_t main() {
fio;
cin >> n >> k;
vb canfirstwin(k + k + 2, false);
forr(i, n) {
cin >> a[i];
canfirstwin[a[i]] = 1;
}
forr(i, k) {
if (canfirstwin[i]) {
continue;
}
forr(j, n) { canfirstwin[k + a[j]] = 1; }
}
if (canfirstwin[k]) {
cout << "First";
} else {
cout << "Second";
}
}
| /* _
_oo0oo_
o8888888o
88" . "88
(| -_- |)
0\ = /0
____/`---'\____
/ \\| |// \
/ \\||| /:\ |||// \
/ _||||| -:- |||||- \
| | \\\ \-/ /// | |
| \_| ''\---/'' |_/ |
\ .-\__ '-' ___/-. /
____'. .' /--.--\ `. .'_____
/"" '< `.___\_<|>_/___.' >' "" \
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `_. \_ __\ /__ _/ .-` / _/
`-.____`.___ \_____/___.-`___.-'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JENISH MONPARA S. IIT PATNA I_LOVE_ADITI_GOEL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793;
const long double DEL = 1e-12;
const int mod = 1000000007;
const int LIM = 100005;
#define fio \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define mpq priority_queue<int, vector<int>, greater<int>>
#define deb(a) cerr << #a << ": " << a << endl
#define ftt \
cin >> t; \
for (int tt = 1; tt <= t; ++tt)
#define forr(i, n) for ((i) = 1; (i) <= (n); (i)++)
#define Rev(v) reverse(v.begin(), v.end())
#define Sort(v) sort(v.begin(), v.end())
#define mem(a, b) memset(a, b, sizeof(a))
#define umii unordered_map<int, int>
#define all(a) a.begin(), a.end()
#define vvi vector<vector<int>>
#define pq priority_queue<int>
#define sqr(a) (((a) * (a)))
#define double long double
#define dbg cout << "\nhi\n"
#define pii pair<int, int>
#define mii map<int, int>
#define vb vector<bool>
#define eb emplace_back
#define vi vector<int>
#define nl cout << "\n"
#define pb push_back
#define int long long
#define sp << " " <<
#define se second
#define fi first
int fpow(int x, int n) {
int res = 1;
while (n) {
if (n & 1) {
res = res * x % mod;
}
x = x * x % mod;
n >>= 1;
}
return res;
}
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
void sieve(int n) {
bool prime[5 * LIM];
memset(prime, true, sizeof(prime));
int rootn = (int)sqrt(n);
for (int p = 2; p <= rootn; p++)
if (prime[p] == true)
for (int i = p * p; i <= n; i += p)
prime[i] = false;
prime[1] = 0;
}
int cnt, sum, mid, mx = -1e17, mn = 1e17, a[2 * LIM];
int n, m, d, t, i, j, k, l, r, x, y, z;
bool f, f1, f2;
string s;
//******************************************* CHECK CONSTRAINTS
//**************************************************
int32_t main() {
fio;
cin >> n >> k;
vb canfirstwin(k + k + 2, false);
forr(i, n) {
cin >> a[i];
canfirstwin[a[i]] = 1;
}
forr(i, k) {
if (canfirstwin[i]) {
continue;
}
forr(j, n) { canfirstwin[i + a[j]] = 1; }
}
if (canfirstwin[k]) {
cout << "First";
} else {
cout << "Second";
}
}
| [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 978,484 | 978,485 | u116521736 | cpp |
p03170 | /*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
#include <algorithm>
#include <bits/stdc++.h>
#include <ctype.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define f(i, n) for (ll i = 0; i < n; i++)
#define f1(i, n) for (ll i = 1; i <= n; i++)
#define fb(i, n) for (ll i = n - 1; i >= 0; i--)
#define fb1(i, n) for (ll i = n; i > 0; i--)
#define endd cout << '\n';
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define all(x) x.begin(), x.end()
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define vi vector<ll>
#define pii pair<ll, ll>
#define CASES \
ll t; \
cin >> t; \
while (t--)
typedef long long ll;
typedef unsigned long long ull;
// typedef
// tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
// indexed_set; typedef
// tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
// X.order_of_key()
int main() {
fast;
ll n, k;
cin >> n >> k;
ll a[n];
ll dp[k + 1];
f(i, n) cin >> a[i];
memset(dp, 0, sizeof(dp));
f(i, k + 1) {
f(j, n) {
if (dp[i] == 0 && dp[i - a[j]] == 0)
dp[i] = 1;
}
}
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
return 0;
} | /*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
#include <algorithm>
#include <bits/stdc++.h>
#include <ctype.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define f(i, n) for (ll i = 0; i < n; i++)
#define f1(i, n) for (ll i = 1; i <= n; i++)
#define fb(i, n) for (ll i = n - 1; i >= 0; i--)
#define fb1(i, n) for (ll i = n; i > 0; i--)
#define endd cout << '\n';
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define all(x) x.begin(), x.end()
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define vi vector<ll>
#define pii pair<ll, ll>
#define CASES \
ll t; \
cin >> t; \
while (t--)
typedef long long ll;
typedef unsigned long long ull;
// typedef
// tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
// indexed_set; typedef
// tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
// X.order_of_key()
int main() {
fast;
ll n, k;
cin >> n >> k;
ll a[n];
ll dp[k + 1];
f(i, n) cin >> a[i];
memset(dp, 0, sizeof(dp));
f(i, k + 1) {
f(j, n) {
if (a[j] <= i && dp[i - a[j]] == 0)
dp[i] = 1;
}
}
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
return 0;
} | [
"identifier.change",
"control_flow.branch.if.condition.change",
"variable_access.subscript.index.change"
] | 978,493 | 978,494 | u331842396 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0) {
dp[i] = 1;
}
}
}
return (dp[k]) ? "First" : "Second";
}
int main() {
int n, k;
cin >> n >> k;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
cout << solve(v, n);
return 0;
} | #include <bits/stdc++.h>
using namespace std;
string solve(vector<int> &v, int k) {
bool dp[k + 1];
memset(dp, 0, sizeof dp);
for (int i = 1; i <= k; i++) {
for (int move : v) {
if (move > i)
continue;
if (dp[i - move] == 0) {
dp[i] = 1;
}
}
}
return (dp[k]) ? "First" : "Second";
}
int main() {
int n, k;
cin >> n >> k;
vector<int> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
cout << solve(v, k) << endl;
return 0;
}
| [
"call.arguments.change",
"identifier.change",
"io.output.change",
"io.output.newline.add"
] | 978,497 | 978,498 | u345177558 | cpp |
p03170 | /// Journey to the End of earth ///
/// Gunjan Kumar ///
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <functional> // for less
// using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define s(n) scanf("%d", &n)
#define ls(n) scanf("%lld", &n)
#define p(n) printf("%d", n)
// #define ln() printf("\n")
#define pln(n) printf("%d\n", n)
#define lpln(n) printf("%lld\n", n)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define rev(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc \
ll t1; \
cin >> t1; \
while (t1--)
#define inp \
ll n; \
cin >> n; \
ll arr[n]; \
rep(i, 0, n) cin >> arr[i];
#define vect vector<ll>
#define sortv(v) sort(v.begin(), v.end())
#define lower(v, n) lower_bound(v.begin(), v.end(), n) - v.begin()
#define upper(v, n) upper_bound(v.begin(), v.end(), n) - v.begin()
#define bitcount(n) __builtin_popcount(n)
#define ln << endl
#define inf LONG_MAX
#define ninf LONG_MIN
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
const ll mod = 1e9 + 7;
const ll N = 3e2 + 5;
int main() {
int n, k;
cin >> n >> k;
std::vector<bool> dp(k + 1);
std::vector<int> arr(n);
for (int &x : arr)
cin >> x;
for (int i = 0; i <= k; i++) {
for (int x : arr) {
if (i >= x && dp[i - x] == 0)
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "second" << endl;
return 0;
}
| /// Journey to the End of earth ///
/// Gunjan Kumar ///
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <functional> // for less
// using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define s(n) scanf("%d", &n)
#define ls(n) scanf("%lld", &n)
#define p(n) printf("%d", n)
// #define ln() printf("\n")
#define pln(n) printf("%d\n", n)
#define lpln(n) printf("%lld\n", n)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define rev(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc \
ll t1; \
cin >> t1; \
while (t1--)
#define inp \
ll n; \
cin >> n; \
ll arr[n]; \
rep(i, 0, n) cin >> arr[i];
#define vect vector<ll>
#define sortv(v) sort(v.begin(), v.end())
#define lower(v, n) lower_bound(v.begin(), v.end(), n) - v.begin()
#define upper(v, n) upper_bound(v.begin(), v.end(), n) - v.begin()
#define bitcount(n) __builtin_popcount(n)
#define ln << endl
#define inf LONG_MAX
#define ninf LONG_MIN
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
const ll mod = 1e9 + 7;
const ll N = 3e2 + 5;
int main() {
int n, k;
cin >> n >> k;
std::vector<bool> dp(k + 1);
std::vector<int> arr(n);
for (int &x : arr)
cin >> x;
for (int i = 0; i <= k; i++) {
for (int x : arr) {
if (i >= x && dp[i - x] == 0)
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,499 | 978,500 | u464439644 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll long long
#define db double
#define ld long double
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rev(i, n) for (ll i = n; i >= 0; i--)
#define rep_a(i, a, n) for (ll i = a; i < n; i++)
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define debug(x) \
do { \
std::cerr << #x << ": " << x << std::endl; \
} while (0);
#define debugg(x, y) \
do { \
std::cerr << #x << ": " << x << " " << #y << ": " << y << std::endl; \
} while (0);
#define debugggg(i, j, k, ans) \
std::cerr << #i << ": " << i << " " << #j << ": " << j << #k << ": " << k \
<< #ans << ": " << ans << std::endl;
const long long mod = 998244353;
const long long MOD = 1000000007;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<pair<ll, ll>> vpll;
typedef set<ll> sll;
typedef set<string> sstr;
typedef set<pair<ll, ll>> spll;
typedef map<ll, ll> mllll;
typedef map<string, ll> mstrll;
typedef queue<ll> qll;
map<ll, ll> mp;
int solve() {
int n, k;
cin >> n >> k;
vll a(n + 1);
rep(i, n) cin >> a[i + 1];
sort(all(a));
vll dp(n + 1, 0);
// if ist wins 1 else 0;
rep_a(i, 1, k + 1) {
rep_a(j, 1, n + 1) {
bool win = false;
if (i >= a[j])
win = 1 - dp[i - a[j]];
if (win)
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
int main() {
fast;
/* #ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
#endif */
solve();
/* #ifndef ONLINE_JUDGE
cout<<"\nTime Elapsed: "<<1.0*clock()/ CLOCKS_PER_SEC <<" Sec\n";
#endif */
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll long long
#define db double
#define ld long double
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rev(i, n) for (ll i = n; i >= 0; i--)
#define rep_a(i, a, n) for (ll i = a; i < n; i++)
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define debug(x) \
do { \
std::cerr << #x << ": " << x << std::endl; \
} while (0);
#define debugg(x, y) \
do { \
std::cerr << #x << ": " << x << " " << #y << ": " << y << std::endl; \
} while (0);
#define debugggg(i, j, k, ans) \
std::cerr << #i << ": " << i << " " << #j << ": " << j << #k << ": " << k \
<< #ans << ": " << ans << std::endl;
const long long mod = 998244353;
const long long MOD = 1000000007;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<pair<ll, ll>> vpll;
typedef set<ll> sll;
typedef set<string> sstr;
typedef set<pair<ll, ll>> spll;
typedef map<ll, ll> mllll;
typedef map<string, ll> mstrll;
typedef queue<ll> qll;
map<ll, ll> mp;
int solve() {
int n, k;
cin >> n >> k;
vll a(n + 1);
rep(i, n) cin >> a[i + 1];
sort(all(a));
vll dp(k + 1, 0);
// if ist wins 1 else 0;
rep_a(i, 1, k + 1) {
rep_a(j, 1, n + 1) {
bool win = false;
if (i >= a[j])
win = 1 - dp[i - a[j]];
if (win)
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
int main() {
fast;
/* #ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
#endif */
solve();
/* #ifndef ONLINE_JUDGE
cout<<"\nTime Elapsed: "<<1.0*clock()/ CLOCKS_PER_SEC <<" Sec\n";
#endif */
return 0;
} | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,501 | 978,502 | u296273488 | cpp |
p03170 | /* Code by : Suraj (@suraj1611) */
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define mx INT_MAX
#define mn INT_MIN
#define md 1000000007
#define pb push_back
#define mp make_pair
#define maxsize 1100005
#define lb cout << endl;
#define endl "\n"
#define F first
#define S second
#define label cout << "hello!" << endl
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
ll power(ll x, ll y) {
ll m = md;
ll ans = 1;
while (y > 0) {
if (y & 1)
ans = (ans * x) % m;
x = (x * x) % m;
y >>= 1;
}
return ans;
}
int main() {
IOS
ll n,
k;
cin >> n >> k;
ll a[n];
rep(i, n) cin >> a[i];
bool dp[n + 1];
fill(dp, dp + 1, 0);
rep(i, k + 1) {
for (auto j : a) {
if ((i - j) >= 0 and !dp[i - j])
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | /* Code by : Suraj (@suraj1611) */
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define mx INT_MAX
#define mn INT_MIN
#define md 1000000007
#define pb push_back
#define mp make_pair
#define maxsize 1100005
#define lb cout << endl;
#define endl "\n"
#define F first
#define S second
#define label cout << "hello!" << endl
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
ll power(ll x, ll y) {
ll m = md;
ll ans = 1;
while (y > 0) {
if (y & 1)
ans = (ans * x) % m;
x = (x * x) % m;
y >>= 1;
}
return ans;
}
int main() {
IOS
ll n,
k;
cin >> n >> k;
ll a[n];
rep(i, n) cin >> a[i];
bool dp[k + 1];
fill(dp, dp + k + 1, 0);
rep(i, k + 1) {
for (auto j : a) {
if ((i - j) >= 0 and !dp[i - j])
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | [
"identifier.change",
"expression.operation.binary.change"
] | 978,503 | 978,504 | u675396875 | cpp |
p03170 | /// int ->(-2147483648<->2147483647)
/// unsigned int(0<->4294967295)
/// long long int (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
/// unsigned long long int (0 to 18,446,744,073,709,551,615)
//#include<bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip> ///setprecision
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set \
tree<int, null_type, less<int>, rb_tree_tag, \
tree_order_statistics_node_update>
#define FIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define OPEN freopen("in.txt", "r", stdin)
#define OUT freopen("out.txt", "r", stdin)
#define Precision cout << fixed, cout << setprecision(10);
#define INF 1000000000
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define vi vector<int>
#define vll vector<long long>
#define vc vector<char>
#define vd vector<double>
#define sci(value) scanf("%d%*c", &value)
#define scl(value) scanf("%lld%*c", &value)
#define pi (2 * acos(0))
#define pb push_back
#define valid(value123, value234, limitrow, limitcol) \
value123 >= 0 && value123 < limitrow &&value234 >= 0 && value234 < limitcol
// int fx[]= {0,0,1,-1,-1,1,-1,1};//kings move
// int fy[]= {1,-1,0,0,-1,1,1,-1};//kings move
// int fx[]={-2,-2,-1,-1, 1,1, 2,2}; // Knights Move
// int fy[]={-1, 1,-2, 2,-2,2,-1,1}; // Knights Move
// ll powFunction(ll a,ll b){if(b==0)return 1;ll
// re=powFunction(a,b/2);re=(re*re);if(b&1)re=(re*a);return re;}
/// ll digitSum(ll a){ll ans=0;while(a){ans+=(a%10);a/=10;}return ans;}
#define MX 100005
#define mod 1000000007
/// idea : if there are n stones in the pile and I can take several stones from
/// this, after that with these remaining stones second player will loose the
/// game then first player win otherwise he will loose.
bool dp[MX];
int main() {
int n, k;
sci(n), sci(k);
vector<int> arr(n);
for (int &x : arr) {
sci(x);
}
for (int stones = 0; stones <= k; stones++) {
for (int x : arr) {
if (stones >= x && !dp[stones - x]) {
dp[stones] = true;
}
}
}
printf("%s\n", dp[k] ? "first" : "second");
}
| /// int ->(-2147483648<->2147483647)
/// unsigned int(0<->4294967295)
/// long long int (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
/// unsigned long long int (0 to 18,446,744,073,709,551,615)
//#include<bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip> ///setprecision
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set \
tree<int, null_type, less<int>, rb_tree_tag, \
tree_order_statistics_node_update>
#define FIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define OPEN freopen("in.txt", "r", stdin)
#define OUT freopen("out.txt", "r", stdin)
#define Precision cout << fixed, cout << setprecision(10);
#define INF 1000000000
#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define vi vector<int>
#define vll vector<long long>
#define vc vector<char>
#define vd vector<double>
#define sci(value) scanf("%d%*c", &value)
#define scl(value) scanf("%lld%*c", &value)
#define pi (2 * acos(0))
#define pb push_back
#define valid(value123, value234, limitrow, limitcol) \
value123 >= 0 && value123 < limitrow &&value234 >= 0 && value234 < limitcol
// int fx[]= {0,0,1,-1,-1,1,-1,1};//kings move
// int fy[]= {1,-1,0,0,-1,1,1,-1};//kings move
// int fx[]={-2,-2,-1,-1, 1,1, 2,2}; // Knights Move
// int fy[]={-1, 1,-2, 2,-2,2,-1,1}; // Knights Move
// ll powFunction(ll a,ll b){if(b==0)return 1;ll
// re=powFunction(a,b/2);re=(re*re);if(b&1)re=(re*a);return re;}
/// ll digitSum(ll a){ll ans=0;while(a){ans+=(a%10);a/=10;}return ans;}
#define MX 100005
#define mod 1000000007
/// idea : if there are n stones in the pile and I can take several stones from
/// this, after that with these remaining stones second player will loose the
/// game then first player win otherwise he will loose.
bool dp[MX];
int main() {
int n, k;
sci(n), sci(k);
vector<int> arr(n);
for (int &x : arr) {
sci(x);
}
for (int stones = 0; stones <= k; stones++) {
for (int x : arr) {
if (stones >= x && !dp[stones - x]) {
dp[stones] = true;
}
}
}
printf("%s\n", dp[k] ? "First" : "Second");
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 978,505 | 978,506 | u079671504 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define mii map<ll, ll>
#define pqb priority_queue<ll>
#define pqs priority_queue<ll, vi, greater<ll>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x) \
ll x; \
cin >> x; \
while (x--)
#define FIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define mx 3000
ll n, m;
bool dp[100005];
string solve(vector<ll> &v, ll k) {
for (int i = 1; i <= k; i++) {
for (ll move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "First" : "Second";
}
int main() {
FIO;
ll c, d, e, f = 0, sum = 0, ck, k, p, q, r, t, add = 0, w, x, y, z;
string ans;
cin >> n >> k;
memset(dp, -1, sizeof dp);
vector<ll> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
ans = solve(v, k);
cout << ans << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define mii map<ll, ll>
#define pqb priority_queue<ll>
#define pqs priority_queue<ll, vi, greater<ll>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x) \
ll x; \
cin >> x; \
while (x--)
#define FIO \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define mx 3000
ll n, m;
bool dp[100005];
string solve(vector<ll> &v, ll k) {
for (int i = 1; i <= k; i++) {
for (ll move : v) {
if (move > i)
continue;
if (dp[i - move] == 0)
dp[i] = 1;
}
}
return dp[k] ? "First" : "Second";
}
int main() {
FIO;
ll c, d, e, f = 0, sum = 0, ck, k, p, q, r, t, add = 0, w, x, y, z;
string ans;
cin >> n >> k;
memset(dp, 0, sizeof dp);
vector<ll> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
ans = solve(v, k);
cout << ans << endl;
return 0;
}
| [
"literal.number.change",
"call.arguments.change"
] | 978,516 | 978,517 | u525882623 | cpp |
p03170 | #include <bits/stdc++.h>
#define rep(a, n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<vector<ll>> Graph;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const ll INF = 1e18;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> a(n);
rep(i, n) cin >> a[i];
vector<bool> dp(n, false);
for (int i = 1; i <= k; i++) {
rep(j, n) {
if (i - a[j] < 0)
continue;
if (!dp[i - a[j]]) {
dp[i] = true;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(a, n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<vector<ll>> Graph;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const ll INF = 1e18;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> a(n);
rep(i, n) cin >> a[i];
vector<bool> dp(k + 1, false);
for (int i = 1; i <= k; i++) {
rep(j, n) {
if (i - a[j] < 0)
continue;
if (!dp[i - a[j]]) {
dp[i] = true;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| [
"assignment.change"
] | 978,518 | 978,519 | u045408189 | cpp |
p03170 | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
int main() {
int N, K;
cin >> N >> K;
vector<int> a(N);
REP(i, N) cin >> a[i];
// dp[i] = 石が i 個のときに太郎くんが勝つかどうか
vector<bool> dp(K + 1, false);
FOR(i, 1, K + 1) {
bool check = false;
REP(j, N) {
if (i >= a[j] and !dp[i - a[j]]) {
check = true;
break;
}
}
if (check)
dp[i] = true;
}
if (dp[K])
cout << "Frist" << endl;
else
cout << "Second" << endl;
return 0;
} | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
int main() {
int N, K;
cin >> N >> K;
vector<int> a(N);
REP(i, N) cin >> a[i];
// dp[i] = 石が i 個のときに太郎くんが勝つかどうか
vector<bool> dp(K + 1, false);
FOR(i, 1, K + 1) {
bool check = false;
REP(j, N) {
if (i >= a[j] and !dp[i - a[j]]) {
check = true;
break;
}
}
if (check)
dp[i] = true;
}
if (dp[K])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | [
"literal.string.change",
"io.output.change"
] | 978,524 | 978,525 | u127285813 | cpp |
p03170 | // k-stones
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvll;
typedef vector<vd> vvd;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int>> vpii;
int main() {
int n, k;
cin >> n >> k;
vi a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vb state(k + 1, 0);
for (int i = 0; i < k + 1; i++) {
for (auto j : a) {
if (i >= j && !state[i - j]) {
state[i] = 1;
}
}
}
cout << (state[k] ? "First" : "second") << endl;
} | // k-stones
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvll;
typedef vector<vd> vvd;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int>> vpii;
int main() {
int n, k;
cin >> n >> k;
vi a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vb state(k + 1, 0);
for (int i = 0; i < k + 1; i++) {
for (auto j : a) {
if (i >= j && !state[i - j]) {
state[i] = 1;
}
}
}
cout << (state[k] ? "First" : "Second") << endl;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,532 | 978,533 | u068011824 | cpp |
p03170 | // k-stones
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvll;
typedef vector<vd> vvd;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int>> vpii;
int main() {
int n, k;
cin >> n >> k;
vi a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vi state(k + 1, 0);
for (int i = 1; i < k + 1; i++) {
for (auto j : a) {
if (i >= j && !state[i - j]) {
state[i] = 1;
}
}
}
cout << (state[k] ? "First" : "second") << endl;
} | // k-stones
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvll;
typedef vector<vd> vvd;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int>> vpii;
int main() {
int n, k;
cin >> n >> k;
vi a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vb state(k + 1, 0);
for (int i = 0; i < k + 1; i++) {
for (auto j : a) {
if (i >= j && !state[i - j]) {
state[i] = 1;
}
}
}
cout << (state[k] ? "First" : "Second") << endl;
} | [
"variable_declaration.type.change",
"literal.number.change",
"variable_declaration.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,534 | 978,533 | u068011824 | cpp |
p03170 | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
const ll mod = 1e9 + 7;
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define rc(x) return cout << x << "\n", 0
#define sz(s) (int)s.size()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
using namespace std;
ll n, x, k;
bool dp[10005];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
ll a[k + 2];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int stones = 0; stones <= k; stones++) {
for (int x = 1; x <= n; x++) {
if (stones >= a[x] && dp[stones - a[x]] == 0) {
dp[stones] = true;
break;
}
}
}
if (dp[k] == true) {
cout << "First";
} else
cout << "Second";
}
| #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
const ll mod = 1e9 + 7;
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define rc(x) return cout << x << "\n", 0
#define sz(s) (int)s.size()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
using namespace std;
ll n, x, k;
bool dp[100005];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
ll a[k + 2];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int stones = 0; stones <= k; stones++) {
for (int x = 1; x <= n; x++) {
if (stones >= a[x] && dp[stones - a[x]] == 0) {
dp[stones] = true;
break;
}
}
}
if (dp[k] == true) {
cout << "First";
} else
cout << "Second";
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,539 | 978,540 | u055298530 | cpp |
p03170 | /*
author : Divyansh Gupta
*/
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
void print_err() { cerr << "\n"; }
template <class T, class... Arg> void print_err(T x, Arg &&...args) {
cerr << x << " ";
print_err(args...);
}
#ifdef local
#define debug(...) print_err(__VA_ARGS__)
#else
#define debug(...)
#endif
#define test_case \
int test_cases; \
cin >> test_cases; \
while (test_cases--)
#define lu(var, l, r) for (var = l; var < r; var++)
#define ld(var, r, l) for (var = r; var >= l; var--)
#define ll long long
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define pii pair<int, int>
#define br cout << "\n"
#define sp cout << " "
#define pr cout <<
#define in cin >>
#define f first
#define s second
#define mod 1000000007
void solve() {
int n, k, i, j, x;
in n;
in k;
vi A, dp(k + 1, 0);
lu(i, 0, n) {
in x;
A.pb(x);
}
lu(i, 1, k + 1) {
for (int x : A) {
if (i - x >= 0) {
if (dp[i - x] == 0) {
dp[i] = 1;
}
}
}
debug("dp for", i, "is", dp[i]);
}
string ans = dp[k] == 1 ? "First" : "Second";
pr ans;
br;
}
int main() {
test_case solve();
return 0;
} | /*
author : Divyansh Gupta
*/
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
void print_err() { cerr << "\n"; }
template <class T, class... Arg> void print_err(T x, Arg &&...args) {
cerr << x << " ";
print_err(args...);
}
#ifdef local
#define debug(...) print_err(__VA_ARGS__)
#else
#define debug(...)
#endif
#define test_case \
int test_cases; \
cin >> test_cases; \
while (test_cases--)
#define lu(var, l, r) for (var = l; var < r; var++)
#define ld(var, r, l) for (var = r; var >= l; var--)
#define ll long long
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define pii pair<int, int>
#define br cout << "\n"
#define sp cout << " "
#define pr cout <<
#define in cin >>
#define f first
#define s second
#define mod 1000000007
void solve() {
int n, k, i, j, x;
in n;
in k;
vi A, dp(k + 1, 0);
lu(i, 0, n) {
in x;
A.pb(x);
}
lu(i, 1, k + 1) {
for (int x : A) {
if (i - x >= 0) {
if (dp[i - x] == 0) {
dp[i] = 1;
}
}
}
debug("dp for", i, "is", dp[i]);
}
string ans = dp[k] == 1 ? "First" : "Second";
pr ans;
br;
}
int main() {
solve();
return 0;
} | [] | 978,541 | 978,542 | u992065512 | cpp |
p03170 | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
typedef pair<int, int> P;
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9 + 7;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) { cin >> a[i]; }
vector<bool> dp(150, false);
rep(i, k + 1) {
rep(j, n) {
if (i - a[j] >= 0 && dp[i - a[j]] == false)
dp[i] = true;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
cout << endl;
return 0;
}
| #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
typedef pair<int, int> P;
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9 + 7;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) { cin >> a[i]; }
vector<bool> dp(k + 1, false);
rep(i, k + 1) {
rep(j, n) {
if (i - a[j] >= 0 && dp[i - a[j]] == false)
dp[i] = true;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
cout << endl;
return 0;
}
| [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change"
] | 978,547 | 978,548 | u154148649 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
long n, k;
cin >> n >> k;
vector<long> a(n + 1);
for (long i = 1; i <= n; i++) {
cin >> a[i];
}
vector<long> dp(k + 2);
for (long i = 1; i <= k + 1; i++) {
for (long j = 1; j <= n + 1; j++) {
if (i - a[j] >= 0 && dp[i - a[j]] == 0) {
dp[i] = 1;
}
}
}
cout << (dp[k] % 1 == 1 ? "First" : "Second") << endl;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
long n, k;
cin >> n >> k;
vector<long> a(n + 1);
for (long i = 1; i <= n; i++) {
cin >> a[i];
}
vector<long> dp(k + 2);
for (long i = 1; i <= k + 1; i++) {
for (long j = 1; j <= n; j++) {
if (i - a[j] >= 0 && dp[i - a[j]] == 0) {
dp[i] = 1;
}
}
}
cout << (dp[k] % 2 == 1 ? "First" : "Second") << endl;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"literal.number.change",
"expression.off_by_one",
"io.output.change"
] | 978,551 | 978,552 | u229596090 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.