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

#include <bits/stdc++.h>
#include "../lib/segmenttree/segtree_update_add.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];
  }

  SegmentTreeUpdAdd<ll> st(vector<ll>(K+1));
  st.update(K, 1);
  int sz = st.n;
  //cout << sz << endl;

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

  cout << st.node[sz-1] << endl;


}


Compiler output:
a.cc:2:10: fatal error: ../lib/segmenttree/segtree_update_add.hpp: No such file or directory
    2 | #include "../lib/segmenttree/segtree_update_add.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
const ll MOD = 1000000007;
using namespace std;
int main(){
    vaibhavv06;
	int n,k; cin>>n>>k;
    vector<int> dp(k+1);
    dp[0]=1;
    for(int child = 0;child<n;child++){
        int upto; cin>>upto;
       
        vector<int> fake(k+1);
        for(int used=k;used>=0;used--){
            int temp = dp[used];
            int l = used+1;
            int r = used + min(upto,k-used);
            if(l<=r){
                fake[l]+=temp;
                if(fake[l]>MOD) fake[l]-=MOD;
                if(r+1<=k){
                    fake[r+1]-=temp;
                    if(fake[r+1]<0) fake[r+1]+=MOD;
                }
            }
        }
        int prefix = 0;
        for(int i=0;i<=k;i++){
            prefix+=fake[i];
            prefix%=MOD;
            dp[i]+=prefix;
            dp[i]%=MOD;
        }
    }
    cout<<dp[k]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'vaibhavv06' was not declared in this scope
    6 |     vaibhavv06;
      |     ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
typedef long long ll;
//ll par[2000010],sizem[2000010],sizel[2000010],size[2000010],a,b,q1,q2,q3,x,y;
ll a[101];
ll dp[101][100001];
ll sum[100001];
ll solve(ll i,ll j,ll player=1)
{
	if(i>j)
		return 0;
	if(i>n)
		return 0;
	if(j<1)
		return 0;
	ll maxi = -1;
	ll max2 = -1;
	if(dp[i][j][player]!=-1)
		return dp[i][j][player];
	ll &ans = dp[i][j][player];
	if(player==1)
		ans=max(a[i]+solve(i+1,j,2),a[j]+solve(i,j-1,2));
	if(player==2)
		ans=min(-a[j]+solve(i,j-1,1),-a[i]+solve(i+1,j,1));
	return ans;
}
ll calc(ll a,ll b)
{
	if(b<=0)
		return sum[a];
	return (sum[a]-sum[b-1]+mod)%mod;
}

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

Compiler output:
a.cc: In function 'll solve(ll, ll, ll)':
a.cc:13:14: error: 'n' was not declared in this scope
   13 |         if(i>n)
      |              ^
a.cc:19:20: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   19 |         if(dp[i][j][player]!=-1)
      |                    ^
a.cc:20:32: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   20 |                 return dp[i][j][player];
      |                                ^
a.cc:21:27: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   21 |         ll &ans = dp[i][j][player];
      |                           ^
a.cc: In function 'll calc(ll, ll)':
a.cc:32:33: error: 'mod' was not declared in this scope; did you mean 'modf'?
   32 |         return (sum[a]-sum[b-1]+mod)%mod;
      |                                 ^~~
      |                                 modf
a.cc: In function 'int main()':
a.cc:37:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   37 |         cin>>n>>k;
      |              ^
      |              yn
a.cc:37:17: error: 'k' was not declared in this scope
   37 |         cin>>n>>k;
      |                 ^
a.cc:47:38: error: expected primary-expression before ';' token
   47 |                 for (int j = 0; j <= ; ++j)
      |                                      ^
a.cc:52:62: error: 'mod' was not declared in this scope; did you mean 'modf'?
   52 |                                 sum[j]=(sum[j-1]+dp[i-1][j])%mod;
      |                                                              ^~~
      |                                                              modf
Language: C++

#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
typedef int long long int;

ll dp[110][110000],sum[110][110000];
int a[110000];

signed main(){
    int N,K;
    cin>>N>>K;
    for(int i=1;i<=N;i++) cin>>a[i];

    for(int i=0;i<110;i++){
        dp[i][0]=1;
        sum[i][0]=1;
    } 

    for(int i=0;i<110000;i++) sum[0][i]=1;

    for(int i=1;i<=N;i++){
        int x=a[i];
        for(int j=1;j<=K;j++){
            if(j-x-1<0) dp[i][j]=sum[i-1][j];
            else dp[i][j]=sum[i-1][j]-sum[i-1][j-x-1];
            dp[i][j]%=MOD;
            sum[i][j]=sum[i][j-1]+dp[i][j];
            sum[i][j]%=MOD;
        }
    }
    cout<<dp[N][K]<<endl;
}

Compiler output:
a.cc:28:9: error: multiple types in one declaration
   28 | typedef int long long int;
      |         ^~~
a.cc:28:23: error: declaration does not declare anything [-fpermissive]
   28 | typedef int long long int;
      |                       ^~~
Language: C++

#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include<tuple>
using namespace std;
#define INF 1LL<<62
#define MAX 100000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
typedef int ll;

ll dp[110][110000],sum[110][110000];
int a[110000];

signed main(){
    int N,K;
    cin>>N>>K;
    for(int i=1;i<=N;i++) cin>>a[i];

    for(int i=0;i<110;i++){
        dp[i][0]=1;
        sum[i][0]=1;
    } 

    for(int i=0;i<110000;i++) sum[0][i]=1;

    for(int i=1;i<=N;i++){
        int x=a[i];
        for(int j=1;j<=K;j++){
            if(j-x-1<0) dp[i][j]=sum[i-1][j];
            else dp[i][j]=sum[i-1][j]-sum[i-1][j-x-1];
            dp[i][j]%=MOD;
            sum[i][j]=sum[i][j-1]+dp[i][j];
            sum[i][j]%=MOD;
        }
    }
    cout<<dp[N][K]<<endl;
}

Compiler output:
a.cc:28:13: error: conflicting declaration 'typedef int ll'
   28 | typedef int ll;
      |             ^~
a.cc:18:19: note: previous declaration as 'typedef long long int ll'
   18 | typedef long long ll;
      |                   ^~
Language: C++

#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

int n, arr[101], k;long long int faktoriyel[100010];
long long int cvp=0;

long long int fe(long long int b, long long int e){
	if(e==1)return b;
	if(e%2==0)return fe(b*b%MOD, e/2);
	return fe(b*b%MOD, e/2)*b%MOD;
}

int recursive(int konum, int last){
	if(konum==n)return 0;
	if(arr[konum]<k)cvp=(cvp+last*(faktoriyel[n+k-1-arr[konum]-1]*(fe(faktoriyel[n-1], MOD-2)*fe(faktoriyel[k-arr[konum]-1], MOD-2))+MOD)%MOD)%MOD;
	if(last==-1)return recursive(konum+1, -1);
	return recursive(konum+1, -1);
}

int dagit(int konum, int seker, int last){
	if(konum>=n)return 0;
	if(seker+arr[konum]>k)return dagit(konum+1, seker);
	if(seker+arr[konum]+1==k){
		cvp+=last;
	}else{
		cvp+=last*(faktoriyel[n+k-1-arr[konum]-1]/(faktoriyel[n-1]*faktoriyel[k-arr[konum]-1]));
	}
}


int main(void){
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	faktoriyel[0]=1;
	faktoriyel[1]=1;
	for(int i=1;i<=n+k;i++)faktoriyel[i+1]=((faktoriyel[i]*(i+1))%MOD);
	cvp=((faktoriyel[n+k-1]*fe(faktoriyel[n-1], MOD-2))%MOD *fe(faktoriyel[k], MOD-2))%MOD;
	recursive(0, -1);
	cout<<cvp;
	return 0;
}
/*
3
113
023
122

21

10
6
3
*/

Compiler output:
a.cc: In function 'int dagit(int, int, int)':
a.cc:24:43: error: too few arguments to function 'int dagit(int, int, int)'
   24 |         if(seker+arr[konum]>k)return dagit(konum+1, seker);
      |                                      ~~~~~^~~~~~~~~~~~~~~~
a.cc:22:5: note: declared here
   22 | int dagit(int konum, int seker, int last){
      |     ^~~~~
Language: C++

#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

int n, arr[101], k;long long int faktoriyel[100010];
long long int cvp=0;

int recursive(int konum, int last){
	if(konum==n)return 0;
	if(arr[konum]<k)cvp=(cvp+last*(faktoriyel[n+k-1-arr[konum]-1]*(fe(faktoriyel[n-1], MOD-2)*fe(faktoriyel[k-arr[konum]-1], MOD-2))+MOD)%MOD)%MOD;
	if(last==-1)return recursive(konum+1, -1);
	return recursive(konum+1, -1);
}

int dagit(int konum, int seker, int last){
	if(konum>=n)return 0;
	if(seker+arr[konum]>k)return dagit(konum+1, seker);
	if(seker+arr[konum]+1==k){
		cvp+=last;
	}else{
		cvp+=last*(faktoriyel[n+k-1-arr[konum]-1]/(faktoriyel[n-1]*faktoriyel[k-arr[konum]-1]));
	}
}

long long int fe(long long int b, long long int e){
	if(e==1)return b;
	if(e%2==0)return fe(b*b%MOD, e/2);
	return fe(b*b%MOD, e/2)*b%MOD;
}

int main(void){
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	faktoriyel[0]=1;
	faktoriyel[1]=1;
	for(int i=1;i<=n+k;i++)faktoriyel[i+1]=((faktoriyel[i]*(i+1))%MOD);
	cvp=((faktoriyel[n+k-1]*fe(faktoriyel[n-1], MOD-2))%MOD *fe(faktoriyel[k], MOD-2))%MOD;
	recursive(0, -1);
	cout<<cvp;
	return 0;
}
3
113
023
122

21

10
6
3


Compiler output:
a.cc: In function 'int recursive(int, int)':
a.cc:11:72: error: 'fe' was not declared in this scope
   11 |         if(arr[konum]<k)cvp=(cvp+last*(faktoriyel[n+k-1-arr[konum]-1]*(fe(faktoriyel[n-1], MOD-2)*fe(faktoriyel[k-arr[konum]-1], MOD-2))+MOD)%MOD)%MOD;
      |                                                                        ^~
a.cc: In function 'int dagit(int, int, int)':
a.cc:18:43: error: too few arguments to function 'int dagit(int, int, int)'
   18 |         if(seker+arr[konum]>k)return dagit(konum+1, seker);
      |                                      ~~~~~^~~~~~~~~~~~~~~~
a.cc:16:5: note: declared here
   16 | int dagit(int konum, int seker, int last){
      |     ^~~~~
a.cc: At global scope:
a.cc:48:1: error: expected unqualified-id before numeric constant
   48 | 3
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, k; // 10^2, 10^5
vector<int> a; // 10^5
int dp[105][10005];

int m[105];

int rek(int idx, int left) {
	if (idx >= n) return 0;
	if (idx == n - 1) {
		if(left <= a[idx])
		return 1;
		return 0;
	}

	if (dp[idx][left] != -1) return dp[idx][left];
	
	int sol = 0;

	int tops = min(left, a[idx]);
	for (int i = 0; i <= tops; i++) {
		int k = rek(idx + 1, left - i);
		if (k != 0) {
			sol += k;
			sol %= 1000000007;
		}
	}

	return dp[idx][left] = sol;
}

int main() {
	memset(dp, 0, sizeof dp);
	cin >> n >> k;
	a.assign(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i == 0) m[i] = a[i];
		else m[i] = a[i] + m[i - 1];
	}

	if (m[n - 1] < k) {
		cout << 0 << "\n";
		return 0;
	}

	for (int i = 0; i <= a[0]; i++) {
		dp[1][k-i] = 1;
	}

	for (int i = 1; i < n; i++) { // idx
		for (int j = 0; j <= k; j++) { // left
			for (int x = 0; x <= min(j, a[i]); x++) { // current cost
				dp[i + 1][j - x] += dp[i][j];
				dp[i + 1][j - x] %= 1000000007;
			}
		}
	}

	cout << dp[n][0];

	//cout << rek(0, k) << "\n";

}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'memset' was not declared in this scope
   38 |         memset(dp, 0, sizeof dp);
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <bits/stdc++.h>
#define l_ength size
using ll = long long;
const int mod = 1000000007;
const ll infll = (1ll<<60);
using namespace std;

ll dp[110][100010];
ll sum[100010];

int main(){
	int n, k; cin >> n >> k;
	vector<ll> a(n);
	for( auto &k : a ) cin >> k;
	dp[0][0] = 1;
	for( int i = 0; i <= k; ++i ){
		sum[i+1] = ( sum[i] + dp[0][i] ) % mod;
	}
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j <= k; ++j ){
			dp[i+1][j] = ( sum[j+1] - sum[max(0, j-a[i])] + mod ) % mod;
		}
		for( int j = 0; j <= k; ++j ){
			sum[j+1] = ( sum[j] + dp[i+1][j] ) % mod;
		}
	}
	cout << dp[n][k] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:58: error: no matching function for call to 'max(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
   21 |                         dp[i+1][j] = ( sum[j+1] - sum[max(0, j-a[i])] + 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:21:58: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
   21 |                         dp[i+1][j] = ( sum[j+1] - sum[max(0, j-a[i])] + 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:21:58: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   21 |                         dp[i+1][j] = ( sum[j+1] - sum[max(0, j-a[i])] + mod ) % mod;
      |                                                       ~~~^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long d[105][100004],n,i;
int a[105],k;
ll mod = 1000000007;
long long dp(int i,int x,int y){
    if(i==n) return (x+y==0);
    if(x<0) return 0;
    if(d[i][x+y]!=-1) return d[i][x];
    long long one,two;
    one=dp(i,x-1,y)%mod;
    two=dp(i+1,min(x+y,a[i+1]),x+y-min(x+y,a[i+1]))%mod;
    d[i][x+y]=(one%mod+two%mod)%mod;
    return d[i][x+y]%mod;
}
int main(){
    memset(d,-1,sizeof d);
    cin>>n>>k;
    for(i=0;i<n;i++) cin>>a[i];
    cout<<(dp(0,min(a[0],k),k-min(a[0],k)))%mod;
    return 0;
}


Compiler output:
a.cc:5:1: error: 'll' does not name a type
    5 | ll mod = 1000000007;
      | ^~
a.cc: In function 'long long int dp(int, int, int)':
a.cc:11:21: error: 'mod' was not declared in this scope; did you mean 'modf'?
   11 |     one=dp(i,x-1,y)%mod;
      |                     ^~~
      |                     modf
a.cc: In function 'int main()':
a.cc:20:45: error: 'mod' was not declared in this scope; did you mean 'modf'?
   20 |     cout<<(dp(0,min(a[0],k),k-min(a[0],k)))%mod;
      |                                             ^~~
      |                                             modf
Language: C++

#include<bits/stdc++.h>
using namespace std;
int p=1e+9;
int memo[3000][3000];
int candies(int n,int k,int a[],int j){
	int ans=0;
	if(j==n){
		if(k==0)
			return 1;
		else 
			return 0;
	}
	if(memo[k][j]==-1){
	for(int i=0;i<=a[j];i++){
		ans=(ans%p+candies(n,k-i,a,j+1)%p)%p;
	}
	}
	else
		return memo[k][j];

	memo[k][j]=ans%p;
	return ans;
}
int main(){
	int n,k;
	cin>>n>>k;

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

	memset(memo,-1,sizeof(memo));

	int ans=candies(n,k,a,0,memo);
	/*for(int i=0;i<=k;i++){
		for(int j=0;j<=n;j++){
			cout<<memo[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:24: error: too many arguments to function 'int candies(int, int, int*, int)'
   35 |         int ans=candies(n,k,a,0,memo);
      |                 ~~~~~~~^~~~~~~~~~~~~~
a.cc:5:5: note: declared here
    5 | int candies(int n,int k,int a[],int j){
      |     ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int p=1e+9;
int candies(int n,int k,int a[],int j,long long memo[][105]){
	long long ans=0;
	if(j==n){
		if(k==0)
			return 1;
		else 
			return 0;
	}
	if(memo[k][j]==-1){
	for(int i=0;i<=a[j];i++){
		ans=(ans%p+candies(n,k-i,a,j+1,memo)%p)%p;
	}
	}
	else
		return memo[k][j];

	memo[k][j]=ans%p;
	return ans%p;
}
int main(){
	int n,k;
	cin>>n>>k;

	int a[n+5];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
  
    long long memo[k+1][105];
	memset(memo,-1,sizeof(memo));
	long long ans=candies(n,k,a,0);
	/*for(int i=0;i<=k;i++){
		for(int j=0;j<=n;j++){
			cout<<memo[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:30: error: too few arguments to function 'int candies(int, int, int*, int, long long int (*)[105])'
   34 |         long long ans=candies(n,k,a,0);
      |                       ~~~~~~~^~~~~~~~~
a.cc:4:5: note: declared here
    4 | int candies(int n,int k,int a[],int j,long long memo[][105]){
      |     ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

const int maxn = 101;
const int maxk = 100001;
ModInt dp[maxn][maxk];

// i番目以降の人にk個のアメを配る、という状態を考えてDPをする。
// ただ、愚直にDPをするとO(Nk^2)になるのでTLEしてしまう。
// なので、遷移式を式変形してループを含まない形にする。
// やり方は等比数列の一般項の求め方みたいな感じに、dp[i][k] と dp[i][k-1]を考える。
// dp[i][k] - dp[i][k-1] をやるとキャンセルしまくって真ん中らへんの項が消えてくれる。
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n+1) dp[i][0] = 1;
    for(int i = n - 1; i >= 0; i--) {
        for(int j = 1; j <= k; j++) {
            // 元の式：dp[i][j] = dp[i+1][j] + dp[i+1][j-1] +...+ dp[i+1][j-a[i]]
            // dp[i][j] - dp[i][j-1] = (dp[i+1][j] + dp[i+1][j-1] +...+ dp[i+1][j-a[i]]) -
            //                         (dp[i+1][j-1] + dp[i+1][j-2] +...+ dp[i+1][j-a[i]] + dp[i+1][j-a[i]-1])
            // dp[i][j] = dp[i][j-1] + dp[i+1][j] - dp[i+1][j-a[i]-1]
            dp[i][j] = dp[i][j - 1] + dp[i + 1][j];
            if (j - a[i] - 1 >= 0) dp[i][j] -= dp[i + 1][j - a[i] - 1];
        }
    }
    cout << dp[0][k] << endl;
    return 0;
}


Compiler output:
a.cc:8:1: error: 'ModInt' does not name a type
    8 | ModInt dp[maxn][maxk];
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:20:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   20 |     rep(i, n+1) dp[i][0] = 1;
      |                 ^~
      |                 dup
a.cc:27:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |             dp[i][j] = dp[i][j - 1] + dp[i + 1][j];
      |             ^~
      |             dup
a.cc:31:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   31 |     cout << dp[0][k] << endl;
      |             ^~
      |             dup
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
    sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
    {
sim > struct rge
{
    c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
    ~debug()
    {
        cerr << endl;
    }
    eni(!=) cerr << boolalpha << i;
    ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
        *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c &)
    {
        ris;
    }
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int MOD = 1e9 + 7;
const int N = int(3e5) + 999;
//#define int long long int
#define inf 1e18

int n, k;
void add(int &a, int b)
{
    a = a + b;
    if (a >= MOD)
        a -= MOD;
}

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

int main()
{
    cin >> n >> k;
    vector<int> dp(k + 1, 0);
    dp[0] = 1;
    for (int i = 0; i < n; i++)
    {
        int lmt;
        cin >> lmt;
        for (int used = k; used >= 0; used--)
        {
            int tmp = dp[used];
            vector<int> fake(k + 1, 0);
            int l = used + 1;
            int r = used + min(lmt, k - used);
            if (l <= r)
            {
                add(fake[l], tmp);
                if (r + 1 <= k)
                    sub(fake[r + 1], tmp);
            }
        }
        int pp = 0;
        for (int i = 0; i <= k; i++)
        {
            add(pp, fake[i]);
            add(dp[i], pp);
        }
    }
    cout << dp[k];

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:21: error: 'fake' was not declared in this scope
   93 |             add(pp, fake[i]);
      |                     ^~~~
Language: C++

#include<cstdio>
#include<algorithm>

using namespace std;

int dp[150][150000];
int sum[150][150000];

const int MOD=1e9+7;

int main()
{
  int n=0,k=0;scanf("%d%d",&n,&k);for(int i=1;i<=n;i++)scanf("%d",&a[i]);
  dp[0][0]=1;for(int i=0;i<=k;i++)sum[0][i]=1;
  for(int i=1;i<=n;i++)
  {
    for(int j=0;j<=k;j++)
    {
      int l=max(0,j-a[i]);
      if(l==0)dp[i][j]=sum[i-1][j];
      else dp[i][j]=(sum[i-1][j]+MOD-sum[i-1][l-1])%MOD;
    }
    sum[i][0]=dp[i][0];for(int j=1;j<=k;j++)sum[i][j]=(sum[i][j-1]+dp[i][j])%MOD;
  }
  printf("%d",dp[n][k]);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:68: error: 'a' was not declared in this scope
   13 |   int n=0,k=0;scanf("%d%d",&n,&k);for(int i=1;i<=n;i++)scanf("%d",&a[i]);
      |                                                                    ^
a.cc:19:21: error: 'a' was not declared in this scope
   19 |       int l=max(0,j-a[i]);
      |                     ^
Language: C++

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

#define ll long long
const int mod = 1e9 + 7;
ll int INF = 1e17;


int n;
int arr[105];
ll int dp[105][100005];
ll int psum[105][100005];

int kil(int idx, int kleft)
{
  if(idx == n)
  {
    if(kleft == 0)
      return 1;
    return 0;
  }
  if(dp[idx][kleft] != -1)
    return dp[idx][kleft];

  dp[idx][kleft] = 0;
  for(int i=0;i<=min(arr[idx], kleft);i++)
    dp[idx][kleft] += kil(idx+1, kleft-i);

  return dp[idx][kleft];
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

   // iterative
   memset(dp, 0, sizeof dp);
   dp[n][0] = 1;

   for(int kleft = 0; kleft <= k; kleft ++)
     psum[n][kleft] = ((kleft > 0) ? psum[n][kleft - 1] : 0) + dp[n][kleft];

   for(int idx = n-1; idx>=0; idx--)
   {
     for(int kleft = 0; kleft <= k; kleft ++)
     {
       // for(int i=0;i<=min(arr[idx], kleft);i++)
       //   dp[idx][kleft] += dp[idx+1][kleft-i];
       //   // sum  dp[kleft] + dp[kleft-1] + dp[kleft-2] .... dp[kleft-min(arr[idx], kleft)]
       //   // dp[k] .... dp[0]
       int y = min(arr[idx], kleft);
       dp[idx][kleft] = (psum[idx+1][kleft] + mod - ((kleft - y) > 0 ? psum[idx+1][kleft - y -1] : 0)) % mod;
       psum[idx][kleft] = (((kleft > 0) ? psum[idx][kleft - 1] : 0) + dp[idx][kleft]) % mod;
     }
   }

   // recursive
   // memset(dp, -1, sizeof dp);
   // cout<<kil(0, k)<<endl;

   cout<<dp[0][k]<<endl;

   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:32: error: 'k' was not declared in this scope
   41 |    for(int kleft = 0; kleft <= k; kleft ++)
      |                                ^
a.cc:46:34: error: 'k' was not declared in this scope
   46 |      for(int kleft = 0; kleft <= k; kleft ++)
      |                                  ^
a.cc:62:16: error: 'k' was not declared in this scope
   62 |    cout<<dp[0][k]<<endl;
      |                ^
Language: C++

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

int main(){
  int n, k;
  cin>>n>>k;
  if(k==0) return 1;
  int a[n];
  for(int i = 0; i<n; i++){
    cin>>a[i];
  }
  ll dp[n+1][n+1];
  memset(dp, 0, sizeof(dp));
  
  for(int i=n; i>0; i--){
    for(int k1=1; k1<=k; k1++){
      for(int x=1; x<=min(k1, a[i-1]); x++){
        if(i==n) dp[x][i] = 1;
        else{
          dp[k1][i]+ = dp[k1-x][i+1];
          dp[k1][i] = dp[k1][i]%1000000007;
        }
      }
    }
  }
  return dp[k][1];



}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: expected primary-expression before '=' token
   21 |           dp[k1][i]+ = dp[k1-x][i+1];
      |                      ^
Language: C++

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

int main(){
  int n, k;
  if(k==0) return 1;
  cin>>n>>k;
  int a[n];
  for(int i = 0; i<n; i++){
    cin>>a[i];
  }
  ll dp[n+1][n+1];
  memset(dp, 0, sizeof(dp));
  
  for(int i=n; i>0; i--){
    for(int k1=1; k1<=k; k1++){
      for(int x=1; x<=min(k1, a[i-1]); x++){
        if(i==n) dp[x][i] = 1;
        else{
          dp[k1][i]+ = dp[k1-x][i+1];
          dp[k1][i] = dp[k1][i]%1000000007;
        }
      }
    }
  }
  return dp[k][1];



}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: expected primary-expression before '=' token
   21 |           dp[k1][i]+ = dp[k1-x][i+1];
      |                      ^
Language: C++

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

int main(){
  int n, k;
  if(k==0) return 1;
  cin>>n>>k;
  int a[n];
  for(int i = 0; i<n; i++){
    cin>>a[i];
  }
  ll dp[n+1][n+1];
  memset(dp, 0, sizeof(dp));
  
  for(int i=n; i>0; i--){
    for(int k1=1; k1<=k; k1++){
      for(int x=1; x<=min(k1, a[i-1]); x++){
        if(i==n) dp[x][i] = 1;
        else{
          dp[k1][i]+ = dp[k1-x][i+1];
          dp[k1][i] = dp[k1][i]%1000000007;
        }
      }
    }
  }
  return dp[k][1];



}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: expected primary-expression before '=' token
   22 |           dp[k1][i]+ = dp[k1-x][i+1];
      |                      ^
Language: C++

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

int main(){
  int n, k;
  if(k==0) return 1;
  cin>>n>>k;
  int a[n];
  for(int i = 0; i<n; i++){
    cin>>a[i];
  }
  ll dp[n+1][n+1];
  memset(dp, 0, sizeof(dp));
  
  for(int i=n; i>0; i--){
    for(int k1=1; k1<=k; k1++){
      for(int x=1; x<=min(k1, a[i-1]); x++){
        if(i==n) dp[x][i] = 1;
        else{
          dp[k1][i]+ = dp[k1-x][i+1];
          dp[k1][i] = dp[k1][i]%1000000007;
        }
      }
    }
    return dp[k][1];



}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:22: error: expected primary-expression before '=' token
   22 |           dp[k1][i]+ = dp[k1-x][i+1];
      |                      ^
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
  int n, k;
  if(k==0) return 1;
  cin>>n>>k;
  int a[n];
  for(int i = 0; i<n; i++){
    cin>>a[i];
  }
  ll dp[n+1][n+1];
  memset(dp, 0, sizeof(dp));
  
  for(int i=n; i>0; i--){
    for(int k1=1; k1<=k; k1++){
      for(int x=1; x<=min(k1, a[i-1]); x++){
        if(i==n) dp[x][i] = 1;
        else{
          dp[k1][i]+ = dp[k1-x][i+1];
        }
      }
    }
    return dp[k][1];



}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: expected primary-expression before '=' token
   20 |           dp[k1][i]+ = dp[k1-x][i+1];
      |                      ^
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define N 100055
#define ll long long
int n,k, dp[N], ar[N],pre[N];
const int mod = 1e9+7;
void mod_add(int &a, int b) {
    a += b;
    while(a>mod)
        a-=mod;
    while(a<0)
        a+=mod;
}
int main() {

    scanf("%d%d",&n,&k);
    for(int i=1; i<=n; ++i) {
        scanf("%d",&ar[i]);
    }
    dp[0] = 1;
    for(int i = 1 ; i<=n; ++i) {
        for(int used = k; used>=0; --used) {
            int L = used + 1;
            int R = used + min(ar[i], k-used);
            mod_add(pre[L], dp[used]);
            if(R+1<=K)
                mod_add(pre[R+1], -dp[used]);
        }
        int ss = 0;
        for(int x=0; x<=k; ++x) {
            mod_add(ss, pre[x]);
            mod_add(dp[x], ss);
            pre[x]=0;
        }
    }
    cout << dp[k];
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: 'K' was not declared in this scope
   26 |             if(R+1<=K)
      |                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1e2 + 5;
const int MAXK = 1e5 + 5;
const int MOD = 1e9 + 7;
int arr[MAXN];
int dp[MAXN][MAXK];
int sum[MAXN][MAXK];
int32_t main(){
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    for(int i = 0; i < n; i++){
        dp[i][0] = 1;
        sum[i][0] = 1;
    }
    for(int j = 1; j <= k; j++){
        if(j <= arr[0]) dp[0][j] = 1;
        sum[0][j] = (dp[0][j] + sum[0][j - 1]) % MOD;
    }
    for(int i = 1; i < n; i++){
        for(int j = 1; j <= k; j++){
            if(j - arr[i] - 1 >= 0)
                dp[i][j] = ((sum[i - 1][j] - sum[i - 1][j - arr[i] - 1] + MOD)) % MOD;
            else
                dp[i][j] = (sum[i - 1][j])%MOD;
        }
        for(int j = 1; j <= k; j++){
            sum[i][j] = (MOD + dp[i][j] + sum[i][j - 1])%MOD;
        }
    }
    cout << (dp[n - 1][k] << '\n';
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:34:34: error: expected ')' before ';' token
   34 |     cout << (dp[n - 1][k] << '\n';
      |             ~                    ^
      |                                  )
Language: C++

N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10**9 + 7

dp = [[0] * (K + 1) for _ in range(N + 1)]  # dp[child][candy] 残りcandy個の場合の数
dp[0][K] = 1

for child in range(1, N + 1):
    sumDp = [0] * (K + 2)
    for i in range(1, K + 2)[:: -1]:
        sumDp[i - 1] += sumDp[i] + dp[child - 1][i - 1]

    for candy in range(K + 1):
        dp[child][candy] = (sumDp[candy] - sumDp[min(K, candy + A[child - 1]) + 1]) % MOD

print(dp[N][0] % MOD)

Compiler output:
a.cc:5:45: error: stray '#' in program
    5 | dp = [[0] * (K + 1) for _ in range(N + 1)]  # dp[child][candy] 残りcandy個の場合の数
      |                                             ^
a.cc:1:1: error: 'N' does not name a type
    1 | N, K = map(int, input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dp[110][100010];

int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  vector<int> sum(K+1,0);
  dp[1][0] = 1; sum[0] = 1;
  for (int i = 1; i <= a[0]; i++)
    dp[1][i] = 1;
  
  for (int i = 1; i <= m; i++)
    sum[i] = sum[i - 1] + dp[1][i];

  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= min(m,a[i-1]); j++) {
		dp[i][j]=(sum[j]-(j-1>=0?sum[j-1]?0)+mod)%mod;
    }
    sum[0] = dp[i][0];
    for (int j = 1; j <= m; j++) sum[j] = (sum[j - 1] + dp[i][j]) % mod;

  }
  cout << dp[n][m] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'K' was not declared in this scope
   12 |   vector<int> sum(K+1,0);
      |                   ^
a.cc:22:52: error: expected ':' before ')' token
   22 |                 dp[i][j]=(sum[j]-(j-1>=0?sum[j-1]?0)+mod)%mod;
      |                                                    ^
      |                                                    :
a.cc:22:52: error: expected primary-expression before ')' token
a.cc:22:52: error: expected ':' before ')' token
   22 |                 dp[i][j]=(sum[j]-(j-1>=0?sum[j-1]?0)+mod)%mod;
      |                                                    ^
      |                                                    :
a.cc:22:52: error: expected primary-expression before ')' token
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>

#define mod 1e9+5

using namespace std;
using ll = long long; 

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

void sub_self(int& a, int b){a -=b;}

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int>dp(k+1);
    vector<int>fake(k+1);
    dp[0] =1;
    
    while(n--){
        int up_to;
        scanf("%d" ,&up_to);
        
        for(int used = k; used >=0; used--){
            int l = used + 1;
            int r = used + min(up_to ,k - used);
            int tmp = dp [used];
            
            if(l <= r){
                add_self(fake[l]; tmp)
                if(r+1<k){sub_self(fake[r+1], tmp);}
            }
        }
    }
    
    int prefixe_sum = 0;
    for(int i=0; i<=k; i++){
        add_self(prefixe_sum, fake[i]);
        add_self(dp[i], prefixe_sum);
    }
    
    
    printf("%d\n", dp[k]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:33: error: expected ')' before ';' token
   34 |                 add_self(fake[l]; tmp)
      |                         ~       ^
      |                                 )
a.cc:34:38: error: expected ';' before ')' token
   34 |                 add_self(fake[l]; tmp)
      |                                      ^
      |                                      ;
Language: C++

//g++  5.4.0

#include <bits/stdc++.h>

using namespace std;

const 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;
    vector<int> dp(K+1);
    dp[0] = 1;
    
    for(int i = 0; i < n; i++){
        int upto; cin >> upto;
        vector<int> fake(K+1);
        for(int used = K; used >= 0; used--){
            int tmp = dp[used];
            int L = used+1;
            int R = used + min(upto, K - used);
            if(L <= R){
                add_self(fake[L],tmp);
                if(R+1 <= K)
                    sub_self(fake[R+1],tmp);
            }
        }
        int pr = 0;
        for(int i = 0; i <= K; i++){
            add_self(pr,fake[i]);
            add_self(dp[i],pr);
        }
    }
    
    printf("%d\n", dp[k]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:23: error: 'k' was not declared in this scope
   45 |     printf("%d\n", dp[k]);
      |                       ^
Language: C++

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

#define VIC ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define sfi(x) scanf("%d", &x)
#define sfi2(x, y) scanf("%d%d", &x,&y)
#define sfl2(x, y) scanf("%I64d%I64d", &x,&y)
#define sfl(x) scanf("%I64d", &x)
#define sfd(x) scanf("%lf", &x)
#define sfd2(x, y) scanf("%lf%lf", &x, &y)
#define sfs(x) scanf("%s", &x)
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;
const int N = 1e2 + 2, K = 1e5 + 5, mod = 1e9 + 7;
//g++ -std=c++11 main.cpp && a.exe


inline add(int x, int y)
{
    x += y;
    if (x >= mod)
        x -= mod;
    return x;
}

inline sub(int x, int y)
{
    x -= y;
    if (x < 0)
        x += mod;
    return x;
}

int n, k, a[N], dp[N][K], prefix[N][K];

int solve()
{
    for (int i = 0; i <= n; i++)
        prefix[i][0] = dp[i][0] = 1;
    for (int i = 0; i <= k; i++)
        prefix[0][i] = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= k; j++)
        {
            int first = (j - a[i] - 1 >= 0? prefix[i - 1][j - a[i] - 1]: 0);
            int last = prefix[i - 1][j];
            dp[i][j] = add(dp[i][j], sub(last, first));
            prefix[i][j] = add(dp[i][j], prefix[i][j - 1]);
        }
    return dp[n][k];
}

int main()
{
    VIC
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    cout << solve();
    return 0;
}


Compiler output:
a.cc:21:8: error: ISO C++ forbids declaration of 'add' with no type [-fpermissive]
   21 | inline add(int x, int y)
      |        ^~~
a.cc:29:8: error: ISO C++ forbids declaration of 'sub' with no type [-fpermissive]
   29 | inline sub(int x, int y)
      |        ^~~
Language: C++


///╔══╗
///╚╗╔╝
///╔╝╚(¯`v´¯)
///╚══╝`.¸.´farzin


#include <bits/stdc++.h>

#define int int64_t
#define pb push_back
#define ibsws ios_base::sync_with_stdio
#define gcd __gcd
#define s second
#define f first
#define mp make_pair
typedef std::pair<int,int> pii ;

using namespace std;

const int N=110,K=1e5+1e2;
int n,dp[N][K],ps[N][K],k,a[N];

int32_t main(){
	ibsws(true==false);
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=0;i<=k;i++){
        dp[1][i]=(a[1]>=i);
        ps[1][i]=ps[1][max(0ll,i-1)]+dp[1][i];
    }
    for(int i=2;i<=n;i++){
        for(int j=0;j<=k;j++){
            if(j<=a[i]){
                dp[i][j]=ps[i-1][j];
            }
            else{
                dp[i][j]=ps[i-1][j]-ps[i-1][j-a[i]-1];
            }
            ps[i][j]=ps[i][j-1]+dp[i][j];
        }
    }
    /*/
    for(int i=1;i<=n;i++){
        for(int j=0;j<=k;j++){
            cout<<i<<' '<<j<<':'<<dp[i][j]<<'\n';
        }
    }//*/
    cout<<dp[n][k];
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:32:27: error: no matching function for call to 'max(long long int, int64_t)'
   32 |         ps[1][i]=ps[1][max(0ll,i-1)]+dp[1][i];
      |                        ~~~^~~~~~~~~
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:8:
/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:32:27: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'})
   32 |         ps[1][i]=ps[1][max(0ll,i-1)]+dp[1][i];
      |                        ~~~^~~~~~~~~
/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:32:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |         ps[1][i]=ps[1][max(0ll,i-1)]+dp[1][i];
      |                        ~~~^~~~~~~~~
Language: Java

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.lang.Math.*;
public class MCandies {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();
        int k = in.nextInt();
        int [][] dp = new int[n+1][k+1];
        int []ai = new int[n+1];
        int mod = (int)1e9+7;
        dp[0][0]=1;
        for(int i=1;i<=n;i++)
            ai[i] = in.nextInt();
        for(int i=1;i<=n;i++){
            int []psum = new int[k+2];
            int cur =0;
            for(int idex=0;idex<=k;idex++){
                cur= (cur + dp[i-1][idex])%mod;
                psum[idex+1]=cur%mod;
            }
            for(int j=0;j<=k;j++){
                int mx = Math.min(ai[i],j);
                int a= psum[j+1];
                int b = psum[(j-mx)];
                if (a<b)
                    a+=mod;
                dp[i][j] = (a-b)%mod;
            }
        }
        System.out.println(dp[n][k]%mod);


    }
}


Compiler output:
Main.java:6: error: class MCandies is public, should be declared in a file named MCandies.java
public class MCandies {
       ^
1 error
Language: C++

#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ordered_set tree<ll int, null_type,less<ll int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}

template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005

int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
        ll i,j,k,l,m,n;
        cin>>n>>k;
        vi v(n+1);
        for(i=1;i<=n;i++)
        {
            cin>>v[i];
        }
        ll dp[102][100005];
        vi vv;
        clr(dp,0);
        dp[0][0]=1;
        for(i=1;i<=n;i++)
        {
            for(j=0;j<=k;j++)
            {
                if(j-v[i]-1<0)
                {
                    dp[i][j]=(dp[i-1][j])%hell;
                    continue;
                }
                dp[i][j]=(dp[i-1][j]-dp[i-1][j-v[i]-1]+hell)%hell;
            }00
            for(j=1;j<=k;j++)
                dp[i][j]=(dp[i][j]+dp[i][j-1])%hell;
        }
        cout<<dp[n][k];
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:84:16: error: expected ';' before 'for'
   84 |             }00
      |                ^
      |                ;
   85 |             for(j=1;j<=k;j++)
      |             ~~~ 
a.cc:85:29: error: expected ';' before ')' token
   85 |             for(j=1;j<=k;j++)
      |                             ^
      |                             ;
Language: C++

#include <iostream>
#include <string.h>
#include <bits/stdc++.h>
#include<algorithm> 
using namespace std;

int main() {
int N, K;
cin >> N >> K;
int a[N];

for (int i = 0; i < N; ++i)
{
	cin >> a[i];
}

if(N == 1){
	if(a[0] < K) cout << 0 << endl;
	else cout << 1 << endl;
	return 0;
}

long int dp[N][K+1];

for (int i = 0; i < N; ++i)
{
	for (int j = 0; j <= K; ++j)
	{
		dp[i][j] = 0;
	}
}

for (int i = 0; i <= a[0]; ++i)
{
	dp[0][i] = 1;
}

for (int i = 1; i <= K; ++i)
{
	dp[0][i] = (dp[0][i] +  dp[0][i-1])%1000000007;
}

for (int i = 1; i < N; ++i)
{
	for (int j = 0; j <= K; ++j)
	{	
		if(j <= a[i])
		dp[i][j] = (j > 0) ? (dp[i][j-1] + dp[i-1][j])%1000000007 : dp[i-1][j]%1000000007;
		else dp[i][j] = (


			] + dp[i][j-1] + dp[i-1][j]-(dp[i-1][j-1-a[i]]) + 1000000007)%1000000007;
	}
}
if(K != 0)
cout << (dp[N-1][K] - dp[N-1][K-1] + 1000000007)%1000000007<< endl;
else cout << dp[N-1][K]%1000000007 << endl;

return 0;
                                                     
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:25: error: expected primary-expression before ']' token
   52 |                         ] + dp[i][j-1] + dp[i-1][j]-(dp[i-1][j-1-a[i]]) + 1000000007)%1000000007;
      |                         ^
a.cc:49:34: error: expected ')' before ']' token
   49 |                 else dp[i][j] = (
      |                                 ~^
      |                                  )
......
   52 |                         ] + dp[i][j-1] + dp[i-1][j]-(dp[i-1][j-1-a[i]]) + 1000000007)%1000000007;
      |                         ~