criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 105, K = 1e5 + 5, MOD = 1e9 + 7;
int n, p prefix[N][K], a[N];
 
inline int add(int a, int b){
	a += b;
	if(a >= MOD)a -= MOD;
	return a;
}
 
inline int sub(int a, int b){
	a -= b;
	if(a < 0)a += MOD;
	return a;
}
 
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
 
	cin>>n>>p;
	for(int i=1;i<=n;++i)
		cin>>a[i];

	for(int j=0;j<=p;++j)
		prefix[0][j] = 1;
 
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=p;++j)
		{
			// coefficient of x^j is prefix[i - 1][j - a[i] : j];
 
			int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
			int last = prefix[i - 1][j];
			prefix[i][j] = add(prefix[i][j - 1], sub(last, first));
		}
	}
		int first = (p - a[n] - 1 >= 0)? prefix[n - 1][p - a[n] - 1] : 0;
			int last = prefix[n - 1][p];
 
	cout<<sub(last,first)<<"\n";
	return 0;
}


Compiler output:
a.cc:6:10: error: expected initializer before 'prefix'
    6 | int n, p prefix[N][K], a[N];
      |          ^~~~~~
a.cc: In function 'int main()':
a.cc:25:17: error: 'p' was not declared in this scope
   25 |         cin>>n>>p;
      |                 ^
a.cc:27:22: error: 'a' was not declared in this scope
   27 |                 cin>>a[i];
      |                      ^
a.cc:30:17: error: 'prefix' was not declared in this scope; did you mean 'profil'?
   30 |                 prefix[0][j] = 1;
      |                 ^~~~~~
      |                 profil
a.cc:38:42: error: 'a' was not declared in this scope
   38 |                         int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
      |                                          ^
a.cc:38:58: error: 'prefix' was not declared in this scope; did you mean 'profil'?
   38 |                         int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
      |                                                          ^~~~~~
      |                                                          profil
a.cc:43:34: error: 'a' was not declared in this scope
   43 |                 int first = (p - a[n] - 1 >= 0)? prefix[n - 1][p - a[n] - 1] : 0;
      |                                  ^
a.cc:43:50: error: 'prefix' was not declared in this scope; did you mean 'profil'?
   43 |                 int first = (p - a[n] - 1 >= 0)? prefix[n - 1][p - a[n] - 1] : 0;
      |                                                  ^~~~~~
      |                                                  profil
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 105, K = 1e5 + 5, MOD = 1e9 + 7;
int n, p prefix[N][K], a[N];
 
inline int add(int a, int b){
	a += b;
	if(a >= MOD)a -= MOD;
	return a;
}
 
inline int sub(int a, int b){
	a -= b;
	if(a < 0)a += MOD;
	return a;
}
 
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
 
	cin>>n>>p;
	for(int i=1;i<=n;++i)
		cin>>a[i];

	for(int j=0;j<=p;++j)
		prefix[0][j] = 1;
 
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=p;++j)
		{
			// coefficient of x^j is prefix[i - 1][j - a[i] : j];
 
			int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
			int last = prefix[i - 1][j];
			prefix[i][j] = add(prefix[i][j - 1], sub(last, first));
		}
	}
		int first = (k - a[n] - 1 >= 0)? prefix[n - 1][k - a[n] - 1] : 0;
			int last = prefix[n - 1][k];
 
	cout<<sub(last,first)<<"\n";
	return 0;
}


Compiler output:
a.cc:6:10: error: expected initializer before 'prefix'
    6 | int n, p prefix[N][K], a[N];
      |          ^~~~~~
a.cc: In function 'int main()':
a.cc:25:17: error: 'p' was not declared in this scope
   25 |         cin>>n>>p;
      |                 ^
a.cc:27:22: error: 'a' was not declared in this scope
   27 |                 cin>>a[i];
      |                      ^
a.cc:30:17: error: 'prefix' was not declared in this scope; did you mean 'profil'?
   30 |                 prefix[0][j] = 1;
      |                 ^~~~~~
      |                 profil
a.cc:38:42: error: 'a' was not declared in this scope
   38 |                         int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
      |                                          ^
a.cc:38:58: error: 'prefix' was not declared in this scope; did you mean 'profil'?
   38 |                         int first = (j - a[i] - 1 >= 0)? prefix[i - 1][j - a[i] - 1] : 0;
      |                                                          ^~~~~~
      |                                                          profil
a.cc:43:30: error: 'k' was not declared in this scope
   43 |                 int first = (k - a[n] - 1 >= 0)? prefix[n - 1][k - a[n] - 1] : 0;
      |                              ^
a.cc:43:34: error: 'a' was not declared in this scope
   43 |                 int first = (k - a[n] - 1 >= 0)? prefix[n - 1][k - a[n] - 1] : 0;
      |                                  ^
a.cc:43:50: error: 'prefix' was not declared in this scope; did you mean 'profil'?
   43 |                 int first = (k - a[n] - 1 >= 0)? prefix[n - 1][k - a[n] - 1] : 0;
      |                                                  ^~~~~~
      |                                                  profil
Language: C++

#include<bits/stdc++.h>
using namespace std;
void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
void sub_self(int& a, int b) {
    a -= b;
    if(a < 0) {
        a += mod;
    }
}
 
int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int> dp(k + 1);
    // dp[i] - the number of ways such that we used i candies so far
    dp[0] = 1;
    for(int child = 0; child < n; ++child) {
        int up_to;
        scanf("%d", &up_to);
        vector<int> fake(k + 1);
        for(int used = k; used >= 0; --used) {
            int tmp = dp[used];
            int L = used + 1;
            int R = used + min(up_to, k - used);
            if(L <= R) {
                add_self(fake[L], tmp);
                if(R + 1 <= k) {
                    sub_self(fake[R+1], tmp);
                }
            }
            //~ for(int i = L; i <= R; ++i) {
                //~ add_self(dp[i], tmp);
            //~ }
        }
        int prefix_sum = 0;
        for(int i = 0; i <= k; ++i) {
            add_self(prefix_sum, fake[i]);
            add_self(dp[i], prefix_sum);
        }
    }
    printf("%d\n", dp[k]);
}

Compiler output:
a.cc: In function 'void add_self(int&, int)':
a.cc:5:13: error: 'mod' was not declared in this scope; did you mean 'modf'?
    5 |     if(a >= mod) {
      |             ^~~
      |             modf
a.cc: In function 'void sub_self(int&, int)':
a.cc:12:14: error: 'mod' was not declared in this scope; did you mean 'modf'?
   12 |         a += mod;
      |              ^~~
      |              modf
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
const int mod=1e9+7;
ll dp[3001][3001];

int solve(vector<ll>a,int i,int j){
	if(i>j || i>=n || j<0) return 0;
	if(dp[i][j]!=-1) return dp[i][j];
	ll x=0;
	x+=max(a[i]+min(solve(a,i+1,j-1),solve(a,i+2,j)),
		   a[j]+min(solve(a,i+1,j-1),solve(a,i,j-2)));
	return dp[i][j]=x;
}

int main(){
	ll n;
	cin>>n;
	vector<ll>a(n);
	ll sum=0;
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++) {
		cin>>a[i];
		sum+=a[i];
	}
	cout<<2*solve(a,0,n-1)-sum<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int solve(std::vector<long int>, int, int)':
a.cc:8:22: error: 'n' was not declared in this scope
    8 |         if(i>j || i>=n || j<0) return 0;
      |                      ^
Language: C++

#include<bits/stdc++.h>
using namespace  std;
int n,k,a[n+1];
int main()
{
  cin>>n>>k;
  for(int i=1;i<=n;i++)cin>>a[i];
  long long int dp[n+1][k+1];
  dp[0][0]=0;
  for(int i=1;i<=k;i++)dp[0][i]=0;
  for(int i=1;i<=n;i++)dp[i][0]=1;
  for(int i=1;i<=n;i++)
  {  long long int sum[k+1]={0};
   sum[0]=dp[i-1][0];
      for(int j=1;j<=k;j++)
         sum[j]=sum[j-1]+dp[i-1][j];
   
    for(int j=0;j<=k;j++)
    { if(j>=a[i])
      dp[i][j]=sum[j]-sum[j-a[i]];
     else
       dp[i][j]=sum[j]-sum[0];
    }
  }
  cout<<dp[n][k];
  return 0;
}

Compiler output:
a.cc:3:12: error: size of array 'a' is not an integral constant-expression
    3 | int n,k,a[n+1];
      |           ~^~
Language: C++

#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
typedef long long ll;
int n,k;
ll dp[110][100010];
ll mod = 1000000007;

int main(){
 cin >> n >> k;
 ll a[n];
 for(int i = 0; i < n; ++i) cin >> a[i];
 for(int i = 0; i <= n; ++i) dp[i][0] = 1;

 for(int i = 1; i <= n; ++i){
   for(int j = 1; j <= k; ++j){
     dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
     if(j - a[i - 1] - 1 >= 0){
       dp[i][j] = dp[i][j] - dp[i - 1][j - a[i - 1] - 1];
     if(dp[i][j]>MOD) dp[i][j] -= MOD;
     }
   }
 }
 cout << dp[n][k] << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:18: error: 'MOD' was not declared in this scope
   21 |      if(dp[i][j]>MOD) dp[i][j] -= MOD;
      |                  ^~~
Language: C++

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

const ll mod = 1e9 + 7;
ll n, k, a[104];
ll dp[104][100005];
bool used[104][100005];

ll add(ll a, ll b){
    ll res = a + b;
    if(res >= mod){res -= mod;}
    return res;
}

ll rec(ll pos, ll left){
    if(pos == n){ return (left == 0); }
    if(used[pos][left]){ return dp[pos][left]; }
    used[pos][left] = 1;
    for(ll i = 0; i <= a[pos]; ++i){
        if(left - i >= 0){
            dp[pos][left] = add(dp[pos][left], rec(pos+1, left-i);
        }else{
            break;
        }
    }
    return dp[pos][left];
}

int main() {
    scanf(%lld%lld, &n, &k);
    for(ll i = 0; i < n; i++){
        scanf(%lld, &a[i]);
    }
    printf(%lld, rec(0, k));
	return 0;
}

Compiler output:
a.cc: In function 'll rec(ll, ll)':
a.cc:22:66: error: expected ')' before ';' token
   22 |             dp[pos][left] = add(dp[pos][left], rec(pos+1, left-i);
      |                                ~                                 ^
      |                                                                  )
a.cc: In function 'int main()':
a.cc:31:11: error: expected primary-expression before '%' token
   31 |     scanf(%lld%lld, &n, &k);
      |           ^
a.cc:31:12: error: 'lld' was not declared in this scope; did you mean 'll'?
   31 |     scanf(%lld%lld, &n, &k);
      |            ^~~
      |            ll
a.cc:33:15: error: expected primary-expression before '%' token
   33 |         scanf(%lld, &a[i]);
      |               ^
a.cc:35:12: error: expected primary-expression before '%' token
   35 |     printf(%lld, rec(0, k));
      |            ^
Language: C++

#include<bits/stdc++.h>
#define crap ios_base::sync_with_stdio(0);cin.tie(0)
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define endl "\n"
#define int ll

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;

// O(N * K^2)

void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
void sub_self(int& a, int b) {
    a -= b;
    if(a < 0) {
        a += mod;
    }
}

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int> dp(k + 1);
    // dp[i] - the number of ways such that we used i candies so far
    dp[0] = 1;
    for(int child = 0; child < n; ++child) {
        int up_to;
        scanf("%d", &up_to);
        vector<int> fake(k + 1);
        for(int used = k; used >= 0; --used) {
            int tmp = dp[used];
            int L = used + 1;
            int R = used + min(up_to, k - used);
            if(L <= R) {
                add_self(fake[L], tmp);
                if(R + 1 <= k) {
                    sub_self(fake[R+1], tmp);
                }
            }
            //~ for(int i = L; i <= R; ++i) {
                //~ add_self(dp[i], tmp);
            //~ }
        }
        int prefix_sum = 0;
        for(int i = 0; i <= k; ++i) {
            add_self(prefix_sum, fake[i]);
            add_self(dp[i], prefix_sum);
        }
    }
    printf("%d\n", dp[k]);
}

Compiler output:
a.cc:3:12: error: expected nested-name-specifier before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:11:7: note: in expansion of macro 'll'
   11 | using ll = long long;
      |       ^~
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;

void add_self(int &a, int b)
{
  a += b;
  if(a > mod) a -= mod;
}

void sub_self(int &a, int b)
{
  a -= b;
  if(a < 0) a += mod;
}

int main()
{
  int n, k;
  cin >> n >> k;
  int arr[n];
  for(int i = 0; i < n; i++) cin >> arr[i];
  int dp[k+1];
  vector<int>dp2(k+1);
  vector<int>fake(k+1);
  dp[0] = 1;
  for(int i = 0; i < n;i++)
  {
    for(int j = k; j >= 0; j--)
    {
      int temp = dp[j]
      int lb = j+1;
      int ub = j + min(k - j, arr[i]);
      if( lb <= ub){
        add_self(fake[lb], tmp);
        if ( ub + 1 <= k) sub_self(fake[ub+1], tmp);
      }
    }
  }
  int sm = 0;
  for(int i = 0; i <= k; i++)
  {
    add_self(sm, fake[i]);
    add_self(dp[i], sm);
  }
  cout << dp[k] << endl;
}
      
      
      
    

Compiler output:
a.cc: In function 'int main()':
a.cc:32:7: error: expected ',' or ';' before 'int'
   32 |       int lb = j+1;
      |       ^~~
a.cc:34:11: error: 'lb' was not declared in this scope; did you mean 'ub'?
   34 |       if( lb <= ub){
      |           ^~
      |           ub
a.cc:35:28: error: 'tmp' was not declared in this scope; did you mean 'temp'?
   35 |         add_self(fake[lb], tmp);
      |                            ^~~
      |                            temp
Language: C++

#include<bits/stdc++.h>
typedef int ll;
using namespace std;
#define endl '\n'
const ll mod=1e9+7;
#define N 100005
ll a[N],dp[ll(105)][N],n,k;
ll solve(ll idx,ll taken){
if(idx==n+1 && taken==k)return 1;
if(taken>k || index>n)return 0;
if(taken==k)return 1;
if(dp[idx][taken]!=-1)return dp[idx][taken];
ll ans=0;
for(ll i=0;i<=a[idx];i++)ans+=solve(idx+1,taken+i);
return dp[idx][taken]=ans;
}
int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    cin>>n>>k;
    memset(dp,-1,sizeof(dp));
    for(ll i=1;i<=n;i++)cin>>a[i];
    cout<<solve(1ll,ll(0))<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'll solve(ll, ll)':
a.cc:10:20: error: invalid operands of types '<unresolved overloaded function type>' and 'll' {aka 'int'} to binary 'operator>'
   10 | if(taken>k || index>n)return 0;
      |               ~~~~~^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define M 1000000007;
int main()
{
	long long int n,k,i,j;
	cin>>n>>k;
	long long int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];


	long long int dp[2][k+1],b[k+1]={};
	memset(dp,0,sizeof(dp));
	b[0]=1;
	for(i=0;i<n;i++)
	{
		for(j=0;j<=k;j++)
		{
			if(i==0)
			{
				if(j<=a[i])
					dp[(i%2)][j]=1;
				continue;
			}
			else if(j==0)
			{
				dp[(i%2)][j]=1;
				continue;
			}
			b[j]=(b[j-1]+dp[((i-1)%2)][j])%M;
			if(j<=a[i])
				dp[(i%2)][j]=b[j];
			else
				dp[(i%2)][j]=(b[j]-b[j-a[i]-1]+M)%M;
		}
	}
	cout<<dp[((n+1)%2)][k]<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:21: error: expected ')' before ';' token
    3 | #define M 1000000007;
      |                     ^
a.cc:35:64: note: in expansion of macro 'M'
   35 |                                 dp[(i%2)][j]=(b[j]-b[j-a[i]-1]+M)%M;
      |                                                                ^
a.cc:35:46: note: to match this '('
   35 |                                 dp[(i%2)][j]=(b[j]-b[j-a[i]-1]+M)%M;
      |                                              ^
a.cc:35:65: error: expected primary-expression before ')' token
   35 |                                 dp[(i%2)][j]=(b[j]-b[j-a[i]-1]+M)%M;
      |                                                                 ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#ifdef ONLINE_JUDGE 
  #define debug(...) 630;
#else
  #include "..\debug.hpp"
#endif

const int mod = 1e9+7;
 
struct Mint {
  long long x; Mint() : x(0) {}
  Mint(long long _x) : x ((_x%mod + mod)%mod) {}
  Mint& fix() { x = (x%mod + mod)%mod; return *this; }
  Mint& operator += (const Mint& other) { if ((x += other.x) >= mod) { x-= mod; } return *this;}
  Mint& operator -= (const Mint& other) { if ((x += mod-other.x) >= mod) { x -= mod; } return *this; }
  Mint& operator *= (const Mint& other) { (x*=other.x)%=mod; return *this; }
  Mint operator + (const Mint& other) const { return Mint(*this) += other; }
  Mint operator - (const Mint& other) const { return Mint(*this) -= other; }
  Mint operator * (const Mint& other) const { return Mint(*this) *= other; }
  Mint operator - () const { return Mint(0) - *this; }
  Mint operator ++ (int) { Mint result(*this); *this += 1; return result; }
  Mint operator -- (int) { Mint result(*this); *this -= 1; return result; }
  bool operator < (const Mint& other) const { return x < other.x; }
  bool operator == (const Mint& other) const { return x == other.x;} 
};
ostream& operator << (ostream& out, const Mint& val) { return out << val.x; }
istream& operator >> (istream& in, Mint& val ) { in >> val.x; return in;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<Mint> dp(k + 1);
  vector<int> a(n);
  for (auto& x : a) cin >> x; 
  dp[0] = 1;
  for (int j = 0; j < n; j++) {
    vector<Mint> p = dp;
    for (int i = 1; i <= k; i++) {
      p[i] += p[i - 1];
    }
    for (int i = 1; i <= k; i++) {
      dp[i] = p[i];
      if ( i - a[j] -1 >= 0) {
        dp[i] -= p[i - a[j] - 1];
      }
    }
  }
  cout << dp[k] << '\n';
  return 0;
}

Compiler output:
a.cc:8:12: fatal error: ..\debug.hpp: No such file or directory
    8 |   #include "..\debug.hpp"
      |            ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define rep(x,n) for(int x = 0 ; x < n ; x++)
#define pb push_back
#define all(c) (c).begin() , (c).end()
const ll mod = 1e9 + 7;
vi dp(1e5+10, 0);

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n)   cin >> a[i];
    
    rep(i, a[0] + 1)
        dp[i] = 1;
    
    for (int i = 1; i < n; i++)
        for (int j = 1; j <= k ; j++)
            if (j - a[i] <= 0)
                (dp[j] += dp[j-1]) %= mod;
            else
                dp[j] = (max(dp[j] + dp[j - 1] - a[j - a[i]- 1], 0) + mod) % mod;
    cout << dp[k] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:29: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)'
   30 |                 dp[j] = (max(dp[j] + dp[j - 1] - a[j - a[i]- 1], 0) + mod) % mod;
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:30:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   30 |                 dp[j] = (max(dp[j] + dp[j - 1] - a[j - a[i]- 1], 0) + mod) % mod;
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:30:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   30 |                 dp[j] = (max(dp[j] + dp[j - 1] - a[j - a[i]- 1], 0) + mod) % mod;
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 1e5 + 5;

ll n, k, memo[105][nax], arr[105];

ll dp(ll i, ll j){
	if (j == 0){
		return 1;
	}
	if (j < 0){
		return 0;
	}
	if (i == 0){
		return 0;
	}
	if(memo[i][j] != -1){
		return memo[i][j];
	}
	ll ret = ((dp(i-1, j) + dp(i, j-1) % mod) - (dp(i - 1, j - arr[i] - 1) % mod) % mod;
	return memo[i][j] = ret;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(); cout.tie();

	cin >> n >> k;
	for (ll i = 1; i <= n; i++){
		cin >> arr[i];
	}
	sort(arr+1, arr+n+1);
	memset(memo, -1, sizeof(memo));
	cout << dp(n, k) << '\n';
}
  

Compiler output:
a.cc: In function 'll dp(ll, ll)':
a.cc:28:92: error: expected ')' before ';' token
   28 |         ll ret = ((dp(i-1, j) + dp(i, j-1) % mod) - (dp(i - 1, j - arr[i] - 1) % mod) % mod;
      |                  ~                                                                         ^
      |                                                                                            )
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define int long long int
#define vi vector<int>
#define pi pair<int,int>
#define ff first
#define ss second
//#define vlli vector<long long int>
#define si set<int>
#define loop(i,k,n) for(int i=k;i<n;i++)
#define MOD 1000000007
#define r0 return 0
/*
//gcd in O(log(an n n nnnnn n n
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
*/
/*
int gcd, x, y;

void extendedEuclid (int a, int b)
{
    if (b==0)
    {
        x=1;
        y=0;
        gcd=a;
        return;
    }
    extendedEuclid(b, a%b);
    int x1=y;
    int y1=x-(a/b)*y;
    x=x1;
    y=y1;
}

int nCr (int n, int r)
{
    int p=1, k=1, modInv;
    if (n-r<r)
        r=n-r;
    if (r!=0)
    {
        while (r)
        {
            p=(p*n)%MOD;
            k*=r;
            n--;
            r--;
        }
        extendedEuclid(k, MOD);
        modInv=(x+MOD)%MOD;
        p=(p*modInv)%MOD;
    }
    else
        p=1;
    return p;
}

*/
// A modular inverse based solution to

int dp[102][100003];
int32_t main(void)
{
    int t=1;
    //cin>>t;
    while(t--)
    {
       int n,k;
       cin>>n>>k;

       for(int i=0;i<=n;i++)
        for(int j=0;j<=k;j++)
            dp[i][j]=0;
       for(int i=1;i<=n;i++)
        dp[i][0]=1;
        int c=0;
       for(int i=1;i<=n;i++)
       {
           int temp;
           cin>>temp;
           c=c+temp;
           if(c>k)
            c=k;
           for(int j=1;j<=temp;j++)
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
           for(int j=temp+1;j<=c;j++)
            dp[i][j]=dp[i][j-1]-1;
           if(dp[i][j]<0)
            dp[i][j]+=MOD;
       }
       cout<<dp[n][k]<<endl;

    }

}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:95:21: error: 'j' was not declared in this scope
   95 |            if(dp[i][j]<0)
      |                     ^
Language: C++

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

//貰うDPを配るdpにして高速化、で式変形orBITor累積和によってまとめる,式変形はj-1を代入
int n,k;
vector<ll> a;
ll dp[110][100010];
ll mod = 1000000007;

ll modpow(ll a,ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * a%mod;
        a = a*a%mod;
    n >>=1;
    }
    return res;
}
ll modMinus(ll val,ll m){
    ll res = val % m;
    if(res < 0) res += m;
        return res;
}
 void modAdd(ll &a,ll b){
a += b;
if(a >= MOD) a-= MOD;
}

int main(){
 cin >> n >> k;
 a.resize(n);
 for(int i = 0; i < n; ++i) cin >> a[i];
 for(int i = 0; i <= n; ++i) dp[i][0] = 1; //i人目までに0個配る方法は1通り

 for(int i = 1; i <= n; ++i){
   for(int j = 1; j <= k; ++j){
     dp[i][j] = modAdd(dp[i - 1][j],dp[i][j - 1]);
     if(j - a[i - 1] - 1 >= 0){
       dp[i][j] = modMinus(dp[i][j],dp[i - 1][j - a[i - 1] - 1]);
     }
   }
 }
 cout << dp[n][k] << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:23: error: void value not ignored as it ought to be
   93 |      dp[i][j] = modAdd(dp[i - 1][j],dp[i][j - 1]);
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

 #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

//貰うDPを配るdpにして高速化、で式変形orBITor累積和によってまとめる,式変形はj-1を代入
int n,k;
vector<ll> a;
ll dp[110][100010];
ll mod = 1000000007;

ll modpow(ll a,ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * a%mod;
        a = a*a%mod;
    n >>=1;
    }
    return res;
}
ll modMinus(ll val,ll m){
    ll res = val % m;
    if(res < 0) res += m;
        return res;
}
 void modAdd(int &a,int b){
a += b;
if(a >= MOD) a-= MOD;
}

int main(){
 cin >> n >> k;
 a.resize(n);
 for(int i = 0; i < n; ++i) cin >> a[i];
 for(int i = 0; i <= n; ++i) dp[i][0] = 1; //i人目までに0個配る方法は1通り

 for(int i = 1; i <= n; ++i){
   for(int j = 1; j <= k; ++j){
     dp[i][j] = modAdd(dp[i - 1][j],dp[i][j - 1]);
     if(j - a[i - 1] - 1 >= 0){
       dp[i][j] = modMinus(dp[i][j],dp[i - 1][j - a[i - 1] - 1]);
     }
   }
 }
 cout << dp[n][k] << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:35: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'll' {aka 'long long int'}
   93 |      dp[i][j] = modAdd(dp[i - 1][j],dp[i][j - 1]);
      |                        ~~~~~~~~~~~^
a.cc:80:19: note:   initializing argument 1 of 'void modAdd(int&, int)'
   80 |  void modAdd(int &a,int b){
      |              ~~~~~^
Language: C++

// She is Pretty pretty!
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 1100;
ll n, a[N],f[N][N], sum[N];
int main()
{
    ios::sync_with_stdio(false),cin.tie(0);
    cin >> n;
    memset(f, 0x3f, sizeof f);
    for(int i = 1; i <= n; i++){
        f[i][i] = 0;
        cin >> a[i];
        sum[i] = sum[i-1]+a[i];
    }
    for(int len = 1; len < n; len++){
        for(int l = 1; l + len <= n; l++){
            int r = l + len;
            for(int k = l; k < r; k++){
                f[l][r] = min(f[l][r] , f[l][k]+f[k+1][r]);
            }
            sum += sum[r] - sum[l-1];
        }
    }
    cout <<f[1][n] <<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: incompatible types in assignment of 'long long int' to 'long long int [1100]'
   29 |             sum += sum[r] - sum[l-1];
      |             ~~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define int long long int
#define pll pair<int,int>
#define dbl long double
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define eps 0.00000001
#define inf 10000000000001
#define all(x) (x).begin(),(x).end()
#define size(x) (int)(x).size()
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define popb() pop_back()
#define popf() pop_front()
#define mp(x,y) make_pair((x),(y))
#define vv(dt) vector<vector<dt>>
#define fastio(x) ios_base::sync_with_stdio(x); cin.tie(NULL)
#define init(v,s) memset(v,s,sizeof(v)) 
#define bug(x) cerr<<"LINE: "<<__LINE__<<" || "<<#x<<" = "<<x<<endl
#define loop(i,s,n) for(auto i=s;i<n;i++)
#define rloop(i,n,b) for(auto i=n-1;i>=b;i--)
using namespace std;
// #define bug(x) {}

signed main()
{
	fastio(0);
	int n,k;
	cin>>n>>k;
	int a[n];
	loop(i,0,n) cin>>a[i];
	int dp[k+1][n+1];
	init(dp,0);
	//no of ways for n=1, fill upto a[0], is 1.
	loop(i,0,k+1)
	{
		if(i<=a[0]) dp[i][1] = 1;
		else dp[i][1] = 0;
		// use dp[k][0] as prefix array
		if(i==0) dp[i][0] = dp[i][1];
		else dp[i][0] = (dp[i-1][0] + dp[i][1])%mod;
	}

	// dp[k][n] = sum(dp[k-ai][n-1]) ; ai E [0,min(k,an)].
	for(int N=2;N<=n;N++)
	{
		for(int K=0;K<=k;K++)
		{
			if(a[N-1]<K)
			else dp[K][N] = dp[K][0]%mod;
		}
		// update prefix array
		for(int K=0;K<=k;K++)
		{
			if(K==0) dp[K][0] = dp[K][N]%mod;
			else dp[K][0] = (dp[K-1][0] + dp[K][N])%mod;
		}
	}

	// ans = dp[k][n]
	cout<<dp[k][n]%mod<<endl;
	return 0;	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:25: error: expected primary-expression before 'else'
   52 |                         else dp[K][N] = dp[K][0]%mod;
      |                         ^~~~
Language: Java

//package javaapplication9;
import java.util.*;
import java.io.*;
public class Main{

 public static int candies(int n, int k, int arr[],int[][] dp){
     
    if(n < 0 || k < 0)
        return 0;
     if(k == 0 && n == 0)
         return 1;
     if(dp[n][k] > -1){
//         System.out.println("used");
         return dp[n][k];
     }
     int a = 0;
     
     for(int i = 0; i <= arr[n]; i++){
      a +=candies(n-1,k-i,arr,dp);
     }
     
     dp[n][k] =  a;
    return dp[n][k];

 
 } 
    public static void main(String[] args) throws Exception {
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   
         StringTokenizer str  = new StringTokenizer(br.readLine()," ");
    
      int n  = Integer.parseInt(str.nextToken());
    int k  = Integer.parseInt(str.nextToken());
    int[] arr = new int[n+1];
    str  = new StringTokenizer(br.readLine()," ");
    int i = 1;
    while(str.hasMoreTokens()){
        arr[i] = Integer.parseInt(str.nextToken());
    i++;
    }
 
    int[][] dp = new int[n+1][k+1];
      for(int i = 0; i < dp.length; i++){
      Arrays.fill(dp[i],-1);
      }
      System.out.println(candies(n,k,arr,dp ) );
    
    
    }
    
}


Compiler output:
Main.java:42: error: variable i is already defined in method main(String[])
      for(int i = 0; i < dp.length; i++){
              ^
1 error
Language: Java

//package javaapplication9;
import java.util.*;
import java.io.*;
public class Main{

 public static int candies(int n, int k, int arr[]){
     
    if(n < 0 || k < 0)
        return 0;
     if(k == 0 && n == 0)
         return 1;
  
     int a = 0;
     
     for(int i = 0; i <= arr[n]; i++){
      a +=candies(n-1,k-i,arr,dp);
     }
     
     return  a;
    

 
 } 
    public static void main(String[] args) throws Exception {
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   
         StringTokenizer str  = new StringTokenizer(br.readLine()," ");
    
      int n  = Integer.parseInt(str.nextToken());
    int k  = Integer.parseInt(str.nextToken());
    int[] arr = new int[n+1];
    str  = new StringTokenizer(br.readLine()," ");
    int i = 1;
    while(str.hasMoreTokens()){
        arr[i] = Integer.parseInt(str.nextToken());
    i++;
    }
 
    int[][] dp = new int[n+1][k+1];
      for(int ii = 0; ii < dp.length; ii++){
      Arrays.fill(dp[ii],-1);
      }
      System.out.println(candies(n,k,arr ) );
    
    
    }
    
}


Compiler output:
Main.java:16: error: cannot find symbol
      a +=candies(n-1,k-i,arr,dp);
                              ^
  symbol:   variable dp
  location: class Main
1 error
Language: Java

//package javaapplication9;
import java.util.*;
import java.io.*;
public class Main{

 public static int candies(int n, int k, int arr[],int[][] dp){
     
    if(n < 0 || k < 0)
        return 0;
     if(k == 0 && n == 0)
         return 1;
     if(dp[n][k] > -1){
//         System.out.println("used");
         return dp[n][k];
     }
     int a = 0;
     
     for(int i = 0; i <= arr[n]; i++){
      a +=candies(n-1,k-i,arr,dp);
     }
     
     return dp[n][k] =  a;
    

 
 } 
    public static void main(String[] args) throws Exception {
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   
         StringTokenizer str  = new StringTokenizer(br.readLine()," ");
    
      int n  = Integer.parseInt(str.nextToken());
    int k  = Integer.parseInt(str.nextToken());
    int[] arr = new int[n+1];
    str  = new StringTokenizer(br.readLine()," ");
    int i = 1;
    while(str.hasMoreTokens()){
        arr[i] = Integer.parseInt(str.nextToken());
    i++;
    }
 
    int[][] dp = new int[n+1][k+1];
      for(int i = 0; i < dp.length; i++){
      Arrays.fill(dp[i],-1);
      }
      System.out.println(candies(n,k,arr,dp ) );
    
    
    }
    
}


Compiler output:
Main.java:42: error: variable i is already defined in method main(String[])
      for(int i = 0; i < dp.length; i++){
              ^
1 error
Language: Java

//package javaapplication9;
import java.util.*;
import java.io.*;
public class Main{

 public static int candies(int n, int k, int arr[],int[][] dp){
     
    if(n < 0 || k < 0)
        return 0;
     if(k == 0 && n == 0)
         return 1;
     if(dp[n][k] > 0){
//         System.out.println("used");
         return dp[n][k];
     }
     int a = 0;
     
     for(int i = 0; i <= arr[n]; i++){
      a +=candies(n-1,k-i,arr,dp);
     }
     
     return dp[n][k] =  a;
    

 
 } 
    public static void main(String[] args) throws Exception {
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   
    int n  = Integer.parseInt(str.nextToken());
    int k  = Integer.parseInt(str.nextToken());
    int[] arr = new int[n+1];
    str  = new StringTokenizer(br.readLine()," ");
    int i = 1;
    while(str.hasMoreTokens()){
        arr[i] = Integer.parseInt(str.nextToken());
    i++;
    }
 
    int[][] dp = new int[n+1][k+1];
      System.out.println(candies(n,k,arr,dp ) );
    
    
    }
    
}


Compiler output:
Main.java:29: error: cannot find symbol
    int n  = Integer.parseInt(str.nextToken());
                              ^
  symbol:   variable str
  location: class Main
Main.java:30: error: cannot find symbol
    int k  = Integer.parseInt(str.nextToken());
                              ^
  symbol:   variable str
  location: class Main
Main.java:32: error: cannot find symbol
    str  = new StringTokenizer(br.readLine()," ");
    ^
  symbol:   variable str
  location: class Main
Main.java:34: error: cannot find symbol
    while(str.hasMoreTokens()){
          ^
  symbol:   variable str
  location: class Main
Main.java:35: error: cannot find symbol
        arr[i] = Integer.parseInt(str.nextToken());
                                  ^
  symbol:   variable str
  location: class Main
5 errors
Language: C++

#include<bits/stdc++.h>
#define ll long long 
using namespace std;
ll mod=1e9+7;
int main(){
	ll n,k;
	cin>>n>>k;
	ll dp[k+1]={0};
	
	dp[0]=1;
	for(int i=0;i<n;i++){
		ll a;
		cin>>a;
		ll prefix[k+1]={0};
		for(int used=k;used>=0;used--){
			ll temp=dp[used];
			ll l=used+1;
			ll r=used+min(a,k-used);
			if(l<=r){
				prefix[l]+=temp;
				prefix[l]%=mod;
				if(r+1<=k){
				prefix[r+1]+=-temp;
				prefix[r+1]%=mod;
				}
			}
			
		}
		ll ps=0;
		for(int j=0;j<=k;j++){
			p+=prefix[j];
			p%=mod;
			dp[j]+=p;
			dp[j]%=mod;
		}
	}
	cout<<dp[k];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:25: error: 'p' was not declared in this scope
   31 |                         p+=prefix[j];
      |                         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define int long long int
const int N = 1e2 + 4 , M = 200005 , MOD = 1e9 + 7;
int n , k;
int arr[M] , cache[N][M];
int dp(int pos, int val)
{
     if (val > k)
          return 0;
     if (pos == n)
          return val == k;

     int &ans = cache[pos][val];
     if (ans != -1)
          return ans;

     ans = dp(pos, val + 1) + dp(pos + 1, val) - dp(pos + 1, val + arr[pos] + 1) + 2 * MOD;
     ans %= MOD;
     return ans;
}
//int solve(int idx , int candies){
//    if(candies < 0)
//        return 0;
//     if(idx == n){
//        return (candies == 0);
//     }
//     int &ret = mem[idx][candies];
//     if(~ret)
//        return ret;
//    ret = solve(idx , candies -1) + solve(idx + 1 , candies) - solve(idx + 1 , candies - arr[idx] -1 ) + 2 * MOD;
//    ret%= MOD;
//    return ret;
//}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(cache , -1 , sizeof cache);
    cin >> n >> k;
    for(int i = 0 ; i < n ; ++i){
        cin >> arr[i];
    }
    cout << dp(0 , 0) % MOD;


    return 0;

}


Compiler output:
a.cc:4:23: error: '::main' must return 'int'
    4 | #define int long long int
      |                       ^~~
a.cc:36:1: note: in expansion of macro 'int'
   36 | int main()
      | ^~~
Language: C++

# -*- coding: utf-8 -*-
"""
Created on Thu Jan 30 16:06:12 2020

@author: matsui
"""

import numpy as np



N, K=map(int,input().split())
a=input().split()
a=[int(i) for i in a]

dp=np.zeros([N+1,K+1])
s=np.zeros(K+1)

for i in range(a[0]+1):
    dp[1][i]=1
          
M=a[0]
for j in range(2,N+1):
    M+=a[j-1]
    dp[j][0]=1
    
    s[0]=dp[j-1][0]
    for i in range(1,min(K+1,M+1)):
        s[i]=s[i-1]+dp[j-1][i]
      
    for i in range(1,min(K+1,M+1)):
        dp[j][i]=s[i]
        if i>a[j-1]:
            dp[j][i]-=s[i-a[j-1]-1]

        if dp[j][i] > 1e9+7: dp[j][i]=dp[j][i]%(1e9+7)
            
            
print(int(dp[N][K]))

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:2:3: warning: missing terminating " character
    2 | """
      |   ^
a.cc:2:3: error: missing terminating " character
a.cc:5:1: error: stray '@' in program
    5 | @author: matsui
      | ^
a.cc:6:3: warning: missing terminating " character
    6 | """
      |   ^
a.cc:6:3: error: missing terminating " character
a.cc:2:1: error: expected unqualified-id before string constant
    2 | """
      | ^~
Language: C++

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

typedef long long ll;
const int N(105), K(133333);
ll a[N], s[K];
ll dp[N][K];
int n, k;

int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int j = 0; j <= k; ++j)
        dp[0][j] = 0;
    for (int j = 0; j <= n; ++j)
        dp[j][0] = 1;
    for (int i = 1; i <= n; ++i)
    {
        s[0] = 0;
        for (int j = 1; j <= k + 1; j++)
            s[j] = (s[j - 1] + dp[i - 1][j - 1]) % mod;
        for (int j = 1; j <= k; j++)
        {
            dp[i][j] = s[j + 1] - s[max(0, j - a[i - 1])];
            dp[i][j] = dp[i][j] % mod;
        }
    }
    cout << dp[n][k];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:40: error: no matching function for call to 'max(int, ll)'
   27 |             dp[i][j] = s[j + 1] - s[max(0, j - a[i - 1])];
      |                                     ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:27:40: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   27 |             dp[i][j] = s[j + 1] - s[max(0, j - a[i - 1])];
      |                                     ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:27:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |             dp[i][j] = s[j + 1] - s[max(0, j - a[i - 1])];
      |                                     ~~~^~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>

using namespace std;
const int MAX = 1e9 + 7;
int main(int argc, char*argv[])
{
	int N, K;
	cin >> N >> K;
	vector<int> a(N+1);
	sort(a.begin(), a.end());
	vector<vector<pair<int, int>>> dp(N+1, vector<pair<int, int>>(K+1, make_pair(0, 0)));
	for (int i = 1; i <= N; ++i)
		cin >> a[i];
	
	for (int i = min(a[1],K) ; i >= 0; --i)
	{dp[1][i].first = 1;dp[1][i].second = (dp[1][i].first%MAX; + dp[1][i+1].second%MAX)%MAX;}
	
	for (int i = 2 ; i <= N; ++i) //child loop
	{
		for (int j = K; j >= 0 ; --j) // candy loop
		{
			int left = a[i] > j ? 0: j-a[i];
			
			//if(dp[i-1][left].first)
			{
				if(j)
				{
					dp[i][j].first = (dp[i][j].first%MAX + dp[i-1][left].second%MAX)%MAX;
					if((a[i]-j)>=0)
					{
						dp[i][j].first = (dp[i][j].first%MAX - dp[i-1][K-(a[i]-j)+1].second%MAX + MAX)%MAX;
						if(dp[i][j].first<0)
							dp[i][j].first += MAX;
					}
				}
				else
					dp[i][j].first = 1;
				dp[i][j].second = (dp[i][j].first%MAX + dp[i][j+1].second%MAX)%MAX;
			}
		}
	}
	cout << dp[N][K].first;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:17:66: error: expected ')' before ';' token
   17 |         {dp[1][i].first = 1;dp[1][i].second = (dp[1][i].first%MAX; + dp[1][i+1].second%MAX)%MAX;}
      |                                               ~                  ^
      |                                                                  )
a.cc:17:91: error: expected ';' before ')' token
   17 |         {dp[1][i].first = 1;dp[1][i].second = (dp[1][i].first%MAX; + dp[1][i+1].second%MAX)%MAX;}
      |                                                                                           ^
      |                                                                                           ;
Language: C++

#include <bits/stdc++.h>
#include "../lib/data_structure/bit.hpp"

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

  int n, K; cin >> n >> K;
  vi a(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
  }

  BIT<ll> bit(K+1);
  bit.add(K, 1);
  //cout << sz << endl;

  for(int i=0;i<n;++i) {
    //printv(bit.node);
    for(int j=0;j<K;++j) {
      int l = j, r = j + a[i];
      l = max(0, l);
      r = min(K, r);
      ll tmp = bit.sum(r) - bit.sum(l);
      //cout << l << ":" << r << ":" << tmp << endl;
      bit.add(j, tmp % MOD);
    }
  }
  
  //printv(bit.node);

  cout << bit.sum(0) << endl;


}


Compiler output:
a.cc:2:10: fatal error: ../lib/data_structure/bit.hpp: No such file or directory
    2 | #include "../lib/data_structure/bit.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.