alexjercan/bugnet huggingface dataset:
Problem p02639 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int, int>
#define PSI pair<string, int>
#define PIS pair<int, string>

#define REP(i, n) for ((i) = 0; (i) < (int)(n); (i)++)
#define REPD(i, n) for ((i) = (n)-1; (i) >= 0; (i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x, 0, sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/
const ll mod = 1e9 + 7;
const ll INF = 1e18;
/*****************************************************************************/

using namespace std;

int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  int a[6], ans, i;
  for (i = 1; i <= 5; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << i << endl;
    }
  }
  return 0;
}
/******************************************************************************
******************************************************************************/


Error: 0

Fixed submission:

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int, int>
#define PSI pair<string, int>
#define PIS pair<int, string>

#define REP(i, n) for ((i) = 0; (i) < (int)(n); (i)++)
#define REPD(i, n) for ((i) = (n)-1; (i) >= 0; (i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x, 0, sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/
const ll mod = 1e9 + 7;
const ll INF = 1e18;
/*****************************************************************************/

using namespace std;

int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  int a[5], ans, i;
  for (i = 1; i <= 5; i++) {
    cin >> a[i];
    if (a[i] != i) {
      cout << i << endl;
    }
  }
  return 0;
}
/******************************************************************************
******************************************************************************/
Problem p02639 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
  ll a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  if (a == 0) {
    cout << 1;
  } else if (b == 0) {
    cout << 2;
  } else if (c == 0) {
    cout << 3;
  } else if (d == 0) {
    cout << 4;
  } else if (e == 0) {
    cout << 5;
  }
  return 0;
}

Error: -6
*** stack smashing detected ***: terminated


Fixed submission:

#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
  ll x[5];
  for (int i = 1; i < 6; i++) {
    cin >> x[i];
    if (x[i] == 0)
      cout << i;
  }
}
Problem p02639 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] == 0)
      cout << i + 1;
  }
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a[5];
  for (int i = 1; i <= 5; i++) {
    cin >> a[i];
    if (a[i] == 0)
      cout << i;
  }
  return 0;
}
Problem p02639 (C++) — buggy submission, verdict: Runtime Error


/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */

#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d", &n)
#define lscf(n) scanf("%lld", &n)
#define lpri(n) printf("%lld ", n)
#define pri(n) printf("%d ", (int)n)
#define prin(n) printf("%d\\n", (int)n)
#define lprin(n) printf("%lld\\n", n)
#define rep(i, ini, n) for (int i = ini; i < (int)n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define tc                                                                     \\
  int tt;                                                                      \\
  scf(tt);                                                                     \\
  while (tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod = 1e9 + 7;
const int N = 1e7 + 7;

void my_dbg() { cout << endl; }
template <typename Arg, typename... Args> void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

int main() {

  int a[5];

  rep(i, 1, 6) {
    scf(a[i]);

    if (a[i] == 0) {
      cout << i << endl;
      break;
    }
  }
}


Error: 0

Fixed submission:


/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */

#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d", &n)
#define lscf(n) scanf("%lld", &n)
#define lpri(n) printf("%lld ", n)
#define pri(n) printf("%d ", (int)n)
#define prin(n) printf("%d\\n", (int)n)
#define lprin(n) printf("%lld\\n", n)
#define rep(i, ini, n) for (int i = ini; i < (int)n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define tc                                                                     \\
  int tt;                                                                      \\
  scf(tt);                                                                     \\
  while (tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod = 1e9 + 7;
const int N = 1e7 + 7;

void my_dbg() { cout << endl; }
template <typename Arg, typename... Args> void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

int main() {

  int a[5];

  rep(i, 1, 6) {
    scf(a[i]);

    if (a[i] == 0)
      cout << i << endl;
  }
}
Problem p02639 (C++) — buggy submission, verdict: Runtime Error


/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */

#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d", &n)
#define lscf(n) scanf("%lld", &n)
#define lpri(n) printf("%lld ", n)
#define pri(n) printf("%d ", (int)n)
#define prin(n) printf("%d\\n", (int)n)
#define lprin(n) printf("%lld\\n", n)
#define rep(i, ini, n) for (int i = ini; i < (int)n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define tc                                                                     \\
  int tt;                                                                      \\
  scf(tt);                                                                     \\
  while (tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod = 1e9 + 7;
const int N = 1e7 + 7;

void my_dbg() { cout << endl; }
template <typename Arg, typename... Args> void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

int main() {

  int a1, a2, a3, a4, a5;
  scf(a1), scf(a2), scf(a3), scf(a4), scf(a5);

  if (a1 == 0)
    prin(1);

  else if (a2 == 0)
    prin(2);

  else if (a3 == 0)
    prin(3);

  else if (a4 == 0)
    prin(4);

  else
    prin(5);
}


Error: 0

Fixed submission:


/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */

#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d", &n)
#define lscf(n) scanf("%lld", &n)
#define lpri(n) printf("%lld ", n)
#define pri(n) printf("%d ", (int)n)
#define prin(n) printf("%d\\n", (int)n)
#define lprin(n) printf("%lld\\n", n)
#define rep(i, ini, n) for (int i = ini; i < (int)n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define tc                                                                     \\
  int tt;                                                                      \\
  scf(tt);                                                                     \\
  while (tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod = 1e9 + 7;
const int N = 1e7 + 7;

void my_dbg() { cout << endl; }
template <typename Arg, typename... Args> void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

int main() {

  int a[5];

  rep(i, 1, 6) {
    scf(a[i]);

    if (a[i] == 0)
      prin(i);
  }
}
Problem p02639 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define int long long
#define pp pair<int, int>
#define ss second
#define ff first
#define pb push_back
#define S                                                                      \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
using namespace std;
signed main() {
  S;
  int n, k, sum = 0;
  int a[5];
  ;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 5; i++) {
    if (a[i] == 0) {
      cout << i + 1;
      break;
    }
  }
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define int long long
#define pp pair<int, int>
#define ss second
#define ff first
#define pb push_back
#define S                                                                      \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
using namespace std;
signed main() {
  S;
  int n, k, sum = 0;
  int a[5];
  ;
  for (int i = 1; i <= 5; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      cout << i;
      break;
    }
  }
}
Problem p02639 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

long long test_cases;
int main() {

  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);

  /* cin >> test_cases; */
  test_cases = 1;

  while (test_cases > 0) {
    int x[6];

    for (int i = 1; i <= 5; i++) {
      cin >> x[i];
      if (x[i] == 0) {
        cout << i << endl;
        return 0;
      }
    }

    test_cases--;
  }

  return 0;
}

Error: 1

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

long long test_cases;
int main() {

  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);

  /* cin >> test_cases; */
  test_cases = 1;

  while (test_cases > 0) {
    int x[5];

    for (int i = 1; i <= 5; i++)
      cin >> x[i];

    for (int i = 1; i <= 5; i++) {
      if (x[i] == 0) {
        cout << i << endl;
        return i;
      }
    }

    test_cases--;
  }

  return 0;
}
Problem p02639 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define f(i, n) for (int i = 0; i < n; i++)
#define fp(i, k, n) for (int i = k; i <= n; i++)
#define fr(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define dbg(x) cout << (#x) << " is " << (x) << '\\n'
#define F first
#define S second
#define sz(x) (int)(x).size()
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define getc getchar_unlocked
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
/*---------------------------------------------------------------------------------------------------*/

void solve() {
  int x[6], ans = 0;
  fp(i, 1, 5) {
    cin >> x[i];
    if (x[i] == 0)
      ans = i;
  }
  cout << ans << '\\n';
  return;
}

signed main() {
  FAST int T = 1;
  // cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define f(i, n) for (int i = 0; i < n; i++)
#define fp(i, k, n) for (int i = k; i <= n; i++)
#define fr(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pii>
#define dbg(x) cout << (#x) << " is " << (x) << '\\n'
#define F first
#define S second
#define sz(x) (int)(x).size()
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define getc getchar_unlocked
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
/*---------------------------------------------------------------------------------------------------*/

void solve() {
  int x[5], ans = 0;
  fp(i, 1, 5) {
    cin >> x[i];
    if (x[i] == 0)
      ans = i;
  }
  cout << ans << '\\n';
  return;
}

signed main() {
  FAST int T = 1;
  // cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
Problem p02639 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

using namespace std;
int main() {
  int k = 1;
  int z = 5;
  for (int i = 0; i < 5; i++) {
    cin >> z;
    if (z == 0) {
      cout << k << endl;
      return 0;
    } else {
      k++;
    }
  }
}


Error: 1

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define REVE(x) reverse((x).begin(), (x).end())
#define mp make_pair
#define pb push_back
#define chmax(x, y) x = max(x, y)

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}

int lcm(int a, int b) { return a * b / gcd(a, b); }
struct UnionFind {
  VI d;
  UnionFind(int n = 0) : d(n, -1) {}
  int find(int x) {
    if (d[x] < 0)
      return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y)
      return false;
    if (d[x] > d[y])
      swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};
int deg[100005];
VI to[100005];

struct mint {
  LL x; // typedef long long ll;
  mint(LL x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) {
    if ((x += a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint &operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint &operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(LL t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(MOD - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint f(int n) {
  if (n == 0)
    return 1;
  mint x = f(n / 2);
  x *= x;
  if (n % 2 == 1)
    x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i, a) {
    x *= n - i;
    y *= i + 1;
  }
  return x / y;
}

int main() {
  int k = 1;
  int z = 0;
  rep(i, 5) {
    cin >> z;
    if (z == 0) {
      cout << k << endl;
      return 1;
    } else {
      k++;
    }
  }
}
Problem p02640 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

// マクロ
// forループ関係
// 引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   // 最大値を求める
#define MIN(x) *min_element(ALL(x))   // 最小値を求める
// 定数
#define INF 1000000000000 // 10^12:極めて大きい値,∞
#define MOD 1000000007    // 10^9+7:合同式の法
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 // πの値
// 略記
#define PB push_back // vectorヘの挿入
#define MP make_pair // pairのコンストラクタ
#define F first      // pairの一つ目の要素
#define S second     // pairの二つ目の要素

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll X, Y, a, b;
  cin >> X >> Y;
  if (Y % 2 == 1)
    cout << "No";
  else {
    a = 2 * X - Y / 2;
    b = Y / 2 - X;
    if (a < 0 || b < 0)
      cout << "No";
    else
      cout << "Yes";
  }
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

// マクロ
// forループ関係
// 引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   // 最大値を求める
#define MIN(x) *min_element(ALL(x))   // 最小値を求める
// 定数
#define INF 1000000000000 // 10^12:極めて大きい値,∞
#define MOD 1000000007    // 10^9+7:合同式の法
#define MAXR 100000 // 10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 // πの値
// 略記
#define PB push_back // vectorヘの挿入
#define MP make_pair // pairのコンストラクタ
#define F first      // pairの一つ目の要素
#define S second     // pairの二つ目の要素

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll X, Y;
  cin >> X >> Y;
  if (Y % 6 == 2 || Y % 6 == 4 && X % (Y / 6) == 1)
    cout << "Yes";
  else
    cout << "No";
}
Problem p02640 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> v;
typedef pair<int, int> p;
typedef set<int> s;
#define ll long long
#define fr(i, a, b) for (int i = a; i < b; i++)
#define fre(i, a, b) for (int i = a; i <= b; i++)
#define FOR(i, a, b) for (int i = a; i > b; --i)
#define FORE(i, a, b) for (int i = a; i >= b; --i)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bg begin()
#define en end()
/*note

*/
int main() {
  int x, y;
  cin >> x >> y;
  if (y % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }

  if (2 * x <= y && y <= 4 * x)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> v;
typedef pair<int, int> p;
typedef set<int> s;
#define ll long long
#define fr(i, a, b) for (int i = a; i < b; i++)
#define fre(i, a, b) for (int i = a; i <= b; i++)
#define FOR(i, a, b) for (int i = a; i > b; --i)
#define FORE(i, a, b) for (int i = a; i >= b; --i)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bg begin()
#define en end()
/*note

*/
int main() {

  int n, cnt = 0, flg = 0;
  cin >> n;
  int ar[n];
  fr(i, 0, n) { cin >> ar[i]; }

  for (int i = 0; i < n; i++) {
    flg = 0;
    for (int j = 0; j < n; j++) {
      if (i == j) {
        continue;
      }
      if (ar[i] % ar[j] == 0)
        flg = 1;
    }
    if (flg == 0)
      ++cnt;
  }
  cout << cnt << endl;
}
Problem p02640 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <sstream>
using namespace std;
#include <algorithm>
#include <bits/stdc++.h>
#include <iterator>
#include <utility>
#define go return 0
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep(j, m) for (int j = 0; j < m; ++j)
#define REP(i, n) for (int i = 1; i <= n; ++i)
#define all(v) ((v).begin()), ((v).end())
#define len(s) ((int)s.size())
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
typedef long long ll;
typedef double db;
typedef vector<int> ve;
typedef vector<pair<char, int>> vepa;
typedef set<string> se;
typedef map<char, int> mpp;
const ll N = 1e5 + 5, OO = 1e18;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};
int TC, n, a, arr[N], dp[1000][100];
bool vis[N], f;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int x, y;
  cin >> x >> y;
  if (y & 1 || y > 4 * x || y < 2 * x) {
    puts("No");
  } else {
    puts("Yes");
  }
  go;
}


Error: WA

Fixed submission:

#include <iostream>
#include <sstream>
using namespace std;
#include <algorithm>
#include <bits/stdc++.h>
#include <iterator>
#include <utility>
#define go return 0
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep(j, m) for (int j = 0; j < m; ++j)
#define REP(i, n) for (int i = 1; i <= n; ++i)
#define all(v) ((v).begin()), ((v).end())
#define len(s) ((int)s.size())
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
typedef long long ll;
typedef double db;
typedef vector<int> ve;
typedef vector<pair<char, int>> vepa;
typedef set<string> se;
typedef map<char, int> mpp;
const ll N = 1e5 + 5, OO = 1e18;
const int di[] = {1, -1, 0, 0};
const int dj[] = {0, 0, 1, -1};
int TC, n, a, arr[N], dp[1000][100];
bool vis[N], f;
bool solve(int i, int sum) {
  if (i == 0)
    return sum == 0;
  ll ret = dp[i][sum];
  if (~ret)
    return ret;
  ret = solve(i - 1, sum - 2) | solve(i - 1, sum - 4);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  memset(dp, -1, sizeof dp);
  int n, m;
  cin >> n >> m;
  if (solve(n, m))
    cout << "Yes";
  else
    cout << "No";
  go;
}