Problem p02662 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#if ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define SORT(x) std::sort(all(x))
#define REV(x) std::reverse(all(x))
#define UNIQUE(x) x.erase(std::unique(all(x)), x.end());
#define MAX(x) *std::max_element(all(x))
#define MIN(x) *std::min_element(all(x))
#define LOWitr(x, n) std::lower_bound(all(x), n)
#define UPRitr(x, n) std::upper_bound(all(x), n)
#define cii(x)                                                                 \\
  int x;                                                                       \\
  std::cin >> x
#define cill(x)                                                                \\
  signed long long int x;                                                      \\
  std::cin >> x
#define cis(x)                                                                 \\
  std::string x;                                                               \\
  std::cin >> x
#define co(x) std::cout << x << "\\n"
#define pb push_back
#define mp std::make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x)                                                                \\
  if (DEBUG)                                                                   \\
  std::cout << #x << " : " << (x) << "\\n"
template <class T> using V = std::vector<T>;
template <class T> using VV = std::vector<std::vector<T>>;
template <class T> using Q = std::queue<T>;
template <class T> using PQ = std::priority_queue<T>;
template <class T, class U> using P = std::pair<T, U>;
template <class T, class U> using M = std::map<T, U>;
template <class T, class U> using UM = std::unordered_map<T, U>;
template <class T, class U> inline bool chmax(T &a, const U &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class U> inline bool chmin(T &a, const U &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline void vcin(T &v) {
  for (auto &&i : v)
    std::cin >> i;
}
template <class T> inline void dumpv(const T &v, std::ostream &os = std::cout) {
  if (DEBUG) {
    os << "{";
    std::for_each(all(v), [&os](typename T::value_type p) { os << p << ','; });
    os << "}\\n";
  }
}
using std::cin;
using std::cout;
using std::min;
using std::next_permutation;
using std::string;
using LL = signed long long int;
const int INF = INT_MAX, MOD = 1e9 + 7;
const LL LLINF = LLONG_MAX;
const double PI = M_PI;

void Main() {
  cill(n);
  cill(s);
  V<LL> v(n);
  V<LL> dp(6060);
  vcin(v);
  dp[0] = 1;
  rep(i, n) {
    V<LL> ndp(6060);
    rep(j, 3030) {
      ndp[j] += dp[j] * 2;
      ndp[j] %= 998244353;
      ndp[j + v[i]] += dp[j];
      ndp[j + v[i]] %= 998244353;
    }
    dp = ndp;
  }
  co(dp[s]);
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#if ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rep1(i, n) REP(i, 1, n)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)
#define rrep(i, n) rREP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define SORT(x) std::sort(all(x))
#define REV(x) std::reverse(all(x))
#define UNIQUE(x) x.erase(std::unique(all(x)), x.end());
#define MAX(x) *std::max_element(all(x))
#define MIN(x) *std::min_element(all(x))
#define LOWitr(x, n) std::lower_bound(all(x), n)
#define UPRitr(x, n) std::upper_bound(all(x), n)
#define cii(x)                                                                 \\
  int x;                                                                       \\
  std::cin >> x
#define cill(x)                                                                \\
  signed long long int x;                                                      \\
  std::cin >> x
#define cis(x)                                                                 \\
  std::string x;                                                               \\
  std::cin >> x
#define co(x) std::cout << x << "\\n"
#define pb push_back
#define mp std::make_pair
#define F first
#define S second
#define truecheck assert
#define dump(x)                                                                \\
  if (DEBUG)                                                                   \\
  std::cout << #x << " : " << (x) << "\\n"
template <class T> using V = std::vector<T>;
template <class T> using VV = std::vector<std::vector<T>>;
template <class T> using Q = std::queue<T>;
template <class T> using PQ = std::priority_queue<T>;
template <class T, class U> using P = std::pair<T, U>;
template <class T, class U> using M = std::map<T, U>;
template <class T, class U> using UM = std::unordered_map<T, U>;
template <class T, class U> inline bool chmax(T &a, const U &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class U> inline bool chmin(T &a, const U &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline void vcin(T &v) {
  for (auto &&i : v)
    std::cin >> i;
}
template <class T> inline void dumpv(const T &v, std::ostream &os = std::cout) {
  if (DEBUG) {
    os << "{";
    std::for_each(all(v), [&os](typename T::value_type p) { os << p << ','; });
    os << "}\\n";
  }
}
using std::cin;
using std::cout;
using std::min;
using std::next_permutation;
using std::string;
using LL = signed long long int;
const int INF = INT_MAX, MOD = 1e9 + 7;
const LL LLINF = LLONG_MAX;
const double PI = M_PI;

void Main() {
  cill(n);
  cill(s);
  V<LL> v(n);
  V<LL> dp(s + 3500);
  vcin(v);
  dumpv(v);
  dp[0] = 1;
  rep(i, n) {
    V<LL> ndp(s + 3030);
    rep(j, 3030) {
      ndp[j] += dp[j] * 2;
      ndp[j + v[i]] += dp[j];
    }
    dp = ndp;
  }
  co(dp[s]);
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}