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 |
|---|---|---|---|---|---|---|---|
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 + 1);
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;
} | [
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"expression.off_by_one",
"io.output.change"
] | 978,553 | 978,552 | u229596090 | 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 + 1);
for (long i = 1; i <= k; i++) {
for (long j = 1; j <= n; 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;
} | [
"literal.number.change",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"expression.off_by_one",
"io.output.change"
] | 978,554 | 978,552 | u229596090 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll n, k, x, i, j, dp[200005];
set<ll> s;
vector<ll> v;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cerr.tie(0);
cout.tie(0);
cin >> n >> k;
for (i = 1; i <= n; i++) {
cin >> x;
v.pb(x);
}
for (i = 1; i <= k; i++) {
for (auto x : v) {
if (i >= x && !dp[i - x]) {
dp[i] = true;
}
}
}
// for(i=1;i<=k;i++) cout<<dp[i]<<" ";
if (dp[k])
cout << "FIRST";
else
cout << "SECOND";
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll n, k, x, i, j, dp[200005];
set<ll> s;
vector<ll> v;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cerr.tie(0);
cout.tie(0);
cin >> n >> k;
for (i = 1; i <= n; i++) {
cin >> x;
v.pb(x);
}
for (i = 1; i <= k; i++) {
for (auto x : v) {
if (i >= x && !dp[i - x]) {
dp[i] = true;
}
}
}
// for(i=1;i<=k;i++) cout<<dp[i]<<" ";
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,557 | 978,558 | u111912627 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll n, k, x, i, j, dp[200005];
set<ll> s;
vector<ll> v;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cerr.tie(0);
cout.tie(0);
cin >> n >> k;
for (i = 1; i <= n; i++) {
cin >> x;
v.pb(x);
}
for (i = 0; i <= k; i++) {
for (auto x : v) {
if (i >= x && !dp[i - x]) {
dp[i] = true;
}
}
}
// for(i=1;i<=k;i++) cout<<dp[i]<<" ";
if (dp[k])
cout << "FIRST";
else
cout << "SECOND";
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll n, k, x, i, j, dp[200005];
set<ll> s;
vector<ll> v;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cerr.tie(0);
cout.tie(0);
cin >> n >> k;
for (i = 1; i <= n; i++) {
cin >> x;
v.pb(x);
}
for (i = 1; i <= k; i++) {
for (auto x : v) {
if (i >= x && !dp[i - x]) {
dp[i] = true;
}
}
}
// for(i=1;i<=k;i++) cout<<dp[i]<<" ";
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
}
| [
"literal.number.change",
"assignment.value.change",
"control_flow.loop.for.initializer.change",
"expression.off_by_one",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,559 | 978,558 | u111912627 | cpp |
p03170 | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int n, k;
cin >> n >> k;
vector<int> v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
vector<bool> dp(n + 1, 0);
for (int i = 0; i <= k; i++) {
for (int a : v) {
if (i - a >= 0 && !dp[i - a])
dp[i] = 1;
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
}
| #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int n, k;
cin >> n >> k;
vector<int> v(n);
for (int i = 0; i < n; i++)
cin >> v[i];
vector<bool> dp(k + 1, 0);
for (int i = 0; i <= k; i++) {
for (int a : v) {
if (i - a >= 0 && !dp[i - a])
dp[i] = 1;
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,564 | 978,565 | u724012411 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i < n; ++i)
#define exrep(i, a, b) for (ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef vector<vector<double>> vvd;
typedef vector<vector<string>> vvs;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
// cout<<fixed<<setprecision(10);
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;
}
template <class T> void debug(T v) {
rep(i, v.size()) cout << v[i] << " ";
cout << endl;
}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
signed main() {
gearup;
ll n, k;
cin >> n >> k;
vl a(n);
rep(i, n) cin >> a[i];
vb dp(n + 100);
rep1(i, k + 1) {
rep(j, n) {
if (i - a[j] >= 0)
dp[i] = (dp[i] | !dp[i - a[j]]);
}
}
if (dp[k])
out("First");
else
out("Second");
}
| #include <bits/stdc++.h>
using namespace std;
//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i < n; ++i)
#define exrep(i, a, b) for (ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef vector<vector<double>> vvd;
typedef vector<vector<string>> vvs;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
// cout<<fixed<<setprecision(10);
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;
}
template <class T> void debug(T v) {
rep(i, v.size()) cout << v[i] << " ";
cout << endl;
}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
signed main() {
gearup;
ll n, k;
cin >> n >> k;
vl a(n);
rep(i, n) cin >> a[i];
vb dp(k + 100, false);
rep1(i, k + 1) {
rep(j, n) {
if (i - a[j] >= 0)
dp[i] = (dp[i] | !dp[i - a[j]]);
}
}
if (dp[k])
out("First");
else
out("Second");
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"call.arguments.add"
] | 978,572 | 978,573 | u929582923 | cpp |
p03170 |
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0); \
cout << fixed << setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll, ll>
#define vpl vector<pll>
#define vvl vector<vector<ll>>
#define vvpl vector<vector<pll>>
#define ff first
#define ss second
#define pqueue priority_queue<ll>
#define pdqueue priority_queue<ll, vl, greater<ll>>
#define mem(a, b) memset(a, b, sizeof(a));
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll) a.size()
#define f(i, a, b) for (ll i = a; i < b; i++)
#define fd(i, a, b) for (ll i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) \
for (auto it : a) \
cout << it << " "; \
cout << endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;
// vector
template <class T> istream &operator>>(istream &is, vector<T> &v) {
for (T &a : v)
is >> a;
return is;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
for (const T &t : v)
os << t << " ";
return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
return os << v.first << " " << v.second;
}
double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }
long long bpow(long long a, long long b, long long m) {
a %= m;
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
ll kv;
ll t, n, x, y, h, k, z, p, q, w, r;
string s, s1, s2;
// vvl v;
// vl vis,d;
int main() {
IOS;
cin >> n >> k;
vl v(n), a(k + 1, 0);
cin >> v;
for (int i = 1; i <= k; i++) {
x = 0;
y = 0;
fo(j, n) {
if (v[j] <= i)
x++, y += a[i - v[j]];
}
if (x > 0 && y != x)
a[i] = 1;
// cout<<a[i]<<" "<<i<<" "<<x<<" "<<y<<el;
}
if (a[k + 1])
cout << "First";
else
cout << "Second";
return 0;
}
|
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0); \
cout << fixed << setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll, ll>
#define vpl vector<pll>
#define vvl vector<vector<ll>>
#define vvpl vector<vector<pll>>
#define ff first
#define ss second
#define pqueue priority_queue<ll>
#define pdqueue priority_queue<ll, vl, greater<ll>>
#define mem(a, b) memset(a, b, sizeof(a));
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll) a.size()
#define f(i, a, b) for (ll i = a; i < b; i++)
#define fd(i, a, b) for (ll i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) \
for (auto it : a) \
cout << it << " "; \
cout << endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;
// vector
template <class T> istream &operator>>(istream &is, vector<T> &v) {
for (T &a : v)
is >> a;
return is;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
for (const T &t : v)
os << t << " ";
return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
return os << v.first << " " << v.second;
}
double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }
long long bpow(long long a, long long b, long long m) {
a %= m;
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
ll kv;
ll t, n, x, y, h, k, z, p, q, w, r;
string s, s1, s2;
// vvl v;
// vl vis,d;
int main() {
IOS;
cin >> n >> k;
vl v(n), a(k + 1, 0);
cin >> v;
for (int i = 1; i <= k; i++) {
x = 0;
y = 0;
fo(j, n) {
if (v[j] <= i)
x++, y += a[i - v[j]];
}
if (x > 0 && y != x)
a[i] = 1;
// cout<<a[i]<<" "<<i<<" "<<x<<" "<<y<<el;
}
if (a[k])
cout << "First";
else
cout << "Second";
return 0;
}
| [
"expression.operation.binary.remove"
] | 978,580 | 978,581 | u524492594 | cpp |
p03170 | #include <cstdio>
#include <cstring>
#define N 110
using namespace std;
int n, k;
int dp[N][2];
int a[N];
bool dfs(int k, int t) {
if (dp[k][t] >= 0)
return dp[k][t];
int ans = 0;
for (int i = 1; i <= n; i++)
if (k >= a[i])
ans |= !dfs(k - a[i], !t);
return dp[k][t] = ans;
}
signed main() {
memset(dp, -1, sizeof(dp));
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
if (dfs(k, 0) == true)
puts("First");
else
puts("Second");
}
| #include <cstdio>
#include <cstring>
#define N 100010
using namespace std;
int n, k;
int dp[N][2];
int a[N];
bool dfs(int k, int t) {
if (dp[k][t] >= 0)
return dp[k][t];
int ans = 0;
for (int i = 1; i <= n; i++)
if (k >= a[i])
ans |= !dfs(k - a[i], !t);
return dp[k][t] = ans;
}
signed main() {
memset(dp, -1, sizeof(dp));
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
if (dfs(k, 0) == true)
puts("First");
else
puts("Second");
}
| [
"preprocessor.define.value.change",
"literal.integer.change"
] | 978,586 | 978,587 | u251934001 | cpp |
p03170 | #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007 // 1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool> vecbool;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<string> vecstr;
typedef vector<vecint> vec2int;
typedef vector<vecbool> vec2bool;
int dx[4]{-1, +1, 0, 0};
int dy[4]{0, 0, -1, +1};
void init() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
vecint a;
vec2int dp;
int n, k;
bool rec(int p, int q) {
// if (p <= 0) return false;
if (dp[p][q] != -1)
return dp[p][q] == 1 ? true : false;
int r = 0;
if (q == 0)
r = 1;
REP(i, n) {
if (p <= a[i]) {
if (!rec(p - a[i], r)) {
dp[p][q] = 1;
return true;
}
}
}
dp[p][q] = 0;
return false;
}
int main() {
init();
cin >> n >> k;
a.resize(n);
for (auto &e : a)
cin >> e;
dp = vector<vector<int>>(k + 1, vecint(2, -1));
// REP(i, a[0]) dp[i][0] = dp[i][1] = 0;
// for (const auto& e : a) dp[e][0] = dp[e][1] = 1;
// // REP(i, k + 1) { cout << i << " " << dp[i][0] << " " << dp[i][1] << endl;
// }
cout << (rec(k, 0) ? "First" : "Second") << endl;
// REP(i, k + 1) { cout << "i: " << dp[i][0] << " " << dp[i][1] << endl; }
}
| #include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007 // 1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool> vecbool;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<string> vecstr;
typedef vector<vecint> vec2int;
typedef vector<vecbool> vec2bool;
int dx[4]{-1, +1, 0, 0};
int dy[4]{0, 0, -1, +1};
void init() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15);
}
vecint a;
vec2int dp;
int n, k;
bool rec(int p, int q) {
// if (p <= 0) return false;
if (dp[p][q] != -1)
return dp[p][q] == 1 ? true : false;
int r = 0;
if (q == 0)
r = 1;
REP(i, n) {
if (p >= a[i]) {
if (!rec(p - a[i], r)) {
dp[p][q] = 1;
return true;
}
}
}
dp[p][q] = 0;
return false;
}
int main() {
init();
cin >> n >> k;
a.resize(n);
for (auto &e : a)
cin >> e;
dp = vector<vector<int>>(k + 1, vecint(2, -1));
// REP(i, a[0]) dp[i][0] = dp[i][1] = 0;
// for (const auto& e : a) dp[e][0] = dp[e][1] = 1;
// // REP(i, k + 1) { cout << i << " " << dp[i][0] << " " << dp[i][1] << endl;
// }
cout << (rec(k, 0) ? "First" : "Second") << endl;
// REP(i, k + 1) { cout << "i: " << dp[i][0] << " " << dp[i][1] << endl; }
}
| [
"misc.opposites",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 978,592 | 978,593 | u138062788 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int n, k, A[200000], dp[200000];
cin >> n >> k;
rep(i, n) cin >> A[i];
dp[0] = 2;
rep(i, n) {
int z = 0;
rep(j, n) if (dp[i + 1 - A[j]] != 2) z++;
if (z == n)
dp[i + 1] = 2;
else
dp[i + 1] = 1;
}
if (dp[n] == 1)
cout << "First";
else
cout << "Second";
} | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
int n, k, A[200000], dp[200000];
cin >> n >> k;
rep(i, n) cin >> A[i];
dp[0] = 2;
rep(i, k) {
int z = 0;
rep(j, n) if (dp[i + 1 - A[j]] != 2) z++;
if (z == n)
dp[i + 1] = 2;
else
dp[i + 1] = 1;
}
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
} | [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 978,596 | 978,597 | u441296840 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
#define mp make_pair
#define pb push_back
#define ii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define vl vector<vector<ll>>
#define eb emplace_back
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> dp(k + 1, false);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (a[j] <= i && !dp[i - a[j]]) {
dp[i - a[j]] = true;
}
}
}
if (dp[k]) {
cout << "First";
} else {
cout << "Second";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
#define mp make_pair
#define pb push_back
#define ii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define vl vector<vector<ll>>
#define eb emplace_back
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> dp(k + 1, false);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (a[j] <= i && !dp[i - a[j]]) {
dp[i] = true;
}
}
}
if (dp[k]) {
cout << "First";
} else {
cout << "Second";
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 978,600 | 978,601 | u416354178 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
#define mp make_pair
#define pb push_back
#define ii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define vl vector<vector<ll>>
#define eb emplace_back
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> dp(k + 1, false);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (a[j] <= i && !dp[i - a[j]]) {
dp[i - j] = true;
}
}
}
if (dp[k]) {
cout << "First";
} else {
cout << "Second";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
#define mp make_pair
#define pb push_back
#define ii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define vl vector<vector<ll>>
#define eb emplace_back
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> dp(k + 1, false);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (a[j] <= i && !dp[i - a[j]]) {
dp[i] = true;
}
}
}
if (dp[k]) {
cout << "First";
} else {
cout << "Second";
}
return 0;
}
| [
"expression.operation.binary.remove"
] | 978,602 | 978,601 | u416354178 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
#define mp make_pair
#define pb push_back
#define ii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define vl vector<vector<ll>>
#define eb emplace_back
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> dp(k + 1, false);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (a[j] <= i && !dp[i - j]) {
dp[i - j] = true;
}
}
}
if (dp[k]) {
cout << "First";
} else {
cout << "Second";
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
#define mp make_pair
#define pb push_back
#define ii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define vl vector<vector<ll>>
#define eb emplace_back
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> dp(k + 1, false);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (a[j] <= i && !dp[i - a[j]]) {
dp[i] = true;
}
}
}
if (dp[k]) {
cout << "First";
} else {
cout << "Second";
}
return 0;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 978,603 | 978,601 | u416354178 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k;
cin >> n >> k;
vector<int> a(n), dp(k + 1, 0);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i <= k; ++i) {
for (auto j : a) {
if (j >= i && !dp[i - j])
dp[i] = 1;
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << "
// ms\n" ;
return 0;
} | #include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k;
cin >> n >> k;
vector<int> a(n), dp(k + 1, 0);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
for (int i = 0; i <= k; ++i) {
for (auto j : a) {
if (i >= j && !dp[i - j])
dp[i] = 1;
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << "
// ms\n" ;
return 0;
} | [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"control_flow.branch.if.condition.change"
] | 978,604 | 978,605 | u167683777 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0); \
cin.exceptions(cin.failbit);
#define int long long int // Comment when Unnecessary
#define ll long long
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define pii pair<int, int>
#define vi vector<int>
#define F first
#define S second
#define endl "\n" // Remove on Interactive
const int N = 300009;
const int mod = 1000000007;
int32_t main() {
IOS;
int n, k;
cin >> n >> k;
vi a(n);
rep(i, 0, n) { cin >> a[i]; }
vector<bool> dp(n, false);
rep(i, 1, k + 1) {
trav(it, a) {
if ((i - it) >= 0) {
if (dp[i - it] == false)
dp[i] = true;
}
}
}
if (dp[k]) {
cout << "First\n";
} else {
cout << "Second\n";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0); \
cin.exceptions(cin.failbit);
#define int long long int // Comment when Unnecessary
#define ll long long
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define pii pair<int, int>
#define vi vector<int>
#define F first
#define S second
#define endl "\n" // Remove on Interactive
const int N = 300009;
const int mod = 1000000007;
int32_t main() {
IOS;
int n, k;
cin >> n >> k;
vi a(n);
rep(i, 0, n) { cin >> a[i]; }
vector<bool> dp(k + 1, false);
rep(i, 1, k + 1) {
trav(it, a) {
if ((i - it) >= 0) {
if (dp[i - it] == false)
dp[i] = true;
}
}
}
if (dp[k]) {
cout << "First\n";
} else {
cout << "Second\n";
}
return 0;
} | [
"assignment.change"
] | 978,610 | 978,611 | u167282925 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, k, n, imin = 0;
int minn = INT_MAX;
int maxx = INT_MIN;
cin >> n >> k;
int dp[k + 1];
int arr[n];
for (i = 0; i <= k; i++) {
dp[i] = 1;
}
for (i = 0; i < n; i++) {
cin >> arr[i];
if (arr[i] < minn) {
imin = i;
minn = arr[i];
}
dp[arr[i]] = 0;
}
for (i = imin + 1; i <= k; i++) {
if (dp[i] != 0) {
for (j = 0; j < n; j++) {
if (arr[j] >= i && dp[i - arr[j]] == 1) {
dp[i] = 0;
break;
}
}
}
}
if (dp[k] == 0) {
cout << "First";
} else {
cout << "Second";
}
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, j, k, n, imin = 0;
int minn = INT_MAX;
int maxx = INT_MIN;
cin >> n >> k;
int dp[k + 1];
int arr[n];
for (i = 0; i <= k; i++) {
dp[i] = 1;
}
for (i = 0; i < n; i++) {
cin >> arr[i];
if (arr[i] < minn) {
imin = i;
minn = arr[i];
}
dp[arr[i]] = 0;
}
for (i = imin + 1; i <= k; i++) {
if (dp[i] != 0) {
for (j = 0; j < n; j++) {
if (i >= arr[j] && dp[i - arr[j]] == 1) {
dp[i] = 0;
break;
}
}
}
}
if (dp[k] == 0) {
cout << "First";
} else {
cout << "Second";
}
} | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove"
] | 978,615 | 978,616 | u531129785 | cpp |
p03170 | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define endl '\n'
#define N 200005
ll a[N], dp[N], n, k;
int main() {
ios_base::sync_with_stdio(false), cin.tie(NULL);
cin >> n >> k;
for (ll i = 1; i <= n; i++)
cin >> a[i];
for (ll i = 1; i <= k; i++) {
for (ll j = 1; j <= n; j++) {
if (j >= a[i] && dp[j - a[i]] == 0)
dp[j] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define endl '\n'
#define N 200005
ll a[N], dp[N], n, k;
int main() {
ios_base::sync_with_stdio(false), cin.tie(NULL);
cin >> n >> k;
for (ll i = 1; i <= n; i++)
cin >> a[i];
for (ll i = 1; i <= k; i++) {
for (ll j = 1; j <= n; j++) {
if (i >= a[j] && dp[i - a[j]] == 0)
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| [
"identifier.change",
"control_flow.branch.if.condition.change",
"variable_access.subscript.index.change",
"assignment.variable.change"
] | 978,617 | 978,618 | u822543121 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
bool dp[k + 1];
memset(dp, false, sizeof(dp));
for (int i = 1; i < k + 1; i++) {
for (int j = 0; j < n; j++) {
if (i == arr[j]) {
dp[i] = true;
break;
}
if ((i - arr[j] > -1) && (i - arr[j] == false)) {
dp[i] = true;
break;
}
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
} | #include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
bool dp[k + 1];
memset(dp, false, sizeof(dp));
for (int i = 1; i < k + 1; i++) {
for (int j = 0; j < n; j++) {
if (i == arr[j]) {
dp[i] = true;
break;
}
// if(j == 1) cout << i << arr[j]<<endl;
if ((i - arr[j] >= 0) && (dp[i - arr[j]] == false)) {
dp[i] = true;
break;
}
}
}
// for(int i = 0; i < k+1; i++) cout << dp[i] << endl;
if (dp[k])
cout << "First";
else
cout << "Second";
} | [
"control_flow.loop.for.condition.change",
"control_flow.branch.if.condition.change"
] | 978,623 | 978,624 | u227478170 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> P;
typedef long long ll;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define FOR(i, n) for (int i = 0; i < n; i++)
#define all(s) s.begin(), s.end()
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const int INF = 1e18;
signed main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, k, dp[100101];
string f = "First", s = "Second";
cin >> n >> k;
vector<int> a(n);
rep(i, 0, n) { cin >> a[i]; }
rep(i, 0, k + 1) {
if (dp[i]) {
continue;
}
rep(j, 0, n) {
if (i + a[j] <= k) {
dp[i + a[j]] = 1;
}
}
}
if (dp[k]) {
cout << f << "\n";
} else {
cout << s << "\n";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> P;
typedef long long ll;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define FOR(i, n) for (int i = 0; i < n; i++)
#define all(s) s.begin(), s.end()
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const int INF = 1e18;
signed main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, k, dp[100101] = {};
string f = "First", s = "Second";
cin >> n >> k;
vector<int> a(n);
rep(i, 0, n) { cin >> a[i]; }
rep(i, 0, k + 1) {
if (dp[i]) {
continue;
}
rep(j, 0, n) {
if (i + a[j] <= k) {
dp[i + a[j]] = 1;
}
}
}
if (dp[k]) {
cout << f << "\n";
} else {
cout << s << "\n";
}
return 0;
} | [
"variable_declaration.value.change"
] | 978,625 | 978,626 | u885523920 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n];
int i;
for (i = 0; i < n; i++)
cin >> a[i];
int dp[n + 1];
memset(dp, 0, sizeof(dp));
for (i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j] && dp[i - a[j]] == 0)
dp[i] = 1;
}
}
cout << (dp[k] == 1 ? "First" : "Second") << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n];
int i;
for (i = 0; i < n; i++)
cin >> a[i];
int dp[k + 1];
memset(dp, 0, sizeof(dp));
for (i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j] && dp[i - a[j]] == 0)
dp[i] = 1;
}
}
cout << (dp[k] == 1 ? "First" : "Second") << endl;
return 0;
}
| [
"identifier.change",
"expression.operation.binary.change"
] | 978,627 | 978,628 | u931624197 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
int main() {
fastio;
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int dp[k + 1] = {0};
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[i] && dp[i - a[i]] == 0)
dp[i] = 1;
}
}
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
int main() {
fastio;
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int dp[k + 1] = {0};
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= a[j] && dp[i - a[j]] == 0)
dp[i] = 1;
}
}
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
return 0;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 978,629 | 978,630 | u719855312 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int dp[n + 1] = {0};
for (int i = 1; i <= k; i++)
for (int j = 0; j < n; j++) {
if (i - a[j] < 0)
continue;
else if (dp[i - a[j]] == 0)
dp[i] = 1;
}
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int dp[k + 1] = {0};
for (int i = 1; i <= k; i++)
for (int j = 0; j < n; j++) {
if (i - a[j] < 0)
continue;
else if (dp[i - a[j]] == 0)
dp[i] = 1;
}
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
return 0;
}
| [
"identifier.change",
"expression.operation.binary.change"
] | 978,631 | 978,632 | u647025182 | cpp |
p03170 | // stay hungry, stay foolish
//#include <iostream>
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define loopi(stop) for (int i = 0; i < stop; i++)
#define loopj(stop2) for (int j = 0; j < stop2; j++)
#define loopk(stop3) for (int k = 0; k < stop3; k++)
#define loopi1(stop) for (int i = 1; i <= stop; i++)
#define loopj1(stop2) for (int j = 1; j <= stop2; j++)
#define loopk1(stop3) for (int k = 1; k <= stop3; k++)
#define loopse(kt, sstart, eend) for (int kt = sstart; kt < eend; kt++)
#define faster_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define file_io_cf \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
#define p_b push_back
#define pii pair<int, int>
#define fi first
#define se second
#define prec_10 << fixed << setprecision(10)
#define DEB cout << "DEBUG" << '\n';
#define SRAND srand(time(0));
#define rev_comp greater<int>()
using namespace std;
template <typename T> void O(T x) { cout << x << '\n'; }
int dp[100005];
int n;
int least = 10000000000;
int arr[100005];
/////////////////////////////////////////////////////////////////////////////////////////////////////
int go(int k) {
if (k == 0) {
return 0;
}
if (dp[k] != -1) {
return dp[k];
}
loopi(n) {
if (arr[i] > k) {
continue;
}
if (go(k - arr[i]) == 1) {
dp[k] = 1;
return 1;
}
}
dp[k] = 0;
return dp[k];
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
int32_t main() {
faster_io
// file_io_cf
loopj(100005) {
dp[j] = -1;
}
int k;
cin >> n >> k;
loopi(n) {
cin >> arr[i];
least = min(least, arr[i]);
}
if (go(k) == 1) {
O("First");
} else {
O("Second");
}
return 0;
}
| // stay hungry, stay foolish
//#include <iostream>
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define loopi(stop) for (int i = 0; i < stop; i++)
#define loopj(stop2) for (int j = 0; j < stop2; j++)
#define loopk(stop3) for (int k = 0; k < stop3; k++)
#define loopi1(stop) for (int i = 1; i <= stop; i++)
#define loopj1(stop2) for (int j = 1; j <= stop2; j++)
#define loopk1(stop3) for (int k = 1; k <= stop3; k++)
#define loopse(kt, sstart, eend) for (int kt = sstart; kt < eend; kt++)
#define faster_io \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define file_io_cf \
freopen("input.txt", "r", stdin); \
freopen("output.txt", "w", stdout);
#define p_b push_back
#define pii pair<int, int>
#define fi first
#define se second
#define prec_10 << fixed << setprecision(10)
#define DEB cout << "DEBUG" << '\n';
#define SRAND srand(time(0));
#define rev_comp greater<int>()
using namespace std;
template <typename T> void O(T x) { cout << x << '\n'; }
int dp[100005];
int n;
int least = 10000000000;
int arr[100005];
/////////////////////////////////////////////////////////////////////////////////////////////////////
int go(int k) {
if (k == 0) {
return 0;
}
if (dp[k] != -1) {
return dp[k];
}
loopi(n) {
if (arr[i] > k) {
continue;
}
if (go(k - arr[i]) == 0) {
dp[k] = 1;
return 1;
}
}
dp[k] = 0;
return dp[k];
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
int32_t main() {
faster_io
// file_io_cf
loopj(100005) {
dp[j] = -1;
}
int k;
cin >> n >> k;
loopi(n) {
cin >> arr[i];
least = min(least, arr[i]);
}
if (go(k) == 1) {
O("First");
} else {
O("Second");
}
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change"
] | 978,645 | 978,646 | u532629518 | cpp |
p03170 | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const ll mod = 1e9 + 7;
const int inf = 1 << 30;
bool dp[110];
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) cin >> a[i];
rep(i, k + 1) {
rep(j, n) {
if (i - a[j] >= 0)
dp[i] |= (!dp[i - a[j]]);
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const ll mod = 1e9 + 7;
const int inf = 1 << 30;
bool dp[100010];
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) cin >> a[i];
rep(i, k + 1) {
rep(j, n) {
if (i - a[j] >= 0)
dp[i] |= (!dp[i - a[j]]);
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,649 | 978,650 | u136342563 | cpp |
p03170 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
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 <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
fill((T *)array, (T *)(array + N), val);
}
struct io {
io() {
ios::sync_with_stdio(false);
cin.tie(0);
}
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
int main(void) {
int N, K;
cin >> N >> K;
bool dp
[K]; // K個の時先手が行動して勝てるか?,初期値はfalseなのでこのままでいい
vi a(N);
rep(i, N) cin >> a[i];
dp[0] = false; // 0個のとき先手はもう取れないのでfalse
rrep(i, K) {
rep(j, N) {
if (i - a[j] >= 0) {
//今の山の数からこちらの手番で相手をgrundy数0の状態に持って行けたなら
dp[i] |= !dp[i - a[j]];
}
}
}
if (dp[K])
fin("First");
else
fin("Second");
} | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
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 <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
fill((T *)array, (T *)(array + N), val);
}
struct io {
io() {
ios::sync_with_stdio(false);
cin.tie(0);
}
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
int main(void) {
int N, K;
cin >> N >> K;
bool dp
[110000]; // K個の時先手が行動して勝てるか?,初期値はfalseなのでこのままでいい
vi a(N);
rep(i, N) cin >> a[i];
dp[0] = false; // 0個のとき先手はもう取れないのでfalse
rrep(i, K) {
rep(j, N) {
if (i - a[j] >= 0) {
//今の山の数からこちらの手番で相手をgrundy数0の状態に持って行けたなら
dp[i] |=
!dp[i -
a[j]]; // dp[i-a[j]]の中に一つでもfalseがあれば反転してtrue、|= falseは何もしないのでfalse,true、falseでもtrueになる
}
}
}
if (dp[K])
fin("First");
else
fin("Second");
} | [
"identifier.replace.remove",
"literal.replace.add",
"variable_declaration.array_dimensions.change"
] | 978,656 | 978,657 | u484274300 | cpp |
p03170 | // Date: 2020-03-13
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define FIO \
ios::sync_with_stdio(false); \
cin.tie(0)
#define rep(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for (int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {
LL a = 1;
while (y) {
if (y & 1)
a = a * x % MOD;
x = x * x % MOD;
y >>= 1;
}
return a;
}
int a[N], dp[N];
int main() {
FIO;
int n, k;
cin >> n >> k;
rep(i, 1, n) cin >> a[i];
rep(i, 0, k) if (!dp[i]) rep(j, 1, n) dp[i + a[j]] = 1;
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
} | // Date: 2020-03-13
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define FIO \
ios::sync_with_stdio(false); \
cin.tie(0)
#define rep(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for (int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {
LL a = 1;
while (y) {
if (y & 1)
a = a * x % MOD;
x = x * x % MOD;
y >>= 1;
}
return a;
}
int a[N], dp[N];
int main() {
FIO;
int n, k;
cin >> n >> k;
rep(i, 1, n) cin >> a[i];
rep(i, 0, k) if (!dp[i]) rep(j, 1, n) dp[i + a[j]] = 1;
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
}
| [
"literal.number.change",
"expression.operation.binary.change"
] | 978,658 | 978,659 | u896441219 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
bool dp[100005] = {};
int main() {
int n, k;
scanf("%d%d.0", &n, &k);
vector<int> arr(n);
for (int &x : arr)
scanf("%d", &x);
sort(arr.begin(), arr.end());
// dp[i] - true if first one wins after moving optimally
for (int stones = 0; stones < k; stones++) {
for (int i = 0; i < n; i++)
if (arr[i] + stones <= k && !dp[stones])
dp[stones + arr[i]] = true;
}
if (dp[k])
printf("first\n");
else
printf("second\n");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define ll long long
bool dp[100005] = {};
int main() {
int n, k;
scanf("%d%d.0", &n, &k);
vector<int> arr(n);
for (int &x : arr)
scanf("%d", &x);
sort(arr.begin(), arr.end());
// dp[i] - true if first one wins after moving optimally
for (int stones = 0; stones < k; stones++) {
for (int i = 0; i < n; i++)
if (arr[i] + stones <= k && !dp[stones])
dp[stones + arr[i]] = true;
}
if (dp[k])
printf("First\n");
else
printf("Second\n");
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 978,660 | 978,661 | u645596292 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int n, k, dp[105][2];
int a[105];
bool dfs(int k, int t) {
if (dp[k][t] >= 0)
return dp[k][t];
int ans = 0;
for (int i = 1; i <= n; i++)
if (k >= a[i])
ans |= !dfs(k - a[i], !t);
return dp[k][t] = ans;
}
int main() {
memset(dp, -1, sizeof(dp));
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
if (dfs(k, 0))
puts("First");
else
puts("Second");
} | #include <bits/stdc++.h>
using namespace std;
int n, k, dp[1000005][2];
int a[10000005];
bool dfs(int k, int t) {
if (dp[k][t] >= 0)
return dp[k][t];
int ans = 0;
for (int i = 1; i <= n; i++)
if (k >= a[i])
ans |= !dfs(k - a[i], !t);
return dp[k][t] = ans;
}
int main() {
memset(dp, -1, sizeof(dp));
scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
if (dfs(k, 0))
puts("First");
else
puts("Second");
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,667 | 978,668 | u891911133 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef int in;
in a[105], n, k, mik, dp[10000005];
in fun(in k) {
if (k < mik)
return 1;
for (in i = 0; i < n; ++i)
if (k - a[i] >= 0) {
if (dp[k - a[i]] == -1) {
dp[k - a[i]] = fun(k - a[i]);
}
if (dp[k - a[i]] == 2)
return 1;
}
return 2;
}
int main() {
in i;
cin >> n >> k;
for (i = 0; i < 10000005; ++i)
dp[i] = -1;
for (i = 0; i < n; ++i) {
cin >> a[i];
mik = min(mik, a[i]);
dp[a[i]] = 1;
}
in val = fun(k);
if (val == 1)
cout << "first";
else
cout << "second";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
typedef int in;
in a[105], n, k, mik, dp[10000005];
in fun(in k) {
if (k < mik)
return 1;
for (in i = 0; i < n; ++i)
if (k - a[i] >= 0) {
if (dp[k - a[i]] == -1) {
dp[k - a[i]] = fun(k - a[i]);
}
if (dp[k - a[i]] == 2)
return 1;
}
return 2;
}
int main() {
in i;
cin >> n >> k;
for (i = 0; i < 10000005; ++i)
dp[i] = -1;
for (i = 0; i < n; ++i) {
cin >> a[i];
mik = min(mik, a[i]);
dp[a[i]] = 1;
}
in val = fun(k);
if (val == 1)
cout << "First";
else
cout << "Second";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,677 | 978,678 | u371767259 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll long long
#define fop(i, m, n) for (ll i = m; i < n; i++)
using namespace std;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> v;
fop(i, 0, n) {
ll x;
cin >> x;
v.push_back(x);
}
bool win[k + 1] = {};
fop(i, 1, k + 1) {
fop(j, 0, n) {
if (i >= v[j] && !win[i - v[j]]) {
win[i] = true;
break;
}
}
}
if (win[k])
cout << "first";
else
cout << "second";
} | #include <bits/stdc++.h>
#define ll long long
#define fop(i, m, n) for (ll i = m; i < n; i++)
using namespace std;
int main() {
ll n, k;
cin >> n >> k;
vector<ll> v;
fop(i, 0, n) {
ll x;
cin >> x;
v.push_back(x);
}
bool win[k + 1] = {};
fop(i, 1, k + 1) {
fop(j, 0, n) {
if (i >= v[j] && !win[i - v[j]]) {
win[i] = true;
break;
}
}
}
if (win[k])
cout << "First";
else
cout << "Second";
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,681 | 978,682 | u494192771 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <typename T> T pow(T a, int b) {
return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1;
}
const int mod = 10;
ll modpow(ll a, int b) {
return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
rep(i, sz(v)) {
if (i)
os << " ";
os << v[i];
}
return os;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << p.F << " " << p.S;
return os;
}
inline int add(int a, int b) {
a += b;
if (a >= mod)
return a - mod;
return a;
}
void solve();
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T;
// cin >> T;
T = 1;
while (T--) {
solve();
}
}
void solve() {
int n, m;
cin >> n >> m;
vector<int> a(n);
rep(i, n) cin >> a[i];
sort(all(a));
vector<int> dp(n + 1); // 0, 負け
rep3(i, 1, m + 1) {
rep(j, n) {
if (i - a[j] < 0)
break;
if (dp[i - a[j]] == 0) {
dp[i] = 1;
break;
}
}
}
cout << (dp[m] ? "First" : "Second") << endl;
// rep(i, m + 1) cout << dp[i] << " "; cout << endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T> T gcd(T a, T b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <typename T> T pow(T a, int b) {
return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1;
}
const int mod = 10;
ll modpow(ll a, int b) {
return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
rep(i, sz(v)) {
if (i)
os << " ";
os << v[i];
}
return os;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << p.F << " " << p.S;
return os;
}
inline int add(int a, int b) {
a += b;
if (a >= mod)
return a - mod;
return a;
}
void solve();
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T;
// cin >> T;
T = 1;
while (T--) {
solve();
}
}
void solve() {
int n, m;
cin >> n >> m;
vector<int> a(n);
rep(i, n) cin >> a[i];
sort(all(a));
vector<int> dp(m + 1); // 0, 負け
rep3(i, 1, m + 1) {
rep(j, n) {
if (i - a[j] < 0)
break;
if (dp[i - a[j]] == 0) {
dp[i] = 1;
break;
}
}
}
cout << (dp[m] ? "First" : "Second") << endl;
// rep(i, m + 1) cout << dp[i] << " "; cout << endl;
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,689 | 978,690 | u277556971 | cpp |
p03170 | #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800 / 2
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr double dabs(double a, double b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
bool issame(int x, int y) { return root(x) == root(y); }
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
// グラフセット
struct Edge {
ll to; // 辺の行き先
ll weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// std::setprecision(30)<<ans<<endl;
int main() {
ll N, M;
cin >> N >> M;
ll p[N];
FOR(i, 0, N - 1) { cin >> p[i]; }
ll dp[M + 1];
dp[0] = 1;
FOR(i, 1, M) {
ll ct = 0;
FOR(j, 0, N - 1) {
if (i >= p[j]) {
if (dp[i - p[j]] == 0) {
ct++;
}
}
}
if (ct > 0)
dp[i] = 1;
else {
dp[i] = 0;
}
}
FOR(i, 0, M) {
// cout << dp[i];
}
if (dp[M] == 1) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
return 0;
}
| #include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800 / 2
#define ALL(a) (a).begin(), (a).end()
#include <cmath>
#include <iostream>
using namespace std;
bool isPrimeNum(ll x) { // 素数である場合 true を返す
if (x <= 1) { // 1以下である場合は素数でないことがすぐにわかる
return false;
}
// sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
int n = (int)sqrt((double)x);
for (int i = 2; i <= n; i++) {
if (x % i == 0) { // 割り切る整数がある場合、即判定終了
return false;
}
}
return true; // 割り切る整数がない場合、素数である
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr double dabs(double a, double b) {
if (a >= b)
return a - b;
if (a < b)
return b - a;
}
constexpr ll min(ll a, ll b) {
if (a >= b)
return b;
if (a < b)
return a;
}
constexpr ll max(ll a, ll b) {
if (a >= b)
return a;
if (a < b)
return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
class UnionFind {
public:
//親の番号を格納する。親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値を全て-1にする
//こうすると全てバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親をとってきたい]
}
bool issame(int x, int y) { return root(x) == root(y); }
// AとBをくっ付ける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらひっくり返しちゃう。
if (size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
long long fac[510000], finv[510000], inv[510000];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < 510000; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
u %= m;
if (u < 0)
u += m;
return u;
}
void yn(bool flag) {
if (flag) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return;
}
void YN(bool flag) {
if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return;
}
std::vector<ll> enum_div(ll n) // nの約数を列挙
{
std::vector<ll> ret;
for (ll i = 1; i * i <= n; ++i) {
if (n % i == 0) {
ret.push_back(i);
if (i != 1 && i * i != n) {
ret.push_back(n / i);
}
}
}
ret.push_back(n);
return ret;
}
// グラフセット
struct Edge {
ll to; // 辺の行き先
ll weight; // 辺の重み
Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// std::setprecision(30)<<ans<<endl;
int main() {
ll N, M;
cin >> N >> M;
ll p[N];
FOR(i, 0, N - 1) { cin >> p[i]; }
ll dp[M + 1];
dp[0] = 1;
FOR(i, 1, M) {
ll ct = 0;
FOR(j, 0, N - 1) {
if (i >= p[j]) {
if (dp[i - p[j]] == 1) {
ct++;
}
}
}
if (ct == 0)
dp[i] = 1;
else {
dp[i] = 0;
}
}
FOR(i, 0, M) {
// cout << dp[i];
}
if (dp[M] == 1) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
return 0;
}
| [
"literal.number.change",
"control_flow.branch.if.condition.change",
"expression.operator.compare.change"
] | 978,697 | 978,698 | u043443359 | cpp |
p03170 | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define pb push_back
#define ins insert
#define pob pop_back
#define er erase
#define emp empty
#define f first
#define s second
#define ff f.f
#define fs f.s
#define sf s.f
#define ss s.s
#define var auto
using namespace std;
template <typename T> using s = set<T>;
template <typename T> using v = vector<T>;
template <typename T1, typename T2> using p = pair<T1, T2>;
typedef long long ll;
typedef p<int, int> pii;
typedef v<int> vi;
typedef v<pii> vpii;
typedef s<int> si;
typedef s<pii> spii;
const int Max = 4e3 + 100;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
int n, k;
bool dp[Max];
ll A[Max];
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> A[i];
// He Cant Do Any Move So Lose
dp[0] = false;
for (int i = 1; i <= k; i++) {
bool foundLoose = false;
for (var s : A) {
if (s == 0)
break;
if (i >= s) {
foundLoose = !dp[i - s];
}
if (foundLoose)
break;
}
dp[i] = foundLoose;
}
if (dp[k])
cout << "First";
else
cout << "Second";
} | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define pb push_back
#define ins insert
#define pob pop_back
#define er erase
#define emp empty
#define f first
#define s second
#define ff f.f
#define fs f.s
#define sf s.f
#define ss s.s
#define var auto
using namespace std;
template <typename T> using s = set<T>;
template <typename T> using v = vector<T>;
template <typename T1, typename T2> using p = pair<T1, T2>;
typedef long long ll;
typedef p<int, int> pii;
typedef v<int> vi;
typedef v<pii> vpii;
typedef s<int> si;
typedef s<pii> spii;
const int Max = 1e5 + 100;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
int n, k;
bool dp[Max];
ll A[Max];
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> A[i];
// He Cant Do Any Move So Lose
dp[0] = false;
for (int i = 1; i <= k; i++) {
bool foundLoose = false;
for (var s : A) {
if (s == 0)
break;
if (i >= s) {
foundLoose = !dp[i - s];
}
if (foundLoose)
break;
}
dp[i] = foundLoose;
}
if (dp[k])
cout << "First";
else
cout << "Second";
}
| [
"literal.number.change",
"expression.operation.binary.change"
] | 978,699 | 978,700 | u979412452 | cpp |
p03170 |
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int b[k + 1] = {0};
for (int i = 1; i < k + 1; i++) {
for (int j = 0; j < i; j++) {
if (a[j] <= i) {
if (b[i - a[j]] == 0) {
b[i] = 1;
break;
}
}
}
}
if (b[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
|
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int b[k + 1] = {0};
for (int i = 1; i < k + 1; i++) {
for (int j = 0; j < n; j++) {
if (a[j] <= i) {
if (b[i - a[j]] == 0) {
b[i] = 1;
break;
}
}
}
}
if (b[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
| [
"identifier.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 978,701 | 978,702 | u990119031 | cpp |
p03170 | #include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>
#include <vector>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int N, K;
int main() {
int i, j, k;
vector<bool> dp(100010, false);
int a[105];
int MIN = 9999999;
int n;
cin >> N >> K;
rep(i, 0, N - 1) { cin >> a[i]; }
rep(i, 0, K) {
rep(j, 0, N - 1) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == false) {
dp[i - a[j]] = true;
}
}
}
}
if (dp[K] == false) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
} | #include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>
#include <vector>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int N, K;
int main() {
int i, j, k;
vector<bool> dp(100010, false);
int a[105];
int MIN = 9999999;
int n;
cin >> N >> K;
rep(i, 0, N - 1) { cin >> a[i]; }
rep(i, 0, K) {
rep(j, 0, N - 1) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == false) {
dp[i] = true;
}
}
}
}
if (dp[K] == false) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
} | [
"expression.operation.binary.remove"
] | 978,708 | 978,709 | u880221923 | cpp |
p03170 | #include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>
#include <vector>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int N, K;
int main() {
int i, j, k;
vector<bool> dp(100010, false);
int a[105];
int MIN = 9999999;
int n;
cin >> N >> K;
rep(i, 0, N - 1) { cin >> a[i]; }
rep(i, 0, K) {
rep(j, 0, N - 1) {
if (i - a[j] > 0) {
if (dp[i - a[j]] == false) {
dp[i - a[j]] = true;
}
}
}
}
if (dp[K] == false) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
} | #include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>
#include <vector>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int N, K;
int main() {
int i, j, k;
vector<bool> dp(100010, false);
int a[105];
int MIN = 9999999;
int n;
cin >> N >> K;
rep(i, 0, N - 1) { cin >> a[i]; }
rep(i, 0, K) {
rep(j, 0, N - 1) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == false) {
dp[i] = true;
}
}
}
}
if (dp[K] == false) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.binary.remove"
] | 978,710 | 978,709 | u880221923 | cpp |
p03170 | #include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>
#include <vector>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int N, K;
int main() {
int i, j, k;
vector<int> dp(100010, -1);
int a[105];
int MIN = 9999999;
cin >> N >> K;
rep(i, 0, N - 1) { cin >> a[i]; }
rep(i, 0, K) {
rep(j, 0, N - 1) {
if (dp[i] == -1) {
dp[i + a[j]] = 1;
}
}
}
if (dp[K] == -1) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
} | #include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>
#include <vector>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int N, K;
int main() {
int i, j, k;
vector<int> dp(200010, -1);
int a[105];
int MIN = 9999999;
int n;
cin >> N >> K;
rep(i, 0, N - 1) { cin >> a[i]; }
rep(i, 0, K) {
rep(j, 0, N - 1) {
if (dp[i] == -1) {
dp[i + a[j]] = 1;
}
}
}
if (dp[K] == -1) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
} | [
"literal.number.change",
"call.arguments.change",
"variable_declaration.add"
] | 978,711 | 978,712 | u880221923 | cpp |
p03170 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = (0); i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(), (x).end()
#define rrng(x) (x).rbegin(), (x).rend()
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x, y) \
cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x, y, z) \
cout << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z \
<< " = " << (z) << endl
#define showv(v) \
rep(i, v.size()) printf("%d%c", v[i], i == v.size() - 1 ? '\n' : ' ')
#define showv2(v) rep(j, v.size()) showv(v[j])
#define showt(t, n) rep(i, n) printf("%d%c", t[i], i == n - 1 ? '\n' : ' ')
#define showt2(t, r, c) rep(j, r) showt(t[j], c)
#define showvp(p) rep(i, p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i, v.size()) printf("%d\n", v[i])
#define printt(t, n) rep(i, n) printf("%d\n", t[i])
#define incl(v, x) find(rng(v), x) != v.end()
#define incls(s, c) s.find(c) != string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)), x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<string>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1 << 30) - 1;
const ll INFLL = (1LL << 62) - 1;
#define dame \
{ \
puts("No"); \
return 0; \
}
#define yn \
{ puts("Yes"); } \
else { \
puts("No"); \
}
inline int in() {
int x;
scanf("%d", &x);
return x;
}
template <typename T> inline ll suma(const v(T) & a) {
ll res(0);
for (auto &&x : a)
res += x;
return res;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
bool dp[11000];
int main() {
int n, k;
cin >> n >> k;
vi a(n);
rep(i, n) 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]];
}
}
if (dp[k])
puts("First");
else
puts("Second");
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = (0); i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(), (x).end()
#define rrng(x) (x).rbegin(), (x).rend()
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x, y) \
cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x, y, z) \
cout << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z \
<< " = " << (z) << endl
#define showv(v) \
rep(i, v.size()) printf("%d%c", v[i], i == v.size() - 1 ? '\n' : ' ')
#define showv2(v) rep(j, v.size()) showv(v[j])
#define showt(t, n) rep(i, n) printf("%d%c", t[i], i == n - 1 ? '\n' : ' ')
#define showt2(t, r, c) rep(j, r) showt(t[j], c)
#define showvp(p) rep(i, p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i, v.size()) printf("%d\n", v[i])
#define printt(t, n) rep(i, n) printf("%d\n", t[i])
#define incl(v, x) find(rng(v), x) != v.end()
#define incls(s, c) s.find(c) != string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)), x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<string>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1 << 30) - 1;
const ll INFLL = (1LL << 62) - 1;
#define dame \
{ \
puts("No"); \
return 0; \
}
#define yn \
{ puts("Yes"); } \
else { \
puts("No"); \
}
inline int in() {
int x;
scanf("%d", &x);
return x;
}
template <typename T> inline ll suma(const v(T) & a) {
ll res(0);
for (auto &&x : a)
res += x;
return res;
}
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
bool dp[110000];
int main() {
int n, k;
cin >> n >> k;
vi a(n);
rep(i, n) 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]];
}
}
if (dp[k])
puts("First");
else
puts("Second");
return 0;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,718 | 978,719 | u850516963 | cpp |
p03170 | #include <iostream>
using namespace std;
int A[110];
bool F[100100];
int main() {
int N, K;
cin >> N >> K;
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])
F[i] |= F[i - A[j]];
if (F[K])
puts("First");
else
puts("Second");
return 0;
} | #include <iostream>
using namespace std;
int A[110];
bool F[100100];
int main() {
int N, K;
cin >> N >> K;
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])
F[i] |= (1 - F[i - A[j]]);
if (F[K])
puts("First");
else
puts("Second");
return 0;
} | [] | 978,720 | 978,721 | u538921909 | cpp |
p03170 | #include <iostream>
using namespace std;
int n, k;
const int MAXN = 100 + 10;
const int MAXK = 100000 + 100;
int a[MAXN];
int dp[MAXK];
int main() {
cin >> n;
cin >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= n; j++) {
if (a[j] <= i) {
if (!dp[i - a[j]])
dp[i] = 1;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | #include <iostream>
using namespace std;
int n, k;
const int MAXN = 100 + 10;
const int MAXK = 100000 + 100;
int a[MAXN];
int dp[MAXK];
int main() {
cin >> n;
cin >> k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= n; j++) {
if (a[j] <= i) {
if (!dp[i - a[j]])
dp[i] = 1;
}
}
}
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",
"expression.operator.compare.change",
"control_flow.loop.for.condition.change",
"expression.operation.binary.change"
] | 978,728 | 978,729 | u803932112 | cpp |
p03170 | #include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9 + 7)
#define inf (int)(3e18)
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define P std::pair<int, int>
#define PiP std::pair<int, std::pair<int, int>>
#define all(v) v.begin(), v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T, vector<T>, greater<T>>
using namespace std;
template <class T> inline void chmax(T &a, T b) { a = std::max(a, b); }
template <class T> inline void chmin(T &a, T b) { a = std::min(a, b); }
bool prime(int x) {
for (int i = 2; i * i <= x; i++) {
if (x % i == 0)
return false;
}
return x != 1;
}
int gcd(int x, int y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
int lcm(int x, int y) { return x / gcd(x, y) * y; }
int kai(int x, int y) {
int res = 1;
for (int i = x - y + 1; i <= x; i++) {
res *= i;
res %= mod;
}
return res;
}
int mod_pow(int x, int y, int m = mod) {
int res = 1;
x %= m;
while (y > 0) {
if (y & 1) {
res = res * x % m;
}
x = x * x % m;
y >>= 1;
}
return res;
}
int comb(int x, int y) {
if (y > x)
return 0;
return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
std::random_device rnd;
std::mt19937 mt32(rnd());
std::uniform_int_distribution<int> engine(MIN, MAX);
return engine(mt32);
}
struct BIT {
vector<int> bit;
int n;
BIT(int x) {
bit.resize(x + 1, 0);
n = x;
}
void add(int x, int y) {
while (x <= n) {
bit[x] += y;
x += x & -x;
}
}
int sum(int x) {
int res = 0;
while (x > 0) {
res += bit[x];
x -= x & -x;
}
return res;
}
};
struct UnionFind {
vector<int> par, size;
UnionFind(int x) {
par.resize(x);
size.resize(x, 1);
rep(i, x) par[i] = i;
}
int find(int x) {
if (par[x] == x)
return x;
return par[x] = find(par[x]);
}
bool same(int x, int y) { return find(x) == find(y); }
int consize(int x) { return size[find(x)]; }
void unite(int x, int y) {
x = find(x), y = find(y);
if (x == y)
return;
if (size[x] < size[y]) {
par[x] = y;
size[y] += size[x];
} else {
par[y] = x;
size[x] += size[y];
}
}
};
struct Tree {
int size;
vector<int> par, depth;
vector<int> doubling[30];
vector<vector<int>> G;
int root = 0;
Tree(int x) {
par.resize(x);
depth.resize(x);
rep(i, 30) { doubling[i].resize(x, -1); }
G.resize(x);
size = x;
}
void add_edge(int x, int y) {
G[x].push_back(y);
G[y].push_back(x);
}
void dfs(int x) {
for (int i : G[x]) {
if (depth[i] == -1) {
depth[i] = depth[x] + 1;
doubling[0][i] = x;
dfs(i);
}
}
}
void init() {
rep(i, size) depth[i] = -1;
depth[root] = 0;
dfs(root);
rep(i, 29) {
rep(j, size) {
if (doubling[i][j] == -1)
doubling[i + 1][j] = -1;
else
doubling[i + 1][j] = doubling[i][doubling[i][j]];
}
}
}
int lca(int x, int y) {
if (depth[x] > depth[y])
swap(x, y);
for (int i = 29; i >= 0; i--) {
if ((depth[y] - depth[x]) >> i & 1) {
y = doubling[i][y];
}
}
if (x == y)
return x;
for (int i = 29; i >= 0; i--) {
if (doubling[i][x] != doubling[i][y]) {
x = doubling[i][x];
y = doubling[i][y];
}
}
return doubling[0][x];
}
};
struct RollingHash {
int Base = 283;
const int MASK30 = (1ll << 30) - 1;
const int MASK31 = (1ll << 31) - 1;
const int MOD = (1ll << 61) - 1;
vector<int> hash, power;
int calcmod(int val) {
val = (val & MOD) + (val >> 61);
if (val > MOD)
val -= MOD;
return val;
}
int mul(int x, int y) {
int xu = x >> 31;
int xd = x & MASK31;
int yu = y >> 31;
int yd = y & MASK31;
int mid = xd * yu + xu * yd;
int midu = mid >> 30;
int midd = mid & MASK30;
return calcmod(xu * yu * 2 + midu + (midd << 31) + xd * yd);
}
RollingHash(string s) {
// Base=get_rand(1<<7,1<<8);
int sz = s.size();
hash.resize(sz + 1, 0);
power.resize(sz + 1, 1);
rep(i, sz) {
hash[i + 1] = (mul(hash[i], Base) + s[i]) % MOD;
power[i + 1] = mul(power[i], Base) % MOD;
}
}
int get(int l, int r) {
int res = (hash[r] - mul(hash[l], power[r - l]) + MOD) % MOD;
return res;
}
int lcp(int x, int y) {
int len = min(hash.size() - y, hash.size() - x);
int ok = 0, ng = len + 1;
while (ng - ok > 1) {
int mid = (ok + ng) / 2;
if (get(x, x + mid) == get(y, y + mid))
ok = mid;
else
ng = mid;
}
return ok;
}
};
struct Segtree {
int size = 1;
vector<int> dat, lazy;
Segtree(int x) {
while (size < x)
size *= 2;
dat.resize(size * 2 - 1, inf);
lazy.resize(size * 2 - 1, inf);
}
void eval(int k, int l, int r) {
chmin(dat[k], lazy[k]);
if (r - l > 1) {
chmin(lazy[k * 2 + 1], lazy[k]);
chmin(lazy[k * 2 + 2], lazy[k]);
}
lazy[k] = inf;
}
void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
if (r == -1)
r = size;
eval(k, l, r);
if (r <= a || b <= l)
return;
if (a <= l && r <= b) {
chmin(lazy[k], x);
eval(k, l, r);
return;
}
update(a, b, x, k * 2 + 1, l, (l + r) / 2);
update(a, b, x, k * 2 + 2, (l + r) / 2, r);
dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
}
int query(int a, int k = 0, int l = 0, int r = -1) {
if (r == -1)
r = size;
eval(k, l, r);
if (r - l == 1) {
return dat[k];
}
if (a < (l + r) / 2) {
return query(a, k * 2 + 1, l, (l + r) / 2);
}
return query(a, k * 2 + 2, (l + r) / 2, r);
}
};
template <class T> vector<int> KMP(vector<T> target, vector<T> pattern) {
vector<int> table(pattern.size() + 1);
table[0] = 0;
int j = 0;
REP(i, (int)pattern.size()) {
if (pattern[i] == pattern[j]) {
table[i] = j++;
} else {
table[i] = j;
j = 0;
}
}
table[pattern.size()] = j;
j = 0;
vector<int> res;
int i = 0;
while (i < target.size()) {
if (j < pattern.size() && target[i] == pattern[j]) {
i++;
j++;
} else {
if (!j)
i++;
j = table[j];
}
if (j == pattern.size())
res.push_back(i - j);
}
return res;
}
int perm[1000005];
void init_perm() {
perm[0] = 1;
REP(i, 1000005) perm[i] = perm[i - 1] * i % mod;
}
int nCk(int x, int y) {
return perm[x] * mod_pow(perm[x - y], mod - 2) % mod *
mod_pow(perm[y], mod - 2) % mod;
}
/*--------Library Zone!--------*/
int N, K, a[105];
bool dp[100005];
signed main() {
cin >> N >> K;
rep(i, N) cin >> a[i];
rep(i, K) {
if (!dp[i]) {
rep(j, N) dp[i + a[j]] = true;
}
}
cout << (dp[K] ? "First" : "Second") << endl;
}
| #include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9 + 7)
#define inf (int)(3e18)
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define P std::pair<int, int>
#define PiP std::pair<int, std::pair<int, int>>
#define all(v) v.begin(), v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T, vector<T>, greater<T>>
using namespace std;
template <class T> inline void chmax(T &a, T b) { a = std::max(a, b); }
template <class T> inline void chmin(T &a, T b) { a = std::min(a, b); }
bool prime(int x) {
for (int i = 2; i * i <= x; i++) {
if (x % i == 0)
return false;
}
return x != 1;
}
int gcd(int x, int y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
int lcm(int x, int y) { return x / gcd(x, y) * y; }
int kai(int x, int y) {
int res = 1;
for (int i = x - y + 1; i <= x; i++) {
res *= i;
res %= mod;
}
return res;
}
int mod_pow(int x, int y, int m = mod) {
int res = 1;
x %= m;
while (y > 0) {
if (y & 1) {
res = res * x % m;
}
x = x * x % m;
y >>= 1;
}
return res;
}
int comb(int x, int y) {
if (y > x)
return 0;
return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
std::random_device rnd;
std::mt19937 mt32(rnd());
std::uniform_int_distribution<int> engine(MIN, MAX);
return engine(mt32);
}
struct BIT {
vector<int> bit;
int n;
BIT(int x) {
bit.resize(x + 1, 0);
n = x;
}
void add(int x, int y) {
while (x <= n) {
bit[x] += y;
x += x & -x;
}
}
int sum(int x) {
int res = 0;
while (x > 0) {
res += bit[x];
x -= x & -x;
}
return res;
}
};
struct UnionFind {
vector<int> par, size;
UnionFind(int x) {
par.resize(x);
size.resize(x, 1);
rep(i, x) par[i] = i;
}
int find(int x) {
if (par[x] == x)
return x;
return par[x] = find(par[x]);
}
bool same(int x, int y) { return find(x) == find(y); }
int consize(int x) { return size[find(x)]; }
void unite(int x, int y) {
x = find(x), y = find(y);
if (x == y)
return;
if (size[x] < size[y]) {
par[x] = y;
size[y] += size[x];
} else {
par[y] = x;
size[x] += size[y];
}
}
};
struct Tree {
int size;
vector<int> par, depth;
vector<int> doubling[30];
vector<vector<int>> G;
int root = 0;
Tree(int x) {
par.resize(x);
depth.resize(x);
rep(i, 30) { doubling[i].resize(x, -1); }
G.resize(x);
size = x;
}
void add_edge(int x, int y) {
G[x].push_back(y);
G[y].push_back(x);
}
void dfs(int x) {
for (int i : G[x]) {
if (depth[i] == -1) {
depth[i] = depth[x] + 1;
doubling[0][i] = x;
dfs(i);
}
}
}
void init() {
rep(i, size) depth[i] = -1;
depth[root] = 0;
dfs(root);
rep(i, 29) {
rep(j, size) {
if (doubling[i][j] == -1)
doubling[i + 1][j] = -1;
else
doubling[i + 1][j] = doubling[i][doubling[i][j]];
}
}
}
int lca(int x, int y) {
if (depth[x] > depth[y])
swap(x, y);
for (int i = 29; i >= 0; i--) {
if ((depth[y] - depth[x]) >> i & 1) {
y = doubling[i][y];
}
}
if (x == y)
return x;
for (int i = 29; i >= 0; i--) {
if (doubling[i][x] != doubling[i][y]) {
x = doubling[i][x];
y = doubling[i][y];
}
}
return doubling[0][x];
}
};
struct RollingHash {
int Base = 283;
const int MASK30 = (1ll << 30) - 1;
const int MASK31 = (1ll << 31) - 1;
const int MOD = (1ll << 61) - 1;
vector<int> hash, power;
int calcmod(int val) {
val = (val & MOD) + (val >> 61);
if (val > MOD)
val -= MOD;
return val;
}
int mul(int x, int y) {
int xu = x >> 31;
int xd = x & MASK31;
int yu = y >> 31;
int yd = y & MASK31;
int mid = xd * yu + xu * yd;
int midu = mid >> 30;
int midd = mid & MASK30;
return calcmod(xu * yu * 2 + midu + (midd << 31) + xd * yd);
}
RollingHash(string s) {
// Base=get_rand(1<<7,1<<8);
int sz = s.size();
hash.resize(sz + 1, 0);
power.resize(sz + 1, 1);
rep(i, sz) {
hash[i + 1] = (mul(hash[i], Base) + s[i]) % MOD;
power[i + 1] = mul(power[i], Base) % MOD;
}
}
int get(int l, int r) {
int res = (hash[r] - mul(hash[l], power[r - l]) + MOD) % MOD;
return res;
}
int lcp(int x, int y) {
int len = min(hash.size() - y, hash.size() - x);
int ok = 0, ng = len + 1;
while (ng - ok > 1) {
int mid = (ok + ng) / 2;
if (get(x, x + mid) == get(y, y + mid))
ok = mid;
else
ng = mid;
}
return ok;
}
};
struct Segtree {
int size = 1;
vector<int> dat, lazy;
Segtree(int x) {
while (size < x)
size *= 2;
dat.resize(size * 2 - 1, inf);
lazy.resize(size * 2 - 1, inf);
}
void eval(int k, int l, int r) {
chmin(dat[k], lazy[k]);
if (r - l > 1) {
chmin(lazy[k * 2 + 1], lazy[k]);
chmin(lazy[k * 2 + 2], lazy[k]);
}
lazy[k] = inf;
}
void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
if (r == -1)
r = size;
eval(k, l, r);
if (r <= a || b <= l)
return;
if (a <= l && r <= b) {
chmin(lazy[k], x);
eval(k, l, r);
return;
}
update(a, b, x, k * 2 + 1, l, (l + r) / 2);
update(a, b, x, k * 2 + 2, (l + r) / 2, r);
dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
}
int query(int a, int k = 0, int l = 0, int r = -1) {
if (r == -1)
r = size;
eval(k, l, r);
if (r - l == 1) {
return dat[k];
}
if (a < (l + r) / 2) {
return query(a, k * 2 + 1, l, (l + r) / 2);
}
return query(a, k * 2 + 2, (l + r) / 2, r);
}
};
template <class T> vector<int> KMP(vector<T> target, vector<T> pattern) {
vector<int> table(pattern.size() + 1);
table[0] = 0;
int j = 0;
REP(i, (int)pattern.size()) {
if (pattern[i] == pattern[j]) {
table[i] = j++;
} else {
table[i] = j;
j = 0;
}
}
table[pattern.size()] = j;
j = 0;
vector<int> res;
int i = 0;
while (i < target.size()) {
if (j < pattern.size() && target[i] == pattern[j]) {
i++;
j++;
} else {
if (!j)
i++;
j = table[j];
}
if (j == pattern.size())
res.push_back(i - j);
}
return res;
}
int perm[1000005];
void init_perm() {
perm[0] = 1;
REP(i, 1000005) perm[i] = perm[i - 1] * i % mod;
}
int nCk(int x, int y) {
return perm[x] * mod_pow(perm[x - y], mod - 2) % mod *
mod_pow(perm[y], mod - 2) % mod;
}
/*--------Library Zone!--------*/
int N, K, a[105];
bool dp[200005];
signed main() {
cin >> N >> K;
rep(i, N) cin >> a[i];
rep(i, K) {
if (!dp[i]) {
rep(j, N) { dp[i + a[j]] = true; }
}
}
cout << (dp[K] ? "First" : "Second") << endl;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,730 | 978,731 | u147049801 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int k;
cin >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
bool dp[k + 1];
memset(dp, false, sizeof(dp));
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - arr[j] >= 0 && dp[i - arr[j]] == false) {
dp[i - arr[j]] = true;
break;
}
}
}
// for(int i=0;i<=k;i++)
// cout<<dp[i]<<" ";
if (dp[k] == true)
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int k;
cin >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
bool dp[k + 1];
memset(dp, false, sizeof(dp));
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - arr[j] >= 0 && dp[i - arr[j]] == false) {
dp[i] = true;
break;
}
}
}
// for(int i=0;i<=k;i++)
// cout<<dp[i]<<" ";
if (dp[k] == true)
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| [
"expression.operation.binary.remove"
] | 978,837 | 978,838 | u934892029 | cpp |
p03170 | #include <bits/stdc++.h>
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
using namespace std;
int main() {
fast;
int n, k;
cin >> n >> k;
vector<int> arr(n);
bool dp[k + 1];
memset(dp, false, sizeof(dp));
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 (i - arr[j] >= 0) {
if (dp[i - arr[j]] == false) {
dp[i] = true;
break;
}
}
}
}
cout << ((dp[k] == false) ? "second" : "first") << "\n";
return 0;
} | #include <bits/stdc++.h>
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
using namespace std;
int main() {
fast;
int n, k;
cin >> n >> k;
vector<int> arr(n);
bool dp[k + 1];
memset(dp, false, sizeof(dp));
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 (i - arr[j] >= 0) {
if (dp[i - arr[j]] == false) {
dp[i] = true;
break;
}
}
}
}
cout << ((dp[k] == false) ? "Second" : "First") << "\n";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,841 | 978,842 | u560322763 | cpp |
p03170 | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <utility>
#include <vector>
#define fir first
#define sec second
#define sz(s) (s).size();
#define pb push_back
#define get(n) scanf("%d", &n);
#define gets(s) \
string s; \
cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i, j, k) for (int(i) = (j); (i) <= (k); (i)++)
#define rep0(i, j) for (int(i) = 0; (i) <= (j); (i)++)
#define repdown(i, j, k) for (int(i) = (j); (i) >= (k); (i)--)
#define repdown0(i, j) for (int(i) = (j); (i) >= 0; (i)--)
#define dump(x) std::cout << #x << " = " << (x) << std::endl;
#define debug(x) \
cout << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
using ll = long long;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double>;
using vvd = std::vector<vd>;
using qi = std::queue<int>;
using vpii = std::vector<std::pair<int, int>>;
using namespace std;
const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 10241024;
long double INFD = 100100100;
//_____________________________________Templates_________________________________________//
template <class T1, class T2> inline void chmin(T1 &a, T2 b) {
if (a > b)
a = b;
}
template <class T1, class T2> inline void chmax(T1 &a, T2 b) {
if (a < b)
a = b;
}
// mainly use for dynamic prog
template <class T1, class T2> void update(T1 &a, T2 b) {
a += b;
if (a > Mod)
a %= Mod;
}
inline void IN(void) { return; }
template <typename First, typename... Rest>
void IN(First &first, Rest &...rest) {
cin >> first;
IN(rest...);
return;
}
inline void OUT(void) {
cout << "\n";
return;
}
template <typename First, typename... Rest>
void OUT(First first, Rest... rest) {
cout << first << " ";
OUT(rest...);
return;
}
//_____________________array calc____________________________________//
/*
vvi mul(vvi &A, vvi &B){
vvi C(A.size(), vi(B.size()))
rep(i,A.size()){
rep(j,B.size()){
rep(k,B[0].size()){
C[i][j] = (C[i][j] A[i][k] + B[k][j]) % Mod;
}
}
}
return C;
}
vvi pow(vvi A, ll n){
vvi B(A.size(), vi(A.size()));
rep(i=0;i<A.size();i++){
B[i][i] = 1;
}
while (n >0){
if (n & 1) B = mul(B, A);
A = mul(A, A);
n = n >> 1;
}
return B;
}
*/
//_____________________Bynary Indexed Tree __________________________//
/*
const max_st = (1 << 15) - 1;
int bit[max_st];
int sum (int i){
int s = 0;
while(i > 0){
s += bit[i];
i -= i & -i;
}
return s;
}
void add(int i, int x){
while(i <= n){
bit[i] += x;
i += i & -i;
}
}
*/
//_____________________ following sorce code_________________________//
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, k;
IN(n, k);
vi a(n);
rep0(i, n - 1) { IN(a[i]); }
bool dp[100];
rep0(i, 99) dp[i] = false;
rep(i, 0, k) {
rep0(j, n - 1) {
if (i - a[j] > 0)
dp[i] |= dp[i - a[j]];
}
}
if (dp[k])
OUT("First");
else
OUT("Second");
return 0;
} | #include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <utility>
#include <vector>
#define fir first
#define sec second
#define sz(s) (s).size();
#define pb push_back
#define get(n) scanf("%d", &n);
#define gets(s) \
string s; \
cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i, j, k) for (int(i) = (j); (i) <= (k); (i)++)
#define rep0(i, j) for (int(i) = 0; (i) <= (j); (i)++)
#define repdown(i, j, k) for (int(i) = (j); (i) >= (k); (i)--)
#define repdown0(i, j) for (int(i) = (j); (i) >= 0; (i)--)
#define dump(x) std::cout << #x << " = " << (x) << std::endl;
#define debug(x) \
cout << #x << " = " << (x) << " (L" << __LINE__ << ")" \
<< " " << __FILE__ << endl;
using ll = long long;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double>;
using vvd = std::vector<vd>;
using qi = std::queue<int>;
using vpii = std::vector<std::pair<int, int>>;
using namespace std;
const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 10241024;
long double INFD = 100100100;
//_____________________________________Templates_________________________________________//
template <class T1, class T2> inline void chmin(T1 &a, T2 b) {
if (a > b)
a = b;
}
template <class T1, class T2> inline void chmax(T1 &a, T2 b) {
if (a < b)
a = b;
}
// mainly use for dynamic prog
template <class T1, class T2> void update(T1 &a, T2 b) {
a += b;
if (a > Mod)
a %= Mod;
}
inline void IN(void) { return; }
template <typename First, typename... Rest>
void IN(First &first, Rest &...rest) {
cin >> first;
IN(rest...);
return;
}
inline void OUT(void) {
cout << "\n";
return;
}
template <typename First, typename... Rest>
void OUT(First first, Rest... rest) {
cout << first << " ";
OUT(rest...);
return;
}
//_____________________array calc____________________________________//
/*
vvi mul(vvi &A, vvi &B){
vvi C(A.size(), vi(B.size()))
rep(i,A.size()){
rep(j,B.size()){
rep(k,B[0].size()){
C[i][j] = (C[i][j] A[i][k] + B[k][j]) % Mod;
}
}
}
return C;
}
vvi pow(vvi A, ll n){
vvi B(A.size(), vi(A.size()));
rep(i=0;i<A.size();i++){
B[i][i] = 1;
}
while (n >0){
if (n & 1) B = mul(B, A);
A = mul(A, A);
n = n >> 1;
}
return B;
}
*/
//_____________________Bynary Indexed Tree __________________________//
/*
const max_st = (1 << 15) - 1;
int bit[max_st];
int sum (int i){
int s = 0;
while(i > 0){
s += bit[i];
i -= i & -i;
}
return s;
}
void add(int i, int x){
while(i <= n){
bit[i] += x;
i += i & -i;
}
}
*/
//_____________________ following sorce code_________________________//
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, k;
IN(n, k);
vi a(n);
rep0(i, n - 1) { IN(a[i]); }
bool dp[110001];
rep0(i, 110000) dp[i] = false;
rep(i, 0, k) {
rep0(j, n - 1) {
if (i - a[j] >= 0)
dp[i] |= !dp[i - a[j]];
}
}
if (dp[k])
OUT("First");
else
OUT("Second");
return 0;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"assignment.variable.change",
"call.arguments.change",
"expression.operator.compare.change",
"control_flow.branch.if.condition.change",
"expression.operation.unary.add"
] | 978,843 | 978,844 | u264405855 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << '=' << x << ' '
typedef long long ll;
typedef pair<int, int> pi;
// dp(i) = 1 if first player wins with i stones remaining
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int N, K;
cin >> N >> K;
vector<int> A(N + 5);
for (int i = 0; i < N; i++)
cin >> A[i];
vector<bool> dp(K + 5);
for (int i = 0; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (i >= j && !dp[i - j])
dp[i] = true;
}
}
if (dp[K])
cout << "First";
else
cout << "Second";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << '=' << x << ' '
typedef long long ll;
typedef pair<int, int> pi;
// dp(i) = 1 if first player wins with i stones remaining
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int N, K;
cin >> N >> K;
vector<int> A(N + 5);
for (int i = 0; i < N; i++)
cin >> A[i];
vector<bool> dp(K + 5);
for (int i = 0; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (i >= A[j] && !dp[i - A[j]])
dp[i] = true;
}
}
if (dp[K])
cout << "First";
else
cout << "Second";
return 0;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 978,847 | 978,848 | u435691768 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define INF 1000000000007
// long long power(long long x, long long y, long long p)
// {
// long long res = 1;
// x = x % p;
// while (y > 0)
// {
// if (y & 1)
// res = (res*x) % p;
// y = y>>1;
// x = (x*x) % p;
// }
// return res;
// }
// long long modInverse(long long n, long long p)
// {
// return power(n, p-2, p);
// }
// long long ncrp(long long n, long long r, long long p)
// {
// if (r==0)
// return 1;
// long long fac[n+1];
// fac[0] = 1;
// // for (long long i=1 ; i<=n; i++)
// // fac[i] = fac[i-1]*i%p;
// return (fac[n]* modInverse(fac[r], p) % p *
// modInverse(fac[n-r], p) % p) % p;
// }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
if (fopen("input.txt", "r")) {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}
ll n, k;
cin >> n >> k;
ll a[n];
ll i, j;
for (i = 0; i < n; i++) {
cin >> a[i];
}
// ll b[n];
// clr(b);
ll dp[k + 1];
clr(dp);
for (i = 0; i <= k; i++) {
ll w = 0;
for (j = 0; j < n; j++) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == 0) {
w++;
}
}
}
if (w > 0) {
dp[i] = 1;
}
}
cout << (dp[k] == 1 ? "first" : "second") << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define INF 1000000000007
// long long power(long long x, long long y, long long p)
// {
// long long res = 1;
// x = x % p;
// while (y > 0)
// {
// if (y & 1)
// res = (res*x) % p;
// y = y>>1;
// x = (x*x) % p;
// }
// return res;
// }
// long long modInverse(long long n, long long p)
// {
// return power(n, p-2, p);
// }
// long long ncrp(long long n, long long r, long long p)
// {
// if (r==0)
// return 1;
// long long fac[n+1];
// fac[0] = 1;
// // for (long long i=1 ; i<=n; i++)
// // fac[i] = fac[i-1]*i%p;
// return (fac[n]* modInverse(fac[r], p) % p *
// modInverse(fac[n-r], p) % p) % p;
// }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
if (fopen("input.txt", "r")) {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}
ll n, k;
cin >> n >> k;
ll a[n];
ll i, j;
for (i = 0; i < n; i++) {
cin >> a[i];
}
// ll b[n];
// clr(b);
ll dp[k + 1];
clr(dp);
for (i = 0; i <= k; i++) {
ll w = 0;
for (j = 0; j < n; j++) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == 0) {
w++;
}
}
}
if (w > 0) {
dp[i] = 1;
}
}
cout << (dp[k] == 1 ? "First" : "Second") << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,852 | 978,853 | u754279713 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll 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;
void solve() {
int n, k;
cin >> n >> k;
vi a(n);
rep(i, 0, n) cin >> a[i];
vi dp(k + 1);
// dp[i] is 1 when first player wins if there are i stones
rep(i, 0, k + 1) {
rep(j, 0, n) {
if (i >= a[j] && (!dp[i - a[j]])) {
dp[j] = 1;
break;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return;
}
int main() {
int t = 1;
// cin >> t;
while (t--)
solve();
return 0;
}
| #include <bits/stdc++.h>
#define ll 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;
void solve() {
int n, k;
cin >> n >> k;
vi a(n);
rep(i, 0, n) cin >> a[i];
vi dp(k + 1);
// dp[i] is 1 when first player wins if there are i stones
rep(i, 0, k + 1) {
rep(j, 0, n) {
if (i >= a[j] && (!dp[i - a[j]])) {
dp[i] = 1;
break;
}
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return;
}
int main() {
int t = 1;
// cin >> t;
while (t--)
solve();
return 0;
}
| [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 978,863 | 978,864 | u306782289 | cpp |
p03170 | #include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define rfor(i, n) for (int i = n - 1; i >= 0; --i)
#define rmod(x, y) (((x % y) + y) % y)
using namespace std;
typedef vector<int>::iterator vit;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef long long ll;
const int MAXN = 1024;
// OPERATORS
// GLOBALS
// FUNCTIONS
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> fu(n);
for (int i = 0; i < n; i++) {
cin >> fu[i];
}
vector<bool> depe(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (auto ra : fu) {
if (i - ra >= 0 and !depe[i - ra])
depe[i] = true;
}
}
if (depe[k] == true)
cout << "Second" << endl;
else
cout << "First" << endl;
return 0;
}
| #include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define rfor(i, n) for (int i = n - 1; i >= 0; --i)
#define rmod(x, y) (((x % y) + y) % y)
using namespace std;
typedef vector<int>::iterator vit;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef long long ll;
const int MAXN = 1024;
// OPERATORS
// GLOBALS
// FUNCTIONS
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> fu(n);
for (int i = 0; i < n; i++) {
cin >> fu[i];
}
vector<bool> depe(k + 1, 0);
for (int i = 0; i <= k; i++) {
for (auto ra : fu) {
if (i >= ra and !depe[i - ra])
depe[i] = true;
}
}
if (depe[k] == true)
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",
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.cha... | 978,867 | 978,868 | u558825435 | cpp |
p03170 | #include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define rfor(i, n) for (int i = n - 1; i >= 0; --i)
#define rmod(x, y) (((x % y) + y) % y)
using namespace std;
typedef vector<int>::iterator vit;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef long long ll;
const int MAXN = 1024;
// OPERATORS
// GLOBALS
// FUNCTIONS
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> fu(n);
for (int i = 0; i < n; i++) {
cin >> fu[i];
}
vector<bool> depe(k + 1);
for (int i = 0; i <= k; i++) {
for (auto ra : fu) {
if (i - ra >= 0 and !depe[i - ra])
depe[i] = true;
}
}
if (depe[k] == true)
cout << "Second" << endl;
else
cout << "First" << endl;
return 0;
}
| #include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define rfor(i, n) for (int i = n - 1; i >= 0; --i)
#define rmod(x, y) (((x % y) + y) % y)
using namespace std;
typedef vector<int>::iterator vit;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef long long ll;
const int MAXN = 1024;
// OPERATORS
// GLOBALS
// FUNCTIONS
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> fu(n);
for (int i = 0; i < n; i++) {
cin >> fu[i];
}
vector<bool> depe(k + 1);
for (int i = 0; i <= k; i++) {
for (auto ra : fu) {
if (i >= ra and !depe[i - ra])
depe[i] = true;
}
}
if (depe[k] == true)
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
}
| [
"control_flow.loop.for.condition.change",
"expression.operation.binary.remove",
"identifier.replace.add",
"literal.replace.remove",
"control_flow.branch.if.condition.change",
"literal.string.change",
"io.output.change"
] | 978,869 | 978,870 | u558825435 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int dp[N];
int main() {
int n, k;
cin >> n >> k;
int a[n + 1] = {0};
for (int i = 1; i <= n; i++)
cin >> a[i];
memset(dp, -1, sizeof(dp));
dp[0] = 2;
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= n; j++) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == 2)
dp[i] = 1;
}
}
if (dp[i] == -1)
dp[i] = 2;
}
if (dp[k] == 1)
cout << "FIRST" << endl;
else
cout << "SECOND" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int dp[N];
int main() {
int n, k;
cin >> n >> k;
int a[n + 1] = {0};
for (int i = 1; i <= n; i++)
cin >> a[i];
memset(dp, -1, sizeof(dp));
dp[0] = 2;
for (int i = 1; i <= k; i++) {
for (int j = 1; j <= n; j++) {
if (i - a[j] >= 0) {
if (dp[i - a[j]] == 2)
dp[i] = 1;
}
}
if (dp[i] == -1)
dp[i] = 2;
}
if (dp[k] == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,879 | 978,880 | u109008163 | cpp |
p03170 | #include <bits/stdc++.h>
typedef long long int ll;
#define vaibhavv06 \
ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(0);
#define endl '\n'
#define int long long
#define MM(a, b) memset(a, b, sizeof(a))
const ll MOD = 1000000007;
using namespace std;
int32_t main() {
vaibhavv06;
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 i = 0; i <= k; i++) {
for (int x : arr) {
if (i >= x && dp[i - x] == 0) {
dp[i] = 1;
}
}
}
if (dp[k] == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
} | #include <bits/stdc++.h>
typedef long long int ll;
#define vaibhavv06 \
ios::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(0);
#define endl '\n'
#define int long long
#define MM(a, b) memset(a, b, sizeof(a))
const ll MOD = 1000000007;
using namespace std;
int32_t main() {
vaibhavv06;
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int dp[k + 1] = {0};
for (int i = 0; i <= k; i++) {
for (int x : arr) {
if (i >= x && dp[i - x] == 0) {
dp[i] = 1;
}
}
}
if (dp[k] == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"variable_declaration.value.change"
] | 978,881 | 978,882 | u699580536 | cpp |
p03170 | #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iostream>
#include <limits>
#include <queue>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
#define INF 1100000000000
#define MaX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;
typedef pair<pair<int, int>, int> p;
typedef pair<pair<int, int>, int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
// https://kyopro-friends.hatenablog.com/entry/2019/01/12/231000
bool dp[110000];
int main() {
int N, a[110], K;
cin >> N >> K;
for (int i = 0; i < N; i++)
cin >> a[i];
for (int i = 0; i < 110000; i++)
dp[i] = false;
for (int i = 1; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (i - a[j] >= 0 && dp[i - a[j]] == false)
dp[i] = true;
}
}
if (dp[K])
cout << "first" << endl;
else
cout << "Second" << endl;
}
| #include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iostream>
#include <limits>
#include <queue>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
#define INF 1100000000000
#define MaX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;
typedef pair<pair<int, int>, int> p;
typedef pair<pair<int, int>, int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
// https://kyopro-friends.hatenablog.com/entry/2019/01/12/231000
bool dp[110000];
int main() {
int N, a[110], K;
cin >> N >> K;
for (int i = 0; i < N; i++)
cin >> a[i];
for (int i = 0; i < 110000; i++)
dp[i] = false;
for (int i = 1; i <= K; i++) {
for (int j = 0; j < N; j++) {
if (i - a[j] >= 0 && 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,883 | 978,884 | u591914971 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> array(n);
int sum = 0;
for (int i = 0; i < n; i++)
cin >> array[i];
vector<bool> dp(k + 1, false);
for (int stones = 0; stones <= k; ++stones) {
for (int i = 0; i < n; ++i) {
if (stones >= array[i] && !dp[stones - array[i]])
dp[stones] = 1;
}
}
if (dp[k])
cout << "FIRST";
else
cout << "SECOND";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> array(n);
int sum = 0;
for (int i = 0; i < n; i++)
cin >> array[i];
vector<bool> dp(k + 1, false);
for (int stones = 0; stones <= k; ++stones) {
for (int i = 0; i < n; ++i) {
if (stones >= array[i] && !dp[stones - array[i]])
dp[stones] = 1;
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,889 | 978,890 | u073062346 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> array(n);
int sum = 0;
for (int i = 0; i < n; i++)
cin >> array[i];
vector<bool> dp(k + 1, 0);
for (int stones = 0; stones <= k; ++stones) {
for (int i = 0; i < n; ++i) {
if (stones >= array[i] && !dp[stones - array[i]])
dp[stones] = 1;
}
}
if (dp[k])
cout << "FIRST";
else
cout << "SECOND";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> array(n);
int sum = 0;
for (int i = 0; i < n; i++)
cin >> array[i];
vector<bool> dp(k + 1, false);
for (int stones = 0; stones <= k; ++stones) {
for (int i = 0; i < n; ++i) {
if (stones >= array[i] && !dp[stones - array[i]])
dp[stones] = 1;
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
} | [
"call.arguments.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,891 | 978,890 | u073062346 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int INF = 1e9 + 5;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
int main() {
int n, k;
cin >> n >> k;
vector<bool> dp(k + 1);
vi in(n);
for (int &x : in) {
cin >> x;
}
for (int i = 0; i <= k; i++) {
for (int j : in)
if (i > j && !dp[i - j])
dp[i] = true;
}
if (dp[k])
printf("First");
else
printf("Second");
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int INF = 1e9 + 5;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
int main() {
int n, k;
cin >> n >> k;
vector<bool> dp(k + 1);
vi in(n);
for (int &x : in) {
cin >> x;
}
for (int i = 0; i <= k; i++) {
for (int j : in)
if (i >= j && !dp[i - j])
dp[i] = true;
}
if (dp[k])
printf("First");
else
printf("Second");
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 978,892 | 978,893 | u163673196 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
void solve() {
int n, k;
cin >> n >> k;
vector<int> s(n), dp(k + 1);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i <= k; i++) {
for (auto x : s) {
if (i >= x && !dp[i - x])
dp[x] = 1;
}
}
cout << (dp.back() ? "First" : "Second") << endl;
}
int main() {
// int n;
// cin>>n;
// while(n--)
solve();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
void solve() {
int n, k;
cin >> n >> k;
vector<int> s(n), dp(k + 1);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i <= k; i++) {
for (auto x : s) {
if (i >= x && !dp[i - x])
dp[i] = 1;
}
}
cout << (dp.back() ? "First" : "Second") << endl;
}
int main() {
// int n;
// cin>>n;
// while(n--)
solve();
return 0;
} | [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 978,894 | 978,895 | u958501859 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
void solve() {
int n, k;
cin >> n >> k;
vector<int> s(n), dp(n + 1);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i <= n; i++) {
for (auto x : s) {
if (i >= x && !dp[i - x])
dp[x] = 1;
}
}
cout << (dp.back() ? "First" : "Second") << endl;
}
int main() {
// int n;
// cin>>n;
// while(n--)
solve();
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
void solve() {
int n, k;
cin >> n >> k;
vector<int> s(n), dp(k + 1);
for (int i = 0; i < n; i++)
cin >> s[i];
for (int i = 0; i <= k; i++) {
for (auto x : s) {
if (i >= x && !dp[i - x])
dp[i] = 1;
}
}
cout << (dp.back() ? "First" : "Second") << endl;
}
int main() {
// int n;
// cin>>n;
// while(n--)
solve();
return 0;
} | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.loop.for.condition.change",
"assignment.variable.change",
"variable_access.subscript.index.change"
] | 978,896 | 978,895 | u958501859 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define NIL -(long long)(1e9)
#define ll long long
// long long n,w;
bool dp[3005] = {0}; // true if cur player wins
int datas[3005];
int n, k;
int main() {
// memset(dp,-1,sizeof(dp));
// freopen("a.in","r",stdin); freopen("a.out","w",stdout);
cin >> n >> k;
double d1;
for (int i = 0; i < n; ++i) {
cin >> datas[i];
}
for (int i = 1; i <= k; ++i) {
for (int tas : datas) {
if (tas == 0)
break;
if (tas <= i && !dp[i - tas]) // 0 1 0
{
dp[i] = true;
}
}
}
// for(bool k: dp)
cout << (dp[k] ? "First" : "Second");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define NIL -(long long)(1e9)
#define ll long long
// long long n,w;
bool dp[100005] = {0}; // true if cur player wins
long long datas[3005];
int n, k;
int main() {
// memset(dp,-1,sizeof(dp));
// freopen("a.in","r",stdin); freopen("a.out","w",stdout);
cin >> n >> k;
double d1;
for (int i = 0; i < n; ++i) {
cin >> datas[i];
}
for (int i = 1; i <= k; ++i) {
for (int tas : datas) {
if (tas == 0)
break;
if (tas <= i && !dp[i - tas]) // 0 1 0
{
dp[i] = true;
}
}
}
// for(bool k: dp)
cout << (dp[k] ? "First" : "Second");
return 0;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change",
"variable_declaration.type.primitive.change",
"variable_declaration.type.widen.change"
] | 978,899 | 978,900 | u258931378 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define fr(i, n) for (int i = 0; i < n; ++i)
#define fri(i, a, b) for (int i = a; i <= b; ++i)
#define fro(i, a, b) for (int i = a; i >= b; --i)
#define debug(P) cout << #P << " = " << P << endl;
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define endl "\n"
#define ii pair<int, int>
#define LL long long
#define maxm(a, b, c) max(a, max(b, c))
const int INF = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
fr(i, n) { 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])
dp[stones] = true;
}
}
puts(dp[k] ? "FIRST" : "SECOND");
}
| #include <bits/stdc++.h>
using namespace std;
#define fr(i, n) for (int i = 0; i < n; ++i)
#define fri(i, a, b) for (int i = a; i <= b; ++i)
#define fro(i, a, b) for (int i = a; i >= b; --i)
#define debug(P) cout << #P << " = " << P << endl;
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define endl "\n"
#define ii pair<int, int>
#define LL long long
#define maxm(a, b, c) max(a, max(b, c))
const int INF = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(n);
fr(i, n) { cin >> a[i]; }
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;
}
}
puts(dp[k] ? "First" : "Second");
}
| [
"literal.string.change",
"literal.string.case.change",
"call.arguments.change",
"io.output.change"
] | 978,903 | 978,904 | u011179282 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// graph
const ll MAX_V = 1;
const ll MAX_E = 1;
struct edge {
ll from, to, cost;
};
edge ES[MAX_E];
vector<edge> G[MAX_V];
ll d[MAX_V];
ll prev_path[MAX_V];
ll V, E;
const ll MOD = (ll)1e9 + 7;
const int MAX_INT = 1 << 17;
const long long INF_LL = 1LL << 60;
vector<bool> prime;
#define all(x) (x).begin(), (x).end()
#define PRI(n) cout << n << endl;
#define PRI2(n, m) cout << n << " " << m << " " << endl;
#define REP(i, n) for (int i = 0; i < (ll)n; ++i)
#define REPbit(bit, n) for (int bit = 0; bit < (int)(1 << n); ++bit)
#define FOR(i, t, n) for (ll i = t; i <= (ll)n; ++i)
void Era(int x) {
prime.resize(x + 1, 1);
prime[0] = 0;
prime[1] = 0;
FOR(i, 2, x) {
if (prime[i]) {
for (int j = 2 * i; j <= x; j += i) {
prime[j] = 0;
}
}
}
}
bool isPrime(ll x) {
if (x == 0)
return 0;
if (x == 1)
return 0;
if (x == 2)
return 1;
if (x % 2 == 0)
return 0;
FOR(i, 3, sqrt(x) + 1) {
if (x % i == 0)
return 0;
}
return 1;
}
ll GCD(ll a, ll b) {
if (b == 0)
return a;
return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
ll gcd = GCD(a, b);
return a / gcd * b;
}
ll nCr(ll n, ll r) {
vector<ll> C(r + 1);
C[0] = 1;
FOR(i, 1, n) for (ll j = min(i, r); j < 1; --j) C[j] = (C[j] + C[j - 1]);
return C[r];
}
template <class T> class SegTree {
int n;
vector<T> data;
T def;
function<T(T, T)> operation;
function<T(T, T)> update;
T _query(int a, int b, int k, int l, int r) {
if (r <= a || b <= l)
return def;
if (a <= l && r <= b)
return data[k];
else {
T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
return operation(c1, c2);
}
}
public:
SegTree(size_t _n, T _def, function<T(T, T)> _operation,
function<T(T, T)> _update)
: def(_def), operation(_operation), update(_update) {
n = 1;
while (n < _n) {
n *= 2;
}
data = vector<T>(2 * n - 1, def);
}
void change(int i, T x) {
i += n - 1;
data[i] = update(data[i], x);
while (i > 0) {
i = (i - 1) / 2;
data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
}
}
T query(int a, int b) { return _query(a, b, 0, 0, n); }
T operator[](int i) { return data[i + n - 1]; }
};
struct UnionFind {
vector<int> par;
vector<int> rank;
vector<int> sz;
UnionFind(int N) {
for (int i = 0; i < N; ++i) {
par.push_back(i);
rank.push_back(0);
sz.push_back(-1);
}
}
int find(int x) {
if (par[x] == x)
return x;
else
return par[x] = find(par[x]);
}
void unite(int x, int y) {
x = find(x);
y = find(y);
if (x == y)
return;
if (rank[x] < rank[y])
par[x] = y;
else {
par[y] = x;
if (rank[x] == rank[y])
rank[x]++;
}
}
bool same(int x, int y) { return find(x) == find(y); }
int root(int x) {
if (sz[x] < 0)
return x;
else
return sz[x] = root(sz[x]);
}
bool isSame(int x, int y) { return root(x) == root(y); }
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (sz[x] > sz[y])
swap(x, y); // merge technique
sz[x] += sz[y];
sz[y] = x;
return true;
}
int size(int x) { return -sz[root(x)]; }
};
void Bellman_short(int s) {
REP(i, V) d[i] = 1LL << 50;
d[s] = 0;
REP(i, V)
REP(i, E) {
edge e = ES[i];
if (d[e.from] != 1LL << 50 && d[e.to] > d[e.from] + e.cost) {
d[e.to] = d[e.from] + e.cost;
}
}
}
bool Bellman_negLoop(int s) {
REP(i, V) d[i] = 1LL << 50;
d[s] = 0;
REP(i, V)
REP(j, E) {
edge e = ES[j];
if (d[e.from] != 1LL << 50 && d[e.to] > d[e.from] + e.cost) {
d[e.to] = d[e.from] + e.cost;
if (i == V - 1)
return true;
}
}
return false;
}
void dijkstra(int s) {
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> Q;
fill(d, d + V, LLONG_MAX);
fill(prev_path, prev_path + V, -1);
d[s] = 0;
Q.push(P(0, s));
while (!Q.empty()) {
P p = Q.top();
Q.pop();
ll v = p.second;
if (d[v] < p.first)
continue;
for (edge e : G[v]) {
if (d[e.to] > d[v] + e.cost) {
d[e.to] = d[v] + e.cost;
Q.push(P(d[e.to], e.to));
prev_path[e.to] = v;
}
}
}
}
vector<ll> getPath(int t) {
vector<ll> path;
for (; t != -1; t = prev_path[t]) {
path.push_back(t);
}
reverse(all(path));
return path;
}
class Combination {
private:
vector<ll> fac, finv, inv;
public:
Combination(ll N) {
fac.resize(N);
finv.resize(N);
inv.resize(N);
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < N; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll nCr(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
};
bool dp[100010];
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N);
REP(i, N) cin >> A[i];
REP(i, K + 1) {
REP(a, N) {
if (i - A[a] >= 0)
dp[i] = !dp[i - A[a]];
}
}
PRI((dp[K] ? "First" : "Second"))
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// graph
const ll MAX_V = 1;
const ll MAX_E = 1;
struct edge {
ll from, to, cost;
};
edge ES[MAX_E];
vector<edge> G[MAX_V];
ll d[MAX_V];
ll prev_path[MAX_V];
ll V, E;
const ll MOD = (ll)1e9 + 7;
const int MAX_INT = 1 << 17;
const long long INF_LL = 1LL << 60;
vector<bool> prime;
#define all(x) (x).begin(), (x).end()
#define PRI(n) cout << n << endl;
#define PRI2(n, m) cout << n << " " << m << " " << endl;
#define REP(i, n) for (int i = 0; i < (ll)n; ++i)
#define REPbit(bit, n) for (int bit = 0; bit < (int)(1 << n); ++bit)
#define FOR(i, t, n) for (ll i = t; i <= (ll)n; ++i)
void Era(int x) {
prime.resize(x + 1, 1);
prime[0] = 0;
prime[1] = 0;
FOR(i, 2, x) {
if (prime[i]) {
for (int j = 2 * i; j <= x; j += i) {
prime[j] = 0;
}
}
}
}
bool isPrime(ll x) {
if (x == 0)
return 0;
if (x == 1)
return 0;
if (x == 2)
return 1;
if (x % 2 == 0)
return 0;
FOR(i, 3, sqrt(x) + 1) {
if (x % i == 0)
return 0;
}
return 1;
}
ll GCD(ll a, ll b) {
if (b == 0)
return a;
return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
ll gcd = GCD(a, b);
return a / gcd * b;
}
ll nCr(ll n, ll r) {
vector<ll> C(r + 1);
C[0] = 1;
FOR(i, 1, n)
for (ll j = min(i, r); j < 1; --j)
C[j] = (C[j] + C[j - 1]);
return C[r];
}
template <class T> class SegTree {
int n;
vector<T> data;
T def;
function<T(T, T)> operation;
function<T(T, T)> update;
T _query(int a, int b, int k, int l, int r) {
if (r <= a || b <= l)
return def;
if (a <= l && r <= b)
return data[k];
else {
T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
return operation(c1, c2);
}
}
public:
SegTree(size_t _n, T _def, function<T(T, T)> _operation,
function<T(T, T)> _update)
: def(_def), operation(_operation), update(_update) {
n = 1;
while (n < _n) {
n *= 2;
}
data = vector<T>(2 * n - 1, def);
}
void change(int i, T x) {
i += n - 1;
data[i] = update(data[i], x);
while (i > 0) {
i = (i - 1) / 2;
data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
}
}
T query(int a, int b) { return _query(a, b, 0, 0, n); }
T operator[](int i) { return data[i + n - 1]; }
};
struct UnionFind {
vector<int> par;
vector<int> rank;
vector<int> sz;
UnionFind(int N) {
for (int i = 0; i < N; ++i) {
par.push_back(i);
rank.push_back(0);
sz.push_back(-1);
}
}
int find(int x) {
if (par[x] == x)
return x;
else
return par[x] = find(par[x]);
}
void unite(int x, int y) {
x = find(x);
y = find(y);
if (x == y)
return;
if (rank[x] < rank[y])
par[x] = y;
else {
par[y] = x;
if (rank[x] == rank[y])
rank[x]++;
}
}
bool same(int x, int y) { return find(x) == find(y); }
int root(int x) {
if (sz[x] < 0)
return x;
else
return sz[x] = root(sz[x]);
}
bool isSame(int x, int y) { return root(x) == root(y); }
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (sz[x] > sz[y])
swap(x, y); // merge technique
sz[x] += sz[y];
sz[y] = x;
return true;
}
int size(int x) { return -sz[root(x)]; }
};
void Bellman_short(int s) {
REP(i, V) d[i] = 1LL << 50;
d[s] = 0;
REP(i, V) REP(i, E) {
edge e = ES[i];
if (d[e.from] != 1LL << 50 && d[e.to] > d[e.from] + e.cost) {
d[e.to] = d[e.from] + e.cost;
}
}
}
bool Bellman_negLoop(int s) {
REP(i, V) d[i] = 1LL << 50;
d[s] = 0;
REP(i, V) REP(j, E) {
edge e = ES[j];
if (d[e.from] != 1LL << 50 && d[e.to] > d[e.from] + e.cost) {
d[e.to] = d[e.from] + e.cost;
if (i == V - 1)
return true;
}
}
return false;
}
void dijkstra(int s) {
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> Q;
fill(d, d + V, LLONG_MAX);
fill(prev_path, prev_path + V, -1);
d[s] = 0;
Q.push(P(0, s));
while (!Q.empty()) {
P p = Q.top();
Q.pop();
ll v = p.second;
if (d[v] < p.first)
continue;
for (edge e : G[v]) {
if (d[e.to] > d[v] + e.cost) {
d[e.to] = d[v] + e.cost;
Q.push(P(d[e.to], e.to));
prev_path[e.to] = v;
}
}
}
}
vector<ll> getPath(int t) {
vector<ll> path;
for (; t != -1; t = prev_path[t]) {
path.push_back(t);
}
reverse(all(path));
return path;
}
class Combination {
private:
vector<ll> fac, finv, inv;
public:
Combination(ll N) {
fac.resize(N);
finv.resize(N);
inv.resize(N);
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < N; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll nCr(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
};
bool dp[100010];
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N);
REP(i, N) cin >> A[i];
REP(i, K + 1) {
REP(a, N) {
if (i - A[a] >= 0)
dp[i] |= !dp[i - A[a]];
}
}
PRI((dp[K] ? "First" : "Second"))
return 0;
}
| [
"assignment.value.change"
] | 978,907 | 978,908 | u181806820 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprrev(i, a, b) for (int i = b - 1; i >= a; i--) // [a, b)
#define reprev(i, n) reprrev(i, 0, n)
typedef long long ll;
typedef unsigned long long ull;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
/* attention
long longのシフト演算には気をつけよう
タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
sizeは(int)とキャストしよう
cin.tie(0);
ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう
*/
const ll mod = 1e9 + 7;
void chmod(ll &M) {
if (M >= mod)
M %= mod;
else if (M < 0) {
M += (abs(M) / mod + 1) * mod;
M %= mod;
}
}
ll modpow(ll x, ll n) {
if (n == 0)
return 1;
ll res = modpow(x, n / 2);
if (n % 2 == 0)
return res * res % mod;
else
return res * res % mod * x % mod;
}
int getl(int i, int N) { return i == 0 ? N - 1 : i - 1; };
int getr(int i, int N) { return i == N - 1 ? 0 : i + 1; };
// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b) {
double ax = a.first, ay = a.second, bx = b.first, by = b.second;
return atan2(by - ay, bx - ax);
}
/* <----------------------------------------------------------------------------------->
*/
/* <----------------------------------------------------------------------------------->
*/
/* <----------------------------------------------------------------------------------->
*/
/* <----------------------------------------------------------------------------------->
*/
int n, k;
vector<int> a;
vector<int> memo;
// 1:win, -1:lose, 0:unknown
int rec(int x) {
if (memo[x] != 0)
return memo[n];
if (x == 0)
return -1;
rep(i, n) {
if (x - a[i] >= 0 && rec(x - a[i]) == -1)
return memo[x] = 1;
}
return memo[x] = -1;
}
void input() {
cin >> n >> k;
a.resize(n);
rep(i, n) cin >> a[i];
memo.resize(k + 5, 0);
}
void solve() {
if (rec(k) == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
input();
solve();
// cout << rec(4) << endl;
// cout << rec(2) << endl;
// cout << rec(1) << endl;
// cout << rec(0) << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprrev(i, a, b) for (int i = b - 1; i >= a; i--) // [a, b)
#define reprev(i, n) reprrev(i, 0, n)
typedef long long ll;
typedef unsigned long long ull;
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
/* attention
long longのシフト演算には気をつけよう
タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
sizeは(int)とキャストしよう
cin.tie(0);
ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう
*/
const ll mod = 1e9 + 7;
void chmod(ll &M) {
if (M >= mod)
M %= mod;
else if (M < 0) {
M += (abs(M) / mod + 1) * mod;
M %= mod;
}
}
ll modpow(ll x, ll n) {
if (n == 0)
return 1;
ll res = modpow(x, n / 2);
if (n % 2 == 0)
return res * res % mod;
else
return res * res % mod * x % mod;
}
int getl(int i, int N) { return i == 0 ? N - 1 : i - 1; };
int getr(int i, int N) { return i == N - 1 ? 0 : i + 1; };
// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b) {
double ax = a.first, ay = a.second, bx = b.first, by = b.second;
return atan2(by - ay, bx - ax);
}
/* <----------------------------------------------------------------------------------->
*/
/* <----------------------------------------------------------------------------------->
*/
/* <----------------------------------------------------------------------------------->
*/
/* <----------------------------------------------------------------------------------->
*/
int n, k;
vector<int> a;
vector<int> memo;
// 1:win, -1:lose, 0:unknown
int rec(int x) {
if (memo[x] != 0)
return memo[x];
if (x == 0)
return -1;
rep(i, n) {
if (x - a[i] >= 0 && rec(x - a[i]) == -1)
return memo[x] = 1;
}
return memo[x] = -1;
}
void input() {
cin >> n >> k;
a.resize(n);
rep(i, n) cin >> a[i];
memo.resize(k + 5, 0);
}
void solve() {
if (rec(k) == 1)
cout << "First" << endl;
else
cout << "Second" << endl;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
input();
solve();
return 0;
} | [
"identifier.change",
"variable_access.subscript.index.change",
"function.return_value.change"
] | 978,915 | 978,916 | u052332717 | cpp |
p03170 | #include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <queue>
#include <string>
#include <vector>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, f, n) for (int i = f; i < n; i++)
#define MAX(A) *max_element(A.begin(), A.end())
#define MIN(A) *min_element(A.begin(), A.end())
#define SORT(A) sort(A.begin(), A.end())
typedef long long int ll;
using vi = std::vector<int>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
ll gcd(ll x, ll y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
bool bfs(vector<vector<int>> g, vector<int> &dist, int sv) {
queue<int> q;
q.push(sv);
dist[sv] = 0;
while (!q.empty()) {
int now = q.front();
q.pop();
for (auto v : g[now]) {
if (dist[v] != -1)
continue;
dist[v] = dist[now] + 1;
q.push(v);
}
}
}
int main(void) {
int n, k;
cin >> n >> k;
vi a(n);
rep(i, n) cin >> a[i];
vector<bool> dp(n + 1,
false); //残りi個で順番が来た時の勝敗 true:勝ち false:負け
rep2(r, 1, k + 1) rep(i, n) dp[r] =
a[i] <= r ? (dp[r] || !dp[r - a[i]]) : dp[r];
if (dp[k])
out("First");
else
out("Second");
}
| #include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <queue>
#include <string>
#include <vector>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, f, n) for (int i = f; i < n; i++)
#define MAX(A) *max_element(A.begin(), A.end())
#define MIN(A) *min_element(A.begin(), A.end())
#define SORT(A) sort(A.begin(), A.end())
typedef long long int ll;
using vi = std::vector<int>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
ll gcd(ll x, ll y) {
if (y == 0)
return x;
return gcd(y, x % y);
}
bool bfs(vector<vector<int>> g, vector<int> &dist, int sv) {
queue<int> q;
q.push(sv);
dist[sv] = 0;
while (!q.empty()) {
int now = q.front();
q.pop();
for (auto v : g[now]) {
if (dist[v] != -1)
continue;
dist[v] = dist[now] + 1;
q.push(v);
}
}
}
int main(void) {
int n, k;
cin >> n >> k;
vi a(n);
rep(i, n) cin >> a[i];
vector<bool> dp(k + 1,
false); //残りi個で順番が来た時の勝敗 true:勝ち false:負け
rep2(r, 1, k + 1) rep(i, n) dp[r] =
a[i] <= r ? (dp[r] || !dp[r - a[i]]) : dp[r];
if (dp[k])
out("First");
else
out("Second");
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,919 | 978,920 | u086672186 | cpp |
p03170 | #include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>
using namespace std;
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define chmin(mi, value) mi = min(mi, value)
#define chmax(ma, value) ma = max(ma, value)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFR INT_MAX
#define INFL (long long)(4e18)
#define INFLR LLONG_MAX
#define EPS (1e-10)
#define MOD 1000000007
//#define MOD 998244353
#define PI 3.141592653589793238
#define RMAX 4294967295
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vvvvi = vector<vector<vector<vector<int>>>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;
using Pi = pair<int, int>;
using vPi = vector<Pi>;
using vvPi = vector<vector<Pi>>;
using vvvPi = vector<vector<vector<Pi>>>;
using vvvvPi = vector<vector<vector<vector<Pi>>>>;
using Pll = pair<ll, ll>;
using vPll = vector<Pll>;
using Pd = pair<double, double>;
using vPd = vector<Pd>;
template <class T> using vec = vector<T>;
template <class T> using pql = priority_queue<T, vector<T>, greater<T>>;
using Comp = complex<double>;
// vvvvvvvvvvvvvvvvvvvvvvv debug output vvvvvvvvvvvvvvvvvvvvvvv
// vector input
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
for (T &x : vec)
is >> x;
return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pair_var) {
os << "(" << pair_var.first << ", " << pair_var.second << ")";
return os;
}
// vector
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "{";
for (int i = 0; i < vec.size(); i++) {
os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
}
os << "}";
return os;
}
// deque
template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) {
os << "{";
for (int i = 0; i < vec.size(); i++) {
os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
}
os << "}";
return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
os << "{";
repi(itr, map_var) {
os << *itr;
itr++;
if (itr != map_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
// set
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
os << "{";
repi(itr, set_var) {
os << *itr;
itr++;
if (itr != set_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
// multiset
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set_var) {
os << "{";
repi(itr, set_var) {
os << *itr;
itr++;
if (itr != set_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
#define DUMPOUT cerr
void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&...tail) {
DUMPOUT << head;
if (sizeof...(Tail) > 0) {
DUMPOUT << ", ";
}
dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...) \
DUMPOUT << " " << string(#__VA_ARGS__) << ": " \
<< "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
<< " ", \
dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
// ^^^^^^^^^^^^^^^^^^^^^^^ debug output ^^^^^^^^^^^^^^^^^^^^^^^
string YN(bool y, int id = 0) {
if (id)
cout << id;
return (y ? "YES" : "NO");
}
string yn(bool y, int id = 0) {
if (id)
cout << id;
return (y ? "Yes" : "No");
}
string ON(bool y, int id = 0) {
if (id)
cout << id;
return (y ? "OK" : "NG");
}
int dir4[4][2] = {{0, -1}, {-1, 0}, {1, 0}, {0, 1}};
int dir8[8][2] = {{-1, -1}, {0, -1}, {1, -1}, {-1, 0},
{1, 0}, {-1, 1}, {0, 1}, {1, 1}};
char dirchar[4] = {'<', '^', '>', 'v'};
// [a,b)
int irand(int a, int b) {
static mt19937 Rand(static_cast<unsigned int>(time(nullptr)));
uniform_int_distribution<int> dist(a, b - 1);
return dist(Rand);
}
// [a,b)
double drand(int a, int b) {
static mt19937 Rand(static_cast<unsigned int>(time(nullptr)));
uniform_real_distribution<double> dist(a, b);
return dist(Rand);
}
// https://qiita.com/IgnorantCoder/items/3101d6276e9bdddf872c
template <typename A, typename F> inline auto transform(const A &v, F &&f) {
using result_type =
decltype(std::declval<F>()(std::declval<typename A::value_type>()));
vector<result_type> y(v.size());
std::transform(std::cbegin(v), std::cend(v), std::begin(y), f);
return y;
}
// generate vector which has multiple dimension
template <class T> vector<T> make_v(size_t size, const T &init) {
return vector<T>(size, init);
}
template <class... Ts> auto make_v(size_t size, Ts... rest) {
return vector<decltype(make_v(rest...))>(size, make_v(rest...));
}
template <typename T> T Max(vector<T> a) { return *max_element(all(a)); }
template <typename T> T Min(vector<T> a) { return *min_element(all(a)); }
template <typename T> T Sum(vector<T> a) { return accumulate(all(a), (T)0); }
// for counting using map
template <typename T> void Add(map<T, int> &m, T item) {
if (m.find(item) == m.end()) {
m[item] = 1;
} else {
m[item]++;
}
}
// for counting using map
template <typename T> void Erase(map<T, int> &m, T item) {
if (m.find(item) == m.end()) {
} else {
if (m[item] == 1) {
m.erase(item);
} else {
m[item]--;
}
}
}
// get method for map with default value
template <typename T, typename U> U Get(map<T, U> m, T key, U def) {
if (m.find(key) == m.end()) {
return def;
} else {
return m[key];
}
}
template <typename T> inline bool Contains(const set<T> &t, const T &key) {
return t.find(key) != t.end();
}
template <typename T, typename U>
inline bool Contains(const map<T, U> &t, const T &key) {
return t.find(key) != t.end();
}
template <class T> struct Edge {
int from, to;
T cost;
Edge(int f, int t, T c) : from(f), to(t), cost(c) {}
};
template <class T> bool operator<(const Edge<T> e1, const Edge<T> e2) {
return e1.cost < e2.cost || (e1.cost == e2.cost && e1.from < e2.from) ||
(e1.cost == e2.cost && e1.from == e2.from && e1.to < e2.to);
}
template <class T> ostream &operator<<(ostream &os, const Edge<T> &edge) {
os << "(" << edge.from << "->" << edge.to << ":" << edge.cost << ")";
return os;
}
template <class T = int> class Graph {
int n;
bool directed;
vector<vector<Edge<T>>> edges;
public:
Graph(int n, bool directed)
: n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {}
void add_edge(int s, int t, T cost) {
edges[s].emplace_back(s, t, cost);
if (!directed) {
edges[t].emplace_back(t, s, cost);
}
}
Graph() {}
vector<Edge<T>> &operator[](size_t i) { return edges[i]; }
int size() const { return n; }
};
//======================================================
int main() {
int N, K;
cin >> N >> K;
vi a(N);
cin >> a;
vb win(N + 1, false);
rep(i, K + 1) {
rep(j, N) {
if (i - a[j] >= 0 && !win[i - a[j]])
win[i] = true;
}
}
if (win[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| #include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>
using namespace std;
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define chmin(mi, value) mi = min(mi, value)
#define chmax(ma, value) ma = max(ma, value)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFR INT_MAX
#define INFL (long long)(4e18)
#define INFLR LLONG_MAX
#define EPS (1e-10)
#define MOD 1000000007
//#define MOD 998244353
#define PI 3.141592653589793238
#define RMAX 4294967295
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vvvvi = vector<vector<vector<vector<int>>>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using vvs = vector<vector<string>>;
using Pi = pair<int, int>;
using vPi = vector<Pi>;
using vvPi = vector<vector<Pi>>;
using vvvPi = vector<vector<vector<Pi>>>;
using vvvvPi = vector<vector<vector<vector<Pi>>>>;
using Pll = pair<ll, ll>;
using vPll = vector<Pll>;
using Pd = pair<double, double>;
using vPd = vector<Pd>;
template <class T> using vec = vector<T>;
template <class T> using pql = priority_queue<T, vector<T>, greater<T>>;
using Comp = complex<double>;
// vvvvvvvvvvvvvvvvvvvvvvv debug output vvvvvvvvvvvvvvvvvvvvvvv
// vector input
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
for (T &x : vec)
is >> x;
return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pair_var) {
os << "(" << pair_var.first << ", " << pair_var.second << ")";
return os;
}
// vector
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
os << "{";
for (int i = 0; i < vec.size(); i++) {
os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
}
os << "}";
return os;
}
// deque
template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) {
os << "{";
for (int i = 0; i < vec.size(); i++) {
os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
}
os << "}";
return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
os << "{";
repi(itr, map_var) {
os << *itr;
itr++;
if (itr != map_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
// set
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
os << "{";
repi(itr, set_var) {
os << *itr;
itr++;
if (itr != set_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
// multiset
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &set_var) {
os << "{";
repi(itr, set_var) {
os << *itr;
itr++;
if (itr != set_var.end())
os << ", ";
itr--;
}
os << "}";
return os;
}
#define DUMPOUT cerr
void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&...tail) {
DUMPOUT << head;
if (sizeof...(Tail) > 0) {
DUMPOUT << ", ";
}
dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...) \
DUMPOUT << " " << string(#__VA_ARGS__) << ": " \
<< "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
<< " ", \
dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
// ^^^^^^^^^^^^^^^^^^^^^^^ debug output ^^^^^^^^^^^^^^^^^^^^^^^
string YN(bool y, int id = 0) {
if (id)
cout << id;
return (y ? "YES" : "NO");
}
string yn(bool y, int id = 0) {
if (id)
cout << id;
return (y ? "Yes" : "No");
}
string ON(bool y, int id = 0) {
if (id)
cout << id;
return (y ? "OK" : "NG");
}
int dir4[4][2] = {{0, -1}, {-1, 0}, {1, 0}, {0, 1}};
int dir8[8][2] = {{-1, -1}, {0, -1}, {1, -1}, {-1, 0},
{1, 0}, {-1, 1}, {0, 1}, {1, 1}};
char dirchar[4] = {'<', '^', '>', 'v'};
// [a,b)
int irand(int a, int b) {
static mt19937 Rand(static_cast<unsigned int>(time(nullptr)));
uniform_int_distribution<int> dist(a, b - 1);
return dist(Rand);
}
// [a,b)
double drand(int a, int b) {
static mt19937 Rand(static_cast<unsigned int>(time(nullptr)));
uniform_real_distribution<double> dist(a, b);
return dist(Rand);
}
// https://qiita.com/IgnorantCoder/items/3101d6276e9bdddf872c
template <typename A, typename F> inline auto transform(const A &v, F &&f) {
using result_type =
decltype(std::declval<F>()(std::declval<typename A::value_type>()));
vector<result_type> y(v.size());
std::transform(std::cbegin(v), std::cend(v), std::begin(y), f);
return y;
}
// generate vector which has multiple dimension
template <class T> vector<T> make_v(size_t size, const T &init) {
return vector<T>(size, init);
}
template <class... Ts> auto make_v(size_t size, Ts... rest) {
return vector<decltype(make_v(rest...))>(size, make_v(rest...));
}
template <typename T> T Max(vector<T> a) { return *max_element(all(a)); }
template <typename T> T Min(vector<T> a) { return *min_element(all(a)); }
template <typename T> T Sum(vector<T> a) { return accumulate(all(a), (T)0); }
// for counting using map
template <typename T> void Add(map<T, int> &m, T item) {
if (m.find(item) == m.end()) {
m[item] = 1;
} else {
m[item]++;
}
}
// for counting using map
template <typename T> void Erase(map<T, int> &m, T item) {
if (m.find(item) == m.end()) {
} else {
if (m[item] == 1) {
m.erase(item);
} else {
m[item]--;
}
}
}
// get method for map with default value
template <typename T, typename U> U Get(map<T, U> m, T key, U def) {
if (m.find(key) == m.end()) {
return def;
} else {
return m[key];
}
}
template <typename T> inline bool Contains(const set<T> &t, const T &key) {
return t.find(key) != t.end();
}
template <typename T, typename U>
inline bool Contains(const map<T, U> &t, const T &key) {
return t.find(key) != t.end();
}
template <class T> struct Edge {
int from, to;
T cost;
Edge(int f, int t, T c) : from(f), to(t), cost(c) {}
};
template <class T> bool operator<(const Edge<T> e1, const Edge<T> e2) {
return e1.cost < e2.cost || (e1.cost == e2.cost && e1.from < e2.from) ||
(e1.cost == e2.cost && e1.from == e2.from && e1.to < e2.to);
}
template <class T> ostream &operator<<(ostream &os, const Edge<T> &edge) {
os << "(" << edge.from << "->" << edge.to << ":" << edge.cost << ")";
return os;
}
template <class T = int> class Graph {
int n;
bool directed;
vector<vector<Edge<T>>> edges;
public:
Graph(int n, bool directed)
: n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {}
void add_edge(int s, int t, T cost) {
edges[s].emplace_back(s, t, cost);
if (!directed) {
edges[t].emplace_back(t, s, cost);
}
}
Graph() {}
vector<Edge<T>> &operator[](size_t i) { return edges[i]; }
int size() const { return n; }
};
//======================================================
int main() {
int N, K;
cin >> N >> K;
vi a(N);
cin >> a;
vb win(K + 1, false);
rep(i, K + 1) {
rep(j, N) {
if (i - a[j] >= 0 && !win[i - a[j]])
win[i] = true;
}
}
if (win[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,923 | 978,924 | u366676780 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int dp[N], a[N];
int n, k;
int play(int l) {
if (dp[l] != -1)
return dp[n];
if (l == 0)
return 0;
int state = 0;
for (int i = 1; i <= n; i++) {
if (a[i] > l)
continue;
if (play(l - a[i]) == 0) {
state = 1;
break;
}
}
return dp[l] = state;
}
int main() {
scanf("%d %d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
memset(dp, -1, sizeof dp);
if (play(k))
printf("First\n");
else
printf("Second\n");
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int dp[N], a[N];
int n, k;
int play(int l) {
if (dp[l] != -1)
return dp[l];
if (l == 0)
return 0;
int state = 0;
for (int i = 1; i <= n; i++) {
if (a[i] > l)
continue;
if (play(l - a[i]) == 0) {
state = 1;
break;
}
}
return dp[l] = state;
}
int main() {
scanf("%d %d", &n, &k);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
memset(dp, -1, sizeof dp);
if (play(k))
printf("First\n");
else
printf("Second\n");
return 0;
}
| [
"identifier.change",
"variable_access.subscript.index.change",
"function.return_value.change"
] | 978,925 | 978,926 | u377964143 | cpp |
p03170 | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
const ll inf = 1e17;
const ll N = 1e5 + 10;
const ll bits = 30;
const ll mod = 1e9 + 7;
ll dp[N][2]; // 1 if first win 0 if second wins
ll arr[N];
int solve(int k, int pl, int n) {
if (k < 0) {
return pl;
}
if (k == 0) {
return !pl;
}
if (dp[k][pl] != -1) {
return dp[k][pl];
}
dp[k][pl] = !pl;
for (int i = 0; i < n; i++) {
if (pl == solve(k - arr[i], !pl, n)) {
dp[k][pl] = pl;
break;
}
}
return dp[k][pl];
}
int main() {
FASTIO;
int n;
cin >> n;
int k;
cin >> k;
for (int i = 0; i <= k; i++) {
dp[i][0] = dp[i][1] = -1;
}
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
if (solve(k, 1, n)) {
cout << "first\n";
} else {
cout << "second\n";
}
} | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
const ll inf = 1e17;
const ll N = 1e5 + 10;
const ll bits = 30;
const ll mod = 1e9 + 7;
ll dp[N][2]; // 1 if first win 0 if second wins
ll arr[N];
int solve(int k, int pl, int n) {
if (k < 0) {
return pl;
}
if (k == 0) {
return !pl;
}
if (dp[k][pl] != -1) {
return dp[k][pl];
}
dp[k][pl] = !pl;
for (int i = 0; i < n; i++) {
if (pl == solve(k - arr[i], !pl, n)) {
dp[k][pl] = pl;
break;
}
}
return dp[k][pl];
}
int main() {
FASTIO;
int n;
cin >> n;
int k;
cin >> k;
for (int i = 0; i <= k; i++) {
dp[i][0] = dp[i][1] = -1;
}
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
if (solve(k, 1, n)) {
cout << "First\n";
} else {
cout << "Second\n";
}
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,927 | 978,928 | u366125603 | cpp |
p03170 | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
const ll inf = 1e17;
const ll N = 1e4 + 10;
const ll bits = 30;
const ll mod = 1e9 + 7;
ll dp[N][2]; // 1 if first win 0 if second wins
ll arr[N];
int solve(int k, int pl, int n) {
if (k < 0) {
return pl;
}
if (k == 0) {
return !pl;
}
if (dp[k][pl] != -1) {
return dp[k][pl];
}
dp[k][pl] = !pl;
for (int i = 0; i < n; i++) {
if (pl == solve(k - arr[i], !pl, n)) {
dp[k][pl] = pl;
break;
}
}
return dp[k][pl];
}
int main() {
FASTIO;
int n;
cin >> n;
int k;
cin >> k;
for (int i = 0; i <= k; i++) {
dp[i][0] = dp[i][1] = -1;
}
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
if (!solve(k, 0, n)) {
cout << "first\n";
} else {
cout << "second\n";
}
} | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
using namespace std;
const ll inf = 1e17;
const ll N = 1e5 + 10;
const ll bits = 30;
const ll mod = 1e9 + 7;
ll dp[N][2]; // 1 if first win 0 if second wins
ll arr[N];
int solve(int k, int pl, int n) {
if (k < 0) {
return pl;
}
if (k == 0) {
return !pl;
}
if (dp[k][pl] != -1) {
return dp[k][pl];
}
dp[k][pl] = !pl;
for (int i = 0; i < n; i++) {
if (pl == solve(k - arr[i], !pl, n)) {
dp[k][pl] = pl;
break;
}
}
return dp[k][pl];
}
int main() {
FASTIO;
int n;
cin >> n;
int k;
cin >> k;
for (int i = 0; i <= k; i++) {
dp[i][0] = dp[i][1] = -1;
}
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
if (solve(k, 1, n)) {
cout << "First\n";
} else {
cout << "Second\n";
}
} | [
"literal.number.change",
"expression.operation.binary.change",
"expression.operation.unary.logical.remove",
"control_flow.branch.if.condition.change",
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,929 | 978,928 | u366125603 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, m, n) for (int i = m; i < n; i++)
ll mod = 1e9 + 7;
int main() {
int n, k;
cin >> n, k;
int a[n];
rep(i, 0, n) cin >> a[i];
bool p[k + 1];
p[0] = false;
rep(i, 0, k + 1) {
bool q = false;
rep(j, 0, n) {
if (i - a[j] >= 0 && !p[i - a[j]]) {
q = true;
}
}
p[i] = q;
}
if (p[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, m, n) for (int i = m; i < n; i++)
ll mod = 1e9 + 7;
int main() {
int n, k;
cin >> n >> k;
int a[n];
rep(i, 0, n) cin >> a[i];
bool p[k + 1];
p[0] = false;
rep(i, 1, k + 1) {
bool q = false;
rep(j, 0, n) {
if (i - a[j] >= 0 && !p[i - a[j]]) {
q = true;
}
}
p[i] = q;
}
if (p[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"literal.number.change",
"call.arguments.change"
] | 978,734 | 978,735 | u356701928 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define vec(x) vector<x>
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define matrix(x) vector<vector<x>>
#define all(v) v.begin(), v.end()
#define mem(a, b) memset(a, b, sizeof a)
#define setBits(n) __builtin_popcountll(n)
#define prec(n) fixed << setprecision(n)
#define ff first
#define ss second
#define print(x) \
for (auto it : x) \
cout << it << " ";
#define dbg(x) cerr << #x << " :: " << x << endl;
#define dbg2(x, y) \
cerr << #x << " :: " << x << "\t" << #y << " :: " << y << endl;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double pi = acos(-1);
int power(int a, int b, int m = MOD) {
int ans = 1;
while (b > 0) {
if (b & 1)
ans = (ans * a) % m;
a = (a * a) % m;
b >>= 1;
}
return ans;
}
int dir[] = {-1, 0, 1, 0, -1};
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int N = 1e5 + 1;
void solve() {
int i, j, n, k;
cin >> n >> k;
vi a(n);
for (i = 0; i < n; i++)
cin >> a[i];
int dp[k + 1] = {0};
for (i = 1; i <= k; i++) {
for (j = 0; j < n; j++)
if (i - a[j] >= 0)
dp[i] = dp[i] or dp[i - a[j]];
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
t = 1;
// cin>>t;
while (t--)
solve();
} | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define vec(x) vector<x>
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define matrix(x) vector<vector<x>>
#define all(v) v.begin(), v.end()
#define mem(a, b) memset(a, b, sizeof a)
#define setBits(n) __builtin_popcountll(n)
#define prec(n) fixed << setprecision(n)
#define ff first
#define ss second
#define print(x) \
for (auto it : x) \
cout << it << " ";
#define dbg(x) cerr << #x << " :: " << x << endl;
#define dbg2(x, y) \
cerr << #x << " :: " << x << "\t" << #y << " :: " << y << endl;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double pi = acos(-1);
int power(int a, int b, int m = MOD) {
int ans = 1;
while (b > 0) {
if (b & 1)
ans = (ans * a) % m;
a = (a * a) % m;
b >>= 1;
}
return ans;
}
int dir[] = {-1, 0, 1, 0, -1};
int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int N = 1e5 + 1;
void solve() {
int i, j, n, k;
cin >> n >> k;
vi a(n);
for (i = 0; i < n; i++)
cin >> a[i];
int dp[k + 1] = {0};
for (i = 1; i <= k; i++) {
for (j = 0; j < n; j++)
if (i - a[j] >= 0)
dp[i] = dp[i] or !dp[i - a[j]];
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
t = 1;
// cin>>t;
while (t--)
solve();
} | [
"expression.operation.unary.add"
] | 978,740 | 978,741 | u088871523 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n + 1];
for (int i = 0; i < n; i++)
cin >> a[i];
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= k; i++) {
for (int val : a) {
if (val > i)
continue;
if (dp[i - val] == 0)
dp[i] = 1;
}
}
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;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= k; i++) {
for (int val : a) {
if (val > i)
continue;
if (dp[i - val] == 0)
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"expression.operation.binary.remove"
] | 978,746 | 978,747 | u962801933 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n + 1];
for (int i = 1; i <= n; i++)
cin >> a[i];
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= k; i++) {
for (int val : a) {
if (val > i)
continue;
else if (dp[i - val] == 0)
dp[i] = 1;
}
}
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;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= k; i++) {
for (int val : a) {
if (val > i)
continue;
if (dp[i - val] == 0)
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
} | [
"expression.operation.binary.remove",
"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",
"control_flow... | 978,748 | 978,747 | u962801933 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int dp[100001][2];
int a[100], n, min_val = INT_MAX;
int dfs(int k, int level) {
if (k < min_val)
return level;
if (dp[k][level] != -1)
return dp[k][level];
if (level == 0) {
int mx = 0;
for (int i = 0; i < n; i++) {
if (k >= a[i])
mx = max(mx, dfs(k - a[i], !(level & 1)));
}
dp[k][level] = mx;
return mx;
}
if (level == 1) {
int mn = 1;
for (int i = 0; i < n; i++) {
if (k >= a[i])
mn = min(mn, dfs(k - a[i], !(level & 1)));
}
dp[k][level] = mn;
return mn;
}
}
int main() {
int k;
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
min_val = min(min_val, a[i]);
}
int level = 0;
memset(dp, -1, sizeof(dp));
int ans = dfs(k, level);
if (ans)
cout << "first\n";
else
cout << "second\n";
} | #include <bits/stdc++.h>
using namespace std;
int dp[100001][2];
int a[100], n, min_val = INT_MAX;
int dfs(int k, int level) {
if (k < min_val)
return level;
if (dp[k][level] != -1)
return dp[k][level];
if (level == 0) {
int mx = 0;
for (int i = 0; i < n; i++) {
if (k >= a[i])
mx = max(mx, dfs(k - a[i], !(level & 1)));
}
dp[k][level] = mx;
return mx;
}
if (level == 1) {
int mn = 1;
for (int i = 0; i < n; i++) {
if (k >= a[i])
mn = min(mn, dfs(k - a[i], !(level & 1)));
}
dp[k][level] = mn;
return mn;
}
}
int main() {
int k;
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> a[i];
min_val = min(min_val, a[i]);
}
int level = 0;
memset(dp, -1, sizeof(dp));
int ans = dfs(k, level);
if (ans)
cout << "First\n";
else
cout << "Second\n";
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,749 | 978,750 | u230341913 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
double pi = 3.14159265359;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
//解説AC
int main() {
int n, k;
cin >> n >> k;
int a[n];
rep(i, 0, n) cin >> a[i];
bool dp[k + 1] = {}; // dp[i]:i個残りの時先手が勝てるか
rep(i, 1, k + 1) {
rep(j, 0, n) {
if (i > a[j])
dp[i] |= !dp[i - a[j]];
}
}
cout << (dp[k] ? "First" : "Second") << "\n";
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
double pi = 3.14159265359;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// 解説AC
int main() {
int n, k;
cin >> n >> k;
int a[n];
rep(i, 0, n) cin >> a[i];
bool dp[k + 1] = {}; // dp[i]:i個残りの時先手が勝てるか
rep(i, 1, k + 1) {
rep(j, 0, n) {
if (i >= a[j])
dp[i] |= !dp[i - a[j]];
}
}
cout << (dp[k] ? "First" : "Second") << "\n";
}
| [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 978,753 | 978,754 | u877494916 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define loop(i, a, b) for (ll i = a; i < b; i++)
#define rloop(i, a, b) for (ll i = a; i > b; i--)
const int inf = 1e9 + 7;
int main() {
ll n, k;
cin >> n >> k;
ll a[n];
loop(i, 0, n) { cin >> a[i]; }
bool dp[k + 1];
dp[0] = false;
loop(i, 1, k + 1) {
bool flag = false;
loop(j, 0, n) {
if (i == a[j])
flag = true;
else if (i - a[j] > 0)
flag += !(dp[i - a[j]] == true);
if (flag)
break;
}
dp[i] = flag;
}
if (dp[k])
cout << "first";
else
cout << "second";
} | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define loop(i, a, b) for (ll i = a; i < b; i++)
#define rloop(i, a, b) for (ll i = a; i > b; i--)
const int inf = 1e9 + 7;
int main() {
ll n, k;
cin >> n >> k;
ll a[n];
loop(i, 0, n) { cin >> a[i]; }
bool dp[k + 1];
dp[0] = false;
loop(i, 1, k + 1) {
bool flag = false;
loop(j, 0, n) {
if (i == a[j])
flag = true;
else if (i - a[j] > 0)
flag += !(dp[i - a[j]] == true);
if (flag)
break;
}
dp[i] = flag;
}
if (dp[k])
cout << "First";
else
cout << "Second";
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,758 | 978,759 | u933095385 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define faster \
cin.tie(0); \
ios_base::sync_with_stdio(0)
#define ll long long
// # setprecision doubt
int n, k;
int main() {
int temp;
cin >> n >> k;
vector<int> arr;
for (int i = 0; i < n; i++) {
cin >> temp;
arr.push_back(temp);
}
sort(arr.begin(), arr.end());
vector<bool> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i < arr[j] < 0)
break;
if (dp[i - arr[j]] == false) {
// found a way to defeat a opponent
// so i win
dp[i] = true;
break;
}
}
}
if (dp[k]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
}
| #include <bits/stdc++.h>
using namespace std;
#define faster \
cin.tie(0); \
ios_base::sync_with_stdio(0)
#define ll long long
// # setprecision doubt
int n, k;
int main() {
int temp;
cin >> n >> k;
vector<int> arr;
for (int i = 0; i < n; i++) {
cin >> temp;
arr.push_back(temp);
}
sort(arr.begin(), arr.end());
vector<bool> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - arr[j] < 0)
break;
if (dp[i - arr[j]] == false) {
// found a way to defeat a opponent
// so i win
dp[i] = true;
break;
}
}
}
if (dp[k]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
}
| [
"control_flow.branch.if.condition.change"
] | 978,760 | 978,761 | u829903680 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(101);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (a[j] > i) {
continue;
}
if (dp[i - a[j]] == 0) {
dp[i] = 1;
}
}
}
if (dp[k] == 1) {
cout << "first";
} else {
cout << "second";
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> a(101);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<bool> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (a[j] > i) {
continue;
}
if (dp[i - a[j]] == 0) {
dp[i] = 1;
}
}
}
if (dp[k] == 1) {
cout << "First";
} else {
cout << "Second";
}
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,766 | 978,767 | u997276644 | cpp |
p03170 | #include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <iostream>
#include <map>
#include <math.h>
#include <stack>
#include <string.h>
#include <unordered_map>
#include <vector>
using namespace std;
const int INF = 1e9;
#define ll long long
#define int ll
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define testcase \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define endl "\n"
#define deb1(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl
#define deb3(x, y, z) \
cout << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << endl
#define deb4(x, y, z, w) \
cout << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << " | " << #w << ": " << w << endl
#define deb5(a, b, c, d, e) \
cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(a) int((a).size())
#define pii pair<int, int>
#define fi first
#define se second
#define ld long double
#define vii vector<int>
#define all(v) v.begin(), v.end()
#define prec(n) fixed << setprecision(n)
const int MOD = (int)1e9 + 7;
const int MOD2 = 1007681537;
const ll LINF = (ll)1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-12;
inline ll gcd(ll a, ll b) {
ll r;
while (b) {
r = a % b;
a = b;
b = r;
}
return a;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline ll fpow(ll n, ll k, int p = MOD) {
ll r = 1;
for (; k; k >>= 1) {
if (k & 1)
r = r * n % p;
n = n * n % p;
}
return r;
}
template <class T> inline int chkmin(T &a, const T &val) {
return val < a ? a = val, 1 : 0;
}
template <class T> inline int chkmax(T &a, const T &val) {
return a < val ? a = val, 1 : 0;
}
inline void addmod(int &a, int val, int p = MOD) {
if ((a = (a + val)) >= p)
a -= p;
}
inline void submod(int &a, int val, int p = MOD) {
if ((a = (a - val)) < 0)
a += p;
}
inline int mult(int a, int b, int p = MOD) { return (ll)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
template <class T> inline void get_arr(T arr[], int n) {
for (int i = 0; i < n; i++)
cin >> arr[i];
}
template <class T> inline void print_arr(T arr[], int n) {
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
cout << endl;
}
int32_t main() {
int n, k;
cin >> n >> k;
int arr[n];
get_arr(arr, n);
vector<bool> dp(n + 1);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - arr[j] >= 0 && !dp[i - arr[j]]) {
dp[i] = true;
}
}
}
cout << (dp[k] ? "First" : "Second");
}
| #include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <iostream>
#include <map>
#include <math.h>
#include <stack>
#include <string.h>
#include <unordered_map>
#include <vector>
using namespace std;
const int INF = 1e9;
#define ll long long
#define int ll
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define testcase \
int t; \
cin >> t; \
while (t--)
#define pb push_back
#define endl "\n"
#define deb1(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl
#define deb3(x, y, z) \
cout << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << endl
#define deb4(x, y, z, w) \
cout << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " \
<< z << " | " << #w << ": " << w << endl
#define deb5(a, b, c, d, e) \
cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " \
<< c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(a) int((a).size())
#define pii pair<int, int>
#define fi first
#define se second
#define ld long double
#define vii vector<int>
#define all(v) v.begin(), v.end()
#define prec(n) fixed << setprecision(n)
const int MOD = (int)1e9 + 7;
const int MOD2 = 1007681537;
const ll LINF = (ll)1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-12;
inline ll gcd(ll a, ll b) {
ll r;
while (b) {
r = a % b;
a = b;
b = r;
}
return a;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline ll fpow(ll n, ll k, int p = MOD) {
ll r = 1;
for (; k; k >>= 1) {
if (k & 1)
r = r * n % p;
n = n * n % p;
}
return r;
}
template <class T> inline int chkmin(T &a, const T &val) {
return val < a ? a = val, 1 : 0;
}
template <class T> inline int chkmax(T &a, const T &val) {
return a < val ? a = val, 1 : 0;
}
inline void addmod(int &a, int val, int p = MOD) {
if ((a = (a + val)) >= p)
a -= p;
}
inline void submod(int &a, int val, int p = MOD) {
if ((a = (a - val)) < 0)
a += p;
}
inline int mult(int a, int b, int p = MOD) { return (ll)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
template <class T> inline void get_arr(T arr[], int n) {
for (int i = 0; i < n; i++)
cin >> arr[i];
}
template <class T> inline void print_arr(T arr[], int n) {
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
cout << endl;
}
int32_t main() {
int n, k;
cin >> n >> k;
int arr[n];
get_arr(arr, n);
vector<bool> dp(k + 1);
for (int i = 0; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i - arr[j] >= 0 && !dp[i - arr[j]]) {
dp[i] = true;
}
}
}
cout << (dp[k] ? "First" : "Second");
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,768 | 978,769 | u556783345 | cpp |
p03170 | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n;
int a[n];
bool dp[k + 1];
// memset(dp,false,sizeof(dp));
dp[0] = false;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= k; i++) {
dp[i] = false;
for (int j = 0; j < n; j++) {
if (i >= a[j] && dp[i - a[j]] == false)
dp[i] = true;
}
}
if (dp[k] == true)
cout << "First\n";
else
cout << "Second\n";
} | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int a[n];
bool dp[k + 1];
// memset(dp,false,sizeof(dp));
dp[0] = false;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 1; i <= k; i++) {
dp[i] = false;
for (int j = 0; j < n; j++) {
if (i >= a[j] && dp[i - a[j]] == false)
dp[i] = true;
}
}
if (dp[k] == true)
cout << "First\n";
else
cout << "Second\n";
} | [
"expression.operation.binary.add"
] | 978,772 | 978,773 | u842473278 | cpp |
p03170 | #include <bits/stdc++.h>
#define pb push_back
#define int long long int
#define f(i, a, b) for (int i = a; i < b; ++i)
using namespace std;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int dp[k + 1] = {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;
}
}
}
}
if (dp[k] == 1)
cout << "first";
else
cout << "second";
}
| #include <bits/stdc++.h>
#define pb push_back
#define int long long int
#define f(i, a, b) for (int i = a; i < b; ++i)
using namespace std;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, k;
cin >> n >> k;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
int dp[k + 1] = {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;
}
}
}
}
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,776 | 978,777 | u971247494 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> arr(n, 0), dp(k + 1, 0);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
dp[0] = 0;
for (int i = 1; i <= k; i++) {
bool win = 0;
for (int j = 0; j < n; j++) {
if (i - arr[j] >= 0) {
if (dp[i - arr[j]] == 0) {
win = 1;
break;
}
}
}
if (win)
dp[i] = 1;
else
dp[i] = 0;
}
// for(int i:dp)
// cout<<i<<"||";
if (dp[k] == 1)
cout << "first";
else
cout << "second";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> arr(n, 0), dp(k + 1, 0);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
dp[0] = 0;
for (int i = 1; i <= k; i++) {
bool win = 0;
for (int j = 0; j < n; j++) {
if (i - arr[j] >= 0) {
if (dp[i - arr[j]] == 0) {
win = 1;
break;
}
}
}
if (win)
dp[i] = 1;
else
dp[i] = 0;
}
// for(int i:dp)
// cout<<i<<"||";
if (dp[k] == 1)
cout << "First";
else
cout << "Second";
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,784 | 978,785 | u492789403 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, i, j;
cin >> n >> k;
int a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
int dp[k + 1];
dp[0] = 2;
int c;
for (i = 1; i < k + 1; i++) {
c = 0;
for (j = 0; j < n; j++) {
if (i - a[j] >= 0 && dp[i - a[j]] == 2) {
c++;
dp[i] = 1;
break;
}
}
if (c == 0)
dp[i] = 2;
}
if (dp[k] == 2)
cout << "second" << endl;
else
cout << "first" << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, i, j;
cin >> n >> k;
int a[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
int dp[k + 1];
dp[0] = 2;
int c;
for (i = 1; i < k + 1; i++) {
c = 0;
for (j = 0; j < n; j++) {
if (i - a[j] >= 0 && dp[i - a[j]] == 2) {
c++;
dp[i] = 1;
break;
}
}
if (c == 0)
dp[i] = 2;
}
if (dp[k] == 2)
cout << "Second" << endl;
else
cout << "First" << endl;
return 0;
} | [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,797 | 978,798 | u639413043 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define vi vector<int>
#define vvi vector<vector<int>>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
vi a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vi dp(k + 1, 0);
for (int i = 0; i <= k; ++i) {
for (auto x : a) {
if (i >= x)
if (!dp[i - 1])
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << '\n';
else
cout << "Second" << '\n';
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define vi vector<int>
#define vvi vector<vector<int>>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
vi a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vi dp(k + 1, 0);
for (int i = 0; i <= k; ++i) {
for (auto x : a) {
if (i >= x)
if (!dp[i - x])
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << '\n';
else
cout << "Second" << '\n';
return 0;
} | [
"identifier.replace.add",
"literal.replace.remove",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 978,799 | 978,800 | u111302286 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define vi vector<int>
#define vvi vector<vector<int>>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
vi a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vi dp(k + 1);
for (int i = 0; i <= k; ++i) {
for (auto x : a) {
if (i >= x)
if (!dp[i - 1])
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << '\n';
else
cout << "Second" << '\n';
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define vi vector<int>
#define vvi vector<vector<int>>
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
vi a(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
vi dp(k + 1, 0);
for (int i = 0; i <= k; ++i) {
for (auto x : a) {
if (i >= x)
if (!dp[i - x])
dp[i] = 1;
}
}
if (dp[k])
cout << "First" << '\n';
else
cout << "Second" << '\n';
return 0;
} | [
"call.arguments.add",
"identifier.replace.add",
"literal.replace.remove",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 978,801 | 978,800 | u111302286 | cpp |
p03170 | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<int> a(n + 1);
for (int i = 0; i < n; ++i)
cin >> a[i];
vector<bool> dp(k + 1);
for (int stone = 0; stone <= k; ++stone) {
for (int x : a) {
if (stone >= x and dp[stone - x] == false) {
dp[stone] = true;
}
}
}
cout << (dp[k] == true ? "First" : "Second");
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
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];
vector<bool> dp(k + 1);
for (int stone = 0; stone <= k; ++stone) {
for (int x : a) {
if (stone >= x and dp[stone - x] == false) {
dp[stone] = true;
}
}
}
cout << (dp[k] == true ? "First" : "Second");
}
| [
"expression.operation.binary.remove"
] | 978,802 | 978,803 | u469426472 | cpp |
p03170 | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
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];
vector<bool> dp(n + 1);
for (int stone = 0; stone <= k; ++stone) {
for (int x : a) {
if (stone >= x and dp[stone - x] == false) {
dp[stone] = true;
}
}
}
cout << (dp[k] == true ? "First" : "Second");
}
| #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
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];
vector<bool> dp(k + 1);
for (int stone = 0; stone <= k; ++stone) {
for (int x : a) {
if (stone >= x and dp[stone - x] == false) {
dp[stone] = true;
}
}
}
cout << (dp[k] == true ? "First" : "Second");
}
| [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,804 | 978,803 | u469426472 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
bool dp[20005];
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 = 0; i < k; ++i) {
for (int j = 0; j < n; ++j) {
if (!dp[i])
dp[i + a[j]] = true;
}
}
if (dp[k]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
bool dp[200011];
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 = 0; i < k; ++i) {
for (int j = 0; j < n; ++j) {
if (!dp[i])
dp[i + a[j]] = true;
}
}
if (dp[k]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
}
| [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,807 | 978,806 | u144029820 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::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];
vector<bool> dp(n + 5);
for (int stone = 0; stone <= k; stone++) {
for (int x : a) // Foreach stones in array a
{
if (x <= stone && !dp[stone - x]) {
dp[stone] = true;
}
}
}
cout << (dp[k] ? "First" : "Second") << "\n";
return 0;
}
/*
dp[i]: True if player 1 win with i stones remaining
The relation is: if (current x <= i remaining stones AND dp[remaining
stones] = false) dp[i] = true Why dp[stone-x] needs to be false: because
after stone - x the turn will change to the player 2 and if dp[stone-x] =
false is mean that player 2 loose => player 1 win
*/ | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::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];
vector<bool> dp(k + 5);
for (int stone = 0; stone <= k; stone++) {
for (int x : a) // Foreach stones in array a
{
if (x <= stone && !dp[stone - x]) {
dp[stone] = true;
}
}
}
cout << (dp[k] ? "First" : "Second") << "\n";
return 0;
}
/*
dp[i]: True if player 1 win with i stones remaining
The relation is: if (current x <= i remaining stones AND dp[remaining
stones] = false) dp[i] = true Why dp[stone-x] needs to be false: because
after stone - x the turn will change to the player 2 and if dp[stone-x] =
false is mean that player 2 loose => player 1 win
*/ | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 978,823 | 978,824 | u963948625 | cpp |
p03170 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MOD = 1e9 + 7;
#define INF ((1 << 30) - 1)
#define LINF (1LL << 30)
bool dp[110000];
int a[110];
int n, k;
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i <= k; i++) {
dp[i] = false;
for (int j = 0; j < n; j++) {
if (i - a[i] >= 0)
dp[i] |= !dp[i - a[j]];
}
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
return 0;
} | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MOD = 1e9 + 7;
#define INF ((1 << 30) - 1)
#define LINF (1LL << 30)
bool dp[110000];
int a[110];
int n, k;
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i <= k; i++) {
dp[i] = false;
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;
} | [
"identifier.change",
"variable_access.subscript.index.change",
"control_flow.branch.if.condition.change"
] | 978,825 | 978,826 | u503228842 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int dp[300001];
int ar[300001];
int i, j, k, l, m, n;
int solve(int x) {
if (x == 0)
return 0;
if (dp[x] != -1)
return dp[x];
int ans = 0;
for (i = 0; i < n; i++) {
if (ar[i] > x)
continue;
if (solve(x - ar[i]) == 0) {
ans = 1;
break;
}
}
return dp[x] = ans;
}
int main() {
cin >> n >> k;
memset(dp, -1, sizeof dp);
for (i = 0; i < n; i++)
cin >> ar[i];
if (solve(k))
cout << "First" << endl;
else
cout << "Second" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int dp[300001];
int ar[300001];
int j, k, l, m, n;
int solve(int x) {
if (x == 0)
return 0;
if (dp[x] != -1)
return dp[x];
int ans = 0;
for (int i = 0; i < n; i++) {
if (ar[i] > x)
continue;
if (solve(x - ar[i]) == 0) {
ans = 1;
break;
}
}
return dp[x] = ans;
}
int main() {
cin >> n >> k;
memset(dp, -1, sizeof dp);
for (int i = 0; i < n; i++)
cin >> ar[i];
if (solve(k))
cout << "First" << endl;
else
cout << "Second" << endl;
}
| [
"variable_declaration.remove"
] | 978,829 | 978,830 | u313897800 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int dp[300001];
int ar[300001];
int i, j, k, l, m, n;
int solve(int x) {
if (dp[x] != -1)
return dp[x];
if (x == 0)
return dp[x] = 0;
int ans = 0;
for (i = 0; i < n; i++) {
if (ar[i] > x)
continue;
if (solve(x - ar[i]) == 0) {
ans = 1;
break;
}
}
return dp[x] = ans;
}
int main() {
cin >> n >> k;
memset(dp, -1, sizeof dp);
for (i = 0; i < n; i++)
cin >> ar[i];
if (solve(k))
cout << "First" << endl;
else
cout << "Second" << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int dp[300001];
int ar[300001];
int j, k, l, m, n;
int solve(int x) {
if (dp[x] != -1)
return dp[x];
if (x == 0)
return dp[x] = 0;
int ans = 0;
for (int i = 0; i < n; i++) {
if (ar[i] > x)
continue;
if (solve(x - ar[i]) == 0) {
ans = 1;
break;
}
}
return dp[x] = ans;
}
int main() {
cin >> n >> k;
memset(dp, -1, sizeof dp);
for (int i = 0; i < n; i++)
cin >> ar[i];
if (solve(k))
cout << "First" << endl;
else
cout << "Second" << endl;
}
| [
"variable_declaration.remove"
] | 978,831 | 978,832 | u313897800 | cpp |
p03170 | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define FOR(n) for (int i = 0; i < n; i++)
#define till(n) for (int i = 1; i <= n; i++)
#define mod 1000000007
using namespace std;
int main() {
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n, k;
cin >> n >> k;
bool win[k + 1];
int a[k];
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
win[0] = false;
for (int i = 1; i <= k; i++) {
win[i] = false;
for (int j = 0; j < n; j++) {
if (a[j] <= i) {
if (win[i - a[j]] == false) {
win[i] = true;
break;
}
} else
break;
}
}
// for(int i=0;i<=k;i++)cout<<win[i] << " ";
cout << (win[k] ? "first" : "second") << endl;
return 0;
}
| #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define FOR(n) for (int i = 0; i < n; i++)
#define till(n) for (int i = 1; i <= n; i++)
#define mod 1000000007
using namespace std;
int main() {
// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n, k;
cin >> n >> k;
bool win[k + 1];
int a[k];
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
win[0] = false;
for (int i = 1; i <= k; i++) {
win[i] = false;
for (int j = 0; j < n; j++) {
if (a[j] <= i) {
if (win[i - a[j]] == false) {
win[i] = true;
break;
}
} else
break;
}
}
// for(int i=0;i<=k;i++)cout<<win[i] << " ";
cout << (win[k] ? "First" : "Second") << endl;
return 0;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,836 | 978,942 | u800717823 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
string solve(int arr[], int k, int n) {
vector<bool> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= j) {
if (dp[i - arr[j]] == 0)
dp[i] = 1;
}
}
}
return dp[k] ? "First" : "Second";
}
int main() {
// code
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
cout << solve(arr, k, n) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
string solve(int arr[], int k, int n) {
vector<bool> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= arr[j]) {
if (dp[i - arr[j]] == 0)
dp[i] = 1;
}
}
}
return dp[k] ? "First" : "Second";
}
int main() {
// code
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
cout << solve(arr, k, n) << endl;
}
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 978,947 | 978,948 | u723953059 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
string solve(int arr[], int k, int n) {
vector<int> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= j) {
if (dp[i - arr[j]] == 0)
dp[i] = 1;
}
}
}
return dp[k] ? "First" : "Second";
}
int main() {
// code
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
cout << solve(arr, k, n) << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
string solve(int arr[], int k, int n) {
vector<bool> dp(k + 1, 0);
for (int i = 1; i <= k; i++) {
for (int j = 0; j < n; j++) {
if (i >= arr[j]) {
if (dp[i - arr[j]] == 0)
dp[i] = 1;
}
}
}
return dp[k] ? "First" : "Second";
}
int main() {
// code
int n, k;
cin >> n >> k;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
cout << solve(arr, k, n) << endl;
}
| [
"variable_declaration.type.primitive.change",
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 978,949 | 978,948 | u723953059 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
// dp[i] - 1 if first player can win with i stones, 0 otherwise
int N, K, a[105];
bool dp[10005];
int main() {
cin >> N >> K;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
dp[0] = 0;
for (int i = 1; i <= K; i++) {
bool find = false;
for (int j = 0; j < N; j++) {
if (i - a[j] < 0)
continue;
if (dp[i - a[j]] == 0) {
find = true;
}
}
if (find) {
dp[i] = 1;
} else {
dp[i] = 0;
}
}
if (dp[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
} | #include <bits/stdc++.h>
using namespace std;
// dp[i] - 1 if first player can win with i stones, 0 otherwise
int N, K, a[105];
bool dp[100005];
int main() {
cin >> N >> K;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
dp[0] = 0;
for (int i = 1; i <= K; i++) {
bool find = false;
for (int j = 0; j < N; j++) {
if (i - a[j] < 0)
continue;
if (dp[i - a[j]] == 0) {
find = true;
}
}
if (find) {
dp[i] = 1;
} else {
dp[i] = 0;
}
}
if (dp[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,950 | 978,951 | u052165189 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define REPN(i, m, n) for (int(i) = m; (i) < (int)(n); ++(i))
#define REP_REV(i, n) for (int(i) = (int)(n)-1; (i) >= 0; --(i))
#define REPN_REV(i, m, n) for (int(i) = (int)(n)-1; (i) >= m; --(i))
#define INF 2e9
#define INF_LL 1LL << 60
#define ll long long
#define MOD 1e9 + 7
#define print2D(h, w, arr) \
REP(i, h) { \
REP(j, w) cout << arr[i][j] << " "; \
cout << endl; \
}
#define print_line(vec, n) \
{ \
for (int i = 0; i < (n - 1); i++) \
cout << (vec)[i] << " "; \
cout << (vec)[(n)-1] << endl; \
}
template <class T> void print(const T &x) { cout << x << endl; }
template <class T, class... A> void print(const T &first, const A &...rest) {
cout << first << " ";
print(rest...);
}
struct PreMain {
PreMain() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
}
} premain;
/* 残りi枚で回ってきたときその人が勝てるかどうか */
bool dp[10001];
int main() {
int N, K;
cin >> N >> K;
vector<int> a(N);
REP(i, N) cin >> a[i];
REPN(i, 1, K + 1) REP(j, N) { dp[i] |= (a[j] <= i) && (!dp[i - a[j]]); }
if (dp[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define REPN(i, m, n) for (int(i) = m; (i) < (int)(n); ++(i))
#define REP_REV(i, n) for (int(i) = (int)(n)-1; (i) >= 0; --(i))
#define REPN_REV(i, m, n) for (int(i) = (int)(n)-1; (i) >= m; --(i))
#define INF 2e9
#define INF_LL 1LL << 60
#define ll long long
#define MOD 1e9 + 7
#define print2D(h, w, arr) \
REP(i, h) { \
REP(j, w) cout << arr[i][j] << " "; \
cout << endl; \
}
#define print_line(vec, n) \
{ \
for (int i = 0; i < (n - 1); i++) \
cout << (vec)[i] << " "; \
cout << (vec)[(n)-1] << endl; \
}
template <class T> void print(const T &x) { cout << x << endl; }
template <class T, class... A> void print(const T &first, const A &...rest) {
cout << first << " ";
print(rest...);
}
struct PreMain {
PreMain() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(20);
}
} premain;
/* 残りi枚で回ってきたときその人が勝てるかどうか */
bool dp[100001];
int main() {
int N, K;
cin >> N >> K;
vector<int> a(N);
REP(i, N) cin >> a[i];
REPN(i, 1, K + 1) REP(j, N) { dp[i] |= (a[j] <= i) && (!dp[i - a[j]]); }
if (dp[K]) {
cout << "First" << endl;
} else {
cout << "Second" << endl;
}
return 0;
} | [
"literal.number.change",
"variable_declaration.array_dimensions.change"
] | 978,961 | 978,962 | u127768253 | cpp |
p03170 | #include <iostream>
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];
}
for (int i = 0; i <= k; ++i) {
for (int j = 0; j < n; ++j) {
if (i >= a[j] && !dp[i - a[j]]) {
dp[i] = 1;
}
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
}
| #include <iostream>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
bool dp[k + 1] = {0};
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] && !dp[i - a[j]]) {
dp[i] = 1;
}
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
}
| [
"variable_declaration.value.change"
] | 978,969 | 978,970 | u518232099 | cpp |
p03170 | #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define gcd __gcd
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define mp make_pair
#define pb push_back
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define sbits(a) __builtin_popcount(a)
#define lcm(a, b) ((a * b) / gcd(a, b))
#define nani(x) cerr << #x << " is " << x << endl;
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({v, w}), g[v].pb({u, w});
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007
typedef long long ll;
const int N = 1e5 + 5;
int A[105];
bool dp[N];
int main() {
fast;
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> A[i];
for (int i = 0; i <= k; i++) {
int z = !dp[i];
for (int x = 0; x < n; x++) {
if (i + A[x] <= k && !dp[i + A[x]])
dp[i + A[i]] |= z;
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
}
| #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define gcd __gcd
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define mp make_pair
#define pb push_back
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define sbits(a) __builtin_popcount(a)
#define lcm(a, b) ((a * b) / gcd(a, b))
#define nani(x) cerr << #x << " is " << x << endl;
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({v, w}), g[v].pb({u, w});
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000
#define mod 1000000007
typedef long long ll;
const int N = 1e5 + 5;
int A[105];
bool dp[N];
int main() {
fast;
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n, k;
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> A[i];
for (int i = 0; i <= k; i++) {
int z = !dp[i];
for (int x = 0; x < n; x++) {
if (i + A[x] <= k && !dp[i + A[x]])
dp[i + A[x]] |= z;
}
}
if (dp[k])
cout << "First";
else
cout << "Second";
return 0;
}
| [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 978,973 | 978,974 | u205309198 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N, 0);
for (int i = 0; i < N; i++)
cin >> A[i];
// dp[i] = True if game is winnable by Taro
vector<bool> dp(K + 1, false);
dp[0] = false; // Taro loses if zero stones initially
for (int i = 1; i <= K; i++) {
for (int j = 0; j < N; j++) {
if ((i - A[j] > 0) && (dp[i - A[j]] == false)) {
// can make the game unwinnable for other player by
// make a move of removing A[j] stones
// Making game unwinnable for other means
// making it winnable for myself
dp[i] = true;
}
}
}
if (dp[K])
cout << "First";
else
cout << "Second";
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
vector<int> A(N, 0);
for (int i = 0; i < N; i++)
cin >> A[i];
// dp[i] = True if game is winnable by Taro
vector<bool> dp(K + 1, false);
dp[0] = false; // Taro loses if zero stones initially
for (int i = 1; i <= K; i++) {
for (int j = 0; j < N; j++) {
if ((i - A[j] >= 0) && (dp[i - A[j]] == false)) {
// can make the game unwinnable for other player by
// make a move of removing A[j] stones
// Making game unwinnable for other means
// making it winnable for myself
dp[i] = true;
}
}
}
if (dp[K])
cout << "First";
else
cout << "Second";
return 0;
} | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 978,979 | 978,980 | u275188852 | 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];
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i < k + 1; ++i) {
for (int j = 0; j < n; ++j) {
bool t = 0;
if (i >= arr[j]) {
t = !dp[i - arr[j]];
}
dp[i] = dp[i] | t;
}
// cout<<i<<" "<<dp[i]<<endl;
}
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;
int arr[n];
for (int i = 0; i < n; ++i)
cin >> arr[i];
bool dp[k + 1];
memset(dp, 0, sizeof(dp));
for (int i = 1; i < k + 1; ++i) {
for (int j = 0; j < n; ++j) {
bool t = 0;
if (i >= arr[j]) {
t = !dp[i - arr[j]];
}
dp[i] = dp[i] | t;
}
// cout<<i<<" "<<dp[i]<<endl;
}
if (dp[k])
cout << "First" << endl;
else
cout << "Second" << endl;
}
| [
"literal.string.change",
"literal.string.case.change",
"io.output.change"
] | 978,985 | 978,986 | u562275919 | cpp |
p03170 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll T;
T = 6;
start:
while (T--) {
ll n, m;
cin >> n >> m;
ll a[n];
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
ll dp[m + 1];
for (ll i = 0; i < a[0]; i++) {
dp[i] = 2;
}
for (ll i = a[0]; i <= m; i++) {
dp[i] = 2;
for (ll j = 0; j < n; j++) {
if (a[j] <= i) {
ll t = dp[i - a[j]];
if (t == 2) {
dp[i] = 1;
break;
}
} else {
break;
}
}
// cout<<i<<"--"<<dp[i]<<endl;
}
if (dp[m] == 2) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll T;
T = 1;
start:
while (T--) {
ll n, m;
cin >> n >> m;
ll a[n];
for (ll i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
ll dp[m + 1];
for (ll i = 0; i < a[0]; i++) {
dp[i] = 2;
}
for (ll i = a[0]; i <= m; i++) {
dp[i] = 2;
for (ll j = 0; j < n; j++) {
if (a[j] <= i) {
ll t = dp[i - a[j]];
if (t == 2) {
dp[i] = 1;
break;
}
} else {
break;
}
}
// cout<<i<<"--"<<dp[i]<<endl;
}
if (dp[m] == 2) {
cout << "Second" << endl;
} else {
cout << "First" << endl;
}
}
return 0;
} | [
"literal.number.change",
"assignment.value.change"
] | 978,991 | 978,992 | u772329566 | cpp |
p03170 | /***********************************************************
*This code By @1353055672(Ligen) *
*[Warning]You're not excepted to understand this code! *
*CSP-S 2019 RP++ *
***********************************************************/
// #pragma GCC optimize(3)
#define ADD_STACK \
int size = 512 << 20; \
char *pp = (char *)malloc(size) + size; \
__asm__("movl %0, %%esp\n" ::"r"(pp))
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define ll long long
#define ull unsigned long long
#define mn 200020
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) (((x) < (0)) ? (-(x)) : (x))
#define infll (ll)(1e18)
#define infint (1 << 30)
#define mod (int)(1e9 + 7)
#define FOR(a, b, c) for (register int a = b; a <= c; ++a)
#define FORD(a, b, c) for (register int a = b; a >= c; --a)
using namespace std;
// char buf[1<<20],*p1=buf,*p2=buf;
// #define getchar()
// (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
inline ll read() {
ll x = 0, f = 1;
char c;
for (c = getchar(); c < '0' || c > '9';
f = ((c == '-') ? -1 : f), c = getchar())
;
for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = getchar())
;
return x * f;
}
template <typename T> inline void write(T a) {
if (a == 0) {
putchar('0');
return;
}
if (a < 0)
putchar('-'), a = -a;
char c1[120];
int h = 0;
while (a)
c1[++h] = a % 10 + '0', a /= 10;
FORD(i, h, 1) putchar(c1[i]);
}
inline void write_() { return; }
template <typename T, typename... Args> inline void write_(T a, Args... b) {
write(a);
putchar(' ');
write_(b...);
}
inline void writeln() {
putchar('\n');
return;
}
template <typename T, typename... Args> inline void writeln(T a, Args... b) {
write(a);
putchar(' ');
writeln(b...);
}
// need c++11
// inline void write(ll a){
// if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int
// h=0; while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
//}
// inline void write_(ll a){write(a);putchar(' ');}
// inline void writeln(ll a){write(a);putchar('\n');}
inline ll gcd(ll a, ll b) { return a == 0 ? b : gcd(b % a, a); }
inline ll lcm(ll a, ll b) { return 1ll * a / gcd(a, b) * b; }
inline ll Pow(ll n, ll a) {
ll b = 1;
while (a) {
if (a & 1)
b = 1ll * b * n % mod;
n = 1ll * n * n % mod;
a >>= 1;
}
return b;
}
//---------------------Head Files--------------------------//
int n, m, a[120];
bool v[100020], vv;
signed main() {
#ifdef LOCAL_LIGEN
// freopen("0.in","r",stdin);
// freopen("0.out","w",stdout);
double be = clock();
#endif
n = read(), m = read();
FOR(i, 1, n) a[i] = read(), v[a[i]] = 1;
FOR(i, 1, m) if (!v[i]) {
vv = 1;
FOR(j, 1, n) if (i - a[j] >= 0) vv &= v[i - a[j]];
else vv = 0;
if (!vv)
v[i] = 1;
}
if (v[m])
puts("First");
else
puts("Second");
#ifdef LOCAL_LIGEN
double en = clock();
printf("Time: %.0lfms\n", en - be);
fclose(stdin);
fclose(stdout);
#endif
return 0;
} | /***********************************************************
*This code By @1353055672(Ligen) *
*[Warning]You're not excepted to understand this code! *
*CSP-S 2019 RP++ *
***********************************************************/
// #pragma GCC optimize(3)
#define ADD_STACK \
int size = 512 << 20; \
char *pp = (char *)malloc(size) + size; \
__asm__("movl %0, %%esp\n" ::"r"(pp))
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define ll long long
#define ull unsigned long long
#define mn 200020
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) (((x) < (0)) ? (-(x)) : (x))
#define infll (ll)(1e18)
#define infint (1 << 30)
#define mod (int)(1e9 + 7)
#define FOR(a, b, c) for (register int a = b; a <= c; ++a)
#define FORD(a, b, c) for (register int a = b; a >= c; --a)
using namespace std;
// char buf[1<<20],*p1=buf,*p2=buf;
// #define getchar()
// (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
inline ll read() {
ll x = 0, f = 1;
char c;
for (c = getchar(); c < '0' || c > '9';
f = ((c == '-') ? -1 : f), c = getchar())
;
for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = getchar())
;
return x * f;
}
template <typename T> inline void write(T a) {
if (a == 0) {
putchar('0');
return;
}
if (a < 0)
putchar('-'), a = -a;
char c1[120];
int h = 0;
while (a)
c1[++h] = a % 10 + '0', a /= 10;
FORD(i, h, 1) putchar(c1[i]);
}
inline void write_() { return; }
template <typename T, typename... Args> inline void write_(T a, Args... b) {
write(a);
putchar(' ');
write_(b...);
}
inline void writeln() {
putchar('\n');
return;
}
template <typename T, typename... Args> inline void writeln(T a, Args... b) {
write(a);
putchar(' ');
writeln(b...);
}
// need c++11
// inline void write(ll a){
// if(a==0){putchar('0');return;}if(a<0)putchar('-'),a=-a;char c1[120];int
// h=0; while(a)c1[++h]=a%10+'0',a/=10;FORD(i,h,1)putchar(c1[i]);
//}
// inline void write_(ll a){write(a);putchar(' ');}
// inline void writeln(ll a){write(a);putchar('\n');}
inline ll gcd(ll a, ll b) { return a == 0 ? b : gcd(b % a, a); }
inline ll lcm(ll a, ll b) { return 1ll * a / gcd(a, b) * b; }
inline ll Pow(ll n, ll a) {
ll b = 1;
while (a) {
if (a & 1)
b = 1ll * b * n % mod;
n = 1ll * n * n % mod;
a >>= 1;
}
return b;
}
//---------------------Head Files--------------------------//
int n, m, a[120];
bool v[100020], vv;
signed main() {
#ifdef LOCAL_LIGEN
// freopen("0.in","r",stdin);
// freopen("0.out","w",stdout);
double be = clock();
#endif
n = read(), m = read();
FOR(i, 1, n) a[i] = read(), v[a[i]] = 1;
FOR(i, 1, m) if (!v[i]) {
vv = 1;
FOR(j, 1, n) if (i - a[j] >= 0) vv &= v[i - a[j]];
if (!vv)
v[i] = 1;
}
// FOR(i,0,m)writeln(i,v[i]);
if (v[m])
puts("First");
else
puts("Second");
#ifdef LOCAL_LIGEN
double en = clock();
printf("Time: %.0lfms\n", en - be);
fclose(stdin);
fclose(stdout);
#endif
return 0;
} | [] | 978,995 | 978,996 | u379604713 | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.