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

#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define PI 		    acos(-1)
#define pb          push_back
#define ins         insert
#define INF        	1000000000000000007 //1e18+7
#define mk          make_pair
#define lb(v,x)     lower_bound(all(v),x)
#define ub(v,x)     upper_bound(all(v),x)
#define ff          first
#define ss          second
#define rev         reverse
#define endl        "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a)       (ll)a.size()
#define ld     		long double
#define minpq       priority_queue <ll,vector<ll>,greater<ll> > 
#define fill(x,y)   memset(x,y,sizeof(x))
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define MOD         1000000007		//1e9+7
#define bp(n)       __builtin_popcountll(n)
#define mxt(a)      *(max_element(a.begin(),a.end()))
#define mnt(a)      *(min_element(a.begin(),a.end())
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i, a, mp) for(ll i = (a); i<=(mp); ++i)
#define trav(a, x) 	  for(auto &a : x)
#define re(i,n)       for(ll i = 0; i < n; ++i) 
const int N = 5e5 + 7;
const ld eps=1e-7;
typedef pair<ll,ll>   pii;
typedef vector<pii>   vpii;
typedef vector<ll>    vll;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int dx[8]={+1, +1, +1, 0, 0, -1, -1, -1};
int dy[8]={+1, 0, -1, +1, -1, +1, 0, -1};
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x);y=y>>1;x=(x*x);}return res;}
template <typename T> T gcd(T a,T mp){ if(a==0) return mp; return gcd(mp%a,a); }
template <typename T> T powm(T a,T mp, ll m){T cnt=1; while(mp>0){ if(mp%2==1) cnt=(cnt*a)%m; mp/=2; a=(a*a)%m; }return cnt%m;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll sqr(ll x) { return x * x;} 
void prec(){

}
ll sum=0,dp[102][N],now[102][N];
void run(){
	int n,k;cin>>n>>k;
	int a[n+1];
	a[0]=0;
	rep(i,1,n) cin>>a[i],sum+=a[i];
	if(sum<k){
		cout<<0;
		return;
	}
	fill(dp,0);
	dp[0][0]=1;
	for(int j=0;j<=k;j++){
			now[0][j]+=(dp[0][j]+(j==0?0:now[i][j-1]))%MOD;
	}
	for(int i=1; i<=n; ++i){
		for(int j=0; j<=k; ++j){
			dp[i][j]=now[i-1][j]-(j-a[i]-1<0?0:(now[i-1][j-a[i]-1]));            //now[i-1][j-a[i]-1];
			if(dp[i][j]<0) dp[i][j]+=MOD;
			dp[i][j]%=MOD;
			// for(int c=j-a[i]; c<=j; ++c){
			// 	dp[i][j]+=dp[i-1][c];
			// }
		}
		fill(now,0);
		for(int j=0;j<=k;j++){
			now[i][j]+=(dp[i][j]+(j==0?0:now[i][j-1]))%MOD;
		}
	}
	cout<<dp[n][k]<<endl;
}
int main()
{
    cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
    int tc=1;
    //cin>>tc;
    prec();
    re(i,tc)
    	run();
    return 0; 
}

Compiler output:
a.cc: In function 'void run()':
a.cc:60:58: error: 'i' was not declared in this scope
   60 |                         now[0][j]+=(dp[0][j]+(j==0?0:now[i][j-1]))%MOD;
      |                                                          ^
Language: C++

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

const int INF = 1e9 + 5;
const int MOD = 1e9 + 7;

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> a(n + 1);
  for (auto i = 1; i <= n; ++i) {
    cin >> a[i];
  }

  // dp[i][j] - No. of ways to distribute j chocolates to the first i people
  int dp[n + 1][k + 1];
  memset(dp, 0, sizeof(dp));

  dp[0][0] = 1;

  for (auto i = 1; i <= n; ++i) {
    vector<int> prefix(k + 1, 0);
    prefix[0] = dp[i - 1][0];

    for (auto m = 1; m <= k; ++m) {
      prefix[m] = (prefix[m - 1] + dp[i - 1][m]) % MOD;
    }

    for (auto j = 0; j <= k; ++j) {
      dp[i][j] =
          (prefix[j] - (j - a[i] - 1 >= 0 ? prefix[j - a[i] - 1] : 0)) % MOD;
    }
  }

  // dbg(dp[2][0]);
  cout << dp[n][k] << "\n";
}


Compiler output:
a.cc:2:10: fatal error: dbg.h: No such file or directory
    2 | #include <dbg.h>
      |          ^~~~~~~
compilation terminated.
Language: C++

/*

    author : Divyansh Gupta

*/

#include <iostream>

#include <iomanip>

#include <cstring>

#include <vector>

#include <algorithm>

#include <stack>

#include <queue>

#include <utility>

#include <map>

using namespace std;

void print_err() {

	cerr<<"\n";}

template <class T,class... Arg>

void print_err(T x,Arg&&... args) {

	cerr<<x<<" ";

	print_err(args...);

}

#ifdef local

#define debug(...) print_err(__VA_ARGS__)

#else

#define debug(...)

#endif

#define test_case int test_cases;\

                cin>>test_cases;\

                while(test_cases--)

#define lu(var,l,r) for(var=l;var<r;var++)

#define ld(var,r,l) for(var=r;var>=l;var--)

#define ll long long

#define mp make_pair

#define pb push_back

#define vi vector<int>

#define vvi vector<vector<int> >

#define vll vector<ll>

#define vvll vector<vector<ll> >;               	

#define pii pair<int,int>                	

#define br cout<<"\n"

#define sp cout<<" "

#define pr cout<<

#define in cin>>

#define f first

#define s second                    

#define mod 1000000007

            

void solve(){

	int n,k,i,j,x,l;

	ll ans;

	vi A;

	in n;

	in k;

	A.pb(0);

	lu(i,0,n) {

		in x;

		A.pb(x);

	}

	int dp[n+1][k+1];

	lu(i,0,k + 1) {

		dp[0][i] = 1;

	}

	lu(i,0,n) {

		dp[i][0] = 1;

	}

	lu(i,1,n) {

		lu(j,1,k + 1) {

			ans = 0ll;

			if(j - A[i] > 0) {

				ans = mod+dp[i-1][j] - dp[i - 1][j - A[i] - 1];

			} else {

				ans = dp[i-1][j];

			}

			dp[i][j] = (ans + dp[i][j-1])%mod;

		}

	}

	ans = 0;

	if(k - A[n] > 0) {

		ans = mod+dp[n-1][k] - dp[n - 1][k - A[n] - 1];

	} else {

		ans = dp[n-1][k];

	}

	pr ans%mod;

	br;

}

int main(){

    solve();

    return 0;

}

Compiler output:
a.cc:53:17: error: 'cin' does not name a type; did you mean 'in'?
   53 |                 cin>>test_cases;\
      |                 ^~~
      |                 in
a.cc:55:17: error: expected unqualified-id before 'while'
   55 |                 while(test_cases--)
      |                 ^~~~~
a.cc: In function 'int main()':
a.cc:171:5: error: 'solve' was not declared in this scope
  171 |     solve();
      |     ^~~~~
Language: Java

import java.util.*;
import java.io.*;
 
class Main
{
    public static void main(String[] args) throws Exception
    {
    	Scanner in = new Scanner(System.in);
    	int n= in.nextInt();
    	int k = in.nextInt();
    	int[] arr = new int[n];

    	for(int i =0; i< n; i++)
    		arr[i] = in.nextInt();

    	double[][] dp = new double[n+1][n+1];

    	double mod = 1000000007;
    	for(int j =0; j<=k; j++){
    		dp[1][j]=(arr[0]>=j) 1:0;
    	}

    	for(int i =2; i<=n; i++){
    		for(int j =0; j<=k; j++){
    			if(j==0){
    				dp[i][j] = dp[i-1][j];
    			} else{
    				dp[i][j] =(dp[i-1][j]+ dp[i][j-1])%mod;
    				if(j-arr[i-1]>0){
    					dp[i][j] = (dp[i][j] -dp[i-1][j-arr[i-1]-1]+mod)%mod;
    				}
    			}
    		}
    	}

    	System.out.println((int)dp[n][k]);
    }
}

Compiler output:
Main.java:20: error: ';' expected
    		dp[1][j]=(arr[0]>=j) 1:0;
    		                    ^
1 error
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define lld long long double
#define pb push_back
#define mp make_pair
#define M 1000000007
using namespace std;



int f(int n, int k, int a[]) {
	ll dp[n + 2][k + 2];
	for (int j = 0; j <= k; j++)
		dp[1][j] = (j > a[1]) ? 0 : 1;
	for (int i = 2; i <= n; i++) {
		for (int j = 0; j <= k; j++) {
			if (j == 0) dp[i][j] = dp[i - 1][j];
			else {
				dp[i][j] = (mod + dp[i][j - 1] + dp[i - 1][j] - ((j - a[i] - 1 >= 0) ? dp[i - 1][j - a[i] - 1] : 0)) % M;
			}
		}
	}
	return dp[n][k];
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	int n, k;
	cin >> n >> k;
	int a[n + 1];
	for (int i = 1; i <= n; i++) cin >> a[i];
	cout << f(n, k, a);
	return 0;
}

Compiler output:
a.cc: In function 'int f(int, int, int*)':
a.cc:19:45: error: 'mod' was not declared in this scope; did you mean 'modf'?
   19 |                                 dp[i][j] = (mod + dp[i][j - 1] + dp[i - 1][j] - ((j - a[i] - 1 >= 0) ? dp[i - 1][j - a[i] - 1] : 0)) % M;
      |                                             ^~~
      |                                             modf
Language: C++

#include<bits/stdc++.h>
#define int long long
#define ld long double
#define MAX 100001
#define MOD 1000000007
using namespace std;

int permutation(int n, int k ,int*a )
{
    if(k==0)
        return 1;

    int dp[n+1][k+1];

    for(int i=0 ;i<=n ;++i)
    {
        for(int j=0;j<=k;++j)
        {
            if(i==0 || j==0)
            {
                dp[i][j] = 1;
                continue;
            }
            if(j - a[i-1]  > 0 )
                dp[i][j] = dp[i][j-1] + ( dp[i-1][j] - dp[i-1][j-a[i-1]-1] );
            else
                dp[i][j] = dp[i][j-1] + dp[i-1][j];

            dp[i][j]%=MOD;
        }
    }   

    return (dp[n][k] - dp[n][k-1]+MOD)%MOD;
}

 
int main()
{
    int n,k;
    cin>>n>>k;
    int*a = new int[n];
    for(int i=0;i<n;++i)
        cin>>a[i];

    cout << permutation( n, k, a) << endl;

    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[200][100006];
    int candy(int n , int k , int *arr){
        if(n==1  and arr[n]>k)return 0;
        if(n==1 and arr[n]<k)return 1;
        if(k<0)return 0;
        if(dp[n][k]!=-1)return dp[n][k];
        if((k-1-a[n])>=0){
        return dp[n][k]=(candy(a,n,k-1)  + candy(a,n-1,k) -     (candy(a,n-1,k-1-a[n]))  )  %1000000007;}
        else return dp[n][k]=(candy(a,n,k-1)  + candy(a,n-1,k)  )  %1000000007;}
    }
    signed main(){
       int n;cin>>n;
       int k;cin>>k;
       memset(dp , -1 , sizeof dp);
       int arr[n];forr(i,1,n+1)cin>>arr[i];
       cout<<candy(n,k,arr);
         }
    

Compiler output:
a.cc: In function 'long long int candy(long long int, long long int, long long int*)':
a.cc:17:17: error: 'a' was not declared in this scope
   17 |         if((k-1-a[n])>=0){
      |                 ^
a.cc: At global scope:
a.cc:20:5: error: expected declaration before '}' token
   20 |     }
      |     ^
Language: C++

#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[200][100005];
int candy(int *a , int i,  int k ){
     if(i==1 && k<=a[0])return  1;
     if(k<0)return 0;
    if(i==1)return 0;
    if(k==0)return 1;
    if(dp[i][k]!=-1)return dp[i][k];
    return dp[i][k]=(candy(a,i,k-1)  + candy(a,i-1,k) - (candy(a,i-1,k-1-a[i])) +1000000007; )  %1000000007;
}

    
    signed main(){
        int n;cin>>n; int k;cin>>k;
        int a[n+1];forr(i,1,n+1) {cin>>a[i];}
        memset(dp,-1, sizeof dp);
        cout<< candy(a,n,k);
    }

Compiler output:
a.cc: In function 'long long int candy(long long int*, long long int, long long int)':
a.cc:17:92: error: expected ')' before ';' token
   17 |     return dp[i][k]=(candy(a,i,k-1)  + candy(a,i-1,k) - (candy(a,i-1,k-1-a[i])) +1000000007; )  %1000000007;
      |                     ~                                                                      ^
      |                                                                                            )
a.cc:17:94: error: expected primary-expression before ')' token
   17 |     return dp[i][k]=(candy(a,i,k-1)  + candy(a,i-1,k) - (candy(a,i-1,k-1-a[i])) +1000000007; )  %1000000007;
      |                                                                                              ^
Language: C++

#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[200][100005];
int candy(int *a , int i,  int k ){
     if(i==1 && k<=a[0])return  1;
    if(i==1)return 0;
    if(k==0)return 1;
    if(dp[i][k]!=-1)return dp[i][k];
    return dp[i][k]=(candy(a,i,k-1)  + candy(a,i-1,k) -     if((k-1-a[i])>0)(candy(a,i-1,k-1-a[i]))  )  %1000000007;
}

    
    signed main(){
        int n;cin>>n; int k;cin>>k;
        int a[n+1];forr(i,1,n+1) {cin>>a[i];}
        memset(dp,-1, sizeof dp);
        cout<< candy(a,n,k);
    }

Compiler output:
a.cc: In function 'long long int candy(long long int*, long long int, long long int)':
a.cc:16:61: error: expected primary-expression before 'if'
   16 |     return dp[i][k]=(candy(a,i,k-1)  + candy(a,i-1,k) -     if((k-1-a[i])>0)(candy(a,i-1,k-1-a[i]))  )  %1000000007;
      |                                                             ^~
a.cc:16:56: error: expected ')' before 'if'
   16 |     return dp[i][k]=(candy(a,i,k-1)  + candy(a,i-1,k) -     if((k-1-a[i])>0)(candy(a,i-1,k-1-a[i]))  )  %1000000007;
      |                     ~                                  ^    ~~
      |                                                        )
Language: C++

#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[200][100005];
int candy(int *a , int i, int e, int k ){
     if(i==0 && k<=a[0])return  1;
    if(i==0 && k>a[0])return 0;
    if(dp[i][k]!=-1)return dp[i][k];
    } return dp[i][k+1]=(candy(a,i,e,k)  + candy(a,i-1,e,k+1) - candy(a,i,e,k-a[i]))    %1000000007;
}

    
    signed main(){
        int n;cin>>n; int k;cin>>k;
        int a[n];forr(i,0,n) {cin>>a[i];}
        memset(dp,-1, sizeof dp);
        cout<< candy(a,n-1,0,k);
    }

Compiler output:
a.cc:15:7: error: expected unqualified-id before 'return'
   15 |     } return dp[i][k+1]=(candy(a,i,e,k)  + candy(a,i-1,e,k+1) - candy(a,i,e,k-a[i]))    %1000000007;
      |       ^~~~~~
a.cc:16:1: error: expected declaration before '}' token
   16 | }
      | ^
a.cc: In function 'long long int candy(long long int*, long long int, long long int, long long int)':
a.cc:15:5: warning: control reaches end of non-void function [-Wreturn-type]
   15 |     } return dp[i][k+1]=(candy(a,i,e,k)  + candy(a,i-1,e,k+1) - candy(a,i,e,k-a[i]))    %1000000007;
      |     ^
Language: C++

#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
    int dp[200][100005];
int candy(int *a , int i, int e, int k ){
     if(i==0 && k<=a[0])return  1;
    if(i==0 && k>a[0])return 0;
    if(dp[i][k]!=-1)return dp[i][k];
    } return dp[i][k-1]=(candy(a,i,e,k)  - candy(a,i-1,e,k) + candy(a,i-1,e,k-1-a[i]))    %1000000007;
}

    
    signed main(){
        int n;cin>>n; int k;cin>>k;
        int a[n];forr(i,0,n) {cin>>a[i];}
        memset(dp,-1, sizeof dp);
        cout<< candy(a,n-1,0,k);
    }

Compiler output:
a.cc:15:7: error: expected unqualified-id before 'return'
   15 |     } return dp[i][k-1]=(candy(a,i,e,k)  - candy(a,i-1,e,k) + candy(a,i-1,e,k-1-a[i]))    %1000000007;
      |       ^~~~~~
a.cc:16:1: error: expected declaration before '}' token
   16 | }
      | ^
a.cc: In function 'long long int candy(long long int*, long long int, long long int, long long int)':
a.cc:15:5: warning: control reaches end of non-void function [-Wreturn-type]
   15 |     } return dp[i][k-1]=(candy(a,i,e,k)  - candy(a,i-1,e,k) + candy(a,i-1,e,k-1-a[i]))    %1000000007;
      |     ^
Language: C++

#include<bits/stdc++.h>
#define ll long long int
const int MOD = 1e9+7;
using namespace std;
int main()
{ ios_base::sync_with_stdio(false); cin.tie(0);
	int n,k;cin>>n>>k;
  ll dpp[k+1]={0};
  dpp[0]=1;
  for(int i=0;i<n;i++)
  { ll curr_lim;cin>>curr_lim;
    ll dp[k+1]={0};
    for(int already=k;already>=0;--already)
    {
         int l=already+1;
         int r=already+min(k-already,curr_lim);
         if(l<=r)
            { dp[l]=(dp[l]+dpp[already+MOD])%MOD;
               if(r+1<=k)
               { dp[r+1]=(dp[r+1]-dpp[already+MOD])%MOD; }
            }
    }
          int pre=0;
        for(int j=0;j<=k;j++)
        {
          pre=(pre+dp[j]+MOD)%MOD;
          dpp[j]=(dpp[j]+pre+MOD)%MOD;
        }
  }
   cout<<dpp[k];
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:27: error: no matching function for call to 'min(int, long long int&)'
   16 |          int r=already+min(k-already,curr_lim);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:16:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   16 |          int r=already+min(k-already,curr_lim);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:16:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |          int r=already+min(k-already,curr_lim);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
//int dp[3001][3001];
const int mod=1e9+7;
#define ll long long
int main()
{
int n,k;
cin>>n>>k;
int a[n];
vector<ll> dp(k+1);
dp[0]=1;
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<n;i++)
{
   // int dp1[k+1]={};
   vector<ll> dp1(k+1);
   vector<ll> fake(k+1);
    for(int already=0;already<=k;already++)
    {
        fake[already]+=dp[already];
        if(already+a[i]<k)
        fake[already+a[i]+1]+=(-dp[already]);
        // for(int j=0;j<=a[i];j++)
        // {
        //     if(already+j<=k) dp1[already+j]=(dp1[already+j]+dp[already])%mod;
        // }
    }
    for(int j=1;j<=k;j++)
    {
        fake[j]+=fake[j-1];
        faje[j]%=mod;
    }
    for(int j=0;j<=k;j++)
    {
        dp1[j]+=fake[j];
        dp1[j]%=mod;
    }
    dp=dp1;
}
cout<<dp[k]%mod<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: error: 'faje' was not declared in this scope; did you mean 'fake'?
   32 |         faje[j]%=mod;
      |         ^~~~
      |         fake
Language: C++

#include <iostream>

// @idea: digit dp
//      n: total number of children
//      s   : current number of candies
//      dp(i, s) : all the ways s candies can be distributed from [1...i]

using namespace std;
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;

const int NMAX = 1e2 + 11;
const int KMAX = 1e5 + 11;
const int MOD  = 1e9 + 7;

int n, k, a[NMAX], acc[KMAX], dp[NMAX][KMAX];

int solve(void)
{
    dp[0][0] = 1;

    for (int s = 1; s <= k; ++s)
        dp[0][s] = 0;

    for (int i = 1; i <= n; ++i)
    {
        acc[0] = dp[i - 1][0];
        for (int s = 1; s <= k; ++s)
            acc[s] = (acc[s - 1] + dp[i - 1][s]) % MOD;
        // reachable =  [s - a[i], s]
        for (int s = 0; s <= k; ++s)
            dp[i][s] = acc[s] - (s - a[i] - 1 >= 0 ? acc[s - a[i] - 1] : 0);
    }

    return dp[n][k];
}

int main(void)
{
    cin >> n >> k;

    for (int i = 1; i <= n; ++i)
        cin >> a[i];

    cout << solve() << endl;

    return 0;
}


Compiler output:
a.cc:10:13: error: 'vector' does not name a type
   10 | using vi  = vector<int>;
      |             ^~~~~~
a.cc:11:13: error: 'vector' does not name a type
   11 | using vvi = vector<vi>;
      |             ^~~~~~
Language: C++


#include<bits/stdc++.h>
using namespace std ; 
#define MOD 1000000007
long long int dp[105][100005] ; 
int solve(int n,int k,int arr[]){
   if(n==1 && k<=arr[n] && k>=0){
       return 1 ; 
   }else if(n==1 && k>arr[n]){
       return 0 ; 
   }
    if(dp[n][k]!=-1){
        return dp[n][k]%MOD ;
    }
    long long int ways = 0 ; 
    for(int i =0 ; i<=arr[n] ; i++){
        ways+= (solve(n-1,k-i,arr))%MOD ; 
    }
    return dp[n][k] = ways%MOD ; 
}
solve_bottomup(int n,int k,int arr[]){
    //this has much better time complexity . 
    for(int j=0 ; j<=k ;j++){
        dp[1][j] = (j>arr[1])? 0 : 1 ; 
    } //covers the base cases . 
    for(int i = 2 ; i<=n ; i++){
        for(int j =0 ; j<=k ; j++){
            if(j==0){
                dp[i][j] = dp[i-1][j] ; 
            }else{
                dp[i][j] =(MOD+ dp[i][j-1]+dp[i-1][j]-( (j-arr[i]-1>=0) ? dp[i-1][j-arr[i]-1] : 0) )%MOD ; 
            }
        }
    }
return dp[n][k] ; 
}
int main(){
    int n,k ; cin>>n>>k ; 
    int arr[n+1] ; arr[0] = 0; 
    for(int i  = 1; i<=n ; i++){
        cin>>arr[i] ; 
    }
    memset(dp,-1,sizeof(dp)) ; 
    cout<<solve_bottomup(n,k,arr) ; 
}

Compiler output:
a.cc:21:1: error: ISO C++ forbids declaration of 'solve_bottomup' with no type [-fpermissive]
   21 | solve_bottomup(int n,int k,int arr[]){
      | ^~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007;
vector<vector<int>>dp; // dp(i,j) ways when i children and ith children get j candies
vector<int>v;

int ways(int n,int candies){
    //cout<< n<<" "<<candies<<"\n";
    //int q;cin>>q;
    if(dp[n][candies]  != -1){
        return dp[n][candies];
    }
    int ans=0;
    ans = (ways(n,candies-1) + ways(n-1,candies))%mod;
    if(candies>=(v[n]+1)){
        ans -= ways(n-1,candies-v[n]-1);
        ans %=mod;
    }
    return dp[n][candies] =ans;

}

void solve(){
    int n,k;cin>>n>>k;
    dp.resize(n,vector<int>(k+1,-1));
    v.resize(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    int x = min(v[0],k);
    for(int i=0;i<=x;i++){
        dp[0][i]=1;
    }
    for(int i=x+1;i<=k;i++){
        dp[0][i]=0;
    }
    for(int i=0;i<n;i++){
        dp[i][0]=1;
    }
    for(int i=1;i<n;i++){
        for(int j=1;j<=k;j++){
            dp[i][j] = (dp[i][j-1] + dp[i-1][j])%mod
            if(j>= (v[i]+1)){
                dp[i][j] = (mod + dp[i][j] - dp[i-1][j-v[i]-1])%mod;
            }
        }
    }
    cout<<dp[n-1][k]<<"\n";


}

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

    cout.precision(10);
    int t=1;//cin>>t;
    while(t--){

        solve();
    }
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:3:23: error: expected ')' before ';' token
    3 | #define mod 1000000007;
      |                       ^
a.cc:44:29: note: in expansion of macro 'mod'
   44 |                 dp[i][j] = (mod + dp[i][j] - dp[i-1][j-v[i]-1])%mod;
      |                             ^~~
a.cc:44:28: note: to match this '('
   44 |                 dp[i][j] = (mod + dp[i][j] - dp[i-1][j-v[i]-1])%mod;
      |                            ^
a.cc:44:63: error: expected ';' before ')' token
   44 |                 dp[i][j] = (mod + dp[i][j] - dp[i-1][j-v[i]-1])%mod;
      |                                                               ^
      |                                                               ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
const int mod=1e9+7
int a[100];
int dp[100][N];
int main(){
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
        for(int j=0;j<=k;j++){
            dp[i][j] = dp[i - 1][j];
            if(j && j<=a[i])
                dp[i][j] += dp[i][j - 1];
            else if (j)
                dp[i][j] += mod+dp[i][j-1] - dp[i-1][j-a[i]-1];
            dp[i][j]%=mod;
        }

    cout<<dp[n][k];

    return 0;
}

Compiler output:
a.cc:5:1: error: expected ',' or ';' before 'int'
    5 | int a[100];
      | ^~~
a.cc: In function 'int main()':
a.cc:11:14: error: 'a' was not declared in this scope
   11 |         cin>>a[i];
      |              ^
a.cc:16:24: error: 'a' was not declared in this scope
   16 |             if(j && j<=a[i])
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
//map<int,list<int> > m;
//int dis[3000];
//map<int,int> siz;

int main() {

 ll int n,k;
  cin>>n>>k;
 ll int dp[100001][101];
  memset(dp,0,sizeof dp);
 ll int a[101];
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
    dp[i][0]=1;
 ll int sum=a[0];
  for(int i=0;i<=a[0];i++)
  {dp[i][0]=1;}
for(ll int i=1;i<n;i++)
{sum+=a[i];
  for(ll int j=1;j<=sum&j<=k;j++)
  {dp[j][i]=(dp[j-1][i]%mod+dp[j][i-1]%mod)%mod;
}
}

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

    return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'mod' was not declared in this scope; did you mean 'modf'?
   25 |   {dp[j][i]=(dp[j-1][i]%mod+dp[j][i-1]%mod)%mod;
      |                         ^~~
      |                         modf
Language: C++

#include <bits/stdc++.h>
#include<math.h>
using namespace std;
#define int long long int
#define endl "\n"
#define PI 3.14159265
const int mod=1e9+7;
//const int mod=1e9+7;
const int INF =LONG_LONG_MAX;
inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int pow(int a,int n,int mod){if(n==0)return 1;int p=pow(a,n/2,mod);p=(p%mod*p%mod)%mod;if(n%2) return (p%mod*a%mod)%mod;else return p;}

int32_t 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[n+1][k+1];
    int pre[n+1][k+1];

    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            dp[i][j]=0;


            if(j==0){dp[i][j]=1;pre[i][j]=dp[i][j];continue;}
            if(i==0){dp[i][j]=0;pre[i][j]=1;continue;}

            /*  for(int k=0;k<=min(a[i-1],j);k++)
              {
              //    dp[i][j]+=dp[i-1][j-k];
              }*/
              //int d=min(a[i-1],j);
              dp[i][j]=(pre[i-1][j]%mod-((j-d-1)>=0?pre[i-1][j-d-1]:0)%mod)%mod;

              //if(j==0);
               pre[i][j]=(pre[i][j-1]%mod+dp[i][j]%mod)%mod;
        }
    }
   /* for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            cout<<pre[i][j]<<" ";
        }
        cout<<endl;
    }*/
    cout<<dp[n][k]%mod<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:40:45: error: 'd' was not declared in this scope
   40 |               dp[i][j]=(pre[i-1][j]%mod-((j-d-1)>=0?pre[i-1][j-d-1]:0)%mod)%mod;
      |                                             ^
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define inf 9e18
#define pii pair<int,int>
#define ALL(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);
using namespace std;
int n,K;
int dp[101][100005];
int md = 1000000007;
int ways(int i,int k){
    if(i==n){
        if(k==0)
            return 1;
        return 0;
    }
    if(dp[i][k]!=-1)
        return dp[i][k];
    int cur_ways = 0;
    for(int j=0;j<=min(k,a[i]);j++)
        cur_ways = (cur_ways + ways(i+1,k-j))%md;
    return dp[i][k] = cur_ways;
}
int32_t main()
{
    
    fastio
  

   
    cin>>n>>K;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    for(int i=0;i<n;i++)
        for(int j=0;j<=K;j++)
            dp[i][j] = -1;
    cout<<ways(0,K);
    
    return 0;
}

Compiler output:
a.cc: In function 'long long int ways(long long int, long long int)':
a.cc:24:26: error: 'a' was not declared in this scope
   24 |     for(int j=0;j<=min(k,a[i]);j++)
      |                          ^
Language: C++

#include <bits/sdtc++.h>
using namespace std;
#define ll long long
ll mod = 1e9 + 7;
int main()
{




	ll n, k;

	std::cin >> n >> k;
	ll arr[n];
	for (int i = 0; i < n; ++i)
	{
		std::cin >> arr[i];

	}


	ll dp[n + 1][k + 1];
	memset(dp, 0, sizeof dp);

	for (int i = 1; i <= k; i++)
	{	dp[1][i] = (arr[0] < i) ? 0 : 1;
	}


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

	for (int i = 2; i <= n; i++)
	{

		for (int j = 1; j <= k; j++)
		{

			if (j - arr[i - 1] <= 0)
			{
				dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
				dp[i][j] = (dp[i][j] + mod) % mod;
			} else
			{
				dp[i][j]  = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - arr[i - 1]];
				dp[i][j] = (dp[i][j] + mod) % mod;
			}


		}

	}

	// for (int i = 0; i <= n; i++)
	// {

	// 	for (int j = 0; j <= k; j++)
	// 	{
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }



	cout << (dp[n][k] + mod) % mod;


	return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits/sdtc++.h: No such file or directory
    1 | #include <bits/sdtc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;
#define ll long long
ll mod = 1e9 + 7;
int main()
{


#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif

	ll n, k;

	std::cin >> n >> k;
	ll arr[n];
	for (int i = 0; i < n; ++i)
	{
		std::cin >> arr[i];

	}


	ll dp[n + 1][k + 1];
	memset(dp, 0, sizeof dp);

	for (int i = 1; i <= k; i++)
	{	dp[1][i] = (arr[0] < i) ? 0 : 1;
	}


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

	for (int i = 2; i <= n; i++)
	{

		for (int j = 1; j <= k; j++)
		{

			if (j - arr[i - 1] <= 0)
			{
				dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
				dp[i][j] = (dp[i][j] + mod) % mod;
			} else
			{
				dp[i][j]  = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - arr[i - 1]];
				dp[i][j] = (dp[i][j] + mod) % mod;
			}


		}

	}

	// for (int i = 0; i <= n; i++)
	// {

	// 	for (int j = 0; j <= k; j++)
	// 	{
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }



	cout << dp[n][k];


	return 0;
}

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

// n - children, ai - each can take[0,ai], total k candies

#include <iostream>
#include <vector>

using namespace std;

#define mod 1000000007

int main(void){
	int n, k;
	cin >> n >> k;
	vector<int> candies(n);
	for(int i = 0;i < n;i++)
		cin >> candies[i];
	sort(candies.begin(), candies.end());
	vector<int> sum(n, 0);
	sum[0] = candies[0];
	for(int i = 1;i < n;i++)
		sum[i] = sum[i-1]+candies[i];
	vector<vector<int> > dp(n, vector<int>(k+1, 0));
	if(n == 1){
		if(candies[0] <= k){
			cout << 0 << endl;
			return 0;
		}
		cout << 1 << endl;
		return 0;
	}
	vector<vector<long long> > sumdp(n, vector<long long>(k+1, 0));
	for(int i = 0;i < n;i++)
		dp[i][0] = 1, sumdp[i][0] = 1;
	for(int i = 1;i <= k && i <= candies[0];i++)
		dp[0][i] = 1, sumdp[0][i] = 1;
	for(int i = 1;i <= k;i++)
		sumdp[0][i] += sumdp[0][i-1];
	for(int i = 1;i < n;i++){
		int x = 0;
		for(int j = 1;j <= min(sum[i], k);j++){
			if(j <= candies[i]){
				dp[i][j] = sumdp[i-1][j]%mod;
				sumdp[i][j] = dp[i][j];
			}
			else{
				dp[i][j] = (sumdp[i-1][j] - sumdp[i-1][x++])%mod;
				sumdp[i][j] = dp[i][j];
			}
		}
		for(int j = 1;j <= k;j++){
			sumdp[i][j] += sumdp[i][j-1];
		}
	}
	cout << max(0, dp[n-1][k]%1000000007) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |         sort(candies.begin(), candies.end());
      |         ^~~~
      |         short
Language: Java

import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
	public static void main (String[] args) {
      Scanner in = new Scanner(System.in);
      int N = in.nextInt();
      int K = in.nextInt();
      int[] a = new int[N];
      for (int i = 0; i < N; i++) {
        a[i] = in.next();
      }
      int[][] dp = new int[N+1][K+1];
      for(int i=0; i<= N ;i++){
        dp[i][0] = 1;
      }
      for(int i = 1; i<= N ;i++){
        for(int j = 1; j<=K; j++){
          int temp = 0;
          while(temp < a[i] && (j - temp) >=0){
            dp[i][j] += dp[i-1][j-temp];
          }
        }
      }
      
      System.out.println(dp[N][K]);
	}
}

Compiler output:
Main.java:11: error: incompatible types: String cannot be converted to int
        a[i] = in.next();
                      ^
1 error
Language: C++

#include <math.h>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

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

  vector<vector<int>> table(N + 1, vector<int>(K + 1, 0));
  int mod = pow(10, 9) + 7;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= K; ++j) {
      if (i == 1) {
        if (a[0] >= j)
          table[i][j] = 1;
        else
          table[i][j] = 0;
      } else if (j == 0) {
        table[i][j] = 1;
      } else {
        table[i][j] = (table[i - 1][j];
        if (j > a[i - 1]) table[i][j] -= table[i - 1][j - a[i - 1] - 1];
        table[i][j] %= mod;
        table[i][j] += table[i][j - 1]);
        table[i][j] %= mod;
      }
    }
  }
  cout << table[N][K];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:39: error: expected ')' before ';' token
   25 |         table[i][j] = (table[i - 1][j];
      |                       ~               ^
      |                                       )
a.cc:28:39: error: expected ';' before ')' token
   28 |         table[i][j] += table[i][j - 1]);
      |                                       ^
      |                                       ;
Language: C++

#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
int MOD=1e9+7;
 
signed main()
{
   faster;
     {
          int n,k;
          cin>>n>>k;
          int a[n+1];
          for (int i=1;i<=n;i++)
               cin>>a[i];
          long long  dp[n+1][k+1];
          long long pre[n+1][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[1];i++)
               dp[1][i]=1;
          pre[1][0]=dp[1][0];
          for (int i=1;i<=k;i++)
                pre[1][i]=(pre[1][i-1]+dp[1][i])%MOD;
          for (int i=2;i<=n;i++)
          {
               for (int j=0;j<=k;j++)
               {
                    int x=max(j-a[i],0);
                    if (x>0)
                      dp[i][j]=pre[i-1][j]-pre[i-1][x-1];
                    else
                      dp[i][j]=pre[i-1][j];
               }
               pre[i][0]=dp[i][0];
               for (int j=1;j<=k;j++)
                  pre[i][j]=(pre[i][j-1]+dp[i][j])%MOD;
          }
       if(dp[n][k]<0){
         dp[n][k]+=MOD;
       }
       assert(dp[n][k]>=0 && dp[n][k]<MOD);
       cout<<dp[n][k];
     }


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

#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> pref(k+1), dp(k+1);
  dp[0] = 1;
  for(int kid = 1;kid<=n;kid++){
    int c;
    cin >> c;
    pref[0] = dp[0];
    for(int i=1; i<=k; ++i) {
      pref[i] = (pref[i-1] + dp[i]) % MOD;
      dp[i] = (pref[i] - (i-c>=0 ? pref[i-c-1] : 0)) % MOD;
    }

    int ans = dp[k];
    if(ans < 0) ans += MOD; 
    printf("%d\n",ans);

    return 0;
  }


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

#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> pref(k+1), dp(k+1);
  dp[0] = 1;
  for(int kid = 1;kid<=n;kid++){
    int c;
    cin >> c;
    pref[0] = dp[0];
    for(int i=1; i<=k; ++i)
      pref[i] = (pref[i-1] + dp[i]) % MOD;
      dp[i] = (pref[i] - (i-c>=0 ? pref[i-c-1] : 0)) % MOD;
  }

  int ans = dp[k];
  if(ans < 0) ans += MOD; 
  printf("%d\n",ans);

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: 'i' was not declared in this scope
   18 |       dp[i] = (pref[i] - (i-c>=0 ? pref[i-c-1] : 0)) % MOD;
      |          ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int MAXK = 1e5 + 10;
const int MOD = 1e9 + 7;

int pref[MAXK],dp[MAXK],N,K;

int main(){
	cin >> N >> K;
	dp[0] = 1;
	for(int kid = 1;kid<=N;kid++){
		int c;
		cin >> c;
		pref[0] = dp[0];
		dp[0] = 0;
		for(int i = 1;i<=K;i++){
			pref[i] = (pref[i-1] + dp[i]) % MOD;
		}
		for(int i = 0;i<=K;i++){
			dp[i] = (pref[i] - (i-c>=0 ? pref[i-c-1] : 0);
		}
	}

	int ans = dp[K];
	if(ans < 0) ans += MOD; 
	printf("%d\n",ans);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:70: error: expected ')' before ';' token
   22 |                         dp[i] = (pref[i] - (i-c>=0 ? pref[i-c-1] : 0);
      |                                 ~                                    ^
      |                                                                      )
Language: C++

#include<bits/stdc++.h>
using namespace std;
using lint = long long;
const lint MOD = 1e9+7;

signed main(){
	lint N, K; cin >> N >> K;
	vector<lint> a(N);
	for(lint i = 0; i < N; i++) cin >> a[i];
	vector<vector<lint> > dp(N + 1, vector<lint> (K + 1, 0));
	for(lint i = 0; i <= N; i++) dp[i][0] = 1;
	for(lint i = 0; i < N; i++){
		for(lint j = 1; j <= K; j++){
			if(j - 1 - a[i] >= 0){
			  dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j] - dp[i][j - 1 - a[i]]　+ MOD;
				dp[i + 1][j] %= MOD;
			}
			else dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j];
			dp[i + 1][j] %= MOD;
		}
	}
	cout << dp[N][K] << endl;
}


Compiler output:
a.cc:15:91: error: extended character 　 is not valid in an identifier
   15 |                           dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j] - dp[i][j - 1 - a[i]]　+ MOD;
      |                                                                                           ^
a.cc: In function 'int main()':
a.cc:15:91: error: expected ';' before '\U00003000'
   15 |                           dp[i + 1][j] = dp[i + 1][j - 1] + dp[i][j] - dp[i][j - 1 - a[i]]　+ MOD;
      |                                                                                           ^~
      |                                                                                           ;
Language: Java

import java.util.*;
import java.io.*;

 public class Main{
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}

//......................................@uthor_Alx..............................................

   public static void main(String[] args) throws  IOException{
	        		  assign();
	        		  int[] x=int_arr();
	        		  int n=x[0],k=x[1];
	        		  long[][] prefix=new long[n+1][k+1];
	        		  long mod=(long)1e9+7;
	        		  int[] a=int_arr();
	 
	        		  /*
	        		  # prefix[i][j] holds sum of coeff of x^0,x^1,....,x^j  in product
	        		  of 1st i polynomials

	        		  # coeff of X^k in product of 1st i polynomials therefore depends on
	        		  whether highest degree of X (a[i] here) in last polynomial i.e. "ith" poly is
	        		  >= k or not.

	        		  Case1:- if a[i]>=k then all it's term till (x^0,x^1,....,x^k) will contribute
	        		  (see math) so coeff of x^k =prefix[i-1][k]

	        		  Case2:- a[i]<k then all it's term (x^0,x^1,....,x^a[i]) will contribute so 
	        		  in previous product only term contributing are (x^k,x^(k-1),....,x^(k-a[i]))
	        		   so coeff of x^k =prefix[i-1][k]-prefix[i-1][k-a[i]-1];
	        		  */
                      Arrays.fill(prefix[0],1);
	        		  for(int i=1;i<=n;i++){prefix[i][0]=1;}
	        		  for(int i=1;i<=n;i++){
	        		  	  for(int j=1;j<=k;j++){
	        		  	  	long r=(j-a[i-1]-1>=0)?prefix[i-1][j-a[i-1]-1]:0;
	        		  	  	long l=prefix[i-1][j]; 
	        		  	  	prefix[i][j]=(prefix[i][j-1]+(l-r+mod)%mod)%mod;
	        		  	  }
	        		  }
	        		  long r=(k-a[n-1]-1>=0)?prefix[n-1][k-a[n-1]-1]:0;
	        		  long l=prefix[n-1][k]; 
	        		  out.write((l-r+mod)%mod+"");
                      out.flush();
	        		 
	}
}
	       
	          



	
  





Compiler output:
Main.java:8: error: cannot find symbol
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
                                                                                                                                  ^
  symbol:   method int_v(String)
  location: class Main
1 error
Language: C++

import java.util.*;
import java.io.*;

 public class Main{
// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}

//......................................@uthor_Alx..............................................

   public static void main(String[] args) throws  IOException{
	        		  assign();
	        		  int[] x=int_arr();
	        		  int n=x[0],k=x[1];
	        		  long[][] prefix=new long[n+1][k+1];
	        		  long mod=(long)1e9+7;
	        		  int[] a=int_arr();
	        		  Arrays.fill(prefix[0],1);
	        		  for(int i=1;i<=n;i++){prefix[i][0]=1;}
	        		  for(int i=1;i<=n;i++){
	        		  	  for(int j=1;j<=k;j++){
	        		  	  	long r=(j-a[i-1]-1>=0)?prefix[i-1][j-a[i-1]-1]:0;
	        		  	  	long l=prefix[i-1][j]; 
	        		  	  	prefix[i][j]=(prefix[i][j-1]+(l-r+mod)%mod)%mod;
	        		  	  }
	        		  }
	        		  long r=(k-a[n-1]-1>=0)?prefix[n-1][k-a[n-1]-1]:0;
	        		  long l=prefix[n-1][k]; 
	        		  out.write((l-r+mod)%mod+"");
                      out.flush();
	        		 
	}
}
	       
	          



	
  





Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:2: error: expected unqualified-id before 'public'
    4 |  public class Main{
      |  ^~~~~~
Language: C++

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

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


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