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

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ACC                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mod 1000000007
#define MAXN 10000001
// string alpha="abcdefghijklmnopqrstuvwxyz";
// int dx[]={1,-1,0,0};
// int dy[]={0,0,1,-1};
// int dx8[]={1,-1,0,0,1,1,-1,-1};
// int dy8[]={0,0,1,-1,1,-1,1,-1};
/*int spf[MAXN];
void sieve()
{
        int i,j;
        for(i=0;i<MAXN;i++)
        spf[i]=i;
        for(i=4;i<MAXN;i+=2)
        spf[i]=2;
        for(i=3;i*i<MAXN;i++)
        {
                if(spf[i]==i)
                {
                        for(j=i*i;j<MAXN;j+=i)
                        {
                                if(spf[j]==j)spf[j]=i;
                        }
                }
        }
}*/
/*bool isvowel(char c)
{
    switch(c)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':return true;
        default : return false;
    }
}*/
/*bool isValid(int x,int y,int n,int m)
{
    if(x<0||x>n-1||y<0||y>m-1)return false;
    return true;
}*/
/*
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(y.second==x.second)
        return y.first<x.first;
    return y.second<x.second;
}*/
int32_t main() {
  ACC int T;
  T = 1;
  // cin>>T;
  while (T--) {
    int s, j, i;
    cin >> s;
    int dp[s + 100];
    dp[0] = 1;
    dp[1] = 0;
    dp[2] = 0;
    dp[3] = 1;
    for (i = 4; i <= s; i++) {
      dp[i] = 0;
      int x = 0;
      for (j = 3; j <= i; j++) {
        if (i - j < 0)
          continue;
        x = (x % mod + dp[i - j] % mod) % mod;
      }
      dp[i] = x % mod;
    }
    cout << dp[s] << "\\n";
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ACC                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mod 1000000007
#define MAXN 10000001
// string alpha="abcdefghijklmnopqrstuvwxyz";
// int dx[]={1,-1,0,0};
// int dy[]={0,0,1,-1};
// int dx8[]={1,-1,0,0,1,1,-1,-1};
// int dy8[]={0,0,1,-1,1,-1,1,-1};
/*int spf[MAXN];
void sieve()
{
        int i,j;
        for(i=0;i<MAXN;i++)
        spf[i]=i;
        for(i=4;i<MAXN;i+=2)
        spf[i]=2;
        for(i=3;i*i<MAXN;i++)
        {
                if(spf[i]==i)
                {
                        for(j=i*i;j<MAXN;j+=i)
                        {
                                if(spf[j]==j)spf[j]=i;
                        }
                }
        }
}*/
/*bool isvowel(char c)
{
    switch(c)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':return true;
        default : return false;
    }
}*/
/*bool isValid(int x,int y,int n,int m)
{
    if(x<0||x>n-1||y<0||y>m-1)return false;
    return true;
}*/
/*
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(y.second==x.second)
        return y.first<x.first;
    return y.second<x.second;
}*/
int32_t main() {
  ACC int T;
  T = 1;
  // cin>>T;
  while (T--) {
    int s, j, i;
    cin >> s;
    int dp[s + 1];
    dp[0] = 1;
    dp[1] = 0;
    dp[2] = 0;
    dp[3] = 1;
    for (i = 4; i <= s; i++) {
      dp[i] = 0;
      int x = 0;
      for (j = 3; j <= i; j++) {
        if (i - j >= 0)
          x = (x % mod + dp[i - j] % mod) % mod;
      }
      dp[i] = x % mod;
    }
    cout << dp[s] << "\\n";
  }
  return 0;
}