Problem p02843 (C++)

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

using namespace std;

using LL = long long;
using VLL = std::vector<LL>;
using VVLL = std::vector<VLL>;
using VVVLL = std::vector<VVLL>;
using LD = long double;
using VLD = std::vector<LD>;
using VVLD = std::vector<VLD>;
using VVVLD = std::vector<VVLD>;

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

// template<class T=LL> inline vector<T> cinv(LL N){ vector<T> v(N); REP(i,
// N)cin>>v[i]; return move(v);} template<class T=LL> inline vector<T> cinv(LL
// N){ vector<T> v(N); REP(i, N)cin>>v[i]; return move(v);}
#define REP(i, n) for (LL(i) = 0; (i) < (n); (i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v)                                                             \
  {                                                                            \
    LL i = 0;                                                                  \
    for (auto(a) : v) {                                                        \
      cerr << i << " : " << a << endl;                                         \
      i++;                                                                     \
    }                                                                          \
  }
#define PRINTSP(v)                                                             \
  for (auto(a) : v) {                                                          \
    cerr << a << " ";                                                          \
  }                                                                            \
  cerr << endl
#define cmax(a, b)                                                             \
  {                                                                            \
    if (a < b) {                                                               \
      a = b;                                                                   \
    }                                                                          \
  }
#define cmin(a, b)                                                             \
  {                                                                            \
    if (a > b) {                                                               \
      a = b;                                                                   \
    }                                                                          \
  }
#define EACH(a, A) for (auto a : A)
// #define cmax(a,b) a = (a>b ? a:b)
// #define cmin(a,b) a = (a<b ? a:b)
// cin,cout高速化のおまじない＋桁数指定
inline VLL cinvll(LL N) {
  VLL A(N);
  REP(i, N) { cin >> A[i]; }
  return move(A);
}
struct Fast {
  Fast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
  }
} fast;

VLL F;
VLL S{100, 101, 102, 103, 104, 105};

void memo(LL yen) {
  for (auto s : S) {
    if (yen - s >= 0 and F[yen - s] == 1) {
      F[yen] = 1;
    }
  }
}

void func() {
  LL X;
  cin >> X;
  F.resize(X + 1, 0);

  F[100] = 1;
  F[101] = 1;
  F[102] = 1;
  F[103] = 1;
  F[104] = 1;
  F[105] = 1;
  REP(i, X + 1) { memo(i); }
  // PRINTLN(F);
  cout << F[X];
  // LL N;
  // cin >> N;
  // auto A = cinvll(N);
  // PRINTSP(A);
}
int main() {
  func();
  return 0;
}


Fixed submission:
#include "bits/stdc++.h"
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

using LL = long long;
using VLL = std::vector<LL>;
using VVLL = std::vector<VLL>;
using VVVLL = std::vector<VVLL>;
using LD = long double;
using VLD = std::vector<LD>;
using VVLD = std::vector<VLD>;
using VVVLD = std::vector<VVLD>;

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

// template<class T=LL> inline vector<T> cinv(LL N){ vector<T> v(N); REP(i,
// N)cin>>v[i]; return move(v);} template<class T=LL> inline vector<T> cinv(LL
// N){ vector<T> v(N); REP(i, N)cin>>v[i]; return move(v);}
#define REP(i, n) for (LL(i) = 0; (i) < (n); (i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v)                                                             \
  {                                                                            \
    LL i = 0;                                                                  \
    for (auto(a) : v) {                                                        \
      cerr << i << " : " << a << endl;                                         \
      i++;                                                                     \
    }                                                                          \
  }
#define PRINTSP(v)                                                             \
  for (auto(a) : v) {                                                          \
    cerr << a << " ";                                                          \
  }                                                                            \
  cerr << endl
#define cmax(a, b)                                                             \
  {                                                                            \
    if (a < b) {                                                               \
      a = b;                                                                   \
    }                                                                          \
  }
#define cmin(a, b)                                                             \
  {                                                                            \
    if (a > b) {                                                               \
      a = b;                                                                   \
    }                                                                          \
  }
#define EACH(a, A) for (auto a : A)
// #define cmax(a,b) a = (a>b ? a:b)
// #define cmin(a,b) a = (a<b ? a:b)
// cin,cout高速化のおまじない＋桁数指定
inline VLL cinvll(LL N) {
  VLL A(N);
  REP(i, N) { cin >> A[i]; }
  return move(A);
}
struct Fast {
  Fast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
  }
} fast;

VLL F;
VLL S{100, 101, 102, 103, 104, 105};

void memo(LL yen) {
  for (auto s : S) {
    if (yen - s >= 0 and F[yen - s] == 1) {
      F[yen] = 1;
    }
  }
}

void func() {
  LL X;
  cin >> X;
  F.resize(1e6 + 10, 0);

  F[100] = 1;
  F[101] = 1;
  F[102] = 1;
  F[103] = 1;
  F[104] = 1;
  F[105] = 1;
  REP(i, X + 1) { memo(i); }
  // PRINTLN(F);
  cout << F[X];
  // LL N;
  // cin >> N;
  // auto A = cinvll(N);
  // PRINTSP(A);
}
int main() {
  func();
  return 0;
}