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

#include<bits/stdc++.h>
using namespace std;
 
long long int a[100005];
long long int dp[102][100002],m=1e9+7;
void adds(long long& a,long long b){
  a = a+b;
  if(a >= M) a-= M;
  return ;
}
long long int fun(long long int start,long long int end,long long int rem)
{
    if(start == end)
    {
        if(rem == 0)
        return 1;
        else 
        return 0;
    }
    if(rem<0)
    return 0;
 
    if(dp[start][rem]!=-1)
    return dp[start][rem];
 
    long long int ans = 0;
    for(long long int j=0;j<=min(a[start],rem);j++)
    {
        adds(ans,fun(start+1,end,rem-j));
    }
    dp[start][rem] = ans;
    return ans;
}
 
int main()
{
    long long int n,k,i,j,ans=0;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<=k;j++)
        {
            dp[i][j] = -1;
        }
    }
    fun(0,n,k);
    cout<<dp[0][k]<<endl;
}

Compiler output:
a.cc: In function 'void adds(long long int&, long long int)':
a.cc:8:11: error: 'M' was not declared in this scope
    8 |   if(a >= M) a-= M;
      |           ^
Language: C++

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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
ll MOD = 1e9+7;

ll dp[104][100009];
ll a[104],pre[104][100009];
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(){
    fast;
    ll n,k;cin>>n>>k;

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

    for(ll i=0;i<n;++i)
        pre[i][0] = dp[i][0] = 1;
    
    
    for(ll i=0;i<=k;++i){
        dp[0][i] = 1*(i<=a[0]);
        if(i>0)
            pre[0][i] = pre[0][i-1] + dp[0][i];
        else
            pre[0][0] = 1;
        
    }
    for(ll i=1;i<n;++i){
        for(ll j=1;j<=k;++j){//sum to make
            if(j-a[i]-1<0){
                dp[i][j] = pre[i-1][j]%MOD;
            }
            else{
                dp[i][j] = sub(pre[i-1][j] , pre[i-1][j-a[i]-1]);
            }
            pre[i][j] = add(pre[i][j-1]%MOD + dp[i][j]);

            
            /*int first = (j - a[i] - 1 >= 0)? pre[i - 1][j - a[i] - 1] : 0;
            int last = pre[i - 1][j];
            dp[i][j] = add(dp[i][j], sub(last, first));
            pre[i][j] = add(pre[i][j - 1], dp[i][j]);
            */
            /*  precalculate the sum from dp[i-1][max(0,j-a[i])] to dp[i-1][j].
                which is equal to dp[i-1][j] - dp[i-1][max(0,j-a[i])-1]
            */
            /*for(ll l=max(0ll,j-a[i]);l<=j;++l){//
                dp[i][j] = (dp[i][j]%mod + dp[i-1][l]%mod)%mod;
                
            }*/
        }
    }
    /*cout<<endl<<"prefix\n";
    for(ll x=0;x<n;++x){ 
        cout<<"\n->"<<x+1<<endl; 
        for(ll i=0;i<=k;++i){
            cout<<"\t"<<pre[x][i]<<" ";
        }
    }
    cout<<"\ndp\n";
    for(ll x=0;x<n;++x){
        cout<<"\n->"<<x+1<<endl;
        for(ll i=0;i<=k;++i){
            cout<<"\t"<<dp[x][i]<<" ";
        }
    }*/

    cout<<dp[n-1][k];

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:28: error: too few arguments to function 'int add(int, int)'
   50 |             pre[i][j] = add(pre[i][j-1]%MOD + dp[i][j]);
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:12: note: declared here
   11 | inline int add(int a, int b){
      |            ^~~
Language: C++

#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<string>

using namespace std;
 
typedef long long ll;

ll memo[110][101000];

const ll MOD = 1e9 + 7;

ll a[110];

ll dp(ll i, ll j){

  if( j < 0){ return 0;} //インデックスがマイナスのやばい場合を除外
  if( i < 0){ return 0;}
  if( j == 0){ return memo[i]@j] = 1;}
  //初期値 i == 0(0人に配る）も一通りとして考える
  if( memo[i][j] != -1){ return memo[i][j];}
  //すでに書き込まれている場合
  return memo[i][j] = ( (dp(i-1,j) + dp(i,j-1)) % MOD - dp( i-1,j-a[i] - 1)  +  MOD )% MOD;}
                       
  int main(){
    ll N,K; cin >> N >> K;
    for(ll i = 0; i < 110; i++){
      for(ll j = 0; j < 101000; j++){
        memo[i][j] = -1;}} //初期化(未記入)
    
    for(ll i = 0; i < N; i++){
      cin >> a[i];} //i番目の個の上限記入
    
    cout << dp(N-1,K) <<endl; return 0;}
      
    
  


Compiler output:
a.cc:21:30: error: stray '@' in program
   21 |   if( j == 0){ return memo[i]@j] = 1;}
      |                              ^
a.cc: In function 'll dp(ll, ll)':
a.cc:21:29: error: invalid conversion from 'll*' {aka 'long long int*'} to 'll' {aka 'long long int'} [-fpermissive]
   21 |   if( j == 0){ return memo[i]@j] = 1;}
      |                       ~~~~~~^
      |                             |
      |                             ll* {aka long long int*}
a.cc:21:30: error: expected ';' before 'j'
   21 |   if( j == 0){ return memo[i]@j] = 1;}
      |                              ^~
      |                              ;
a.cc:21:32: error: expected ';' before ']' token
   21 |   if( j == 0){ return memo[i]@j] = 1;}
      |                                ^
      |                                ;
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll mod = (ll)1e9+7;
const int INF = 0x3f3f3f3f;

vector<int> v(105);
ll dp[105][100010]; //dp[child #][number of candies left] = possibilities up to this point

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //#ifndef ONLINE_JUDGE
    freopen("B.txt", "r", stdin);
    #endif
    int n, k;
    cin >> n >> k;
    for(int i=1; i<=n; i++)
        cin >> v[i];
    for(int i=0; i<=v[1]; i++) dp[1][i]=1;
    for(int i=2; i<=n; i++)
    {
        dp[i][0] = 1;
        for(int j=1; j<=100000; j++)
        {
            if(j>v[i])
            {
                dp[i][j] -= dp[i-1][j-v[i]-1];
            }
            dp[i][j] += (dp[i][j-1]+dp[i-1][j])%mod;

        }
    }
    cout << dp[n][k];
}


Compiler output:
a.cc:16:6: error: #endif without #if
   16 |     #endif
      |      ^~~~~
Language: C++

#include<iostream>
using namespace std;
#include<bits/stdc++.h>
#include<string.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007



ll dp[101][100001] = {};
int a[101];
ll sum[100001];
int n,k;

ll rec(int idx , int left){
	if(idx<1 && left!=0) return 0;
	if(idx<1 && left==0) return 1;
	ll& ans = dp[idx][left];
	if(ans!=-1) return ans%mod;
	
	ans=0;
	for(int i=0;i<=a[idx] ; ++i){
		if(left-i>=0) ans += rec(idx-1 , left-i);
		ans%=mod;
	}
	return ans%mod; 
}

int main(){
	//memset(dp,1,sizeof(dp));
	IOS;
	cin >> n >> k;
	for(int i=1;i<=n ;++i){
		cin >> a[i];
	}

	for(int i=0;i<=a[1] ; ++i){
		dp[1][i] = 1;
	}
	
	for(int i=2; i <=n ; ++i){
		sum[0] = dp[i-1][0];
		for(int c=1;c<=k ; ++c){
			sum[c] = (sum[c-1] + dp[i-1][c] + mod) % mod;
		}
		for(int j = 0;j<=k ; ++j){
			if(j-min(j,a[i])-1<0)dp[i][j] = sum[j];
			else cadp[i][j] = sum[j] - sum[j-min(j,a[i])-1];
		}
	}
	cout << (dp[n][k] + mod)%mod << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:30: error: 'cadp' was not declared in this scope
   49 |                         else cadp[i][j] = sum[j] - sum[j-min(j,a[i])-1];
      |                              ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
const int M=100111;
const int mod=1000000007;

int main(){
	int n,k,a[M];
	ll dp[101][M]={},sum[M]={};
	cin>>n>>k;
	rep(i,1,n+1)cin>>a[i];
	dp[0][0]=1;
	rep(i,1,n+1){
		rep(j,1,k+1)sum[j]=(sum[j-1]+dp[i-1][j-1])%mod;
		//sum[j]=dp[i-1][j-1] + ... + dp[i-1][0];
		rep(j,0,k+1)
			dp[i][j]=(sum[j]-sum[max(0,j-a[i])]+dp[i-1][j]+mod)%mod;
	}
	print(dp[n][k]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'print' was not declared in this scope; did you mean 'rint'?
   20 |         print(dp[n][k]);
      |         ^~~~~
      |         rint
Language: C++

#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define print(n) cout<<n<<endl
const int mod=1000000007;

int main(){
	int n,k,a[M];
	ll dp[101][M]={},sum[M]={};
	cin>>n>>k;
	rep(i,0,n)cin>>a[i];
	dp[0][0]=1;
	rep(i,1,n+1){
		rep(j,1,k+1)sum[j]=(sum[j-1]+dp[i-1][j-1])%mod;
		//sum[j]=dp[i-1][j-1] + ... + dp[i-1][0];
		rep(j,0,k+1){
			dp[i][j]=(sum[j]-sum[max(0,j-a[i-1])]+dp[i-1][j])%mod;
		}
	}
	print(dp[n][k]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: 'M' was not declared in this scope
    9 |         int n,k,a[M];
      |                   ^
a.cc:12:24: error: 'a' was not declared in this scope
   12 |         rep(i,0,n)cin>>a[i];
      |                        ^
a.cc:13:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   13 |         dp[0][0]=1;
      |         ^~
      |         dup
a.cc:15:29: error: 'sum' was not declared in this scope
   15 |                 rep(j,1,k+1)sum[j]=(sum[j-1]+dp[i-1][j-1])%mod;
      |                             ^~~
a.cc:18:35: error: 'sum' was not declared in this scope
   18 |                         dp[i][j]=(sum[j]-sum[max(0,j-a[i-1])]+dp[i-1][j])%mod;
      |                                   ^~~
a.cc:18:54: error: 'a' was not declared in this scope
   18 |                         dp[i][j]=(sum[j]-sum[max(0,j-a[i-1])]+dp[i-1][j])%mod;
      |                                                      ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
using Int = long long;

const int mod = 1000000007;
const int nax = 100010;

int n;
int ar[101];
int dp[nax][101];

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

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

int rec(int idx, int k) {
  if(k == 0) {
    return 1;
  }
  if(k < 0 || idx >= n) {
    return 0;
  }
  int &x = dp[k][idx];
  if(x != -1) {
    return x;
  }
  x = 0;

// adding interval [k.....k - ar[idx]]
//  for(int i = 0; i <= ar[idx]; ++i) {
//    add(x, rec(idx + 1, k - i));
//  }
  
  add(x, sub(rec(idx + 1, k), rec(idx + 1, k - ar[idx] - 1)));
  add(x, rec(idx, k - 1));

  return x;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  int k;
  cin >> k;
  for(int i = 0; i < n; ++i) {
    cin >> ar[i];
  }
  memset(dp, -1, sizeof dp);
  cout << rec(0, k) << '\n';
  //~ cerr << dp[n - 1][k] << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int rec(int, int)':
a.cc:43:17: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   43 |   add(x, sub(rec(idx + 1, k), rec(idx + 1, k - ar[idx] - 1)));
      |              ~~~^~~~~~~~~~~~
a.cc:20:15: note:   initializing argument 1 of 'void sub(int&, int)'
   20 | void sub(int &a, int b) {
      |          ~~~~~^
Language: Java

public class Main {
	int mod = 1000000007;
    public int findNumWaysToDistributeCandies(int n, int k, int[] a) {
        int[][] prefix = new int[n+1][k+1];
        int[][] dp = new int[n+1][k+1];

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

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

        for(int i=1;i<=n;++i) {
            for(int j=1;j<=k;++j) {
                int low = (j-a[i]-1)>=0?prefix[i-1][j-a[i]-1]:0;
                int high = prefix[i-1][j];
                dp[i][j]=(high-low)%mod;
                prefix[i][j]=(prefix[i][j-1]+dp[i][j])%mod;
            }
        }
        return dp[n][k];
    }

    public static void main(String[] args) {
        Main m = new Main();
        InputStreamReader r=new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(r);
        try {
            String[] line1 = reader.readLine().split(" ");
            int n = Integer.parseInt(line1[0]);
            int k = Integer.parseInt(line1[1]);
            int[] a = new int[n+1];
            String[] line2 = reader.readLine().split(" ");
            for(int i=0;i<n;++i) {
                a[i+1]=Integer.parseInt(line2[i]);
            }
            int res = m.findNumWaysToDistributeCandies(n,k,a);
            System.out.println(res);
        } catch (IOException e) {

        }
    }
}

Compiler output:
Main.java:29: error: cannot find symbol
        InputStreamReader r=new InputStreamReader(System.in);
        ^
  symbol:   class InputStreamReader
  location: class Main
Main.java:29: error: cannot find symbol
        InputStreamReader r=new InputStreamReader(System.in);
                                ^
  symbol:   class InputStreamReader
  location: class Main
Main.java:30: error: cannot find symbol
        BufferedReader reader = new BufferedReader(r);
        ^
  symbol:   class BufferedReader
  location: class Main
Main.java:30: error: cannot find symbol
        BufferedReader reader = new BufferedReader(r);
                                    ^
  symbol:   class BufferedReader
  location: class Main
Main.java:42: error: cannot find symbol
        } catch (IOException e) {
                 ^
  symbol:   class IOException
  location: class Main
5 errors
Language: C++

// M - Candies  https://atcoder.jp/contests/dp/tasks/dp_m
/* 入力例
3 4
1 2 3
// →出力 5
*/
#include <bits/stdc++.h>
using namespace std;

int main(void) {
    int N, K;
    cin >> N >> K;
    unsighned long long int a[N], dp[K + 1][N];
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    for(int j = 0; j < N; j++) {
        dp[0][j] = 1;
    }
    for(int i = 1; i <= K; i++) {
        if(i <= a[0]) {
            dp[i][0] = 1;
        } else {
            dp[i][0] = 0;
        }
        for(int j = 1; j < N; j++) {
            if(a[j] == 0) {
                dp[i][j] = dp[i][j - 1];
            } else {
                if(i <= a[j]) {
                    dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % (1000000000 + 7);
                } else {
                    dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1 - a[j]][j - 1]) % (1000000000 + 7);
                }
            }
        }
    }
    cout << dp[K][N - 1] % (1000000000 + 7) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'unsighned' was not declared in this scope; did you mean 'unsigned'?
   13 |     unsighned long long int a[N], dp[K + 1][N];
      |     ^~~~~~~~~
      |     unsigned
a.cc:15:16: error: 'a' was not declared in this scope
   15 |         cin >> a[i];
      |                ^
a.cc:18:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   18 |         dp[0][j] = 1;
      |         ^~
      |         dup
a.cc:21:17: error: 'a' was not declared in this scope
   21 |         if(i <= a[0]) {
      |                 ^
a.cc:22:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |             dp[i][0] = 1;
      |             ^~
      |             dup
a.cc:24:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   24 |             dp[i][0] = 0;
      |             ^~
      |             dup
a.cc:27:16: error: 'a' was not declared in this scope
   27 |             if(a[j] == 0) {
      |                ^
a.cc:28:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   28 |                 dp[i][j] = dp[i][j - 1];
      |                 ^~
      |                 dup
a.cc:31:21: error: 'dp' was not declared in this scope; did you mean 'dup'?
   31 |                     dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % (1000000000 + 7);
      |                     ^~
      |                     dup
a.cc:33:21: error: 'dp' was not declared in this scope; did you mean 'dup'?
   33 |                     dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1 - a[j]][j - 1]) % (1000000000 + 7);
      |                     ^~
      |                     dup
a.cc:38:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   38 |     cout << dp[K][N - 1] % (1000000000 + 7) << endl;
      |             ^~
      |             dup
Language: C++

#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll n,k;
ll dp[110][100010];
bool mark[110][100010];
ll deca[110];
ll modul=1000000007;

ll resi(ll n, ll k)
{
	if(k<0)
		return 0;
	if(k==0)
		return 1;
	if(n==0)
		return k==0;
	if(mark[n][k])
		return dp[n][k];
	mark[n][k]=true;
	ll tekp=0;
	for(int i=0;i<=deca[n];i++)
		tekp=(tekp+resi(n-1,k-i))%modul;
	dp[n][k]=tekp;
	//cout<<n<<" "<<k<<endl;
	return tekp;
}

int main()
{
	ios::sync_with_stdio(false);	
	cin.tie(0);
	
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>deca[i];
		
	cout<<resi(n,k);
	
	return 0;
}


Compiler output:
a.cc: In function 'long long int resi(long long int, long long int)':
a.cc:24:24: error: reference to 'deca' is ambiguous
   24 |         for(int i=0;i<=deca[n];i++)
      |                        ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:66,
                 from a.cc:1:
/usr/include/c++/14/ratio:626:9: note: candidates are: 'using std::deca = struct std::ratio<10, 1>'
  626 |   using deca   = ratio<                       10,                         1>;
      |         ^~~~
a.cc:9:4: note:                 'long long int deca [110]'
    9 | ll deca[110];
      |    ^~~~
a.cc: In function 'int main()':
a.cc:38:22: error: reference to 'deca' is ambiguous
   38 |                 cin>>deca[i];
      |                      ^~~~
/usr/include/c++/14/ratio:626:9: note: candidates are: 'using std::deca = struct std::ratio<10, 1>'
  626 |   using deca   = ratio<                       10,                         1>;
      |         ^~~~
a.cc:9:4: note:                 'long long int deca [110]'
    9 | ll deca[110];
      |    ^~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n,k;
ll dp[110][100010];
bool mark[110][100010];
ll deca[110];
ll modul=1000000007;

ll resi(int n, int k)
{
	if(k<0)
		return 0;
	if(k==0)
		return 1;
	if(n==0)
		return k==0;
	if(mark[n][k])
		return dp[n][k];
	mark[n][k]=true;
	ll tekp=0;
	for(int i=0;i<=deca[n];i++)
		tekp=(tekp+resi(n-1,k-i))%modul;
	dp[n][k]=tekp;
	//cout<<n<<" "<<k<<endl;
	return tekp;
}

int main()
{
	ios::sync_with_stdio(false);	
	cin.tie(0);
	
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>deca[i];
		
	cout<<resi(n,k);
	
	return 0;
}


Compiler output:
a.cc: In function 'long long int resi(int, int)':
a.cc:24:24: error: reference to 'deca' is ambiguous
   24 |         for(int i=0;i<=deca[n];i++)
      |                        ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:66,
                 from a.cc:1:
/usr/include/c++/14/ratio:626:9: note: candidates are: 'using std::deca = struct std::ratio<10, 1>'
  626 |   using deca   = ratio<                       10,                         1>;
      |         ^~~~
a.cc:9:4: note:                 'long long int deca [110]'
    9 | ll deca[110];
      |    ^~~~
a.cc: In function 'int main()':
a.cc:38:22: error: reference to 'deca' is ambiguous
   38 |                 cin>>deca[i];
      |                      ^~~~
/usr/include/c++/14/ratio:626:9: note: candidates are: 'using std::deca = struct std::ratio<10, 1>'
  626 |   using deca   = ratio<                       10,                         1>;
      |         ^~~~
a.cc:9:4: note:                 'long long int deca [110]'
    9 | ll deca[110];
      |    ^~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n,k;
ll dp[110][100010];
bool mark[110][100010];
ll deca[110];
ll modul=1000000007;

ll resi(int n, int k)
{
	if(k<0)
		return 0;
	if(k==0)
		return 1;
	if(n==2)
		return 0;//k==0;
	if(mark[n][k])
		return dp[n][k];
	mark[n][k]=true;
	ll tekp=0;
	for(int i=0;i<=deca[n];i++)
		tekp=(tekp+resi(n-1,k-i))%modul;
	dp[n][k]=tekp;
	//cout<<n<<" "<<k<<endl;
	return tekp;
}

int main()
{
	ios::sync_with_stdio(false);	
	cin.tie(0);
	
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>deca[i];
		
	cout<<resi(n,k);
	
	return 0;
}


Compiler output:
a.cc: In function 'long long int resi(int, int)':
a.cc:24:24: error: reference to 'deca' is ambiguous
   24 |         for(int i=0;i<=deca[n];i++)
      |                        ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:66,
                 from a.cc:1:
/usr/include/c++/14/ratio:626:9: note: candidates are: 'using std::deca = struct std::ratio<10, 1>'
  626 |   using deca   = ratio<                       10,                         1>;
      |         ^~~~
a.cc:9:4: note:                 'long long int deca [110]'
    9 | ll deca[110];
      |    ^~~~
a.cc: In function 'int main()':
a.cc:38:22: error: reference to 'deca' is ambiguous
   38 |                 cin>>deca[i];
      |                      ^~~~
/usr/include/c++/14/ratio:626:9: note: candidates are: 'using std::deca = struct std::ratio<10, 1>'
  626 |   using deca   = ratio<                       10,                         1>;
      |         ^~~~
a.cc:9:4: note:                 'long long int deca [110]'
    9 | ll deca[110];
      |    ^~~~
Language: C++

#include <cstdio>
#include <iostream>
#define MAXN 105000
#define WTF 1000000007
using namespace std;

int n, k;
int a[MAXN];
int ans[150][MAXN];
int main(){
    cin >> n >> k;
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    for (int i = 0; i <= a[0]; i++){
        ans[0][i] = 1;
    }
    for (int i = 1; i < n; i++){
        ans[i][j] = ans[i-1][j];
        for (int j = 1; j <= a[i]; j++){
            ans[i][j] = (ans[i-1][j] + ans[i][j-1])%WTF;
        }
        for (int j = a[i]+1; j <= k; j++){
            ans[i][j] = (ans[i][j-1] + ans[i-1][j] - ans[i-1][j-a[i]-1])%WTF;
        }
    }
    /*for (int i = 0; i <= n; i++){
        for (int j = 0; j <= k; j++){
            cout << ans[i][j] << ' ';
        }
        cout << endl;
    }*/
    cout << ans[n-1][k]%WTF << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: 'j' was not declared in this scope
   19 |         ans[i][j] = ans[i-1][j];
      |                ^
Language: C++

#include <iostream>
using namespace std;
#define ll long long

int main () {
  ll n, k;
  cin >> n >> k;
  ll a[n + 1], dp[n + 1][k + 1], sum[n + 1][n + 1];
  for (ll i = 1; i <= n; i++) {
    for (ll j = 0; j <= k; j++) {
      dp[i][j] = 0;
      sum[i][j] = 0;
      sum[0][j] = 1;
      dp[0][j] = 0;
    }
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (ll i = 1; i <= n; i++) {
    for (ll j = 0; j <= k; j++) {
      // j個数ある状態でありここから，
      ll now = j;
      if (now >= a[i]) now = a[i];
      // 0 ~ now個数まで使う
      if (j - now != 0) {
        dp[i][j] = (sum[i - 1][j] - sum[i - 1][j - now - 1] + mod) % mod;;
      }
      else {
        dp[i][j] = sum[i - 1][j] % mod;;
      }
      sum[i][j] = dp[i][j];
      if (j != 0) sum[i][j] = (sum[i][j - 1] + sum[i][j]) % mod;
    }
  }
  cout << sum[n][k] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:63: error: 'mod' was not declared in this scope
   26 |         dp[i][j] = (sum[i - 1][j] - sum[i - 1][j - now - 1] + mod) % mod;;
      |                                                               ^~~
a.cc:29:36: error: 'mod' was not declared in this scope
   29 |         dp[i][j] = sum[i - 1][j] % mod;;
      |                                    ^~~
a.cc:32:61: error: 'mod' was not declared in this scope
   32 |       if (j != 0) sum[i][j] = (sum[i][j - 1] + sum[i][j]) % mod;
      |                                                             ^~~
Language: C++

#include"bits/stdc++.h"
using namespace std;
int f[101][100001];
int n,m;
int a[101];
int s[101];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		s[i]=a[i-1]+a[i];
	}
	f[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		f[i][0]=1;
		for(int j=1;j<=m;j++)
		{
			f[i][j]=sum[j]-sum[a[i]];
			//printf("%d ",f[i][j]);
		}
		//cout<<endl;
	}
	printf("%d",f[n][m]);
}

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

#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
using namespace std;
#define int ll

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	int dp[k+1][n+1];
	for(int i=0;i<=k;i++)
		for(int j=0;j<=n;j++)
			dp[i][j]=0;
	
	for(int i=0;i<=k;i++)
		dp[i][0]=0;
	for(int i=0;i<=min(k,a[0]);i++)
		dp[i][1]=1;
	for(int i=2;i<=n;i++)
	{
		dp[0][i]=1;
		int su=1;
		for(int j=1;j<=k;j++)
		{
			su+=dp[j][i-1];
			if(j>a[i-1])
				su-=dp[j-a[i-1]][i-1];
			su%=mod;
			su=(su+mod)%mod
			dp[j][i]=su;
			//cout<<dp[j][i]<<' ';
		}
		//cout<<endl;
	}
	cout<<(dp[k][n]%mod+mod)%mod<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:25: error: expected ';' before 'dp'
   42 |                         dp[j][i]=su;
      |                         ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
#define vi vector < int >
#define pii pair < int, int >
 
const int K = 1e5 + 7;
const int N = 107;
const int mod = 1e9 + 7;
 
int a[N], pr[N][K + 1], ar[N][K + 1];
int n, k;
 
main (){
    fill(pr[0], pr[0] + K + 1, 1);
    scanf("%lld%lld", &n, &k);
    for (int i = 1; i <= n; i++){
        scanf("%lld", &a[i]);
        for (int j = K; j >= 0; j--){
            ar[i][j] = pr[i - 1][j];
            if (j - a[i] - 1 >= 0){
                ar[i][j] -= pr[i - 1][j - a[i] - 1];
                ar[i][j = (ar[i][j] + mod) % mod ;
            }
        }
        pr[i][0] = ar[i][0];
        for (int j = 1; j <= K; j++){
            pr[i][j] = pr[i][j - 1] + ar[i][j];
            pr[i][j] %= mod;
        }
    }
    cout << ar[n][k];
}

Compiler output:
a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main (){
      | ^~~~
a.cc: In function 'int main()':
a.cc:28:49: error: expected ']' before ';' token
   28 |                 ar[i][j = (ar[i][j] + mod) % mod ;
      |                                                 ^~
      |                                                 ]
Language: C++

#include <iostream>
using namespace std;
 
#define MAXN 120
#define MAXK 100020
#define MOD 1000000007
 
int N,K;
long long dp[MAXN][MAXK];
long long a[MAXN];
 
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];
  
  for (int i = 0; i <= a[0]; i++) dp[0][i] = 1;
  
  for (int i = 1; i < N; i++) {
    dp[i][0] = dp[i-1][0];
    for (int j = 1; j <= a[i]; j++) {
      dp[i][j] = (dp[i][j-1] + dp[i-1][j])%MOD;
    }
    for (int j = a[i]+1; j <= K; j++) {
      dp[i][j] = (dp[i][j-1] + dp[i-1][j])%MOD;
      dp[i][j] -= (dp[i][j-a[i]-1]);
      dp[i][j]%=MOD;
      if (dp[i][j] < 0) dp[i][j] += MOD;
    }
    
      
      
  cout << dp[N-1][K] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:12:12: note: to match this '{'
   12 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
using namespace std;

long int main()
{
  ios::sync_with_stdio(false);

  long int N,K;
  cin>>N>>K;
  vector<vector<int>>dp(N+1,vector<int>(K+1,-1));
  vector<int>a(N+1);
  for(long int i=0;i<N;i++)
  {
    cin>>a[i+1];
  }
  for(long int i=0;i<K+1;i++)
  {
    if(a[1]>=i)dp[1][i]=i+1;
    else  dp[1][i]=a[1]+1;
  }
  for(long int i=2;i<N+1;i++)
  {
    dp[i][0]=1;
    for(long int j=1;j<K+1;j++)
    {
      if(j>a[i])dp[i][j]=dp[i][j-1]+dp[i-1][j]-dp[i-1][j-a[i]-1];
      else dp[i][j]=dp[i][j-1]+dp[i-1][j];
      dp[i][j]%=1000000007;
    }
  }
  if(dp[N][K]<0){dp[N][K]+=1000000007;dp[N][K]%=1000000007;}
  long int res=dp[N][K]-dp[N][K-1];
  if(res<0){res+=1000000007;res%=1000000007;}
  if(K>0){cout<<res;return 0;}
  cout<<dp[N][K];
  cout<<endl;

}


Compiler output:
a.cc:13:6: error: '::main' must return 'int'
   13 | long int main()
      |      ^~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[110][100010];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K; cin >> N >> K;
    int a[110];
    rep(i, N) cin >> a[i];
    dp[0][0] = 1;
    rep(i, N) {
        rep(j, K + 1) {
            dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j];
            if (j - 1 - a[i] >= 0) {
                dp[i + 1][j] -= dp[i][j - 1 - a[i]];
            }
            dp[i + 1][j] = (dp[i + 1] + mod) % mod;
        }
    }
    /*
    rep(i, N + 1) {
        rep(j, K + 1) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    cout << dp[N][K] << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:46: error: invalid operands of types 'long long int*' and 'int' to binary 'operator%'
   29 |             dp[i + 1][j] = (dp[i + 1] + mod) % mod;
      |                            ~~~~~~~~~~~~~~~~~ ^
      |                                       |
      |                                       long long int*
Language: C++

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define per(i,b,a) for(int i=b; i>=a; i--)
#define pb push_back
#define fi first
#define se second
using namespace std ;
typedef pair<int, int> pi ;
typedef vector<pair<int,int> > vpi ;
typedef vector<int> vi ;
typedef long long ll ;
const int MOD = 1e9 + 7;
const int inf = 1e9 + 5;
ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
const int maxn = 105 ;
int n, k ;
int a[maxn] ;
ll dp[maxn][100005] ;
ll ps[100005] ;

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::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cin >> n >> k ;
    rep(i,0,n-1)
    {
        cin >> a[i] ;
    }
    rep(i,0,a[0])
    {
        dp[0][k-i] = 1 ;
        ps[0] = dp[0][0] ;
        rep(j,1,k)
        {
            ps[j] = add(ps[j - 1], dp[0][j]);
        }
    }
    rep(i,1,n-1)
    {
        rep(j,0,k)
        {
           int l = j ;
           int r = min(j + a[i], k) ;
           if(l > 0)
            dp[i][j] = sub(ps[r], ps[l - 1]);
           else
            dp[i][j] = ps[r];
        }
        rep(i,0,100004) ps[i] = 0 ;
        ps[0] = dp[i][0] ;
        rep(j,1,k)
            ps[j] = add(dp[i][j], ps[j - 1]);
    }
    ll res = dp[n-1][0] ;
    cout << res << "\n" ;
    return 0 ;
}


Compiler output:
a.cc: In function 'll powmod(ll, ll)':
a.cc:14:71: error: 'mod' was not declared in this scope; did you mean 'modf'?
   14 | ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
      |                                                                       ^~~
      |                                                                       modf
a.cc:14:88: error: 'mod' was not declared in this scope; did you mean 'modf'?
   14 | ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
      |                                                                                        ^~~
      |                                                                                        modf
Language: C++

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define per(i,b,a) for(int i=b; i>=a; i--)
#define pb push_back
#define fi first
#define se second
using namespace std ;
typedef pair<int, int> pi ;
typedef vector<pair<int,int> > vpi ;
typedef vector<int> vi ;
typedef long long ll ;
const int MOD = 1e9 + 7;
const int inf = 1e9 + 5;
ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
const int maxn = 105 ;
int n, k ;
int a[maxn] ;
ll dp[maxn][100005] ;
ll ps[100005] ;

inline int add(int a, int b){
    a += MOD;
    if(a > MOD)a -= MOD;
    return a;
}

int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cin >> n >> k ;
    rep(i,0,n-1)
    {
        cin >> a[i] ;
    }
    rep(i,0,a[0])
    {
        dp[0][k-i] = 1 ;
        ps[0] = dp[0][0] ;
        rep(j,1,k)
        {
            ps[j] = add(ps[j - 1], dp[0][j]);
        }
    }
    rep(i,1,n-1)
    {
        rep(j,0,k)
        {
           int l = j ;
           int r = min(j + a[i], k) ;
           if(l > 0)
            dp[i][j] = add(ps[r] - ps[l - 1]);
           else
            dp[i][j] = ps[r];
        }
        rep(i,0,100004) ps[i] = 0 ;
        ps[0] = dp[i][0] ;
        rep(j,1,k)
            ps[j] = add(dp[i][j], ps[j - 1]);
    }
    ll res = dp[n-1][0] ;
    cout << res << "\n" ;
    return 0 ;
}


Compiler output:
a.cc: In function 'll powmod(ll, ll)':
a.cc:14:71: error: 'mod' was not declared in this scope; did you mean 'modf'?
   14 | ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
      |                                                                       ^~~
      |                                                                       modf
a.cc:14:88: error: 'mod' was not declared in this scope; did you mean 'modf'?
   14 | ll powmod(ll a, ll b) { ll ret = 1 ; while(b) { if(b&1) ret = (ret*a)%mod ;  a = (a*a)%mod ; b >>= 1 ; }  return ret ; }
      |                                                                                        ^~~
      |                                                                                        modf
a.cc: In function 'int main()':
a.cc:52:27: error: too few arguments to function 'int add(int, int)'
   52 |             dp[i][j] = add(ps[r] - ps[l - 1]);
      |                        ~~~^~~~~~~~~~~~~~~~~~~
a.cc:21:12: note: declared here
   21 | inline int add(int a, int b){
      |            ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int , int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti set <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
ll dp[100][100001]
int main()
{  
    FAST
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<=k;j++)
        {
            dp[i][j]=0;
        }
    }
    for(ll i=0;i<=a[0];i++)
    {
        dp[0][i]=1;
    }
    for(ll i=1;i<n;i++)
    {
        ll q=0;
        for(ll j=0;j<=k;j++)
        {
            q+=dp[i-1][j];
            if(j>a[i])
                q-=dp[i-1][j-a[i]];
          q%=mod;
          q+=mod;
          q%=mod;
            dp[i][j]=q;
        }
    }
    cout<<dp[n-1][k];
}

Compiler output:
a.cc:30:1: error: expected initializer before 'int'
   30 | int main()
      | ^~~
Language: C++

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>

using namespace std;

constexpr int p = 1e9+7;

int N;
int dp[100008];

int main() {
    int K, a;
	scanf("%d%d", &N, &K);
    {
        scanf("%d", &a);
        for(int k=0; k<=a; ++k) {
            dp[k] = 1;
        }
    }
    for(int n=1; n<N; ++n) {
        int sum = dp[k-1];
        for(int k=1; k<=K; ++k) {
            sum += dp[k];
            if(p<=sum) sum -= p; 
            dp[k] = sum;
        }
        scanf("%d", &a);
        for(int k=K; a<k; --k) {
            int sum = dp[k] - dp[k-a-1];
            if(sum<0) sum += p;
            dp[k] = sum;
        }
    }
    printf("%d\n", dp[K]);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: 'k' was not declared in this scope
   23 |         int sum = dp[k-1];
      |                      ^
Language: C++

#define MAXN 100100
 
int ft[MAXN +1]; // for more dimensions, make ft multi-dimensional
void upd(int i0, int v){ // add v to i0th element (0-based)
        // add extra fors for more dimensions
        for(int i=i0+1;i<=MAXN;i+=i&-i)ft[i]= (ft[i] + v)%mod;
}
int get(int i0){ // get sum of range [0,i0)
        int r=0;
        // add extra fors for more dimensions
        for(int i=i0;i;i-=i&-i)r= (r +ft[i])%mod;;
        return r;
}
int get_sum(int i0, int i1){ // get sum of range [i0,i1) (0-based)
        return (get(i1)-get(i0)+mod)%mod;
}
int a[101];
int dp[100001][2];
 
int32_t main(int32_t argc, char const *argv[]){
    FIN;
 
    int n ,k;cin>>n>>k;
    fore(i,0,n)cin>>a[i];
    bool b = true;
    fore(i,0,a[n-1]+1){
        dp[i][b] =1;
        upd(i,1);
    }
 
    rfore(i,0,n-1){
        b = !b;
        fore(j,0,k+1){
            dp[j][b] = get_sum(max(j-a[i],0ll),j+1);
         //   cout<<dp[j][b]<<" ";
        }
        mm(ft,0);
        fore(j,0,k+1){
            upd(j,dp[j][b]);
        }
    }
    cout<<dp[k][b];
 
 
    return 0;
}

Compiler output:
a.cc: In function 'void upd(int, int)':
a.cc:6:59: error: 'mod' was not declared in this scope
    6 |         for(int i=i0+1;i<=MAXN;i+=i&-i)ft[i]= (ft[i] + v)%mod;
      |                                                           ^~~
a.cc: In function 'int get(int)':
a.cc:11:46: error: 'mod' was not declared in this scope
   11 |         for(int i=i0;i;i-=i&-i)r= (r +ft[i])%mod;;
      |                                              ^~~
a.cc: In function 'int get_sum(int, int)':
a.cc:15:33: error: 'mod' was not declared in this scope
   15 |         return (get(i1)-get(i0)+mod)%mod;
      |                                 ^~~
a.cc: At global scope:
a.cc:20:1: error: 'int32_t' does not name a type
   20 | int32_t main(int32_t argc, char const *argv[]){
      | ^~~~~~~
a.cc:1:1: note: 'int32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
  +++ |+#include <cstdint>
    1 | #define MAXN 100100
Language: C++

trip around the kitchen in such a way that he picks up each tool and delivers it to the requesting cook. Since the Chef has two hands, he may carry up to two tools at once.

Once the last item has been delivered, the Chef also has to return to his starting position. This must be done as fast as possible so the Chef wants to do this while traveling the minimum possible distance.

Input
The first line contains 

Compiler output:
a.cc:1:1: error: 'trip' does not name a type
    1 | trip around the kitchen in such a way that he picks up each tool and delivers it to the requesting cook. Since the Chef has two hands, he may carry up to two tools at once.
      | ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
typedef long long ll;
  int main(){
  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
  ll n,k;
  cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)
      cin>>a[i];
  ll dp[n][k+1];
    memset(dp,0,sizeof(dp));
   for(int i=0;i<=a[n-1];i++)
     dp[n-1][i]=1;
    for(int i=0;i<n;i++)
      dp[i][0]=1;
    for(int i=n-2;i>=0;i--){
      for(int j=1;j<=a[i];j++)
        dp[i][j]=(dp[i][j-1]+dp[i+1][j])%mod;
      for(int j=a[i]+1;j<=k;j++)
        dp[i][j]=(dp[i][j-1]+dp[i+1][j]-dp[i+1][j-a[i]-1])%mod;
      if(dp[i][j]<0)
        dp[i][j]+=mod;
     }
                  cout<<dp[0][k]<<"\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: 'j' was not declared in this scope
   23 |       if(dp[i][j]<0)
      |                ^
Language: Java

import java.util.Scanner;

public class EDPC_M_ {

    static int MOD = 1_000_000_007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] A = new int[N+1];
        for(int i = 1; i <= N; i++) A[i] = sc.nextInt();
        // dp[i][j]：ｉ人目まででｊ個の飴を分ける分け方 % MOD
        long[][] dp = new long[N+1][K+1];
        dp[0][0] = 0;
        int sum = 0;
        for(int i = 1; i <= N; i++){
            sum += A[i];
            for(int j = 0; j <= K; j++){
                if(j == 0) dp[i][j] = 1;
                else if(j <= A[i]) dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
                else if(j <= sum) dp[i][j] = (dp[i-1][j] + dp[i][j-1] - dp[i-1][j - A[i] -1] + MOD) % MOD;
            }
        }
        System.out.println(dp[N][K]);
        sc.close();
    }

}


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

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll mod = 1e9 + 7, s = 0;

    ll dp[110][100010] = {0};

    dp[0][k] = 1;

    forx(i,1,n+1)rep(j,k+1){
        if(j==0){
            s = 0;
            rep(l, a[i-1] + 1){
                s += dp[i-1][l];
                s %= mod;
            }
        }
        else
            s += (dp[i-1][j + a[i-1]] - dp[i-1][j - 1]);
        dp[i][j] += s;
        dp[i][j] %= mod;
    }

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

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll mod = 1e9 + 7, s = 0;

    ll dp[110][100010] = {0};

    dp[0][k] = 1;

    forx(i,1,n+1)rep(j,k+1){
        if(j==0){
            s = 0;
            rep(l, a[i-1] + 1){
                s += dp[i-1][l];
                s %= mod;
            }
        }
        else
            s += (dp[i-1][j + a[i-1]] - dp[i-1][j - 1]);
        dp[i][j] += s;
        dp[i][j] %= mod;
    }

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

    return 0;
}


Compiler output:
a.cc:47:5: error: redefinition of 'int main()'
   47 | int main()
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main()
      |     ^~~~
Language: C++

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    ll mod = 1e9 + 7, s = 0;

    ll dp[110][100010] = {0};

    dp[0][k] = 1;

    forx(i,1,n+1)rep(j,k+1){
        if(j==0){
            s = 0;
            rep(l, a[i-1] + 1){
                s += dp[i-1][l];
                s %= mod;
        }
        else
            s += (dp[i-1][j + a[i-1]] - dp[i-1][j - 1]);
        dp[i][j] += s;
        dp[i][j] %= mod;
    }

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

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: expected '}' before 'else'
   30 |         else
      |         ^~~~
a.cc:24:17: note: to match this '{'
   24 |         if(j==0){
      |                 ^
Language: C++

# pragma GCC optimize("O3")
# include <bits/stdc++.h>
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define rcg(s) cout << s;exit(0)
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define all(s) s.begin(),s.end()
# define sz(x) (int)((x).size())
# define int ll
using namespace std;

int n,k,dp[1 << 17],x;

const int mod = 1e9 + 7;

int32_t main(){_
    //freopen("in","r",stdin);
    cin >> n >> k;
    dp[0] = 1;
    for(int i = 1;i <= n;i++)
    {
        cin >> x;
        for(int val = k;val >= 0;val--)
        {
            dp[val] = (mod + (dp[val] - (val - x - 1 >= 0 ? dp[val - x - 1] : 0)) % mod;
            dp[val] %= mod;
        }
        for(int val = 1;val <= k;val++)
        {
            dp[val] += dp[val - 1];
            dp[val] %= mod;
        }
    }
    rc(dp[k]);
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:30:88: error: expected ')' before ';' token
   30 |             dp[val] = (mod + (dp[val] - (val - x - 1 >= 0 ? dp[val - x - 1] : 0)) % mod;
      |                       ~                                                                ^
      |                                                                                        )
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
int dp[111][100100];
int a[111](
const int mod = 1000000007;
signed main()
{
  int N, K;
  cin >> N >> K;
  rep(i, N) cin >> a[i];
  dp[0][0] = 1;
  rep(i, N) {
    rep(j, K+1) {
      dp[i+1][j] += dp[i][j];
      dp[i+1][min(j+a[i]+1, K+1)] -= dp[i][j];
    }
    rep(j, K) {
      dp[i+1][j+1] += dp[i+1][j];
      dp[i+1][j+1] %= mod;
    }
  }
  cout << dp[N][K] << endl;
}

Compiler output:
a.cc:8:15: error: default arguments are only permitted for function parameters [-fpermissive]
    8 | const int mod = 1000000007;
      |               ^
a.cc:8:27: error: expected ')' before ';' token
    8 | const int mod = 1000000007;
      |                           ^
      |                           )
a.cc:7:11: note: to match this '('
    7 | int a[111](
      |           ^
a.cc:7:5: error: declaration of 'a' as array of functions
    7 | int a[111](
      |     ^
a.cc: In function 'int main()':
a.cc:13:20: error: 'a' was not declared in this scope
   13 |   rep(i, N) cin >> a[i];
      |                    ^
a.cc:18:21: error: 'a' was not declared in this scope
   18 |       dp[i+1][min(j+a[i]+1, K+1)] -= dp[i][j];
      |                     ^
a.cc:22:23: error: 'mod' was not declared in this scope; did you mean 'modf'?
   22 |       dp[i+1][j+1] %= mod;
      |                       ^~~
      |                       modf
Language: C++

#include <iostream>
using namespace std;
typedef long long ll;
int N,K,A[110];
ll dp[110][100010] = {},inf = 1e9+7;


int main(){
	cin >> N >> K;
	factorial(K);
	for(int i=1;i<=N;i++){
		cin >> A[i];
	}
	ll ans = 0;
	for(int i=1;i<=N;i++){
		ll sum[K+10] = {};
		for(int j=0;j<=K;j++){
			sum[j] += dp[i-1][j];
			if(j>0) sum[j] += sum[j-1];
			sum[j] %= inf;
		}
		for(int j=0;j<=K;j++){
			if(j-A[i]-1<0) dp[i][j] += sum[j];
			else dp[i][j] += sum[j]-sum[j-A[i]-1];
			dp[i][j] %= inf;
		}
	}
	cout << dp[N][K] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'factorial' was not declared in this scope
   10 |         factorial(K);
      |         ^~~~~~~~~