Problem p03170 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

#define db1(x) cout << #x << "=" << x << '\n'
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n'
#define db3(x, y, z)                                                           \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << '\n'
#define db4(x, y, z, w)                                                        \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << "," << #w << "=" << w << '\n'
#define sz(a) int((a).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define PR(a, n)                                                               \
  {                                                                            \
    cout << #a << "=";                                                         \
    for (int __ = 0; __ < n; __++)                                             \
      cout << a[__] << ' ';                                                    \
    cout << "\n";                                                              \
  }
using namespace std;
using ll = unsigned long long;
#define int ll

signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;

  vector<int> v(n);
  for (int &i : v)
    cin >> i;
  vector<bool> dp(k + 1);
  sort(v.begin(), v.end());
  int m = v.front();
  if (k < m)
    cout << "Second";
  else {
    for (int i = 0; i < m; ++i)
      dp[i] = false;
    dp[m] = true;
    for (int i = m + 1; i <= k; ++i) {

      for (int x : v) {
        if (i - x < 0) {
          break;
        }
        if (!dp[i - x]) {
          dp[i] = true;
          break;
        }
      }
    }
    if (dp[k]) {
      cout << "First";
    } else {
      cout << "Second";
    }
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

#define db1(x) cout << #x << "=" << x << '\n'
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n'
#define db3(x, y, z)                                                           \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << '\n'
#define db4(x, y, z, w)                                                        \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << "," << #w << "=" << w << '\n'
#define sz(a) int((a).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define PR(a, n)                                                               \
  {                                                                            \
    cout << #a << "=";                                                         \
    for (int __ = 0; __ < n; __++)                                             \
      cout << a[__] << ' ';                                                    \
    cout << "\n";                                                              \
  }
using namespace std;
using ll = long long;
#define int ll

signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;

  vector<int> v(n);
  for (int &i : v)
    cin >> i;
  vector<bool> dp(k + 1);
  sort(v.begin(), v.end());
  int m = v.front();
  if (k < m)
    cout << "Second";
  else {
    for (int i = 0; i < m; ++i)
      dp[i] = false;
    dp[m] = true;
    for (int i = m + 1; i <= k; ++i) {

      for (int x : v) {
        if (i - x < 0) {
          break;
        }
        if (!dp[i - x]) {
          dp[i] = true;
          break;
        }
      }
    }
    if (dp[k]) {
      cout << "First";
    } else {
      cout << "Second";
    }
  }
  return 0;
}