Problem p02843 (C++)

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

#define REP(i, num) for (int i = 0; i < (num); ++i)
#define LOOP(i) while (i--)
#define ALL(c) c.begin(), c.end()
#define PRINTALL(c)                                                            \
  for (auto pitr = c.begin(); pitr != c.end(); ++pitr) {                       \
    cout << *pitr;                                                             \
    if (next(pitr, 1) != c.end())                                              \
      cout << ' ';                                                             \
  }                                                                            \
  cout << endl;
#define PAIRCOMP(c, comp)                                                      \
  [](const pair<ll, ll> &lhs, const pair<ll, ll> &rhs) {                       \
    return lhs.c comp rhs.c;                                                   \
  }

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9 + 7;

template <typename T = int> T in() {
  T x;
  cin >> x;
  return (x);
}
template <typename T = int, typename C = vector<T>> C vecin(int N) {
  C x(N);
  REP(i, N) { x[i] = in<T>(); }
  return move(x);
}

void vout() { cout << endl; }
template <typename Head, typename... Tail> void vout(Head &&h, Tail &&...t) {
  cout << ' ' << h;
  vout(forward<Tail>(t)...);
}
void out() { cout << endl; }
template <typename Head, typename... Tail> void out(Head &&h, Tail &&...t) {
  cout << h;
  vout(forward<Tail>(t)...);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int A = in();
  vector<int> V(A + 1);
  V[100] = V[101] = V[102] = V[103] = V[104] = V[105] = 1;
  for (int i = 0; i <= A; i++) {
    if (V[i]) {
      for (int j = 0; j < 6; j++) {
        if (i + 100 + j <= A)
          V[i + 100 + j] = 1;
      }
    }
  }
  out(V[A] ? 1 : 0);
  return 0;
}


Fixed submission:
#include "bits/stdc++.h"

#define REP(i, num) for (int i = 0; i < (num); ++i)
#define LOOP(i) while (i--)
#define ALL(c) c.begin(), c.end()
#define PRINTALL(c)                                                            \
  for (auto pitr = c.begin(); pitr != c.end(); ++pitr) {                       \
    cout << *pitr;                                                             \
    if (next(pitr, 1) != c.end())                                              \
      cout << ' ';                                                             \
  }                                                                            \
  cout << endl;
#define PAIRCOMP(c, comp)                                                      \
  [](const pair<ll, ll> &lhs, const pair<ll, ll> &rhs) {                       \
    return lhs.c comp rhs.c;                                                   \
  }

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9 + 7;

template <typename T = int> T in() {
  T x;
  cin >> x;
  return (x);
}
template <typename T = int, typename C = vector<T>> C vecin(int N) {
  C x(N);
  REP(i, N) { x[i] = in<T>(); }
  return move(x);
}

void vout() { cout << endl; }
template <typename Head, typename... Tail> void vout(Head &&h, Tail &&...t) {
  cout << ' ' << h;
  vout(forward<Tail>(t)...);
}
void out() { cout << endl; }
template <typename Head, typename... Tail> void out(Head &&h, Tail &&...t) {
  cout << h;
  vout(forward<Tail>(t)...);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int A = in();
  vector<int> V(A + 1);
  if (A >= 100)
    V[100] = 1;
  if (A >= 101)
    V[101] = 1;
  if (A >= 102)
    V[102] = 1;
  if (A >= 103)
    V[103] = 1;
  if (A >= 104)
    V[104] = 1;
  if (A >= 105)
    V[105] = 1;
  for (int i = 0; i <= A; i++) {
    if (V[i]) {
      for (int j = 0; j < 6; j++) {
        if (i + 100 + j <= A)
          V[i + 100 + j] = 1;
      }
    }
  }
  out(V[A] ? 1 : 0);
  return 0;
}