prithivMLmods/Coder-Stat huggingface dataset:
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int x;
  cin >> x;

  vector<bool> t(100001, false);
  for (int i = 0; i <= x; i++) {
    if (i == 100 || i == 101 || i == 102 || i == 103 || i == 104 || i == 105) {
      t[i] = true;
    }

    if (t[i]) {
      t[i + 100] = true;
      t[i + 101] = true;
      t[i + 102] = true;
      t[i + 103] = true;
      t[i + 104] = true;
      t[i + 105] = true;
    }
  }

  int ans = 0;
  if (t[x]) {
    ans = 1;
  }

  cout << ans << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int x;
  cin >> x;

  vector<bool> t(200001, false);
  for (int i = 0; i <= x; i++) {
    if (i == 100 || i == 101 || i == 102 || i == 103 || i == 104 || i == 105) {
      t[i] = true;
    }

    if (t[i]) {
      t[i + 100] = true;
      t[i + 101] = true;
      t[i + 102] = true;
      t[i + 103] = true;
      t[i + 104] = true;
      t[i + 105] = true;
    }
  }

  int ans = 0;
  if (t[x]) {
    ans = 1;
  }

  cout << ans << endl;

  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  int x;
  cin >> x;
  if (x < 100) {
    cout << 0 << endl;
    return 0;
  }

  int amari = x % 100;
  int sho = x / 100;

  if (amari == 0) {
    cout << 1 << endl;
    return 0;
  }

  for (int a = 0; a <= sho; a++) {
    for (int b = 0; b <= sho; b++) {
      for (int c = 0; c <= sho; c++) {
        for (int d = 0; d <= sho; d++) {
          for (int e = 0; e <= sho; e++) {
            for (int f = 0; f <= sho; f++) {
              if (a + b + c + d + e + f == sho) {
                if (0 * a + 1 * b + 2 * c + 3 * d + 4 * e + 5 * f == amari) {
                  cout << 1 << endl;
                  return 0;
                }
              }
            }
          }
        }
      }
    }
  }

  cout << 0 << endl;
}

Fixed submission:
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  int x;
  cin >> x;
  if (x < 100) {
    cout << 0 << endl;
    return 0;
  }

  int amari = x % 100;
  int sho = x / 100;

  if (amari == 0) {
    cout << 1 << endl;
    return 0;
  }

  for (int a = 0; a <= sho; a++) {
    for (int b = 0; b <= sho; b++) {
      for (int c = 0; c <= sho; c++) {
        for (int d = 0; d <= sho; d++) {
          for (int e = 0; e <= sho; e++) {
            for (int f = 0; f <= sho; f++) {
              if (100 * a + 101 * b + 102 * c + 103 * d + 104 * e + 105 * f ==
                  x) {
                cout << 1 << endl;
                return 0;
              }
            }
          }
        }
      }
    }
  }

  cout << 0 << endl;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
#include <cstdlib>

template <class T> inline void fr(T &a) {
  T s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = s * 10 + ch - '0', ch = getchar();
  a = w * s;
}
template <class T> inline T fr() {
  T a;
  fr(a);
  return a;
}
#define R() fr<int>()

signed main() {
  int x = R(), y = x / 100, z = x / y;
  if (z * y == x)
    puts("1");
  else if (z >= 105)
    puts("0");
  else {
    int a = 105 - z, b = x - y * z, c = b / a;
    if (c * a == b) {
      if (c <= y)
        puts("1");
      else
        puts("0");
    } else {
      c++;
      if (c <= y)
        puts("1");
      else
        puts("0");
    }
  }
  return 0;
}

Fixed submission:
#include <cstdio>
#include <cstdlib>

template <class T> inline void fr(T &a) {
  T s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = s * 10 + ch - '0', ch = getchar();
  a = w * s;
}
template <class T> inline T fr() {
  T a;
  fr(a);
  return a;
}
#define R() fr<int>()

signed main() {
  int x = R(), y = x / 100, z = x / y;
  if (y == 0)
    return !printf("0\n");
  else
    z = x / y;
  if (z * y == x && z <= 105)
    puts("1");
  else if (z == 105 && y == 1)
    puts("1");
  else if (z >= 105)
    puts("0");
  else {
    int a = 105 - z, b = x - y * z, c = b / a;
    if (c * a == b) {
      if (c <= y)
        puts("1");
      else
        puts("0");
    } else {
      c++;
      if (c <= y)
        puts("1");
      else
        puts("0");
    }
  }
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

int main() {

  ll x;
  cin >> x;
  int res = x / 100;
  int t = x % 100;
  if (t / res < 5 || (t / res == 5 && t % res == 0)) {
    cout << '1' << endl;
  } else
    cout << '0' << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

int main() {

  ll x;
  cin >> x;
  if (1 <= x && x < 100) {
    cout << '0' << endl;
    return 0;
  }
  int res = x / 100;
  int t = x % 100;
  if (t / res < 5 || (t / res == 5 && t % res == 0)) {
    cout << '1' << endl;
  } else
    cout << '0' << endl;
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int rest = n - 100 * i;
    if (rest >= 0 && rest <= i * 5) {
      cout << 1 << endl;
      return 0;
    }
    if (rest < 0) {
      break;
    }
  }
  puts(0);
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int rest = n - 100 * i;
    if (rest >= 0 && rest <= i * 5) {
      cout << 1 << endl;
      return 0;
    }
    if (rest < 0) {
      break;
    }
  }
  cout << 0 << endl;
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

int main() {
  int n;
  cin >> n;
  int k = n;
  int cnt = n / 100;
  cnt += 2;

  n %= 100;
  bool can = false;

  for (int a = 0; a < cnt; a++) {
    for (int b = 0; b < cnt - a; b++) {
      for (int c = 0; c < cnt - a - b; c++) {
        for (int d = 0; d < cnt - a - b - c; d++) {
          if (100 * a + 101 * b + 102 * c + 103 * d > k)
            break;
          for (int e = 0; e < cnt - a - b - c - d; e++) {
            if (100 * a + 101 * b + 102 * c + 103 * d + 104 * e > k)
              break;
            for (int f = 0; f < cnt - a - b - c - d - e; f++) {
              if ((b + 2 * c + 3 * d + 4 * e + 5 * f) != n)
                continue;
              if ((100 * a + 101 * b + 102 * c + 103 * d + 104 * e + 105 * f) ==
                  k) {
                cout << 1 << endl;
                return 0;
              }
            }
          }
        }
      }
    }
  }
  cout << 0 << endl;
}


Fixed submission:
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

int main() {
  int n;
  cin >> n;
  int k = n;
  int cnt = n / 100;
  cnt += 2;

  n %= 100;
  bool can = false;

  if (k > 10001) {
    cout << 1;
    return 0;
  }

  for (int a = 0; a < cnt; a++) {
    for (int b = 0; b < cnt - a; b++) {
      for (int c = 0; c < cnt - a - b; c++) {
        for (int d = 0; d < cnt - a - b - c; d++) {
          if (100 * a + 101 * b + 102 * c + 103 * d > k)
            break;
          for (int e = 0; e < cnt - a - b - c - d; e++) {
            if (100 * a + 101 * b + 102 * c + 103 * d + 104 * e > k)
              break;
            for (int f = 0; f < cnt - a - b - c - d - e; f++) {
              if ((b + 2 * c + 3 * d + 4 * e + 5 * f) != n)
                continue;
              if ((100 * a + 101 * b + 102 * c + 103 * d + 104 * e + 105 * f) ==
                  k) {
                cout << 1 << endl;
                return 0;
              }
            }
          }
        }
      }
    }
  }
  cout << 0 << endl;
}
Problem p02843 (C++)

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  long long t;
  // cin >> t;
  t = 1;
  while (t--) {
    int n, i;
    cin >> n;
    vector<int> v = {100, 101, 102, 103, 104, 105};
    int z = v.size();
    int ispossible[1000001];
    ispossible[0] = 1;
    for (int i = 0; i < z; ++i) {
      int value = v[i];
      if (ispossible[value])
        continue;
      for (int j = 0; j + value < 1000001; ++j) {
        if (ispossible[j])
          ispossible[j + value] = 1;
      }
    }
    if (ispossible[n])
      cout << 1;
    else
      cout << 0;
  }
  return 0;
}

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

int main() {

  long long t;
  // cin >> t;
  t = 1;
  while (t--) {
    int n, i;
    cin >> n;
    vector<int> v = {100, 101, 102, 103, 104, 105};
    int z = v.size();
    int ispossible[1000001];
    ispossible[0] = 1;
    for (int i = 0; i < z; ++i) {
      int value = v[i];
      if (ispossible[value])
        continue;
      for (int j = 0; j + value < 1000001; ++j) {
        if (ispossible[j])
          ispossible[j + value] = 1;
      }
    }
    if (ispossible[n])
      cout << 1;
    else
      cout << 0;
  }
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  int x;
  cin >> x;
  int dp[100100] = {0};
  int a[6] = {100, 101, 102, 103, 104, 105};
  dp[0] = 1;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < x; j++) {
      if (dp[j] == 1) {
        dp[j + a[i]] = 1;
      }
    }
  }
  cout << dp[x];
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  int x;
  cin >> x;
  int dp[101000] = {0};
  int a[6] = {100, 101, 102, 103, 104, 105};
  dp[0] = 1;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < x; j++) {
      if (dp[j] == 1) {
        dp[j + a[i]] = 1;
      }
    }
  }
  cout << dp[x];
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <cstring>
#include <queue>
#define mp make_pair
#define pb push_back
#define p push

#define FOR(a, c) for (int a = 0; a < c; a++)
#define ll long long int

#define getI(a) scanf("%d", &a)
#define getII(a, b) scanf("%d%d", &a, &b)
#define getIII(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define getL(a) scanf("%lld", &a)
#define getLL(a, b) scanf("%lld%lld", &a, &b)
#define BEND(c) (c).begin(), (c).end()
#define BEND2(c) (c).rbegin(), (c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s", a)
#define pfi(a) printf("%d", a);
#define pfii(a, b) printf("%d%d", a, b);
#define pfl(a) printf("%lld", a);
#define pfll(a, b) printf("%lld%lld", a, b);
#define pfd(a) printf("%lf", a);
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);

#define sag (sol | 1)
#define sol (root << 1)
#define ort (bas + son) / 2
#define SIZE 1000000007
#define MAXN 100005
using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vi> graph;

int main() {
  ll n;
  cin >> n;
  ll k = n % 100;
  ll t = n / 100;
  if (k / t > 5)
    cout << 0;
  else
    cout << 1;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <cstring>
#include <queue>
#define mp make_pair
#define pb push_back
#define p push

#define FOR(a, c) for (int a = 0; a < c; a++)
#define ll long long int

#define getI(a) scanf("%d", &a)
#define getII(a, b) scanf("%d%d", &a, &b)
#define getIII(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define getL(a) scanf("%lld", &a)
#define getLL(a, b) scanf("%lld%lld", &a, &b)
#define BEND(c) (c).begin(), (c).end()
#define BEND2(c) (c).rbegin(), (c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s", a)
#define pfi(a) printf("%d", a);
#define pfii(a, b) printf("%d%d", a, b);
#define pfl(a) printf("%lld", a);
#define pfll(a, b) printf("%lld%lld", a, b);
#define pfd(a) printf("%lf", a);
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);

#define sag (sol | 1)
#define sol (root << 1)
#define ort (bas + son) / 2
#define SIZE 1000000007
#define MAXN 100005
using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vi> graph;

int main() {
  ll n;
  cin >> n;
  ll k = n % 100;
  ll t = n / 100;
  if (k > t * 5)
    cout << 0;
  else
    cout << 1;

  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int X;
  cin >> X;
  int C;
  C = X / 100;
  if (C * 100 <= X && X <= C * 105) {
    cout << 0 << endl;
    return 1;
  }
  cout << 0 << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int X;
  cin >> X;
  int C;
  C = X / 100;
  if (C * 100 <= X && X <= C * 105) {
    cout << 1 << endl;
    return 0;
  }
  cout << 0 << endl;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

vector<bool> dp;

int main(void) {
  int X;
  cin >> X;

  dp.resize(X + 1, false);
  dp[0] = true;

  for (int i = 0; i < X; i++) {
    if (dp[i]) {
      dp[i + 100] = true;
      dp[i + 101] = true;
      dp[i + 102] = true;
      dp[i + 103] = true;
      dp[i + 104] = true;
      dp[i + 105] = true;
    }
  }

  if (dp[X]) {
    cout << "1" << endl;
  } else {
    cout << "0" << endl;
  }

  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

vector<bool> dp;

int main(void) {
  int X;
  cin >> X;

  dp.resize(X + 110, false);
  dp[0] = true;

  for (int i = 0; i < X; i++) {
    if (dp[i]) {
      dp[i + 100] = true;
      dp[i + 101] = true;
      dp[i + 102] = true;
      dp[i + 103] = true;
      dp[i + 104] = true;
      dp[i + 105] = true;
    }
  }

  if (dp[X]) {
    cout << "1" << endl;
  } else {
    cout << "0" << endl;
  }

  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const ll inf = 1e6 + 5;
typedef pair<int, bool> pib;

int main() {
  int n;
  cin >> n;
  int goal = n % 100;
  int item = n / 100;
  if (goal == 0) {
    cout << 1;
    exit(0);
  }
  queue<int> q;
  q.push(0);
  vector<int> p = {1, 2, 3, 4, 5};
  vector<bool> visit(goal + 1);
  vector<int> dist(goal + 1, inf);
  visit[0] = true;
  dist[0] = 0;
  while (!q.empty()) {
    int cur = q.front();
    q.pop();
    for (int j : p) {
      if (cur + j <= goal && item >= min(dist[cur] + 1, dist[cur + j])) {
        dist[cur + j] = min(dist[cur] + 1, dist[cur + j]);
        q.push(cur + j);
      }
    }
  }
  if (dist[goal] <= item) {
    cout << 1;
  } else {
    cout << 0;
  }
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const ll inf = 1e6 + 5;
typedef pair<int, bool> pib;

int main() {
  int n;
  cin >> n;
  int goal = n % 100;
  int item = n / 100;
  if (goal == 0) {
    cout << 1;
    exit(0);
  }
  queue<int> q;
  q.push(0);
  vector<int> p = {1, 2, 3, 4, 5};
  vector<bool> visit(goal + 1);
  vector<int> dist(goal + 1, inf);
  visit[0] = true;
  dist[0] = 0;
  while (!q.empty()) {
    int cur = q.front();
    q.pop();
    for (int j : p) {
      if (cur + j <= goal && item >= min(dist[cur] + 1, dist[cur + j]) &&
          !visit[cur + j]) {
        visit[cur + j] = true;
        dist[cur + j] = min(dist[cur] + 1, dist[cur + j]);
        q.push(cur + j);
      }
    }
  }
  if (dist[goal] <= item) {
    cout << 1;
  } else {
    cout << 0;
  }
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(), (v).end()

int main() {
  int n;
  cin >> n;
  vector<bool> dp(n + 5, false);
  if (n < 100) {
    cout << 0 << endl;
    return 0;
  }
  dp[100] = true;
  dp[101] = true;
  dp[102] = true;
  dp[103] = true;
  dp[104] = true;
  dp[105] = true;
  for (int i = 106; i <= n; i++) {
    if (dp[i - 100] || dp[i - 101] || dp[i - 102] || dp[i - 103] ||
        dp[i - 104] || dp[i - 105])
      dp[i] = true;
  }
  if (dp[n])
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}


Fixed submission:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(), (v).end()

int main() {
  int n;
  cin >> n;
  vector<bool> dp(n + 10, false);
  if (n < 100) {
    cout << 0 << endl;
    return 0;
  }
  dp[100] = true;
  dp[101] = true;
  dp[102] = true;
  dp[103] = true;
  dp[104] = true;
  dp[105] = true;
  for (int i = 106; i <= n; i++) {
    if (dp[i - 100] || dp[i - 101] || dp[i - 102] || dp[i - 103] ||
        dp[i - 104] || dp[i - 105])
      dp[i] = true;
  }
  if (dp[n])
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
Problem p02843 (C++)

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

int main() {
  int x;
  cin >> x;
  vector<int> d(x + 1);
  if (x < 100) {
    cout << '0';
    return 0;
  }
  for (int i = 0; i < 100; i++)
    d[i] = 0;
  d[100] = d[101] = d[102] = d[103] = d[104] = d[105] = 1;
  for (int i = 106; i < x + 1; i++) {
    d[i] = (d[i - 100] || d[i - 101] || d[i - 102] || d[i - 103] ||
            d[i - 104] || d[i - 105]);
  }
  d[x] ? cout << '1' : cout << '0';
}


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

int main() {
  int x;
  cin >> x;
  vector<int> d(x + 1);
  if (x < 100) {
    cout << '0';
    return 0;
  }
  if (x < 106) {
    cout << '1';
    return 0;
  }
  for (int i = 0; i < 100; i++)
    d[i] = 0;
  d[100] = d[101] = d[102] = d[103] = d[104] = d[105] = 1;
  for (int i = 106; i < x + 1; i++) {
    d[i] = (d[i - 100] || d[i - 101] || d[i - 102] || d[i - 103] ||
            d[i - 104] || d[i - 105]);
  }
  d[x] ? cout << '1' : cout << '0';
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main() {
  int X;
  cin >> X;
  if (X >= 2000) {
    cout << 1 << endl;
    return 0;
  } else {
    int S = X / 100;
    int R = X % (100 * S);
    // cout << S << " " << R << endl;
    if (R <= S * 5) {
      cout << 1 << endl;
      return 0;
    }
    cout << 0 << endl;
  }
}

Fixed submission:
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main() {
  int X;
  cin >> X;
  if (X >= 2000) {
    cout << 1 << endl;
    return 0;
  } else if (X < 100) {
    cout << 0 << endl;
    return 0;
  } else {
    int S = X / 100;
    int R = X % (100 * S);
    // cout << S << " " << R << endl;
    if (R <= S * 5) {
      cout << 1 << endl;
      return 0;
    }
    cout << 0 << endl;
  }
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout << (x) << endl
#define all(x) (x).begin(), (x).end()
#define rp(i, s, e) for (int i = (s); i < (e); ++i)
#define rpz(i, e) rp(i, 0, e)

int main() {
  int X;
  cin >> X;
  int y = X % 100;
  int n = X / 100;
  // ote(y);//
  // ote(n);//
  ote((y + n - 1) / n <= 5 ? 1 : 0);
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout << (x) << endl
#define all(x) (x).begin(), (x).end()
#define rp(i, s, e) for (int i = (s); i < (e); ++i)
#define rpz(i, e) rp(i, 0, e)

int main() {
  int X;
  cin >> X;
  int y = X % 100;
  int n = X / 100;
  // ote(y);//
  // ote(n);//
  if (n > 0)
    ote((y + n - 1) / n <= 5 ? 1 : 0);
  else
    ote(0);
}
Problem p02843 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
using namespace std;

int main() {
  string s;
  cin >> s;

  ll a = stoll(s);
  while (true) {
    if (a < 100) {
      cout << 0 << endl;
      exit(0);
    } else if (a % 100 == 0) {
      break;
    } else if (a % 101 == 0) {
      break;
    } else if (a % 102 == 0) {
      break;
    } else if (a % 103 == 0) {
      break;
    } else if (a % 104 == 0) {
      break;
    } else if (a % 105 == 0) {
      break;
    } else if (a <= 945 && a >= 900) {
      break;
    } else if (a <= 840 && a >= 800) {
      break;
    } else if (a <= 735 && a >= 700) {
      break;
    } else if (a <= 630 && a >= 600) {
      break;
    } else if (a <= 525 && a >= 500) {
      break;
    } else if (a <= 420 && a >= 400) {
      break;
    } else if (a <= 315 && a >= 300) {
      break;
    } else if (a <= 210 && a >= 200) {
      break;
    }

    else if (s[s.size() - 1] >= '5') {
      a -= 105;
      // cout << a << endl;
    } else if (s[s.size() - 1] == '4') {
      a -= 104;
      // cout << a << endl;
    } else if (s[s.size() - 1] == '3') {
      a -= 103;
      // cout << a << endl;
    } else if (s[s.size() - 1] == '2') {
      a -= 102;
    } else if (s[s.size() - 1] == '1') {
      a -= 101;
    }

    s = to_string(a);
  }
  cout << 1 << endl;
}


Fixed submission:
#include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
using namespace std;

int main() {
  string s;
  cin >> s;

  ll a = stoll(s);
  while (true) {
    if (a < 100) {
      cout << 0 << endl;
      exit(0);
    } else if (a % 100 == 0) {
      break;
    } else if (a % 101 == 0) {
      break;
    } else if (a % 102 == 0) {
      break;
    } else if (a % 103 == 0) {
      break;
    } else if (a % 104 == 0) {
      break;
    } else if (a % 105 == 0) {
      break;
    } else if (a <= 945 && a >= 900) {
      break;
    } else if (a <= 840 && a >= 800) {
      break;
    } else if (a <= 735 && a >= 700) {
      break;
    } else if (a <= 630 && a >= 600) {
      break;
    } else if (a <= 525 && a >= 500) {
      break;
    } else if (a <= 420 && a >= 400) {
      break;
    } else if (a <= 315 && a >= 300) {
      break;
    } else if (a <= 210 && a >= 200) {
      break;
    }

    else if (s[s.size() - 1] >= '5') {
      a -= 105;
      // cout << a << endl;
    } else if (s[s.size() - 1] == '4') {
      a -= 104;
      // cout << a << endl;
    } else if (s[s.size() - 1] == '3') {
      a -= 103;
      // cout << a << endl;
    } else if (s[s.size() - 1] == '2') {
      a -= 102;
    } else if (s[s.size() - 1] == '1') {
      a -= 101;
    } else if (s[s.size() - 1] == '0') {
      a -= 100;
    }

    s = to_string(a);
  }
  cout << 1 << endl;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long int ll;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;

bool dp[1000] = {};

int main() {
  int x;
  cin >> x;
  dp[0] = true;
  for (int i = 100; i <= 105; i++) {
    for (int j = 0; j <= x - i; j++) {
      dp[j + i] |= dp[j];
    }
  }
  cout << (dp[x] ? "1" : "0") << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long int ll;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;

bool dp[1000001] = {};

int main() {
  int x;
  cin >> x;
  dp[0] = true;
  for (int i = 100; i <= 105; i++) {
    for (int j = 0; j <= x - i; j++) {
      dp[j + i] |= dp[j];
    }
  }
  cout << (dp[x] ? "1" : "0") << endl;
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MM = 1000000000;
ll mod = MM + 7;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, j, n) for (int i = j; i < n; i++)
#define all(vec) vec.begin(), vec.end()
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;
}
const ll INF = 1LL << 60;

int main() {
  ll x;
  cin >> x;
  ll a = x / 100;
  ll b = x % 100;
  if (ceil(b / a) <= a)
    cout << 1 << endl;
  else
    cout << 0 << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MM = 1000000000;
ll mod = MM + 7;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, j, n) for (int i = j; i < n; i++)
#define all(vec) vec.begin(), vec.end()
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;
}
const ll INF = 1LL << 60;

int main() {
  ll x;
  cin >> x;
  ll min = x / 100;
  ll max = x / 105 + 2;
  rep(i, 1000) {
    if (100 * i <= x && x <= 105 * i) {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}
Problem p02843 (C++)

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

int main() {
  int x;
  cin >> x;
  int judge = x / 100;
  int calcu = x % 100;
  int count = 0;

  bool answer = true;
  for (int i = 5;; i--) {
    count += judge / i;
    if (count > judge) {
      answer = false;
      break;
    } else if (calcu == 0) {
      answer = true;
      break;
    } else {
      calcu %= i;
    }
  }

  if (answer) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
}


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

int main() {
  int x;
  cin >> x;
  int judge = x / 100;
  int calcu = x % 100;
  int count = 0;

  bool answer = true;
  for (int i = 5; i != 0; i--) {
    count += calcu / i;
    if (count > judge) {
      answer = false;
      break;
    } else if (calcu == 0) {
      answer = true;
      break;
    } else {
      calcu %= i;
    }
  }

  if (answer) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;

int main() {
  const int N = 6;
  const vector<int> v = {100, 101, 102, 103, 104, 105};

  int X;
  cin >> X;

  if (X < 100) {
    cout << 0 << endl;
    return 0;
  }

  vector<bool> dp(X + 1, false);
  dp.at(0) = true;
  rep(i, N) dp.at(v.at(i)) = true;

  for (int i = 200; i <= X; i++) {
    if (any_of(v.begin(), v.end(), [&dp, &i](int y) { return dp.at(i - y); }))
      dp.at(i) = true;
  }

  cout << (dp.at(X) ? 1 : 0) << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;

int main() {
  const int N = 6;
  const vector<int> v = {100, 101, 102, 103, 104, 105};

  int X;
  cin >> X;

  if (X < 100) {
    cout << 0 << endl;
    return 0;
  } else if (X < 106) {
    cout << 1 << endl;
    return 0;
  }

  vector<bool> dp(X + 1, false);
  dp.at(0) = true;
  rep(i, N) dp.at(v.at(i)) = true;

  for (int i = 200; i <= X; i++) {
    if (any_of(v.begin(), v.end(), [&dp, &i](int y) { return dp.at(i - y); }))
      dp.at(i) = true;
  }

  cout << (dp.at(X) ? 1 : 0) << endl;
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int algo(int);
int main() {
  int x;
  cin >> x;
  cout << algo(x) << endl;
  return 0;
}

int algo(int price) {
  if (price < 100)
    return 0;
  if (100 <= price && price <= 105)
    return 1;
  int answer = algo(price - 100) + algo(price - 101) + algo(price - 102) +
               algo(price - 103) + algo(price - 104) + algo(price - 105);
  if (answer >= 1)
    return 1;
  else
    return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int algo(int);
int main() {
  int x;
  cin >> x;
  cout << algo(x) << endl;
  return 0;
}

int algo(int price) {
  int s100 = price / 100;
  int a100 = price % 100;
  if (a100 <= 5 * s100)
    return 1;
  else
    return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int x;
  cin >> x;
  bool dp[x + 1];
  for (int i = 0; i <= x; i++)
    dp[i] = false;
  dp[0] = true;
  for (int i = 0; i < x; i++) {
    if (dp[i]) {
      for (int j = 1; j <= 5; j++) {
        dp[i + 100 + j] = true;
      }
    }
  }
  cout << dp[x] << endl;
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int x;
  cin >> x;
  bool dp[x + 1];
  for (int i = 0; i <= x; i++)
    dp[i] = false;
  dp[0] = true;
  for (int i = 0; i < x; i++) {
    if (dp[i]) {
      for (int j = 0; j <= 5; j++) {
        if (i + 100 + j <= x)
          dp[i + 100 + j] = true;
      }
    }
  }
  cout << dp[x] << endl;
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
// #include <bits/stdc++.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long>> vvll, vvLL;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define mod (ll)(1e9 + 7)
#define FIX(a) ((a) % mod + mod) % mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000              // 1e9
#define LLINF 2000000000000000000LL // 2e18
#define fi first
#define se second
#define pb push_back
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  vint p = {100, 101, 102, 103, 104, 105};
  vint dp(x + 1, 0);
  dp[0] = 1;
  for (int i = 100; i <= x; i++) {
    REP(j, 6) {
      if (dp[i - p[j]] > 0)
        dp[i] = 1;
    }
  }
  cout << dp[x] << endl;

  return 0;
}

Fixed submission:
// #include <bits/stdc++.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long>> vvll, vvLL;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define mod (ll)(1e9 + 7)
#define FIX(a) ((a) % mod + mod) % mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000              // 1e9
#define LLINF 2000000000000000000LL // 2e18
#define fi first
#define se second
#define pb push_back
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  vint p = {100, 101, 102, 103, 104, 105};
  vint dp(x + 1, 0);
  dp[0] = 1;
  for (int i = 100; i <= x; i++) {
    REP(j, 6) {
      if (i - p[j] >= 0 && dp[i - p[j]] > 0)
        dp[i] = 1;
    }
  }
  cout << dp[x] << endl;

  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, ans = 0;
  cin >> x;
  for (int o = 0; 100 * o <= x; o++) {
    for (int p = 0; 101 * p <= x; p++) {
      for (int q = 0; 102 * q <= x; q++) {
        for (int r = 0; 103 * r <= x; r++) {
          for (int s = 0; 104 * s <= x; s++) {
            for (int t = 0; 105 * t <= x; t++) {
              if (100 * o + 101 * p + 102 * q + 103 * r + 104 * s + 105 * t ==
                  x) {
                ans = 1;
                break;
              }
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, ans = 0;
  cin >> x;
  if (x >= 2000) {
    ans = 1;
  } else {
    for (int i = 0; i < 20; i++) {
      if (i * 100 <= x && x <= i * 105) {
        ans = 1;
        break;
      }
    }
  }
  cout << ans << endl;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define rep(i, n) for (ll(i) = 0; (i) < (n); ++(i))
using namespace std;

int main() {
  ll x;
  cin >> x;
  V can(x + 1, 0);
  rep(i, 6) can[100 + i] = 1;
  for (ll i = 100; i <= x; i++) {
    if (can[i] == 1) {
      rep(j, 6) if (i + 100 + j <= x) can[i + 100 + j] = 1;
    }
  }
  cout << can[x] << endl;
}


Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define rep(i, n) for (ll(i) = 0; (i) < (n); ++(i))
using namespace std;

int main() {
  ll x;
  cin >> x;
  V can(x + 1, 0);
  rep(i, 6) if (100 + i <= x) can[100 + i] = 1;
  for (ll i = 0; i <= x; i++) {
    if (can[i] == 1) {
      rep(j, 6) if (i + 100 + j <= x) can[i + 100 + j] = 1;
    }
  }
  cout << can[x] << endl;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
const int INF = 1 << 30;

int main() {
  ll x;
  cin >> x;
  vector<ll> dp(100000 + 1, 0);
  dp[100] = 1;
  dp[101] = 1;
  dp[102] = 1;
  dp[103] = 1;
  dp[104] = 1;
  dp[105] = 1;
  if (x > 105) {
    for (int i = 0; i <= x; i++) {
      for (int j = 0; j <= 5; j++) {
        dp[i] = max(dp[i - j - 100], dp[i]);
      }
    }
  }
  cout << dp[x] << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
const int INF = 1 << 30;

int main() {
  ll x;
  cin >> x;
  vector<ll> dp(100000 + 1, 0);
  dp[100] = 1;
  dp[101] = 1;
  dp[102] = 1;
  dp[103] = 1;
  dp[104] = 1;
  dp[105] = 1;
  if (x > 105) {
    for (int i = 106; i <= x; i++) {
      for (int j = 0; j <= 5; j++) {
        dp[i] = max(dp[i - j - 100], dp[i]);
      }
    }
  }
  cout << dp[x] << endl;
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define reps(i, a, b) for (int i = a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  ll x;
  cin >> x;
  vector<int> vec(x + 1, 0);
  rep(i, 6) {
    vec.at(i + 100) = 1;
    rep(j, x + 1) {
      if (i + j + 100 > x)
        continue;

      if (vec.at(j))
        vec.at(i + j + 100) = 1;
    }
  }
  if (vec.at(x)) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define reps(i, a, b) for (int i = a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  ll x;
  cin >> x;
  vector<int> vec(max(x + 1, (ll)1e6 + 1), 0);
  rep(i, 6) {
    vec.at(i + 100) = 1;
    rep(j, x + 1) {
      if (i + j + 100 > x)
        continue;

      if (vec.at(j))
        vec.at(i + j + 100) = 1;
    }
  }
  if (vec.at(x)) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  int x;
  cin >> x;

  vector<int> dp(x * 2);
  dp[0] = 1;
  for (int i = 0; i <= x; i++) {
    if (!dp[i])
      continue;
    for (int j = 100; j <= 105; j++) {
      dp[i + j] = 1;
    }
  }
  cout << dp[x] << endl;
}


Fixed submission:
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  int x;
  cin >> x;

  vector<int> dp(x + 200);
  dp[0] = 1;
  for (int i = 0; i <= x; i++) {
    if (!dp[i])
      continue;
    for (int j = 100; j <= 105; j++) {
      dp[i + j] = 1;
    }
  }
  cout << dp[x] << endl;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x)                                                              \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                                                           \
  cerr << "(" << #x << "," << #y << ") = "                                     \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto &a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  cin >> N;
  ;
}
int dp[MX + 1];
void solve() {
  dp[0] = 1;
  rep(i, 0, N) {
    if (dp[i]) {
      dp[i + 100] = 1;
      dp[i + 101] = 1;
      dp[i + 102] = 1;
      dp[i + 103] = 1;
      dp[i + 104] = 1;
      dp[i + 105] = 1;
    }
  }

  cout << dp[N] << endl;

  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x)                                                              \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                                                           \
  cerr << "(" << #x << "," << #y << ") = "                                     \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto &a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  cin >> N;
  ;
}
int dp[MX + 1333];
void solve() {
  dp[0] = 1;
  rep(i, 0, N) {
    if (dp[i]) {
      dp[i + 100] = 1;
      dp[i + 101] = 1;
      dp[i + 102] = 1;
      dp[i + 103] = 1;
      dp[i + 104] = 1;
      dp[i + 105] = 1;
    }
  }

  cout << dp[N] << endl;

  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}
Problem p02843 (C++)

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

using namespace std;

int main() {
  int x;
  cin >> x;
  vector<bool> DP(100010);
  for (int i = 100; i <= 105; i++)
    DP[i] = true;

  for (int i = 0; i < x; i++) {
    for (int j = 100; j <= 105; j++) {
      DP[i + j] = DP[i + j] or DP[i];
    }
  }

  cout << DP[x] << endl;
}

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

using namespace std;

int main() {
  int x;
  cin >> x;
  vector<bool> DP(100110);
  for (int i = 100; i <= 105; i++)
    DP[i] = true;

  for (int i = 0; i < x; i++) {
    for (int j = 100; j <= 105; j++) {
      DP[i + j] = DP[i + j] or DP[i];
    }
  }

  cout << DP[x] << endl;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int val = N / 100;
  if (N * 20 / (val * 100) == 20)
    cout << 1 << endl;
  else if (N % 105 == 0)
    cout << 1 << endl;
  else
    cout << 0 << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int val = N / 100;
  if (val == 0)
    cout << 0 << endl;
  else if (N * 20 / (val * 100) == 20)
    cout << 1 << endl;
  else if (N % 105 == 0)
    cout << 1 << endl;
  else
    cout << 0 << endl;
}
Problem p02843 (C++)

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

int main() {
  string x;
  cin >> x;
  int matubi = stoi(x.substr(x.length() - 2, 2));
  int sonota = stoi(x.substr(0, x.length() - 2));
  if (sonota * 5 >= matubi) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

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

int main() {
  string x;
  cin >> x;
  if (x.length() <= 2) {
    cout << 0 << endl;
    return 0;
  }
  int matubi = stoi(x.substr(x.length() - 2, 2));
  int sonota = stoi(x.substr(0, x.length() - 2));
  if (sonota * 5 >= matubi) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
/*
 * Pawan Harendra Mishra
 */

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

#define X first
#define Y second
typedef long long ll;
typedef pair<ll, ll> pll;

int x;
vector<int> a = {100, 101, 102, 103, 104, 105};
vector<int> b(100001, -1);

bool reduce(int c) {
  if (c == 0)
    return true;
  else if (c < 0)
    return false;

  if (b[c] == 0)
    return false;
  else if (b[c] == 1)
    return true;

  bool ans = false;
  for (ll i = 0; i < a.size(); i++) {
    b[c - a[i]] = reduce(c - a[i]);
    ans = ans || b[c - a[i]];
  }

  b[c] == ans;
  return ans;
}

int main(int argc, char const *argv[]) {
  // ios::sync_with_stdio(false);
  // cin.tie(NULL);

  cin >> x;
  if (reduce(x))
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}

Fixed submission:
/*
 * Pawan Harendra Mishra
 */

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

#define X first
#define Y second
typedef long long ll;
typedef pair<ll, ll> pll;

int x;
vector<int> a = {100, 101, 102, 103, 104, 105};
vector<int> b(100001, -1);

bool reduce(int c) {
  if (c == 0)
    return true;
  else if (c < 0)
    return false;

  if (b[c] == 0)
    return false;
  else if (b[c] == 1)
    return true;

  bool ans = false;
  for (ll i = 0; i < a.size(); i++) {
    if (c - a[i] >= 0)
      b[c - a[i]] = reduce(c - a[i]);
    ans = ans || reduce(c - a[i]);
  }

  b[c] == ans;
  return ans;
}

int main(int argc, char const *argv[]) {
  // ios::sync_with_stdio(false);
  // cin.tie(NULL);

  cin >> x;
  if (reduce(x))
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
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 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 1e10
typedef long long ll;
typedef long double ld;
int main() {
  string x;
  cin >> x;
  string head, tail;
  ll n = SIZE(x);
  head = x.substr(0, n - 2), tail = x.substr(n - 2, 2);
  ll head_num = stoll(head), tail_num = stoll(tail);
  cout << ((head_num * 5 >= tail_num) ? 1 : 0) << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
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 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 1e10
typedef long long ll;
typedef long double ld;
int main() {
  string x;
  cin >> x;
  string head, tail;
  ll n = SIZE(x);
  if (n < 3) {
    cout << 0 << endl;
  } else {
    head = x.substr(0, n - 2), tail = x.substr(n - 2, 2);
    ll head_num = stoll(head), tail_num = stoll(tail);
    cout << ((head_num * 5 >= tail_num) ? 1 : 0) << endl;
  }
  return 0;
}
Problem p02843 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
long X, d[] = {100, 101, 102, 103, 104, 105};
bool dp[1 << 17];
int main() {
  cin >> X;
  for (int i = 100; i < 106; i++)
    dp[i] = true;
  for (int i = 100; i < 1 << 17; i++)
    if (dp[i])
      for (int j = 0; j < 6; j++)
        dp[i + d[j]] = dp[i];
  cout << dp[X] << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
long X, d[] = {100, 101, 102, 103, 104, 105};
bool dp[1 << 17];
int main() {
  cin >> X;
  for (int i = 100; i < 106; i++)
    dp[i] = true;
  for (int i = 100; i <= 1e5; i++)
    if (dp[i])
      for (int j = 0; j < 6; j++)
        dp[i + d[j]] = dp[i];
  cout << dp[X] << endl;
}