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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n,m;
  cin >> n >> m;
  vec s(n),t(m);
  for(ll i=0;i<n;i++) cin >> s[i];
  for(ll i=0;i<m;i++) cin >> t[i];
  mat sum(n+1,vec(m+1));
  mat dp(n+1,vec(m+1));
  for(ll i=0;i<n;i++) {
    for(ll j=0;j<m;j++) {
      if(s[i]==t[j]) {
        dp[i+1][j+1]=(dp[i][j]+1);
      }
      sum[i+1][j+1]=sum[i+1][j]+sum[i][j+1]-sum[i][j]+dp[i+1][j+1];
    }
  cout << sum[n][m] << endl;
}

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

#include <algorithm>
#include <iostream>

using namespace std;

const int M = 1e9+7;
int n, m;
int s[2200];
int t[2200];
long long dp[2200][2200];
long long sum[2200][2200];

int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> t[i];
  }
  
  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] + 1) % M;
        ans = max(ans, dp[i][j]);
      }
      sum[i][j] += (sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + dp[i][j] + M) % M;
    }
  }
  
  cout << (sum[n][m] + 1) % M << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |         ans = max(ans, dp[i][j]);
      |         ^~~
      |         abs
Language: C++

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

int main(){
    
    int n,m;
    cin>>n>>m;
    int a[1000],b[1000];
    int dp[6002][6002];
    memset(dp, 0, sizeof dp);

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

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++){

            if(a[i-1]==b[j-1]){
                dp[i][j]=(1+dp[i-1][j]%mod + dp[i][j-1]%mod)%mod;
            }
            else 
            {
                dp[i][j]=(dp[i-1][j]%mod + dp[i-1][j-1]%mod + mod)%mod;
            }
        }    
        
    }
    cout<<(dp[n][m]+1)%mod;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'memset' was not declared in this scope
   12 |     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 | #define mod 100000007
Language: C++

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


int main() {
    
    int n,m;
    cin>>n>>m;
    int a[n],b[m];
    int dp[6002][6002];

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

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++){

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

  return 0;
}


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

#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

#define FOR(i,m,n) for(int i=(m); i<(n); i++)
#define REP(i,n) for(int i=0; i<(n); i++)
#define RFOR(i,n,m) for(int i=(n);i>=(m); i--)
#define RREP(i,n) for(int i=(n-1); (i)>=0; i--)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = 100100100;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct mint 
{
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> s(n+1), t(m+1);
    REP(i,n) cin >> s[i];
    REP(i,m) cin >> t[i];
    dp0[0][0] = 1;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[n][m];
    cout << ans.x << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:20: error: expected ';' before 'for'
   86 |     dp0[0][0] = 1;1
      |                    ^
      |                    ;
a.cc:87:9: error: 'i' was not declared in this scope
   87 |     REP(i,n+1) REP(j,m+1)
      |         ^
a.cc:29:31: note: in definition of macro 'REP'
   29 | #define REP(i,n) for(int i=0; i<(n); i++)
      |                               ^
a.cc:87:20: error: 'j' was not declared in this scope
   87 |     REP(i,n+1) REP(j,m+1)
      |                    ^
a.cc:29:31: note: in definition of macro 'REP'
   29 | #define REP(i,n) for(int i=0; i<(n); i++)
      |                               ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

#define FOR(i,m,n) for(int i=(m); i<(n); i++)
#define REP(i,n) for(int i=0; i<(n); i++)
#define RFOR(i,n,m) for(int i=(n);i>=(m);i--)
#define RREP(i,n) for(int i=n-1; i>=0; i--)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = 100100100;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct mint 
{
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> s(n+1), t(m+1);
    REP(i,n) cin >> s[i];
    REP(i,m) cin >> t[i];
    dp0[0][0] = 1;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[n][m];
    cout << ans.x << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:20: error: expected ';' before 'for'
   86 |     dp0[0][0] = 1;1
      |                    ^
      |                    ;
a.cc:87:9: error: 'i' was not declared in this scope
   87 |     REP(i,n+1) REP(j,m+1)
      |         ^
a.cc:29:31: note: in definition of macro 'REP'
   29 | #define REP(i,n) for(int i=0; i<(n); i++)
      |                               ^
a.cc:87:20: error: 'j' was not declared in this scope
   87 |     REP(i,n+1) REP(j,m+1)
      |                    ^
a.cc:29:31: note: in definition of macro 'REP'
   29 | #define REP(i,n) for(int i=0; i<(n); i++)
      |                               ^
Language: C++

#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
constexpr ll mod = 1000000007;

ll n, m, s[2000], t[2000];

ll rec1(ll, ll);

ll rec2(ll, ll);

ll dp[2][2000][2000][2];

ll rec1(ll a, ll b) {
    if (dp[0][a][b][0] == 0) {
        dp[0][a][b][0] = 1;
        dp[0][a][b][1] = (a < 0 || b < 0 || s[a] != t[b]) ? 0 : (rec2(a - 1, b - 1) + 1) % mod;
    }
    return dp[0][a][b][1];
}

ll rec2(ll a, ll b) {
    if (dp[1][a][b][0] == 0) {
        dp[1][a][b][0] = 1;
        dp[1][a][b][1] = (a < 0 || b < 0) ? 0 :
                         (rec2(a - 1, b) + rec2(a, b - 1) - rec2(a - 1, b - 1) + rec1(a, b) + mod) %
                         mod;
    }
    return dp[1][a][b][1];
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < 2000; i++)
        for (int j = 0; j < 2000; j++)
            dp[0][i][j][0] = dp[0][i][j][1] = dp[1][i][j][0] = dp[1][i][j][1] = 0
    for (int i = 0; i < n; i++) cin >> s[i];
    for (int i = 0; i < m; i++) cin >> t[i];
    cout << (rec2(n - 1, m - 1) + 1) % mod << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:82: error: expected ';' before 'for'
   54 |             dp[0][i][j][0] = dp[0][i][j][1] = dp[1][i][j][0] = dp[1][i][j][1] = 0
      |                                                                                  ^
      |                                                                                  ;
   55 |     for (int i = 0; i < n; i++) cin >> s[i];
      |     ~~~                                                                           
a.cc:55:21: error: 'i' was not declared in this scope
   55 |     for (int i = 0; i < n; i++) cin >> s[i];
      |                     ^
Language: C++

#include <bits/stdc++.h>

int main() {
  int n,m;
  std::cin >> n >> m;
  std::vector<int> a(n),b(m);
  for(int&&x:a) std::cin >> x;
  for(int&&x:b) std::cin >> x;
  constexpr int MOD = 1e9+7;
  std::vector<std::vector<int> > dp(n+1,std::vector<int>(m+1,0));
  for(int i=0;i<n;i++) {
    for(int j=0;j<m;j++) {
      dp[i+1][j+1] = dp[i][j+1] + dp[i+1][j] + dp[i][j];
      if(a[i]==b[i]) dp[i+1][j+1]++;
    }
  }
  std::cout << dp[n][m] << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: cannot bind rvalue reference of type 'int&&' to lvalue of type 'int'
    7 |   for(int&&x:a) std::cin >> x;
      |              ^
a.cc:8:14: error: cannot bind rvalue reference of type 'int&&' to lvalue of type 'int'
    8 |   for(int&&x:b) std::cin >> x;
      |              ^
Language: C++

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> S(N),T(M);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
  }
  for(int i=0;i<M;i++){
    cin>>T.at(i);
  }
  
  vector<vector<int>> index(N);
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(S.at(i)==T.at(j)){
        index.at(i).push_back(j);
      }
    }
  }
  
  long long ans=0;
  vector<map<int,long long>> sum(N);
  for(int i=0;i<N;i++){
    if(index.at(i).size()==0){
      continue;
    }
    for(int k=0;k<index.at(i).size();k++){
      sum.at(i)[index.at(i).at(k)]=1;
      for(int j=0;j<i;j++){
        for(auto m:sum.at(i)){
          if(m.first<index.at(i).at(k)){
            sum.at(i)[index.at(i).at(k)]+=m.second;
            sum.at(i)[index.at(i).at(k)]%=MOD;
          }
        }
      }
    }
  }
  for(int i=0;i<N;i++){
    for(auto m:sum.at(i)){
      ans+=sum.at(i).second;
      ans%=MOD;
    }
  }
  cout<<ans<<endl;
}
        
    

Compiler output:
a.cc: In function 'int main()':
a.cc:45:22: error: '__gnu_cxx::__alloc_traits<std::allocator<std::map<int, long long int> >, std::map<int, long long int> >::value_type' {aka 'class std::map<int, long long int>'} has no member named 'second'
   45 |       ans+=sum.at(i).second;
      |                      ^~~~~~
Language: C++

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> S(N),T(M);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
  }
  for(int i=0;i<M;i++){
    cin>>T.at(i);
  }
  
  vector<vector<int>> index(N);
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(S.at(i)==T.at(j)){
        index.at(i).push_back(j);
      }
    }
  }
  
  long long ans=0;
  vector<map<int,long long>> sum(N);
  for(int i=0;i<N;i++){
    if(index.at(i).size()==0){
      continue;
    }
    for(int k=0;k<index.at(i).size();k++){
      sum.at(i)[index.at(i).at(k)]=1;
      for(int j=0;j<i;j++){
        for(auto m:sum.at(i)){
          if(m.key<index.at(i).at(k)){
            sum.at(i)[index.at(i).at(k)]+=m.value;
            sum.at(i)[index.at(i).at(k)]%=MOD;
          }
        }
      }
    }
  }
  for(int i=0;i<N;i++){
    for(auto m:sum.at(i)){
      ans+=sum.m.value;
      ans%=MOD;
    }
  }
  cout<<ans<<endl;
}
        
    

Compiler output:
a.cc: In function 'int main()':
a.cc:35:16: error: 'struct std::pair<const int, long long int>' has no member named 'key'
   35 |           if(m.key<index.at(i).at(k)){
      |                ^~~
a.cc:36:45: error: 'struct std::pair<const int, long long int>' has no member named 'value'
   36 |             sum.at(i)[index.at(i).at(k)]+=m.value;
      |                                             ^~~~~
a.cc:45:16: error: 'class std::vector<std::map<int, long long int> >' has no member named 'm'
   45 |       ans+=sum.m.value;
      |                ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define int long long

const int N = 2e3 + 7;
const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int dp[N][N];
int ps[N][N];

vector<int> s;
vector<int> t;

int calc(int i, int j) {
	if (dp[i][j] == -1) {
		dp[i][j] = 0;
		for (int i1 = 0; i1 < i; i1++) {
			for (int j1 = 0; j1 < j; j1++) {
				if (s[i1] == t[j1]) {
					dp[i][j] = add(dp[i][j], calc(i1, j1));
				}
			}
		}
		dp[i][j]++;
	}
	return dp[i][j];
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			dp[i][j] = -1;
		}
	}
	int n, m;
	cin >> n >> m;
	s.resize(n);
	t.resize(m);
	for (auto &x : s) cin >> x;
	for (auto &x : t) cin >> x;
	int ans = 0;
	auto gt = [&](int i, int j) {
		if (i >= 0 && j >= 0) return ps[i][j];
		else return 0;
	};
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i] == t[j]) {
				dp[i][j] = gt(i - 1, j - 1);
				dp[i][j] = add(dp[i][j], 1);
				ans = add(ans, dp[i][j]);
			} else {
				dp[i][j] = 0;
			}
			ps[i][j] = gt(i - 1, j) + gt(i, j - 1) - gt(i - 1, j - 1) + dp[i][j];
			ps[i][j] %= MOD;
			ps[i][j] += MOD;
			ps[i][j] %= MOD;	
		}
	}
	ans = add(ans, 1);
	cout << ans << endl;
}


Compiler output:
a.cc: In lambda function:
a.cc:71:29: error: inconsistent types 'long long int' and 'int' deduced for lambda return type
   71 |                 else return 0;
      |                             ^
Language: C++

#include <cstdio>
using namespace std;

const int N = 2e3 + 7;
const int M = 1e9 + 7;
int S[N], T[N], sum[N][N];

int mod(int val)
{
	return (val % M + M) % M;
}

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < n; ++i)
		scanf("%d", &S[i]);
	for (int i = 0; i < m; ++i)
		scanf("%d", &T[i]);

	for (int i = 0; i <= max(n, m); ++i)
		sum[0][i] = sum[i][0] = 1;

	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j)
		{
			int val = S[i] == T[j] ? sum[i][j] : 0;
			sum[i + 1][j + 1] = mod(mod(mod(sum[i + 1][j] + sum[i][j + 1]) - sum[i][j]) + val);
		}

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

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:30: error: 'max' was not declared in this scope
   23 |         for (int i = 0; i <= max(n, m); ++i)
      |                              ^~~
Language: C++

#include<vector>
#include<iostream>
using namespace std;

#define MOD 1000000007;

int main(){
  int n,m; cin >> n >> m;
  vector<long long int> dp(max(n,m)+1), ts(100005), tt(100005);
  vector<long long int> s(n), t(m);
  for(int i=0;i<n;i++) cin >> s[i];
  for(int i=0;i<m;i++) cin >> t[i];
  dp[0] = 1;
  for(int i=1;i<=max(n,m);i++){
  	if(i-1<n) ts[s[i-1]] = (ts[s[i-1]] + dp[i-1]) % MOD;
    if(i-1<m) tt[t[i-1]] = (tt[t[i-1]] + dp[i-1]) % MOD;
  	dp[i] = (((i-1<n ? tt[s[i-1]] : 0) + (i-1<m ? ts[t[i-1]] : 0))%MOD) + (s[i-1<n ? i-1 : n-1]!=t[i-1<m ? i-1 : m-1] ? dp[i-1] : 0);
    dp[i] %= MOD
  }
  cout << dp[max(n,m)] << endl;
  return 0;
}                   


Compiler output:
a.cc: In function 'int main()':
a.cc:5:23: error: expected ')' before ';' token
    5 | #define MOD 1000000007;
      |                       ^
a.cc:17:72: note: in expansion of macro 'MOD'
   17 |         dp[i] = (((i-1<n ? tt[s[i-1]] : 0) + (i-1<m ? ts[t[i-1]] : 0))%MOD) + (s[i-1<n ? i-1 : n-1]!=t[i-1<m ? i-1 : m-1] ? dp[i-1] : 0);
      |                                                                        ^~~
a.cc:17:17: note: to match this '('
   17 |         dp[i] = (((i-1<n ? tt[s[i-1]] : 0) + (i-1<m ? ts[t[i-1]] : 0))%MOD) + (s[i-1<n ? i-1 : n-1]!=t[i-1<m ? i-1 : m-1] ? dp[i-1] : 0);
      |                 ^
a.cc:17:75: error: expected primary-expression before ')' token
   17 |         dp[i] = (((i-1<n ? tt[s[i-1]] : 0) + (i-1<m ? ts[t[i-1]] : 0))%MOD) + (s[i-1<n ? i-1 : n-1]!=t[i-1<m ? i-1 : m-1] ? dp[i-1] : 0);
      |                                                                           ^
Language: C++

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

int main() {
    int n, m;
    cin >> n >> m;
    ll s[n], t[n];

    rep(i, n) { cin >> s[i]; }
    rep(i, m) { cin >> t[i]; }

    ll dp[n + 1][m + 1];
    rep(i, m + 1) { dp[0][i] = 1; }
    rep(i, n + 1) { dp[i][0] = 1; }

    rep(i, n) {
        for (int j = 0; j < m; j++) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1]) % mod;
            } else {
                dp[i + 1][j + 1] =
                    (dp[i + 1][j] + dp[i][j + 1] - dp[i][j] + mod) % mod;
            }
        }
    }
    cout << dp[n][m] << endl;
}


Compiler output:
a.cc:6:16: error: expected parameter name, found "("
    6 | #define rep(i, (n)) repd(i, 0, (n))
      |                ^
a.cc: In function 'int main()':
a.cc:13:9: error: 'i' was not declared in this scope
   13 |     rep(i, n) { cin >> s[i]; }
      |         ^
a.cc:13:5: error: 'rep' was not declared in this scope; did you mean 'repd'?
   13 |     rep(i, n) { cin >> s[i]; }
      |     ^~~
      |     repd
Language: C++

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

int main() {
    int n, m;
    cin >> n >> m;
    ll s[n], t[n];

    rep(i, n) { cin >> s[i]; }
    rep(i, m) { cin >> t[i]; }

    ll dp[n + 1][m + 1];
    rep(i, m + 1) { dp[0][i] = 1; }
    rep(i, n + 1) { dp[i][0] = 1; }

    rep(i, n) {
        for (int j = 0; j < m; j++) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = (dp[i + 1][j] + dp[i][j + 1]) % mod;
            } else {
                dp[i + 1][j + 1] =
                    (dp[i + 1][j] + dp[i][j + 1] - dp[i][j] + mod) % mod;
            }
        }
    }
}
cout << dp[n][m] << endl;
}


Compiler output:
a.cc:31:1: error: 'cout' does not name a type
   31 | cout << dp[n][m] << endl;
      | ^~~~
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

int main() {
input:
    ll n, m;
    cin >> n >> m;

    ll s[n];
    ll t[m];
    rep(i, n) { cin >> s[i]; }
    rep(i, m) { cin >> t[i]; }

calculate:
    ll dp[n + 1][m + 1] = {};
    rep(i, m + 1) { dp[0][i] = 1; }
    rep(i, n + 1) { dp[i][0] = 1; }

    for (ll i = 1, i < n + 1; i++) {
        for (ll j = 1, j < m + 1; j++) {
            dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
            if (dp[i][j] > mod) {
                dp[i][j] -= mod;
            }

            if (s[i - 1] != t[j - 1]) {
                dp[i][j] -= dp[i - 1][j - 1];
            }
            if (dp[i][j] > mod) {
                dp[i][j] -= mod;
            }
        }
    }

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



Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

int N, M;

int S[2010], T[2010];

long long int dp[2100][2100];
 
int main() {
  
    cin >> N >> M;
  
    for (int i = 0; i < N; ++i) cin >> S[i],dp[i][0]=1;
  
    for (int i = 0; i < M; ++i) cin >> T[i],dp[0][j]=1;
 
    memset(dp, 0, sizeof(dp));
  
 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];
      
        if(S[i-1] == T[j-1]){
      dp[i][j]+=dp[i-1][j-1];
        }
			dp[i][j]+=1000000007;
      
			dp[i][j]%=1000000007;
		}
	}
 
  
    cout << dp[N][M] % 1000000007 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:51: error: 'j' was not declared in this scope
   19 |     for (int i = 0; i < M; ++i) cin >> T[i],dp[0][j]=1;
      |                                                   ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

int N, M;

int S[2010], T[2010];

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


Compiler output:
a.cc: In function 'int main()':
a.cc:19:51: error: 'j' was not declared in this scope
   19 |     for (int i = 0; i < M; ++i) cin >> T[i],dp[0][j] = 1;
      |                                                   ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

int N, M;

int S[2010], T[2010];

long long int dp[2100][2100];
 
int main() {
  
    cin >> N >> M;
  
   S.resize(N),T.resize(M);
  
    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));
  
    dp[0][0] = 1;
  
    for (int i = 0; i <= N; ++i) {
        for (int j = 0; j <= M; ++j) {
          
            if (i > 0 && j > 0 && S[i-1] == T[j-1]) dp[i][j] += dp[i-1][j-1];
          
          dp[i][j] %= 1000000007;
          
            if (i > 0) dp[i][j] += dp[i-1][j];
          
          dp[i][j] %= 1000000007;
          
            if (j > 0) dp[i][j] += dp[i][j-1];
          
          dp[i][j] %= 1000000007;
          
            if (i > 0 && j > 0) dp[i][j] -= dp[i-1][j-1]; 
          
          dp[i][j] %= 1000000007;
        }
    }
  
    cout << dp[N][M] % 1000000007 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:6: error: request for member 'resize' in 'S', which is of non-class type 'int [2010]'
   17 |    S.resize(N),T.resize(M);
      |      ^~~~~~
a.cc:17:18: error: request for member 'resize' in 'T', which is of non-class type 'int [2010]'
   17 |    S.resize(N),T.resize(M);
      |                  ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <complex>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const ll MOD = 1000000007;
int main(){
    int n,m; cin >> n >> m;
    int s[n],t[m];
    rep(i,n) cin >> s[i];
    rep(i,m) cin >> t[i];
    ll dp[n][m];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    if(s[0]==t[0]) dp[0][0]++;
    rep(i,n){
        rep(j,n){
            if(i==0 && j==0) continue;
            if(i==0){
                if(s[i]==t[j]) dp[i][j]=dp[i][j-1]+1;
                else dp[i][j]=dp[i][j-1];
                continue;
            }
            else if(j==0){
                if(s[i]==t[j]) dp[i][j]=dp[i-1][j]+1;
                else dp[i][j]=dp[i-1][j];
                continue;
            }
            if(i>0) dp[i][j]+=dp[i-1][j];
            dp[i][j]%=MOD;
            if(j>0) dp[i][j]+=dp[i][j-1];
            dp[i][j]%=MOD;
            if(s[i]!=t[j] && i>0 && j>0) dp[i][j]-=dp[i-1][j-1];
            dp[i][j]%=MOD;
        }
    }
    //rep(i,n){
      //  rep(j,m){
        //    cout << dp[i][j] << " ";
        }
      //  cout << endl;
    //}
    
    cout << dp[n-1][m-1] << endl;

}


Compiler output:
a.cc:64:5: error: 'cout' does not name a type
   64 |     cout << dp[n-1][m-1] << endl;
      |     ^~~~
a.cc:66:1: error: expected declaration before '}' token
   66 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define P 1000000007
int main(){
  long long N,M;cin>>N>>M;
  vector<long long>S(N),T(M);
  for(long long i=0;i<N;i++)cin>>S[i];
  for(long long i=0;i<M;i++)cin>>T[i];
  
  vector<vector<long long> > DP(N,vector<long long>(M,0));
  for(long long s=0;s<N;s++){
    for(long long t=0;t<M;t++){
      if(s==0&&t==0){
        DP[s][t]=(S[s]==T[t])+1;
      }
      else if(s==0){
        DP[s][t]=((S[s]==T[t])+DP[s][t-1])%P;
      }
      else if(t==0){
        DP[s][t]=((S[s]==T[t])+DP[s-1][t])%P;
      }
      else{
        long long a=((S[s]==T[t])*(DP[s-1][t-1]))%P;
        long long b=(DP[s-1][t]+DP[s][t-1]-DP[s-1][t-1])%P
        DP[s][t]=(a+b)%P;
      }
    }
  }
  cout<<DP[N-1][M-1];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: expected ',' or ';' before 'DP'
   25 |         DP[s][t]=(a+b)%P;
      |         ^~
Language: C++

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

ll dp0[2005][2005];
ll dp1[2005][2005];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  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,n+1)rep(j,m+1){
    (dp0[i+1][j]+=dp0[i][j])%=MOD;
    (dp1[i][j]+=dp0[i][j])%=MOD;
    (dp1[i][j+1]+=dp[i][j])%=MOD;
    if(s[i]==t[j]) (dp0[i+j][j+1]+=dp1[i][j])%=MOD;
  }
  ll ans=dp1[n][m]%MOD;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:19: error: 'dp' was not declared in this scope; did you mean 'dy'?
   64 |     (dp1[i][j+1]+=dp[i][j])%=MOD;
      |                   ^~
      |                   dy
Language: C++

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

ll dp0[2005][2005];
ll dp1[2005][2005];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  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,n+1)rep(j,m+1){
    (dp0[i+1][j]+=dp0[i][j])%=MOD;
    (dp1[i][j]+=dp0[i][j])%=MOD;
    (dp1[i][j+1]+=dp[i][j])%=MOD;
    if(s[i]==t[j]) (dp0[i+j][j+1]+=dp[i][j])%=MOD;
  }
  ll ans=dp1[n][m]%MOD;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:19: error: 'dp' was not declared in this scope; did you mean 'dy'?
   64 |     (dp1[i][j+1]+=dp[i][j])%=MOD;
      |                   ^~
      |                   dy
Language: C++

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

using namespace std;

const long long MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++) 

int main(){
    int N, M; cin >> N >> M;
    int S[N+1], T[M+1];
    repn(i, N) cin >> S[i];
    repn(i, M) cin >> T[i];

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


Compiler output:
a.cc: In function 'int main()':
a.cc:24:65: error: expected ';' before 'else'
   24 |             dp[i][j] = (dp[i-1][j] + dp[i][j-1] + 1 + MOD) % MOD
      |                                                                 ^
      |                                                                 ;
   25 |         else
      |         ~~~~
Language: C++

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

#define DIV 1000000007

long long N, M;
long long S[20005];
long long T[20005];
long long dp[2005][2005];

int main(){
	cin >> N >> M;
	for(long long i = 1; i <= N; i++){
		cin >> S[i];
	}
	for(long long j = 1; j <= M; j++){
		cin >> T[j];
	}

	for(long long i = 0; i <= N; i++){
		dp[i][0] = 0;
	}
	for(long long i = 0; i <= M; i++){
		dp[0][i] = 0;
	}
	for(long long i = 1; i <= N; i++){
		for(long long j = 1; j <= M; j++){
			dp[i][j] = dp[i-1][j] + dp[i][j-1];
			if(S[i] == T[j]){
				dp[i][j]++;
			}else{
				dp[i][j] -= dp[i-1][j-1];
			}
			(dp[i][j] + DIV) %= DIV;
		}
	}

	cout << (dp[N][M] + 1)%DIV << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:35: error: lvalue required as left operand of assignment
   34 |                         (dp[i][j] + DIV) %= DIV;
      |                         ~~~~~~~~~~^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=2e3+5;
typedef long long ll;
const int mod=1e9+7;

int main()
{
  ll dp[maxn][maxn],sum[maxn][maxn];
  int n,m;
  int s[maxn],t[maxn];
	cin >> n >> m;
	for(int i=1;i<=n;i++)
	{
		cin >> s[i];
	}
	for(int i=1;i<=m;i++)
	{
		cin >> t[i];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(s[i]==t[j]) dp[i][j]=sum[i-1][j-1]+1;
			else dp[i][j]=0;
      dp[i][j] %= mod
			sum[i][j] = sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+dp[i][j];
			sum[i][j] %= mod;
		}
	}
	sum[n][m]++;
  sum[n][m]%=mod;
	cout<<sum[n][m]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:22: error: expected ';' before 'sum'
   27 |       dp[i][j] %= mod
      |                      ^
      |                      ;
   28 |                         sum[i][j] = sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+dp[i][j];
      |                         ~~~
Language: C++

#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 400000;







int main() {

	int N, M;
	cin >> N >> M;

	int S[3000], T[3000];
	
	rep(i, N) {
		cin >> S[i];
	}
	
	rep(i, M) {
		cin >> T[i]; cout << i;
	}

	ll D[3000][3000];
	ll line[3000][3000];
	ll seq[3000][3000];
	ll sum[3000][3000];

	for(i=0; i<N; i++) {
		for(j=0; j<M; j++) {
			if (j == 0) { line[i][j] = 0; }
			else { line[i][j] = (line[i][j - 1] + D[i][j - 1]) % MOD; }

			if (i == 0) { seq[i][j] = 0; }
			else { seq[i][j] = (seq[i - 1][j] + D[i - 1][j]) % MOD; }

			if (i == 0 || j == 0) { sum[i][j] = 0; }
			else { sum[i][j] = (sum[i - 1][j - 1] + line[i - 1][j - 1] + seq[i - 1][j - 1] + D[i - 1][j - 1]) % MOD; }

			if (S[i] != T[j]) { D[i][j] = 0; }
			else { D[i][j] = sum[i][j] + 1; }

			
		}
	}

	ll ans = (1+ sum[N - 1][M - 1] + line[N - 1][M - 1] + seq[N - 1][M - 1] + D[N - 1][M - 1]) % MOD;

	cout << ans;
	system("PAUSE");

}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:13: error: 'i' was not declared in this scope
   47 |         for(i=0; i<N; i++) {
      |             ^
a.cc:48:21: error: 'j' was not declared in this scope
   48 |                 for(j=0; j<M; j++) {
      |                     ^
Language: C++

#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 400000;







int main() {

	int N, M;
	cin >> N >> M;

	int S[3000], T[3000];
	
	rep(i, N) {
		cin >> S[i];
	}
	
	rep(i, M) {
		cin >> T[i]; cout << i;
	}

	ll D[3000][3000];
	ll line[3000][3000];
	ll seq[3000][3000];
	ll sum[3000][3000];

	rep(i, N) {
		rep(j, M) {
			if (j == 0) { line[i][j] = 0; }
			else { line[i][j] = (line[i][j - 1] + D[i][j - 1]) % MOD; }

			if (i == 0) { seq[i][j] = 0; }
			else { seq[i][j] = (seq[i - 1][j] + D[i - 1][j]) % MOD; }

			if (i == 0 || j == 0) { sum[i][j] = 0; }
			else { sum[i][j] = (sum[i - 1][j - 1] + line[i - 1][j - 1] + seq[i - 1][j - 1] + D[i - 1][j - 1]) % MOD; }

			if (S[i] != T[j]) { D[i][j] = 0; }
			else { D[i][j] = sum[i][j] + 1; }

			
		}
	}

	//ll ans = (1+ sum[N - 1][M - 1] + line[N - 1][M - 1] + seq[N - 1][M - 1] + D[N - 1][M - 1]) % MOD;

	cout << D[i][j];
	system("PAUSE");

}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:19: error: 'i' was not declared in this scope
   67 |         cout << D[i][j];
      |                   ^
a.cc:67:22: error: 'j' was not declared in this scope
   67 |         cout << D[i][j];
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
typedef long long ll;
typedef multiset<ll> S;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
int main(){
  int n,m;cin>>n>>m;
  vi a(n),b(m);
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];
  vvi dp(n+1,vi(m+1,1));
  rep(i,n+1){
    rep(j,m+1){
      dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j]-dp[i][j])%mod;
      if(i==n||j==m) continue:
      if(a[i]==b[j])dp[i+1][j+1]=(dp[i+1][j+1]+dp[i][j])%mod;
      }
    }
  cout<<dp[n][m]%mod<<endl;
}


Compiler output:
a.cc:21:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   21 | bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
      |            ^~~~
a.cc:21:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   21 | bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
      |                    ^~~~
a.cc:22:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   22 | bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
      |            ^~~~
a.cc:22:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   22 | bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:32:30: error: expected ';' before ':' token
   32 |       if(i==n||j==m) continue:
      |                              ^
      |                              ;
a.cc:32:30: error: expected primary-expression before ':' token
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <stack>
#include <queue>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;
int main(){
  ll i,j,k,n,m;
  cin >> n >> m;
  ll s[n+1];
  ll t[m+1];
  for(i=1;i<=n;i++)cin >> s[i];
  for(i=1;i<=m;i++)cin >> t[i];
  s[0]=-1;
  t[0]=-5;
  for(i=0;i<=m;i++)dp[0][i]=1;
  for(i=0;i<=n;i++)dp[i][0]=1;
  dp[0][0] = 1; //空文字列
  // dp[x][y] := sのx文字目,tのy文字目まで見たときの共通部分列の数
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      if(s[i]!=t[j])dp[i][j]=(dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1])%MOD;
      if(s[i]==t[j])dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
      dp[i][j]%=MOD;
    }
  }
  cout << dp[n][m]%MOD << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: 'dp' was not declared in this scope
   21 |   for(i=0;i<=m;i++)dp[0][i]=1;
      |                    ^~
a.cc:22:20: error: 'dp' was not declared in this scope
   22 |   for(i=0;i<=n;i++)dp[i][0]=1;
      |                    ^~
a.cc:23:3: error: 'dp' was not declared in this scope
   23 |   dp[0][0] = 1; //空文字列
      |   ^~
Language: C++

#include <stdio.h>
#include <iostream>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)

using namespace std;

typedef int64_t ll;

const ll MOD = 1000000007;
const int MAX_N = 2010;

int ns, nt;
int s[MAX_N], t[MAX_N];
ll cum[MAX_N][MAX_N];

int main()
{
	cin >> ns >> nt;
	REP(i, ns) scanf_s("%d", s + i);
	REP(j, nt) scanf_s("%d", t + j);

	REP(i, MAX_N)
		cum[1][i] = cum[i][1] = 1;

	REP(i, ns)
		REP(j, nt)
	{
		ll dp = 0;
		if (s[i] == t[j])
			dp = cum[i + 1][j + 1];

		cum[i + 2][j + 2] = dp + cum[i + 1][j + 2] + cum[i + 2][j + 1] - cum[i + 1][j + 1];
		cum[i + 2][j + 2] = (cum[i + 2][j + 2] + MOD) % MOD;
	}

	cout << cum[ns + 1][nt + 1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   20 |         REP(i, ns) scanf_s("%d", s + i);
      |                    ^~~~~~~
      |                    scanf
a.cc:21:20: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   21 |         REP(j, nt) scanf_s("%d", t + j);
      |                    ^~~~~~~
      |                    scanf
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const int MOD = 1000000007;
ll dp[2019][2019];
int main(){
    ll n,m;
    cin >> n >> m;
    ll s[n],t[m];
    rep(i,n) cin >> s[i];
    rep(i,m) cin >> t[i];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    rep(i,n+1){
        rep(j,m+1){
            if(i>0) dp[i][j] += dp[i-1][j] % MOD;
            if(j>0) dp[i][j] += dp[i][j-1] % MOD;
            if(i>0 && j>0) dp[i][j] -= dp[i-1][j-1] % MOD;
            if(s[i-1]==t[j-1] && j>0 && i>0) dp[i][j]+=dp[i-1][j-1] % MOD;
            dp[i][j] %= MOD;
        }
    }
    cout << dp[n][m] % MOD << endl;
    return 0;
}


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

using namespace std;
typedef long long int ll; 

int main(void){
    int N, M;
    cin >> N >>M;
    
    vector<int> S(N), T(M);
    for (int i = 0; i < N; i++) {
    			cin >> S.at(i);
  	}
  	
    for (int i = 0; i < M; i++) {
    			cin >> T.at(i);
  	}
  	
  	
  	vector<vector<ll>> dp(N+1, vector<ll>(M+1,1)); 
  	ll P = 1000*1000*1000+7; 
  	
  	for(int i=1; i<=N; i++){
  	    ll sum=0; 
  	    for(int j=1; j<=M; j++){

  	        if(S.at(i-1)==T.at(j-1)){
  	            dp.at(i).at(j) = dp.at(i-1).at(j-1) + dp.at(i-1).at(j) + sum; 
  	            sum+= dp.at(i-1).at(j-1); 
  	            dp.at(i).at(j) = dp.at(i).at(j)%P;
  	            sum = sum%P; 
  	        }else{
  	            dp.at(i).at(j) = dp.at(i-1).at(j) + sum; 
  	            dp.at(i).at(j) = dp.at(i).at(j)%P;
  	        }
  	        //cout<< dp.at(i).at(j)<<" "; 
  	    }
  	    //cout<< endl; 
  	}
  	dp.at(N).at(M)=dp.at(N).at(M)%P; 
  	
  	cout<< dp.at(N).at(M);   	  	
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> N >>M;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:8:5: error: 'vector' was not declared in this scope
    8 |     vector<int> S(N), T(M);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:8:12: error: expected primary-expression before 'int'
    8 |     vector<int> S(N), T(M);
      |            ^~~
a.cc:10:32: error: 'S' was not declared in this scope
   10 |                         cin >> S.at(i);
      |                                ^
a.cc:14:32: error: 'T' was not declared in this scope
   14 |                         cin >> T.at(i);
      |                                ^
a.cc:18:25: error: expected primary-expression before '>>' token
   18 |         vector<vector<ll>> dp(N+1, vector<ll>(M+1,1));
      |                         ^~
a.cc:18:45: error: expected primary-expression before '>' token
   18 |         vector<vector<ll>> dp(N+1, vector<ll>(M+1,1));
      |                                             ^
a.cc:18:28: error: 'dp' was not declared in this scope
   18 |         vector<vector<ll>> dp(N+1, vector<ll>(M+1,1));
      |                            ^~
a.cc:25:20: error: 'S' was not declared in this scope
   25 |                 if(S.at(i-1)==T.at(j-1)){
      |                    ^
a.cc:25:31: error: 'T' was not declared in this scope
   25 |                 if(S.at(i-1)==T.at(j-1)){
      |                               ^
a.cc:40:9: error: 'cout' was not declared in this scope
   40 |         cout<< dp.at(N).at(M);
      |         ^~~~
a.cc:40:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'