Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vd vector<double>
#define vvi vector<vi>
#define vvl vector<vl>
#define vvb vector<vb>
#define vvd vector<vd>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define pb push_back
#define sz(s) (int)(s.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent, diff_weight;
  UnionFind(int n){
    Parent = vi(n,-1);
    diff_weight = vi(n,0);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    int r = root(Parent[a]);
    diff_weight[a] += diff_weight[Parent[a]];
    return Parent[a] = r;
  }

  int weight(int a){
    root(a);
    return diff_weight[a];
  }

  bool issame(int a, int b){
    return root(a) == root(b);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  // weight(b) - weight(a) = w となるように繋ぐ
  // 数直線上で a........b となっていてその距離が w 、のようなイメージ
  bool merge(int a, int b, int w = 0){
    w += weight(a); w -= weight(b);

    a = root(a);
    b = root(b);

    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b), w = -w;
    Parent[a] += Parent[b];
    Parent[b] = a;
    diff_weight[b] = w;
    return true;
  }

  int diff(int a, int b){
    return weight(b) - weight(a);
  }
};

vi MP(string s){
  vi A(s.size()+1);
  A[0] = -1;
  int j = -1;
  rep(i,s.size()) {
    while(j >= 0 && s[i] != s[j]) j = A[j];
    j++;
    A[i+1] = j;
  }
  return A;
}

vi Manacher(string s){
  vi R(s.size());
  int i = 0, j = 0;
  while(i < s.size()){
    while(i-j >= 0 && i+j < s.size() && s[i-j] == s[i+j]) ++j;
    R[i] = j;
    int k = 1;
    while(i-k >= 0 && i+k < s.size() && k+R[i-k] < j) R[i+k] = R[i-k], k++;
    i += k; j -= k;
  }
  return R;
}

vi Z_algorithm(string &s){
  vi Z(s.size());
  Z[0] = s.size();
  int i = 1, j = 0;
  while(i < s.size()){
    while(i+j < s.size() && s[j] == s[i+j]) j++;
    Z[i] = j;
    if(j == 0){++i; continue;}
    int k = 1;
    while(i+k < s.size() && k+Z[k] < j) Z[i+k] = Z[k], ++k;
    i += k; j -= k;
  }
  return Z;
}

const int MAX = 1e6+1;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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(ll n, ll k){
  if(n >= MAX){
    ll tmp = 1;
    rep(i,k){
      tmp *= (n-i);
      tmp %= MOD;
    }
    return tmp*finv[k]%MOD;
  }

  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll POW(ll x, ll n){
  ll ret = 1;
  if(n < 0){// n < 0 にも対応
    n *= -1;
    x = inv[x];
  }
  while(0 < n){
    if(n%2 == 0){
      x = x*x%MOD;
      n /= 2;
    }
    else{
      ret = ret*x%MOD;
      n--;
    }
  }
  return ret;
}

int dp[200100];
// dp[k]: 石の数が k 個の時にその手番の人が勝てるか？

int main(){
  int n, K;
  cin >> n >> K;
  vi a(n); rep(i,n) cin >> a[i];
  rep(k,K) rep(i,n) {
    if(dp[k] == 0) dp[k+a[i]] = 1;
  }
  cout << (dp[K] ? "First" : "Second") << endl;
}
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vd vector<double>
#define vvi vector<vi>
#define vvl vector<vl>
#define vvb vector<vb>
#define vvd vector<vd>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define pb push_back
#define sz(s) (int)(s.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent, diff_weight;
  UnionFind(int n){
    Parent = vi(n,-1);
    diff_weight = vi(n,0);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    int r = root(Parent[a]);
    diff_weight[a] += diff_weight[Parent[a]];
    return Parent[a] = r;
  }

  int weight(int a){
    root(a);
    return diff_weight[a];
  }

  bool issame(int a, int b){
    return root(a) == root(b);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  // weight(b) - weight(a) = w となるように繋ぐ
  // 数直線上で a........b となっていてその距離が w 、のようなイメージ
  bool merge(int a, int b, int w = 0){
    w += weight(a); w -= weight(b);

    a = root(a);
    b = root(b);

    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b), w = -w;
    Parent[a] += Parent[b];
    Parent[b] = a;
    diff_weight[b] = w;
    return true;
  }

  int diff(int a, int b){
    return weight(b) - weight(a);
  }
};

vi MP(string s){
  vi A(s.size()+1);
  A[0] = -1;
  int j = -1;
  rep(i,s.size()) {
    while(j >= 0 && s[i] != s[j]) j = A[j];
    j++;
    A[i+1] = j;
  }
  return A;
}

vi Manacher(string s){
  vi R(s.size());
  int i = 0, j = 0;
  while(i < s.size()){
    while(i-j >= 0 && i+j < s.size() && s[i-j] == s[i+j]) ++j;
    R[i] = j;
    int k = 1;
    while(i-k >= 0 && i+k < s.size() && k+R[i-k] < j) R[i+k] = R[i-k], k++;
    i += k; j -= k;
  }
  return R;
}

vi Z_algorithm(string &s){
  vi Z(s.size());
  Z[0] = s.size();
  int i = 1, j = 0;
  while(i < s.size()){
    while(i+j < s.size() && s[j] == s[i+j]) j++;
    Z[i] = j;
    if(j == 0){++i; continue;}
    int k = 1;
    while(i+k < s.size() && k+Z[k] < j) Z[i+k] = Z[k], ++k;
    i += k; j -= k;
  }
  return Z;
}

const int MAX = 1e6+1;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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(ll n, ll k){
  if(n >= MAX){
    ll tmp = 1;
    rep(i,k){
      tmp *= (n-i);
      tmp %= MOD;
    }
    return tmp*finv[k]%MOD;
  }

  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll POW(ll x, ll n){
  ll ret = 1;
  if(n < 0){// n < 0 にも対応
    n *= -1;
    x = inv[x];
  }
  while(0 < n){
    if(n%2 == 0){
      x = x*x%MOD;
      n /= 2;
    }
    else{
      ret = ret*x%MOD;
      n--;
    }
  }
  return ret;
}

int main(){
  int n, x, y; cin >> n >> x >> y;
  x--; y--;
  int G[n][n];
  rep(i,n) rep(j,n) G[i][j] = abs(i-j);
  G[x][y] = G[y][x] = 1;
  rep(i,n) rep(j,n) chmin(G[i][j], G[i][x] + G[x][y] + G[y][j]);
  vi ans(n);
  rep(i,n) rep(j,n) ans[G[i][j]]++;
  rep(i,n) {
    if(i == 0) continue;
    cout << ans[i]/2 << endl;
  }
}


Compiler output:
a.cc:235:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
  235 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:28:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
   28 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:236:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
  236 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:29:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
   29 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
      |                               ^~~~~
a.cc:238:4: error: redefinition of 'long long int gcd(long long int, long long int)'
  238 | ll gcd(ll a, ll b) {
      |    ^~~
a.cc:31:4: note: 'long long int gcd(long long int, long long int)' previously defined here
   31 | ll gcd(ll a, ll b) {
      |    ^~~
a.cc:243:4: error: redefinition of 'long long int keta(long long int)'
  243 | ll keta(ll n){
      |    ^~~~
a.cc:36:4: note: 'long long int keta(long long int)' previously defined here
   36 | ll keta(ll n){
      |    ^~~~
a.cc:249:10: error: redefinition of 'const long long int INF'
  249 | const ll INF = 1LL << 60;
      |          ^~~
a.cc:42:10: note: 'const long long int INF' previously defined here
   42 | const ll INF = 1LL << 60;
      |          ^~~
a.cc:251:11: error: redefinition of 'const int dh [4]'
  251 | const int dh[4] = {1,0,-1,0};
      |           ^~
a.cc:44:11: note: 'const int dh [4]' previously defined here
   44 | const int dh[4] = {1,0,-1,0};
      |           ^~
a.cc:252:11: error: redefinition of 'const int dw [4]'
  252 | const int dw[4] = {0,1,0,-1};
      |           ^~
a.cc:45:11: note: 'const int dw [4]' previously defined here
   45 | const int dw[4] = {0,1,0,-1};
      |           ^~
a.cc:254:8: error: redefinition of 'struct Edge'
  254 | struct Edge{
      |        ^~~~
a.cc:47:8: note: previous definition of 'struct Edge'
   47 | struct Edge{
      |        ^~~~
a.cc:262:7: error: redefinition of 'class UnionFind'
  262 | class UnionFind{
      |       ^~~~~~~~~
a.cc:55:7: note: previous definition of 'class UnionFind'
   55 | class UnionFind{
      |       ^~~~~~~~~
a.cc:312:4: error: redefinition of 'std::vector<int> MP(std::string)'
  312 | vi MP(string s){
      |    ^~
a.cc:105:4: note: 'std::vector<int> MP(std::string)' previously defined here
  105 | vi MP(string s){
      |    ^~
a.cc:324:4: error: redefinition of 'std::vector<int> Manacher(std::string)'
  324 | vi Manacher(string s){
      |    ^~~~~~~~
a.cc:117:4: note: 'std::vector<int> Manacher(std::string)' previously defined here
  117 | vi Manacher(string s){
      |    ^~~~~~~~
a.cc:337:4: error: redefinition of 'std::vector<int> Z_algorithm(std::string&)'
  337 | vi Z_algorithm(string &s){
      |    ^~~~~~~~~~~
a.cc:130:4: note: 'std::vector<int> Z_algorithm(std::string&)' previously defined here
  130 | vi Z_algorithm(string &s){
      |    ^~~~~~~~~~~
a.cc:352:11: error: redefinition of 'const int MAX'
  352 | const int MAX = 1e6+1;
      |           ^~~
a.cc:145:11: note: 'const int MAX' previously defined here
  145 | const int MAX = 1e6+1;
      |           ^~~
a.cc:354:11: error: redefinition of 'long long int fac [1000001]'
  354 | long long fac[MAX], finv[MAX], inv[MAX];
      |           ^~~
a.cc:147:11: note: 'long long int fac [1000001]' previously declared here
  147 | long long fac[MAX], finv[MAX], inv[MAX];
      |           ^~~
a.cc:354:21: error: redefinition of 'long long int finv [1000001]'
  354 | long long fac[MAX], finv[MAX], inv[MAX];
      |                     ^~~~
a.cc:147:21: note: 'long long int finv [1000001]' previously declared here
  147 | long long fac[MAX], finv[MAX], inv[MAX];
      |                     ^~~~
a.cc:354:32: error: redefinition of 'long long int inv [1000001]'
  354 | long long fac[MAX], finv[MAX], inv[MAX];
      |                                ^~~
a.cc:147:32: note: 'long long int inv [1000001]' previously declared here
  147 | long long fac[MAX], finv[MAX], inv[MAX];
      |                                ^~~
a.cc:357:6: error: redefinition of 'void COMinit()'
  357 | void COMinit() {
      |      ^~~~~~~
a.cc:150:6: note: 'void COMinit()' previously defined here
  150 | void COMinit() {
      |      ^~~~~~~
a.cc:369:11: error: redefinition of 'long long int COM(long long int, long long int)'
  369 | long long COM(ll n, ll k){
      |           ^~~
a.cc:162:11: note: 'long long int COM(long long int, long long int)' previously defined here
  162 | long long COM(ll n, ll k){
      |           ^~~
a.cc:384:4: error: redefinition of 'long long int POW(long long int, long long int)'
  384 | ll POW(ll x, ll n){
      |    ^~~
a.cc:177:4: note: 'long long int POW(long long int, long long int)' previously defined here
  177 | ll POW(ll x, ll n){
      |    ^~~
a.cc:403:5: error: redefinition of 'int main()'
  403 | int main(){
      |     ^~~~
a.cc:199:5: note: 'int main()' previously defined here
  199 | int main(){
      |     ^~~~