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

#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define inf 1000000007
#define int long long
using namespace std;
int dp[2140][2140];
int sum[2140][2140];
signed main(){
	int n,m;
	cin>>n>>m;
	vector<int> s,t;
	for(int i=0;i<n;i++){int x;cin>>x;s.pb(x);}
	for(int i=0;i<m;i++){int x;cin>>x;t.pb(x);}
	dp[0][0]=1;
	for(int i=0;i<=max(n.m);i++){
		sum[i][0]=1;
		sum[0][i]=1;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(s[i-1] == t[j-1]){
				dp[i][j] = sum[i-1][j-1];
				sum[i][j] = sum[i-1][j]+sum[i][j-1]+dp[i][j]-sum[i-1][j-1];
				dp[i][j] %= inf;
				sum[i][j] %= inf;
			}
			else{
				sum[i][j] = sum[i-1][j]+sum[i][j-1]+dp[i][j]-sum[i-1][j-1];
				sum[i][j] %= inf;
			}
			//cout<<dp[i][j]<<endl;
		}
	}
	cout<<sum[n][m]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:30: error: request for member 'm' in 'n', which is of non-class type 'long long int'
   17 |         for(int i=0;i<=max(n.m);i++){
      |                              ^
Language: C++

#include<bits/stdc++.h>
#include<math.h>
#include<vector>
#include<deque>
#include<stdlib.h>
#include <algorithm>
#include<set>
#include<map>
#include <limits>
#include<iomanip>
#include<string>
#include<bitset>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_5 100000
#define d9_7 1000000007
struct input{
  ll num;
  ll times;
  ll pre;
};
int main(void){
  ll n,m;
  cin>>n>>m;
  vector<input> s,t;
  ll ts,tt;
  rep(i,n){
    cin>>ts;
    s.push_back({ts,0,-1});
  }
  rep(i,m){
    cin>>tt;
    t.push_back({tt,0,-1});
  }
  vector<vector<ll>> dp1(m+1,vector<ll>(n+1,0));
  vector<vector<ll>> dp2(m+1,vector<ll>(n+1,0));
    rep(i,m){
      rep(j,n){
        if(s[j].num==t[i].num){
          dp1[i+1][j+1]+=dp2[i][j]+1;
        }else{
          dp1[i+1][j+1]=0;
        }
        dp1[i+1][j+1]%=d9_7;dp2[i+1][j+1]%=d9_7;

          dp2[i+1][j+1]=(dp2[i][j+1]%d9_7+dp2[i+1][j]%d9_7)%d9_7-dp2[i][j%d9_7+dp1[i+1][j+1]%d9_7;
        dp1[i+1][j+1]%=d9_7;dp2[i+1][j+1]%=d9_7;
      }
    }
  /*rep(i,m){
    rep(j,n){
      cout<<dp[i+1][j+1]<<" ";
    }
    cout<<endl;
  }*/
  cout<<(dp2[m][n]+1)%d9_7<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:98: error: expected ']' before ';' token
   50 |           dp2[i+1][j+1]=(dp2[i][j+1]%d9_7+dp2[i+1][j]%d9_7)%d9_7-dp2[i][j%d9_7+dp1[i+1][j+1]%d9_7;
      |                                                                                                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;
ll dsp[2100][2100];
signed main(){
    int n,m;
    cin>>n>>m;
    vector<int>s(n),t(m);
    ll MOD=1e9+7;
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
    }
    for (int i = 0; i < m; i++)
    {
        cin >> t[i];
    }
    //vector<vector<ll>>dp(n+1,vector<ll>(m+1,0));
    memset(dp,0,sizeof(dp));
    vector<vector<ll>>sdp(n+1,vector<ll>(m+1,0));
    dp[0][0]=1;
    for (int i = 0; i <=n; i++)
    {
        for (int j = 0; j <=m; j++)
        {
            if(s[i-1]==t[j-1] && i-1>=0 && j-1>=0) dp[i][j]+=(dp[i-1][j-1])%MOD;
            if(i-1>=0)  dp[i][j]+=(dp[i-1][j])%MOD;
            if(j-1>=0)  dp[i][j]+=(dp[i][j-1])%MOD;
            if(i-1>=0 && j-1>=0) dp[i][j]-=dp[i-1][j-1];
            dp[i][j]%=MOD;
        }   
        
    }
  /*  for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= m; j++)
        {
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
        
    }*/
    
    cout<<dp[n][m]%MOD<<endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   40 |     memset(dp,0,sizeof(dp));
      |            ^~
      |            dup
Language: Java



import java.util.Scanner;

public class cumulativesum {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int m=scan.nextInt();
		int a[]=new int[n+1];
		int b[]=new int[m+1];
		for(int i=0;i<n;i++)
		{
			a[i]=scan.nextInt();
		}
		for(int i=0;i<m;i++)
		{
			b[i]=scan.nextInt();
		}
		a[n]=0;
		b[m]=0;
		long dp[][]=new long[n+1][m+1];
		long cum[][]=new long[n+1][m+1];
		for(int i=0;i<=n;i++)
		{
			dp[i][0]=(a[i]==b[0])?1:0;
			long prev=(i>0)?cum[i-1][0]:0;
			cum[i][0]=dp[i][0]+prev;
			
		}
		for(int j=0;j<=m;j++)
		{
			dp[0][j]=(a[0]==b[j])?1:0;
			long prev=(j>0)?cum[0][j-1]:0;
			cum[0][j]=prev+dp[0][j];
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(a[i]==b[j]) {
					dp[i][j]=(cum[i-1][j-1]+1)%1000000007;
				}else {
					dp[i][j]=0;
				}
				cum[i][j]=(((((cum[i][j-1]+cum[i-1][j])%1000000007)-cum[i-1][j-1])%1000000007)+dp[i][j])%1000000007;
			}
		}
		System.out.println(dp[n][m]);
	}
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mad=1000000007;
ll dp[2005][2005];
int a[2005],b[2005];

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=m; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
           dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1])%mad;
            if(a[i]==b[j])
                dp[i][j]=(dp[i][j]+dp[i-1][j-1]+1)%mod;


        }
    }

    printf("%lld\n",(dp[n][m]%mad+1+mad)%mad);
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
const int mad=1000000007;
ll dp[2005][2005];
int a[2005],b[2005];

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(int i=1; i<=m; i++)
        scanf("%d",&b[i]);
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
           dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1])%mad;
            if(a[i]==b[j])
                dp[i][j]=(dp[i][j]+dp[i-1][j-1]+1);


        }
    }

    printf("%lld\n",(dp[n][m]%mad+1+mad)%mad);
    return 0;
}


Compiler output:
a.cc:4:1: error: 'll' does not name a type
    4 | ll dp[2005][2005];
      | ^~
a.cc: In function 'int main()':
a.cc:19:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   19 |            dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1])%mad;
      |            ^~
      |            dup
a.cc:27:22: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |     printf("%lld\n",(dp[n][m]%mad+1+mad)%mad);
      |                      ^~
      |                      dup
Language: C++

//参考:http://kmjp.hatenablog.jp/entry/2019/06/17/0930  ムズかしい.....><
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main(void){
    int n,m; cin>>n>>m;
    vector <ll> s(n), t(m);
    rep(i,n) cin>>s[i];
    rep(i,m) cin>>t[i];
    vector <vector<ll>> dp(2019 ,vector <ll>(2019 ));
    vector <vector<ll>> sum(2019 ,vector <ll>(2019));
    rep(i,2019) sum[i][0]=sum[0][i]=1;
    ll ans = 1;
    rep(i,n) rep(j,m){
        if(s[i]==t[j]) {dp[i+1][j+1] = sum[i][j]%MOD; ans += dp[i+1][j+1]; ans %= MOD}
        sum[i+1][j+1] = (sum[i+1][j]%MOD + sum[i][j+1]%MOD + dp[i+1][j+1]%MOD - sum[i][j]) %MOD;
    }
    cout<<ans%MOD<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:86: error: expected ';' before '}' token
   17 |         if(s[i]==t[j]) {dp[i+1][j+1] = sum[i][j]%MOD; ans += dp[i+1][j+1]; ans %= MOD}
      |                                                                                      ^
      |                                                                                      ;
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
//https://stackoverflow.com/questions/31065929/number-of-common-sub-sequences-of-two-strings
//https://www.geeksforgeeks.org/count-common-subsequence-in-two-strings/

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next(
    		) throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
	
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}

public class E_CommonSubSequence {
	
	static int mod=1000000007;
	
	public static void main(String[] args) throws IOException{
		Reader.init(System.in);
		int N=Reader.nextInt();
		int M=Reader.nextInt();
		int S[]=new int[N];
		int T[]=new int[M];
		for(int i=0;i<N;i++) {
			S[i]=Reader.nextInt();
		}
		for(int i=0;i<M;i++) {
			T[i]=Reader.nextInt();
		}
		int result=commonSubsequence(S,T, N, M);
		System.out.println(result);
	}

	private static int commonSubsequence(int[] s, int[] t, int n, int m) {
		int dp[][]=new int[n+1][m+1];
		
		for(int i=0;i<=n;i++) {
			dp[i][0]=1;
		}
		for(int j=0;j<=m;j++) {
			dp[0][j]=1;
		}
		
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=m;j++) {
				if(s[i-1]==t[j-1]) {
					dp[i][j]=dp[i][j-1]+dp[i-1][j];
				}
	            else {
	            	dp[i][j]=dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1];
	            }
				dp[i][j]%=mod;
			}
		}
		return dp[n][m];
	}
  
}


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

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

#define int long long
#define rep(i,a,b) for(int i = a; i < b; i++)
const int mod = 1e9 + 7;

signed main() {
    int N, M;
    cin >> N >> M;
    int S[N];
    rep(i,0,N) cin >> S[i];
    int T[M];
    rep(j,0,M) cin >> T[j];

    int dp[N+1][M+1];
    rep(i,0,N+1) {
        rep(j,0,M+1) {
            if (i == 0 || j == 0) {
                dp[i][j] = 1;
            }
            else {
                dp[i][j] = 0;
            }
        }
    }

    rep(i,1,N+1) {
        rep(j,1,M+1) {
            if (S[i-1] == T[j-1]) {
                dp[i][j] = dp[i][j-1] + dp[i-1][j];
            }
            else {
                dp[i][j] = dp[i][j-1] + dp[i-1][j] - dp[i-1][j-1];
            }
            dp[i][j] = (dp[i][j] + mod) % mod
        }
    }

    int ans = dp[N][M];
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:46: error: expected ';' before '}' token
   36 |             dp[i][j] = (dp[i][j] + mod) % mod
      |                                              ^
      |                                              ;
   37 |         }
      |         ~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N, M; cin >> N >> M;
    char S[2020], T[2020];
    rep(i, N) cin >> S[i];
    rep(i, M) cin >> T[i];
    ll dp[2020][2020], sdp[2020][2020];
    memset(dp, 0, sizeof(dp));
    memset(sdp, 0, sizeof(sdp));
    dp[0][0] = 1LL;
    sdp[1][1] = 1LL;
    for(int i = 0; i <= N ; i++) {
        for(int j = 0; j <= M; j++) {
            if(i == 0 && j == 0) continue;
            if(i - 1 >= 0 && j - 1 >= 0 && S[i - 1] == T[j - 1]) {
                dp[i][j] = sdp[i][j];
            }
            sdp[i + 1][j + 1] = sdp[i][j + 1] + sdp[i + 1][j] - sdp[i][j] + dp[i][j];
            sdp[i + 1][j + 1] = (sdp[i + 1][j + 1] + mod) % mod;
        }
    }
    cout << sdp[N + 1][M + 1] << endl;
	return 0;
}

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

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;

ll dp[2010][2010];

int main(){
ll N,M; cin >> N >> M;
  vector<ll> S(N); vector<ll> T(M);
  for(ll i = 0; i < N; i++){ cin >> S[i];}
    for(ll j = 0; j < M; j++){cin >> T[j];}
  
 for(ll i  =0; i < 2010; i++){
   for(ll j = 0; j < 2010; j++){
     dp[i][j] = 0;}}
  
   dp[0][0] = 1;
  
  for(ll i = 0; i <= N; i++){
    for(ll j = 0; j <= M; j++){
      if( i - 1 >= 0 && j - 1 >= 0 && S[i-1] == T[j-1]){ dp[i][j] += dp[i-1][j-1];
                                                       dp[i][j] %= MOD;}
     　if( i-1 >= 0){ dp[i][j] += dp[i-1][j]; dp[i][j] %= MOD;}
      if( j-1 >= 0){ dp[i][j] += dp[i][j-1]; dp[i][j] %= MOD;}
      if( i - 1 >= 0 && j - 1 >= 0){ dp[i][j] -= dp[i-1][j-1];}
      dp[i][j] = dp[i][j] % MOD;
    }}
  
  dp[N][M] = dp[N][M] % MOD;
  cout << dp[N][M] << endl; return 0;}

Compiler output:
a.cc:30:6: error: extended character 　 is not valid in an identifier
   30 |      　if( i-1 >= 0){ dp[i][j] += dp[i-1][j]; dp[i][j] %= MOD;}
      |      ^
a.cc: In function 'int main()':
a.cc:30:6: error: '\U00003000if' was not declared in this scope
   30 |      　if( i-1 >= 0){ dp[i][j] += dp[i-1][j]; dp[i][j] %= 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++)
#define repf(i,j,n) for(int i=(j);i<(n);i++)
#define repe(i,j,n) for(int i=(j);i<=(n);i++)
#define repr(i,j,n) for(int i=(n)-1;i>=0;i--)

int mod=1e9+7;


signed main(){
	int n,m;cin>>n>>m;
	vector<int> s(n+1),t(m+1);
	repe(i,n)cin>>s[i];
	repe(i,m)cin>>t[i];
	vector<vector<int>>num(n+1,vector<int>(m+1,0));
	vector<vector<int>>sum(n+1,vector<int>(m+1,0));
	num[0][0]=1;
	rep(i,n)sum[i][0]=1;
	rep(i,m)sum[0][i]=1;

	rep(i,n)rep(j,m){
		if(s[i]==t[j]){num[i+1][j+1]=sum[i][j];}
		sum[i+1][j+1]=(num[i+1][j+1]+sum[i+1][j]+sum[i][j+1]+mod-sum[i][j])%mod;
	}
	cout<<sum[n][m]<<endl;
}


Compiler output:
a.cc:15:17: error: macro "repe" requires 3 arguments, but only 2 given
   15 |         repe(i,n)cin>>s[i];
      |                 ^
a.cc:6:9: note: macro "repe" defined here
    6 | #define repe(i,j,n) for(int i=(j);i<=(n);i++)
      |         ^~~~
a.cc:16:17: error: macro "repe" requires 3 arguments, but only 2 given
   16 |         repe(i,m)cin>>t[i];
      |                 ^
a.cc:6:9: note: macro "repe" defined here
    6 | #define repe(i,j,n) for(int i=(j);i<=(n);i++)
      |         ^~~~
a.cc: In function 'int main()':
a.cc:15:9: error: 'repe' was not declared in this scope
   15 |         repe(i,n)cin>>s[i];
      |         ^~~~
a.cc:16:13: error: expected ';' before 'cin'
   16 |         repe(i,m)cin>>t[i];
      |             ^    ~~~
      |             ;
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

uint32_t dp[2001][2001] = {0};
uint32_t ss[2001] = {};
uint32_t ts[2001] = {};

static const uint32_t kRem = 1000000007;

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

	int n, m; cin >> n >> m;
	FOR_LE(i, 1, n) {
		fscanf_s(stdin, "%u", &ss[i]);
	}
	FOR_LE(i, 1, m) {
		fscanf_s(stdin, "%u", &ts[i]);
	}

	FOR_LE(i, 0, n) {
		dp[i][0] = 1;
	}
	FOR_LE(j, 0, m) {
		dp[0][j] = 1;
	}

	FOR_LE(i, 1, n) {
		FOR_LE(j, 1, m) {
			uint32_t val = dp[i][j - 1];
			if (ss[i] == ts[j]) {
				val += dp[i - 1][j - 1];
			}
			val += (dp[i - 1][j] - dp[i - 1][j - 1]);

			val %= kRem;
			if (val < 0) val += kRem;
			dp[i][j] = val;
		}
	}

	printf("%d\n", dp[n][m]);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:17: error: 'fscanf_s' was not declared in this scope; did you mean 'fscanf'?
   44 |                 fscanf_s(stdin, "%u", &ss[i]);
      |                 ^~~~~~~~
      |                 fscanf
a.cc:47:17: error: 'fscanf_s' was not declared in this scope; did you mean 'fscanf'?
   47 |                 fscanf_s(stdin, "%u", &ts[i]);
      |                 ^~~~~~~~
      |                 fscanf
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 2020;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const int mod =  1e9+7;
ll n,m;
ll a[N];
ll b[N];
ll dp[N][N];

int main()
{
cin>>n>>m;
rep(i,1,n+1)
cin>>a[i];
rep(i,1,n+1)
cin>>b[i];
rep(i,0,N)
{
	dp[i][0]=1;
	dp[0][i]=1;
}
rep(i,1,n+1)
{
	rep(j,1,m+1)
	{
		if(a[i]==b[j])
		{

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

	}
		else
		dp[i][j]=(mod+dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1]);
	
	   	dp[i][j]=(dp[i][j])%mod;
	}
}
cout<<dp[n][m];
}
	



Compiler output:
a.cc: In function 'int main()':
a.cc:9:114: error: assignment of read-only variable 'i'
    9 | #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
      |                                                                                                                  ^
a.cc:23:1: note: in expansion of macro 'rep'
   23 | rep(i,0,N)
      | ^~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

long long dp[2020][2020];
long long sum[2020][2020];
long long ret;
int main() {
    int N, M;
    cin >> N >> M;
    vector<long long> S(N);
    vector<long long> T(M);
    REP(i, N) { cin >> S[i]; }
    REP(i, M) { cin >> T[i]; }
    // dp(i+1,j+1) 等しい部分列かつS[i] = T[j] が末尾であるような組み合わせ
    REP(i, 2020) {
        sum[i][0] = 1;
        sum[0][i] = 1;
    }
    long long res = 1;
    REP(x, N) {
        REP(y, M) {
            if(S[x] == T[y]) {
                dp[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
                ret += dp[x + 1][y + 1];
            }
            long long tmp = sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] +
                            dp[x + 1][y + 1];
            sum[x + 1][y + 1] = tmp % MOD;
        }
    }
    cout << ret % MOD << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:61: error: 'mo' was not declared in this scope
   54 |             long long tmp = sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] +
      |                                                             ^~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

long long dp[2020][2020];
long long sum[2020][2020];
long long ret;
int main() {
    int N, M;
    cin >> N >> M;
    vector<long long> S(N);
    vector<long long> T(M);
    REP(i, N) { cin >> S[i]; }
    REP(i, M) { cin >> T[i]; }
    // dp(i+1,j+1) 等しい部分列かつS[i] = T[j] が末尾であるような組み合わせ
    REP(i, 2020) {
        sum[i][0] = 1;
        sum[0][i] = 1;
    }
    long long res = 1;
    REP(x, N) {
        REP(y, M) {
            if(S[x] == T[y]) {
                dp[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
                ret += dp[x + 1][y + 1];
            }
        }
        long long tmp =
            sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + dp[x + 1][y + 1];
        sum[x + 1][y + 1] = tmp % MOD;
    }
    cout << ret % MOD << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:20: error: 'y' was not declared in this scope
   56 |             sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + dp[x + 1][y + 1];
      |                    ^
a.cc:56:45: error: 'mo' was not declared in this scope
   56 |             sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + dp[x + 1][y + 1];
      |                                             ^~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

long long dp[2020][2020];
long long sum[2020][2020];
int main() {
    int N, M;
    cin >> N >> M;
    vector<long long> S(N);
    vector<long long> T(M);
    REP(i, N) { cin >> S[i]; }
    REP(i, M) { cin >> T[i]; }
    // dp(i+1,j+1) 等しい部分列かつS[i] = T[j] が末尾であるような組み合わせ
    REP(i, 2020) {
        sum[i][0] = 1;
        sum[0][i] = 1;
    }
    long long res = 1;
    REP(x, N) {
        REP(y, M) {
            if(S[x] == T[y]) {
                dp[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
                ret += dp[x + 1][y + 1];
            }
        }
        long long tmp =
            sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + dp[x + 1][y + 1];
        sum[x + 1][y + 1] = tmp % MOD;
    }
    cout << ret % MOD << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:17: error: 'ret' was not declared in this scope; did you mean 'res'?
   51 |                 ret += dp[x + 1][y + 1];
      |                 ^~~
      |                 res
a.cc:55:20: error: 'y' was not declared in this scope
   55 |             sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + dp[x + 1][y + 1];
      |                    ^
a.cc:55:45: error: 'mo' was not declared in this scope
   55 |             sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + dp[x + 1][y + 1];
      |                                             ^~
a.cc:58:13: error: 'ret' was not declared in this scope; did you mean 'res'?
   58 |     cout << ret % MOD << endl;
      |             ^~~
      |             res
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

long long dp[2020][2020];
long long sum[2020][2020];
int main() {
    int N, M;
    cin >> N >> M;
    vector<long long> S(N);
    vector<long long> T(M);
    REP(i, N) { cin >> S[i]; }
    REP(i, M) { cin >> T[i]; }
    // dp(i+1,j+1) 等しい部分列かつS[i] = T[j] が末尾であるような組み合わせ
    REP(i, 2020) {
        sum[i][0] = 1;
        sum[0][i] = 1;
    }
    long long res = 1;
    REP(x, N) {
        REP(y, M) {
            if(S[x] == T[y]) {
                num[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
                ret += num[x + 1][y + 1];
            }
        }
        long long tmp =
            sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + num[x + 1][y + 1];
        sum[x + 1][y + 1] = tmp % MOD;
    }
    cout << ret % MOD << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:17: error: 'num' was not declared in this scope; did you mean 'sum'?
   50 |                 num[x + 1][y + 1] = sum[x][y] % MOD; // xyまでの累積和
      |                 ^~~
      |                 sum
a.cc:51:17: error: 'ret' was not declared in this scope; did you mean 'res'?
   51 |                 ret += num[x + 1][y + 1];
      |                 ^~~
      |                 res
a.cc:55:20: error: 'y' was not declared in this scope
   55 |             sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + num[x + 1][y + 1];
      |                    ^
a.cc:55:45: error: 'mo' was not declared in this scope
   55 |             sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + num[x + 1][y + 1];
      |                                             ^~
a.cc:55:62: error: 'num' was not declared in this scope; did you mean 'sum'?
   55 |             sum[x][y + 1] + sum[x + 1][y] + mo - sum[x][y] + num[x + 1][y + 1];
      |                                                              ^~~
      |                                                              sum
a.cc:58:13: error: 'ret' was not declared in this scope; did you mean 'res'?
   58 |     cout << ret % MOD << endl;
      |             ^~~
      |             res
Language: C++

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

#deine m 1000000007
int main(){
  
  int n,m,j,i;
  cin>>n>>m;
  vector<long int>s(n),t(m);
  
  for(i=0;i<n;i++) cin>>s[i];
  for(i=0;i<m;i++) cin>>t[i];
  
  vector<vector<long int>>dp(n+1,vector<long int>(m+1,0));
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      if(s[i-1] == t[j-1])
         dp[i][j] =  (dp[i-1][j] + dp[i][j-1]+1)%m;
      else
        dp[i][j] = (dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1])%m;
    }
  }
  cout<<dp[n][m]%m;
  return 0;
}

Compiler output:
a.cc:4:2: error: invalid preprocessing directive #deine; did you mean #define?
    4 | #deine m 1000000007
      |  ^~~~~
      |  define
Language: C++

#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll div_ceil(ll, ll);

int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};

int main() {
  ll N, M;
  std::cin >> N >> M;
  ll S[N];
  ll T[M];
  REP(i, N) { std::cin >> S[i]; }
  REP(i, M) { std::cin >> T[i]; }
  ll dp[N + 1][M + 1] = {};
  ll sum[N + 1][M + 1] = {};
  ll ans = 1;
  REP(i, N) {
    REP(j, M) {
      if (S[i] == T[j]) {
        dp[i + 1][j + 1] = sum[i][j] + 1;
        ans += dp[i + 1][j + 1] % MOD;
      }
      sum[i + 1][j + 1] = sum[i + 1][j] % MOD + sum[i][j + 1] % MOD -
                          sum[i][j] % MOD + dp[i + 1][j + 1]
    }
  }
  std::cout << ans % MOD << '\n';
}

ll div_ceil(ll a, ll b) {
  ll quotient = a / b;
  ll remainder = a % b;
  if (remainder == 0) {
    return quotient;
  } else {
    return quotient + 1;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:61: error: expected ';' before '}' token
   32 |                           sum[i][j] % MOD + dp[i + 1][j + 1]
      |                                                             ^
      |                                                             ;
   33 |     }
      |     ~
Language: C++

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)


const int MOD = 1000000007;

int N, M;
vector<long long> S, T;

mint dp[2100][2100];
mint sdp[2100][2100];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while (cin >> N >> M) {
        S.resize(N+1); T.resize(M+1);
        for (int i = 0; i < N; ++i) cin >> S[i];
        for (int i = 0; i < M; ++i) cin >> T[i];

        memset(dp, 0, sizeof(dp));
        memset(sdp, 0, sizeof(sdp));
        dp[0][0] = 1;
        sdp[0][0] = 1;
        for (int i = 0; i < 2100; ++i) sdp[0][i] = 1, sdp[i][0] = 1;
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < M; ++j) {
                if (i < N && j < M && S[i] == T[j]) {
                    dp[i+1][j+1] = sdp[i][j];
                }
                sdp[i+1][j+1] = sdp[i][j+1] + sdp[i+1][j] - sdp[i][j] + dp[i+1][j+1];
            }
        }
        cout << sdp[N][M] << endl;
    }
}














Compiler output:
a.cc:35:1: error: 'mint' does not name a type; did you mean 'uint'?
   35 | mint dp[2100][2100];
      | ^~~~
      | uint
a.cc:36:1: error: 'mint' does not name a type; did you mean 'uint'?
   36 | mint sdp[2100][2100];
      | ^~~~
      | uint
a.cc: In function 'int main()':
a.cc:47:16: error: 'dp' was not declared in this scope
   47 |         memset(dp, 0, sizeof(dp));
      |                ^~
a.cc:48:16: error: 'sdp' was not declared in this scope
   48 |         memset(sdp, 0, sizeof(sdp));
      |                ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,i,j,d,cnt=0;
  cin>>n>>m;
  int s[n],t[m],matrix[n][m]={{0}};
  for(i=0;i<n;i++)cin>>s[i];
  for(j=0;j<m;j++)cin>>t[j];
  
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      for(d=0;i+d<n&&j+d<m;d++){
        if(s[i+d]==t[j+d]]){
          cnt++;
        }
      }
    }
  }
  cout<<cnt+1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:26: error: expected ')' before ']' token
   13 |         if(s[i+d]==t[j+d]]){
      |           ~              ^
      |                          )
a.cc:13:26: error: expected primary-expression before ']' token
Language: C++

//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=0;i<n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 4005;
const lo mod = 1000000007;

lo n,m,b[li],a[li],k,flag,dp[li];
lo cev;
string s;
vector<int> v;

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

int main(void){
	scanf("%lld %lld",&n,&m);
	FOR{
		scanf("%lld",&a[i]);
	}
	for(lo i=0;i<m;i++){
		scanf("%lld",&b[i]);
	}
	for(lo i=0;i<=n+m+1;i++){
		dp[i]=1;
	}
	for(lo i=n;i>=1;i--){
		//~ for(lo j=i;j<m+i;j++){
			if ((i & 7) || (j & 7)) {
				if(a[n-i]==b[j-i]){
					dp[j]=(add(dp[j-1],dp[j+1]))%mod;
				}
				else{
					dp[j]=(add(dp[j-1],dp[j+1])-dp[j])%mod;
				}
			//~ }
			//~ else{
				//~ if(a[n-i]==b[j-i]){
					//~ dp[j]=((dp[j-1]+dp[j+1]));
				//~ }
				//~ else{
					//~ dp[j]=(dp[j-1]+dp[j+1]-dp[j]);
				//~ }
			//~ }
		}
	}
	printf("%lld\n",(dp[m]%mod+mod)%mod);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:41: error: 'j' was not declared in this scope
   59 |                         if ((i & 7) || (j & 7)) {
      |                                         ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
using R = double;
using Data = pair < ll, vector <ll>>;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
struct edge { ll from; ll to; ll cost; };
typedef pair<ll, ll>pll;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

ll dp[2020][2020];
int main() {
	ll N, M;
	cin >> N >> M;
	vector<ll>S(N), T(M);
	rep(i, 0, N)cin >> S[i];
	rep(i, 0, M)cin >> T[i];

	dp[0][0] = 1;
	rep(i, 0, 2020)dp[i][0] = 1;
	rep(j, 0, 2020)dp[0][j] = 1;
	rep(i, 1, N+1)rep(j, 1, M+1) {
		if (S[i-1] == T[j-1]) {
			dp[i][j] += dp[i - 1][j - 1];
		}
		dp[i][j] += dp[i - 1][j] + dp[i][j-1];
		dp[i][j] -= dp[i - 1][j - 1];
		dp[i][j] %= MOD;
	}
	cout << dp[N][M] % MOD; << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:33: error: expected primary-expression before '<<' token
   58 |         cout << dp[N][M] % MOD; << endl;
      |                                 ^~
Language: C++

n,m = map(int,input().split())
S = ['a']+list(input().split())
T = ['a']+list(input().split())
dp = [[1]*(n+1) for i in range(m+1)]
mod = 10**9+7
#dp[i][j]:sのi番までとtのj番目まででの共通部分列の個数
for i in range(1,n+1):
    for j in range(1,m+1):
        if S[i]==T[j]:
            dp[i][j] = dp[i-1][j]+dp[i][j-1]
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])
        dp[i][j]%=mod
print(dp[-1][-1])

Compiler output:
a.cc:6:2: error: invalid preprocessing directive #dp
    6 | #dp[i][j]:sのi番までとtのj番目まででの共通部分列の個数
      |  ^~
a.cc:1:1: error: 'n' does not name a type
    1 | n,m = map(int,input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
 
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
 
int fac[MAX_N], inv[MAX_N];
 
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b, bool usemod = true) {ll c = 1LL; while (b > 0) {if (b & 1LL) {if(!usemod)c*=a;else c = a * c%mod;}if (!usemod) a*=a;else a = a * a%mod; b >>= 1LL;}return c;}
void _nCr() {fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) {fac[i] = fac[i - 1LL] * i%mod;}for (int i = 0; i < MAX_N; i++) {inv[i] = POW(fac[i], mod - 2);}}
ll nCr(ll n, ll r) {return (fac[n] * inv[r] % mod)*inv[n - r] % mod;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}

dp[2005][2005]

bool solve() {
	int n,m; cin>>n>>m;
	vi s(n),t(m);
	REP (i,n) cin>>s[i];
	REP (i,m) cin>>t[i];
	REP (i,2005) REP (j,2005) dp[i][j] = 1;
	REP (i,n) {
		REP (j,m) {
			dp[i+1][j+1] = dp[i][j+1] + dp[i+1][j];
			if (s[i] != t[j]) {
				dp[i+1][j+1] -= dp[i][j];
			}
			dp[i+1][j+1] %= mod;
		}
	}
	cout << dp[n][m] << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
}

Compiler output:
a.cc:39:1: error: 'dp' does not name a type; did you mean 'mp'?
   39 | dp[2005][2005]
      | ^~
      | mp
a.cc: In function 'int main()':
a.cc:62:9: error: 'solve' was not declared in this scope
   62 |         solve();
      |         ^~~~~
Language: Java

import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String[] num = sc.nextLine();
    String[] s = sc.nextLine();
    String[] t = sc.nextLine();
    int n = Integer.parseInt(num[0]);
    int m = Integer.parseInt(num[1]);
    int[][] dp = new int[n+1][m+1];
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= m; j++){
        dp[i][j] = 1 + dp[i-1][j] + dp[i][j-1];
        if (s[i-1].equals(t[j-1])){
          dp[i][j] -= 1 + dp[i-1][j-1];
        }
      }
    }
    System.out.println((dp[-1][-1]+1) % 1000000007);
  }
}


Compiler output:
Main.java:6: error: incompatible types: String cannot be converted to String[]
    String[] num = sc.nextLine();
                              ^
Main.java:7: error: incompatible types: String cannot be converted to String[]
    String[] s = sc.nextLine();
                            ^
Main.java:8: error: incompatible types: String cannot be converted to String[]
    String[] t = sc.nextLine();
                            ^
3 errors
Language: Java

import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String[] num = sc.nextLine();
    String[] s = sc.nextLine();
    String[] t = sc.nextLine();
    int n = Integer.parseInt(num[0]);
    int m = Integer.parseInt(num[1]);
    int[][] dp = new int[n+1][m+1]
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= m; j++){
        dp[i][j] = 1 + dp[i-1][j] + dp[i][j-1];
        if (s[i-1].equals(t[j-1])){
          dp[i][j] -= 1 + dp[i-1][j-1];
        }
      }
    }
    System.out.println((dp[-1][-1]+1) % 1000000007);
  }
}


Compiler output:
Main.java:11: error: ';' expected
    int[][] dp = new int[n+1][m+1]
                                  ^
1 error
Language: C++

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

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if (x += a.x >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if (x += mod-a.x >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};

mint dp0[2005][2005];
mint dp1[2005][2005];

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> s(n+1), t(m+1);
  rep(i,n) scanf("%d", s[i]);
  rep(i,m) scanf("%d", t[i]);
  dp0[0][0] = 1;
  rep(i,n+1)rep(j,m+1) {
    dp0[i+1][j] += dp0[i][j];
    dp1[i][j] += dp0[i][j];
    dp1[i][j+1] += dp1[i][j];
    if (s[i] == t[j]) {
      dp0[i+1][j+1] += dp1[i][j];
    }
  }
  mint ans = dp1[i][j];
  cout << ans.x << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:18: error: 'i' was not declared in this scope
   54 |   mint ans = dp1[i][j];
      |                  ^
a.cc:54:21: error: 'j' was not declared in this scope
   54 |   mint ans = dp1[i][j];
      |                     ^
Language: Java


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int m = in.nextInt();
        final int n = in.nextInt();
        final long[] ms = new long[m];
        final long[] ns = new long[n];
        for (int i = 0; i < m; i++) {
            ms[i] = in.nextInt();
        }
        for (int i = 0; i < n; i++) {
            ns[i] = in.nextInt();
        }
        final long[][] sum = new long[m + 1][n + 1];
//        final long[][] dp = new long[m][n];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
//                if (ms[i] == ns[j]) {
//                    dp[i][j] = sum[i][j] + 1;
//                } else {
//                    dp[i][j] = 0;
//                }
                sum[i + 1][j + 1] += sum[i + 1][j];
                sum[i + 1][j + 1] += sum[i][j + 1];
                sum[i + 1][j + 1] -= sum[i][j];
                sum[i + 1][j + 1] += 1_000_000_007;
                sum[i + 1][j + 1] %= 1_000_000_007;
                if (ms[i] == ns[j]) {
                    sum[i + 1][j + 1] += sum[i][j] + 1;;\
                }
                sum[i + 1][j + 1] %= 1_000_000_007;
//                dp[i][j] %= 1_000_000_007;
            }
        }
        System.out.println((sum[m][n] + 1) % 1_000_000_007);
    }
}


Compiler output:
Main.java:34: error: illegal character: '\'
                    sum[i + 1][j + 1] += sum[i][j] + 1;;\
                                                        ^
1 error
Language: C++

#include<stdc++.h>
using namespace std;
int main()
{
  int N,M;
  cin>>N>>M;
  for(int N>=1;N<=2000;N++)
  for(int M>=1;M<=2000;M++)
    cout<<"N*M-1000000007";
  return 0;
}

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

#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;

int N, M;
vector<int> S, T;
#include "Modulo.h"
#define MOD 1000000007

vector<vector<bool>> memo;
vector<vector<Modint>> dp;

Modint dfs(int i, int j) {
	if (memo[i][j])
		return dp[i][j];
	Modint test1 = dfs(i - 1, j);
	Modint test2 = dfs(i, j - 1);
	Modint test3 = S[i] == T[j] ? 0 : dfs(i - 1, j - 1);
	const Modint res = dfs(i - 1, j) + dfs(i, j - 1) - ((S[i] == T[j]) ? 0 : dfs(i - 1, j - 1));
	dp[i][j] = res;
	memo[i][j] = true;
	return res;
}

int main() {
	cin >> N >> M;
	S = vector<int>(N+1), T = vector<int>(M+1);
	for (int i = 1; i <= N; i++)
		cin >> S[i];
	for (int j = 1; j <= M; j++)
		cin >> T[j];
	set_mod(MOD);

	memo = vector<vector<bool>>(N + 1, vector<bool>(M + 1, false));
	dp = vector<vector<Modint>>(N + 1, vector<Modint>(M + 1, 0));
	for (int i = 0; i <= N; i++)
	{
		memo[i][0] = true;
		dp[i][0] = 1;
	}
	for (int j = 0; j <= M; j++)
	{
		memo[0][j] = true;
		dp[0][j] = 1;
	}

	Modint ans = dfs(N, M);
	cout << ans << endl;
	return 0;
}


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

#include <iostream>
#include <vector>


#define MOD 1000000007

using namespace std;

long long int accum[2048][2048] = {};

int main() {
  int N, M;
  cin >> N >> M;

  vector<int> S, T;
  S.push_back(0);
  T.push_back(0);
  
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    S.push_back(tmp);
  }

  for (int i = 0; i < M; i++) {
    int tmp;
    cin >> tmp;
    T.push_back(tmp);
  }

  N++;
  M++;

  dp[0][0] = 1;
  accum[0][0] = 1;

  for (int s = 1; s < N; s++) {
    accum[s][0] = 1;
  }

  for (int t = 1; t < M; t++) {
    accum[0][t] = 1;
  }


  for (int s = 1; s < N; s++) {
    for (int t = 1; t < M; t++) {
      long long int dp;
      if (S[s] == T[t]) {
        dp = accum[s-1][t-1];
      } else {
        dp = 0;
      }

      accum[s][t] = (dp + accum[s-1][t] + accum[s][t-1] - accum[s-1][t-1]) % MOD;
    }
  }

  cout << accum[N-1][M-1] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:3: error: 'dp' was not declared in this scope
   34 |   dp[0][0] = 1;
      |   ^~