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

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  string S,T; cin>>S>>T;
  int N=S.size(),M=T.size();
  vii dp(N+1,vi(M+1));
  rep(i,0,N){
    rep(j,0,M){
      if(S[i]==T[j]) dp[i+1][j+1]=max({dp[i][j+1],dp[i+1][j],dp[i][j]+1});
      else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
    }
  }
  string ans;
  rep(i,0,N){
    rep(j,0,M){
      if(max(dp[i+1][j],dp[i][j+1])<dp[i+1][j+1])) ans+=S[i];
    }
  }
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:32:50: error: expected primary-expression before ')' token
   32 |       if(max(dp[i+1][j],dp[i][j+1])<dp[i+1][j+1])) ans+=S[i];
      |                                                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  string S,T; cin>>S>>T;
  int N=S.size().M=T.size();
  vii dp(N+1,vi(M+1));
  rep(i,0,N){
    rep(j,0,M){
      if(S[i]==T[j]) dp[i+1][j+1]=max({dp[i][j+1],dp[i+1][j],dp[i][j]+1});
      else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
    }
  }
  string ans;
  rep(i,0,N){
    rep(j,0,M){
      if(max(dp[i+1][j],dp[i][j+1])<dp[i+1][j+1])) ans+=S[i];
    }
  }
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:21:18: error: request for member 'M' in 'S.std::__cxx11::basic_string<char>::size()', which is of non-class type 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
   21 |   int N=S.size().M=T.size();
      |                  ^
a.cc:22:17: error: 'M' was not declared in this scope
   22 |   vii dp(N+1,vi(M+1));
      |                 ^
a.cc:32:50: error: expected primary-expression before ')' token
   32 |       if(max(dp[i+1][j],dp[i][j+1])<dp[i+1][j+1])) ans+=S[i];
      |                                                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL<<60;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,j,n) for(int i=j;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(){
    string S,T;
    cin >> S>>T;
    int slen = S.length();
    int tlen = T.length();
    int dp[slen+1][tlen+1]={};
    REP(i,slen){
        REP(j,tlen){
            //i番目の文字とj番目の文字が同じなら増やす．
            if(S[i]==T[j]){
                chmax(dp[i+1][j+1],dp[i][j]+1);
            }
            //それ以外は一つ増やした物と比較．
            chmax(dp[i+1][j+1], dp[i+1][j]);
            chmax(dp[i+1][j+1], dp[i][j+1]);
        }
    }
    // REP(i,slen+1){
    //     REP(j,tlen+1){
    //         cout<<dp[i][j]<<' ';
    //     }
    //     cout << endl;
    // }
    string ans=" ";
    int x=slen+1,y=tlen+1;
    while(x >= 0 && y>=0){
        // cout<<x<<' '<<y<<endl;
        if(dp[x][y]==dp[x-1][y]){
            --x;
        }else if(dp[x][y]==dp[x][y-1]){
            --y;
        }else{
            --x;
            --y;
            ans=S[x]+ans;
        }

    }
    cout << ans<<endl;
}

Compiler output:
a.cc:25:6: error: stray '\16' in program
   25 |     }<U+000E>
      |      ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define mp make_pair
#define pb push_back
typedef vector<long long int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define sz(a) int((a).size())
#define endl '\n'
#define INF 1000000007 

signed main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);

	string s,t;
	cin>>s>>t;

	int sl = s.length();
	int tl = t.length();

	vvi dp(sl+1,vi(tl+1));
	vector<string>v(tl+1);

	for(int i=0;i<=sl;i++){
		for(int j=1;j<=tl;j++){
			if(i==0){
				dp[i][j]=0;
			}else if(s[i-1]==t[j-1]){
				dp[i][j] = dp[i-1][j-1]+1;
				v[j]+=s[i-1];
			}else{
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
				if(dp[i][j]==dp[i][j-1]){
					v[j]=v[j-1];
				}
			}
		}
	}
	cout<<v[tl]<<endl;
}

Compiler output:
a.cc:3:13: error: 'long long long' is too long for GCC
    3 | #define int long long int
      |             ^~~~
a.cc:9:26: note: in expansion of macro 'int'
    9 | typedef vector<long long int> vi;
      |                          ^~~
a.cc:3:18: error: 'long long long' is too long for GCC
    3 | #define int long long int
      |                  ^~~~
a.cc:9:26: note: in expansion of macro 'int'
    9 | typedef vector<long long int> vi;
      |                          ^~~
Language: C++

#include <bits/stdc++.h>
#include <bits/chminmax.h>
using namespace std;
int dp[3010][3010] = {0};
int main(){
    string s,t; cin >> s >> t;
    for(int i=0;i<s.size();++i){
        for(int j=0;j<t.size();++j){
            if(s[i] == t[j]) chmax(dp[i+1][j+1],dp[i][j] + 1);
            chmax(dp[i+1][j+1],dp[i][j+1]);
            chmax(dp[i+1][j+1],dp[i+1][j]);
        }
    }
    string res = "";
    int i = (int)s.size(), j = (int)t.size();
    while(i>0 && j>0){
        if(dp[i][j] == dp[i][j-1]){
            --j;
        } 
        else if(dp[i][j] == dp[i-1][j]){
            --i;
        }
        else {
            res = s[i-1] + res;
             --i; --j;
        }
    }
    cout << res << endl;
    return 0;
}


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

#include <bits/stdc++.h>
#include <bits/chminmax.h>
using namespace std;
int dp[3010][3010] = {0};
int main(){
    string s,t; cin >> s >> t;
    for(int i=0;i<s.size();++i){
        for(int j=0;j<t.size();++j){
            if(s[i] == t[j]) chmax(dp[i+1][j+1],dp[i][j] + 1);
            chmax(dp[i+1][j+1],dp[i][j+1]);
            chmax(dp[i+1][j+1],dp[i+1][j]);
        }
    }
    string res = "";
    int i = (int)s.size(), j = (int)t.size();
    cout << dp[i][j] << endl;
    while(i>0 && j>0){
        if(dp[i][j] == dp[i][j-1]){
            --j;
        } 
        else if(dp[i][j] == dp[i-1][j]){
            --i;
        }
        else {
            res = s[i-1] + res;
             --i; --j;
        }
    }
    cout << res << endl;
    return 0;
}



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

#include "bits/stdc++.h"
#include "bits/chminmax.h"
using namespace std;
int dp[3010][3010] = {0};
int main(){
    string s,t; cin >> s >> t;
    for(int i=0;i<s.size();++i){
        for(int j=0;j<t.size();++j){
            if(s[i] == t[j]) chmax(dp[i+1][j+1],dp[i][j] + 1);
            chmax(dp[i+1][j+1],dp[i][j+1]);
            chmax(dp[i+1][j+1],dp[i+1][j]);
        }
    }
    string res = "";
    int i = (int)s.size(), j = (int)t.size();
    cout << dp[i][j] << endl;
    while(i>0 && j>0){
        if(dp[i][j] == dp[i][j-1]){
            --j;
        } 
        else if(dp[i][j] == dp[i-1][j]){
            --i;
        }
        else {
            res = s[i-1] + res;
             --i; --j;
        }
    }
    cout << res << endl;
    return 0;
}



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

#include <bits/stdc++.h>
#include <bits/chminmax.h>
using namespace std;
int dp[3010][3010];
int main(){
    string s,t; cin >> s >> t;
    for(int i=0;i<s.size();++i){
        for(int j=0;j<t.size();++j){
            if(s[i] == t[j]) chmax(dp[i+1][j+1],dp[i][j] + 1);
            chmax(dp[i+1][j+1],dp[i][j+1]);
            chmax(dp[i+1][j+1],dp[i+1][j]);
        }
    }
    string res = "";
    int i = s.size(), j = t.size();
    while(i>0 && j>0){
        if(dp[i][j] == dp[i][j-1]) j--;
        else if(dp[i][j] == dp[i-1][j]) i--;
        else res += s[i-1]; i--; j--;
    }
    cout << res << endl;
    return 0;
}


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

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

using namespace std;

int main()
{
        string s, t;
        cin >> s >> t;
        vector<vector<int>>dp (s.size()+1, vector<int>(t.size()+1));
        for (int i = 0,I=1; i < s.size(); i++,I++)
        {
            for (int j = 0,J=1; j < t.size(); J++,j++)
            {
                if (s[i] == t[j])
                    dp[I][J] = 1 + dp[I - 1][J - 1];
                else
                    dp[I][J] = max(dp[I - 1][J], dp[I][J - 1]);
            }
        }
        
        int x = s.size(), y = t.size();
        string res;
        int cur = 0;
        while (x >= 1 && y >= 1)
        {
            if (s[x - 1] == t[y - 1])
            {
                res.push_back(s[x - 1]);
                x--;
                y--;
            }
            else
            {
                if (dp[x - 1][y] > dp[x][y - 1])
                    x--;
                else
                    y--;
            }
        }
        reverse(res.begin(), res.end());
        cout << res;
  return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: 'reverse' was not declared in this scope
   42 |         reverse(res.begin(), res.end());
      |         ^~~~~~~
Language: C++

#include<iostream>
#include<string.h>
#include<stdlib>
using namespace std;
char X[3002];
char Y[3002];

void lcs( char *X, char *Y, int m, int n )
{
int L[m+1][n+1];


for (int i=0; i<=m; i++)
{
	for (int j=0; j<=n; j++)
	{
	if (i == 0 || j == 0)
		L[i][j] = 0;
	else if (X[i-1] == Y[j-1])
		L[i][j] = L[i-1][j-1] + 1;
	else
		L[i][j] = max(L[i-1][j], L[i][j-1]);
	}
}


int index = L[m][n];

char lcs[index+1];
lcs[index] = '\0'; 


int i = m, j = n;
while (i > 0 && j > 0)
{
	
	if (X[i-1] == Y[j-1])
	{
		lcs[index-1] = X[i-1]; 
		i--; j--; index--;	 
	}
	
	else if (L[i-1][j] > L[i][j-1])
		i--;
	else
		j--;
}


cout << lcs;
}


int main()
{
cin>>X;
cin>>Y;
int m = strlen(X);
int n = strlen(Y);
lcs(X, Y, m, n);
return 0;
}

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

#include<stdio.h>
#include<string.h>
char a1[1000];
char a2[1000];
int b[1000][1000];
int main()
{
int i,j;
scanf("%s",a1);
scanf(" %s",a2);
int l1=strlen(a1);
int l2=strlen(a2);

/*for(i=0;i<=l1;i++)
    b[i][0]=0;
for(j=0;j<=l2;j++)
    b[0][j]=0;*/

	for(i=0;i<=l1;i++)
	{

        for(j=0;j<=l2;j++)
        {
        if(i==0&&j==0)
        b[i][j]==0;

        else if(a1[i-1]==a2[j-1])
            b[i][j]=b[i-1][j-1]+1;


		else
		{
			if(b[i][j-1]>b[i-1][j])
			b[i][j]=b[i][j-1];

			else
			b[i][j]=b[i-1][j];
		}

		}

	}

	//printf("%d",b[i-1][j-1]);

    int index=b[i-1][j-1];
    char ans[index+1];
    ans[index]='\0';

    int x=l1,y=l2;
    while(x>0&&y>0)
    {
        if(a1[x-1]==a2[y-1])
        {
         ans[index-1]=a1[x-1];
         x--; y--; index--;
        }

        else if(b[x-1][y]>b[x][y-1])
            x--;
        else
            y--;

    }


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

#include<stdio.h>
#include<string.h>
char a1[1000];
char a2[1000];
int b[1000][1000];
main()
{
int i,j;
scanf("%s",a1);
scanf(" %s",a2);
int l1=strlen(a1);
int l2=strlen(a2);

for(i=0;i<=l1;i++)
    b[i][0]=0;
for(j=0;j<=l2;j++)
    b[0][j]=0;

	for(i=1;i<=l1;i++)
	{

        for(j=1;j<=l2;j++)
        {
        if(a1[i-1]==a2[j-1])
            b[i][j]=b[i-1][j-1]+1;


		else
		{
			if(b[i][j-1]>b[i-1][j])
			b[i][j]=b[i][j-1];

			else
			b[i][j]=b[i-1][j];
		}

		}

	}

	//printf("%d",b[i-1][j-1]);

    int index=b[i-1][j-1];
    char ans[index+1];
    ans[index]='\0';

    int x=l1,y=l2;
    while(x>0&&y>0)
    {
        if(a1[x-1]==a2[y-1])
        {
         ans[index-1]=a1[x-1];
         x--; y--; index--;
        }

        else if(b[x-1][y]>b[x][y-1])
            x--;
        else
            y--;

    }

Compiler output:
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:61:6: error: expected '}' at end of input
   61 |     }
      |      ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std; 
void printLCS(char *X, char *Y, int m, int n) 
{ 
	int LCS[m + 1][n + 1]; 
	int len = 0; 
	int row, col; 

	for (int i = 0; i <= m; i++) { 
		for (int j = 0; j <= n; j++) { 
			if (i == 0 || j == 0) 
				LCSuff[i][j] = 0; 

			else if (X[i - 1] == Y[j - 1]) { 
				LCSuff[i][j] = LCSuff[i - 1][j - 1] + 1; 
				if (len < LCSuff[i][j]) { 
					len = LCSuff[i][j]; 
					row = i; 
					col = j; 
				} 
			} 
			else
				LCSuff[i][j] = 0; 
		} 
	} 

	if (len == 0) { 
		cout << "an empty string"; 
		return; 
	} 
	char* resultStr = (char*)malloc((len + 1) * sizeof(char)); 
	while (LCSuff[row][col] != 0) { 
		resultStr[--len] = X[row - 1];
		row--; 
		col--; 
	} 
	cout << resultStr; 
} 

int main() 
{ 
	char a[3001];
	char b[3001];
	int len1,len2,ans;
	scanf("%s %s",a,b);
	len1=strlen(a);
	len2=strlen(b); 

	printLCSubStr(a, b, len1, len2); 
	return 0; 
} 



Compiler output:
a.cc: In function 'void printLCS(char*, char*, int, int)':
a.cc:12:33: error: 'LCSuff' was not declared in this scope
   12 |                                 LCSuff[i][j] = 0;
      |                                 ^~~~~~
a.cc:15:33: error: 'LCSuff' was not declared in this scope
   15 |                                 LCSuff[i][j] = LCSuff[i - 1][j - 1] + 1;
      |                                 ^~~~~~
a.cc:23:33: error: 'LCSuff' was not declared in this scope
   23 |                                 LCSuff[i][j] = 0;
      |                                 ^~~~~~
a.cc:32:16: error: 'LCSuff' was not declared in this scope
   32 |         while (LCSuff[row][col] != 0) {
      |                ^~~~~~
a.cc: In function 'int main()':
a.cc:49:9: error: 'printLCSubStr' was not declared in this scope; did you mean 'printLCS'?
   49 |         printLCSubStr(a, b, len1, len2);
      |         ^~~~~~~~~~~~~
      |         printLCS
Language: C++

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

short dp[3003][3003];
int main() {
  string s, t;
  cin >> s >> t;
  int ss, ts;
  ss = s.size();
  ts = t.size();
//  int dp[ss+1][ts+1];
  rep(i, ts+1) dp[0][i] = 0;
  rep(i, ss+1) dp[i][0] = 0;
  rep(i, ss) {
    rep(j, ts) {
      if ((s[i] == t[j]) && (dp[i][j] == dp[i][j+1]) && (dp[i][j] == dp[i+1][j])) {
        dp[i+1][j+1] = dp[i][j] + 1;
      } else {
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }
//  rep(i, ss+1) {rep(j, ts+1) cout << dp[i][j]; cout << endl;}
  if (dp[ss][ts] == 0) cout << "" << endl;
  else {
    strint ans = "";
    for (int i = ss, j = ts; (i > 0) && (j > 0);) {
//      cout << ss-si << "," << ts-ti << endl;
      if (dp[i][j] == dp[i-1][j]) i--;
      else if (dp[i][j] == dp[i][j-1]) j--;
      else {ans = t[j-1] + ans; i--; j--; if (dp[i][j] <= 0) break;}
    }
    cout << ans << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:5: error: 'strint' was not declared in this scope; did you mean 'strcat'?
   29 |     strint ans = "";
      |     ^~~~~~
      |     strcat
a.cc:34:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |       else {ans = t[j-1] + ans; i--; j--; if (dp[i][j] <= 0) break;}
      |             ^~~
      |             abs
a.cc:36:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

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

short dp[3003][3003];
int main() {
  string s, t;
  cin >> s >> t;
  int ss, ts;
  ss = s.size();
  ts = t.size();
//  int dp[ss+1][ts+1];
  rep(i, ts+1) dp[0][i] = 0;
  rep(i, ss+1) dp[i][0] = 0;
  rep(i, ss) {
    rep(j, ts) {
      if ((s[i] == t[j]) && (dp[i][j] == dp[i][j+1]) && (dp[i][j] == dp[i+1][j])) {
        dp[i+1][j+1] = dp[i][j] + 1;
      } else {
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }
//  rep(i, ss+1) {rep(j, ts+1) cout << dp[i][j]; cout << endl;}
  if (dp[ss][ts] == 0) cout << "" << endl;
  else {
    vector<char> ans;
    int si=0, ti=0;
    for (int i = ss, int j = ss; (i > 0) && (j > 0);) {
//      cout << ss-si << "," << ts-ti << endl;
      if (dp[i][j] == dp[i-1][j]) i--;
      else if (dp[i][j] == dp[i][j-1]) j--;
      else {ans.emplace_back(t[j-1]); i--; if (dp[i][j] <= 0) break;}
    }
    reverse(ans.begin(), ans.end());
    rep(i, ans.size()) printf("%c", ans[i]);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:22: error: expected unqualified-id before 'int'
   31 |     for (int i = ss, int j = ss; (i > 0) && (j > 0);) {
      |                      ^~~
a.cc:31:21: error: expected ';' before 'int'
   31 |     for (int i = ss, int j = ss; (i > 0) && (j > 0);) {
      |                     ^~~~
      |                     ;
a.cc:31:52: error: expected ')' before ';' token
   31 |     for (int i = ss, int j = ss; (i > 0) && (j > 0);) {
      |         ~                                          ^
      |                                                    )
a.cc:31:53: error: expected primary-expression before ')' token
   31 |     for (int i = ss, int j = ss; (i > 0) && (j > 0);) {
      |                                                     ^
Language: C++

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

short dp[3003][3003];
int main() {
  string s, t;
  cin >> s >> t;
  int ss, ts;
  ss = s.size();
  ts = t.size();
//  int dp[ss+1][ts+1];
  rep(i, ts+1) dp[0][i] = 0;
  rep(i, ss+1) dp[i][0] = 0;
  rep(i, ss) {
    rep(j, ts) {
      if ((s[i] == t[j]) && (dp[i][j] == dp[i][j+1]) && (dp[i][j] == dp[i+1][j])) {
        dp[i+1][j+1] = dp[i][j] + 1;
      } else {
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }
//  rep(i, ss+1) {rep(j, ts+1) cout << dp[i][j]; cout << endl;}
  if (dp[ss][ts] == 0) cout << "" << endl;
  else {
    vector<char> ans;
    int si=0, ti=0;
    rep(i, ss+ts-1) {
//      cout << ss-si << "," << ts-ti << endl;
      if (dp[ss-si][ts-ti] == dp[ss-si-1][ts-ti]) si++;
      else if (dp[ss-si][ts-ti] == dp[ss-si][ts-ti-1]) ti++;
      else {ans.push_front(t[ts-ti-1]); si++; if (dp[ss-si][ts-ti] <= 0) break;}
    }
    rep(i, ans.size()) printf("%c", ans.at(i));
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'class std::vector<char>' has no member named 'push_front'
   35 |       else {ans.push_front(t[ts-ti-1]); si++; if (dp[ss-si][ts-ti] <= 0) break;}
      |                 ^~~~~~~~~~
Language: C++

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

short dp[3003][3003];
int main() {
  string s, t;
  cin >> s >> t;
  int ss, ts;
  ss = s.size();
  ts = t.size();
//  int dp[ss+1][ts+1];
  rep(i, ts+1) dp[0][i] = 0;
  rep(i, ss+1) dp[i][0] = 0;
  rep(i, ss) {
    rep(j, ts) {
      if ((s[i] == t[j]) && (dp[i][j] == dp[i][j+1]) && (dp[i][j] == dp[i+1][j])) {
        dp[i+1][j+1] = dp[i][j] + 1;
      } else {
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }
//  rep(i, ss+1) {rep(j, ts+1) cout << dp[i][j]; cout << endl;}
  if (dp[ss][ts] == 0) cout << "" << endl;
  else {
    string ans = "";
    int si=0, ti=0;
    rep(i, ss+ts-1) {
//      cout << ss-si << "," << ts-ti << endl;
      if (dp[ss-si][ts-ti] == dp[ss-si-1][ts-ti]) si++;
      else if (dp[ss-si][ts-ti] == dp[ss-si][ts-ti-1]) ti++;
      else {ans = t[ts-ti-1] + ans; si++; if (dp[ss-si][ts-ti] <= 0) break;}
    }
    println("%s", ans);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: 'println' was not declared in this scope; did you mean 'rintl'?
   37 |     println("%s", ans);
      |     ^~~~~~~
      |     rintl
Language: C++

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

short dp[3003][3003];
int main() {
  string s, t;
  cin >> s >> t;
  int ss, ts;
  ss = s.size();
  ts = t.size();
//  int dp[ss+1][ts+1];
  rep(i, ts+1) dp[0][i] = 0;
  rep(i, ss+1) dp[i][0] = 0;
  rep(i, ss) {
    rep(j, ts) {
      if ((s[i] == t[j]) && (dp[i][j] == dp[i][j+1]) && (dp[i][j] == dp[i+1][j])) {
        dp[i+1][j+1] = dp[i][j] + 1;
      } else {
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }
//  rep(i, ss+1) {rep(j, ts+1) cout << dp[i][j]; cout << endl;}
  if (dp[ss][ts] == 0) cout << "" << endl;
  else {
    string ans = "";
    int si=0, ti=0;
    rep(i, ss+ts-1) {
//      cout << ss-si << "," << ts-ti << endl;
      if (dp[ss-si][ts-ti] == dp[ss-si-1][ts-ti]) si++;
      else if (dp[ss-si][ts-ti] == dp[ss-si][ts-ti-1]) ti++;
      else {ans = t[ts-ti-1] + ans; si++; if (dp[ss-si][ts-ti] <= 0) break;}
    }
    char* ans2[ans.size()];
    rep(i, ans.size()) ans2[i] = ans[i];
    printf("%s", ans2);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:39: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive]
   38 |     rep(i, ans.size()) ans2[i] = ans[i];
      |                                       ^
      |                                       |
      |                                       __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
Language: C++

#include<iostream>
#include <algorithm>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
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; }
//forとか代入しない場合は++iでもi++でも同じ

// 入力
string s, t;

// DPテーブル
int dp[3100][3100] = {0}; // 初期値も初期条件も 0

//Wが大きいときはWじゃなくてVで回してあげる、で重さが最小になるようにすればいい、ここでも全探索の時みたいなループ軸の変更,答えの時はsum_vを使う
int main() {
    cin >> s >> t;
    
    //dp
    for (int i = 0; i < s.size(); i++)
    {
        for (int j = 0; j < t.size(); j++)
        {
            if(s[i] == t[j]) chmax(dp[i+1][j+1],dp[i][j]+1);
            //ここでdp[i][j+1]、dp[i+1][j]ふたつが必要なのはどちらか大きい方が必要だから,dp[i][j+1]とdp[i+1][j]で大きさが違う時があるので
            chmax(dp[i+1][j+1],dp[i][j+1]);
            chmax(dp[i+1][j+1],dp[i+1][j]);
        }
        
    }

    //具体的なLCSを求める
    string res =  "";
    int i = (int)s.size();
    int j = (int)t.size();

    while(i > 0 && j > 0){
        //(i-1,j)→(i,j)
           if(dp[i][j] == dp[i-1][j]){
               i--;
           }
        //(i,j-1)→(i,j)
           else if(dp[i][j] == dp[i][j-1]){
               j--;
           }
        //(i-1,j-1)→(i,j)
        else (dp[i][j] == dp[i-1][j-1]){
               //この場合s[i-1]もt[j-1]も同じなのでどっちでもいい
               res = s[i-1] + res;
               i--;
               j--;
               
           }
    } 

    cout << res << endl;
    
    
    
}




Compiler output:
a.cc: In function 'int main()':
a.cc:56:40: error: expected ';' before '{' token
   56 |         else (dp[i][j] == dp[i-1][j-1]){
      |                                        ^
      |                                        ;
Language: C++

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

unordered_map<int, unordered_map<int, int>> dp;
string s, t;

int recurse(int i, int j) {
    if() {
        return dp[i][j];
    } else if(!i or !j) {
    	return dp[i][j] = 0;
    } else if(s[i - 1] == t[j - 1]) {
    	return dp[i][j] = recurse(i - 1, j - 1) + 1;
    } else {
    	return dp[i][j] = max(recurse(i - 1, j), recurse(i, j - 1));
    }
}

signed main() {
    string lcs = ""; cin >> s >> t;
    int n = (int)s.length(), m = (int)t.length(), x = n, y = m;
    recurse(n, m);
    while(x > 0 and y > 0) {
        if(s[x - 1] == t[y - 1]) {
        lcs = s[x - 1] + lcs;
          x = x - 1; y = y - 1;
        } else if(dp[x - 1][y] > dp[x][y - 1]) {
        	x = x - 1;
        } else {
        	y = y - 1;
        }
    }
    cout << lcs;
    return 0;
}

Compiler output:
a.cc: In function 'int recurse(int, int)':
a.cc:8:8: error: expected primary-expression before ')' token
    8 |     if() {
      |        ^
a.cc:17:1: warning: control reaches end of non-void function [-Wreturn-type]
   17 | }
      | ^
Language: Java


import javax.swing.*;
import java.io.*;
import java.util.*;

public class Main {

    static class Point {
        int i;
        int j;

        public Point(int i, int j) {
            this.i = i;
            this.j = j;
        }
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String first = sc.next();
        String second = sc.next();
        int[][] arr = new int[first.length()][second.length()];
        Point[][] arr2 = new Point[first.length()][second.length()];
        if (first.charAt(0) == second.charAt(0)) {
            arr[0][0] = 1;
        } else {
            arr[0][0] = 0;
        }
        arr2[0][0] = new Point(0,0);
        for(int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[0].length; j++) {
                int prev = 0;
                if(i > 0) {
                    prev = arr[i - 1][j];
                }
                int prev2 = 0;
                if(j > 0) {
                    prev2 = arr[i][j- 1];
                }
                int curValue = 0;
                if (first.charAt(i) == second.charAt(j)) {
                    if (i > 0 && j > 0) {
                        arr[i][j] = arr[i - 1][j - 1] + 1;
                        arr2[i][j] = new Point(i-1,j - 1);
                    } else {
                        arr[i][j] = 1;
                        if (i == 0) {
                            arr2[i][j] = new Point(0, j -1);
                        } else {
                            arr2[i][j] = new Point(i - 1, 0);
                        }
                    }
                } else {
                    arr[i][j] = Integer.max(prev, prev2);
                    if (arr[i][j] == prev) {
                        arr2[i][j] = new Point(i-1,j);
                    } else (arr[i][j] == prev2) {
                        arr2[i][j] = new Point(i,j - 1);
                    } 
                }
            }
        }

        StringBuilder s = new StringBuilder();
        int lastI = arr.length - 1;
        int lastJ = arr[0].length - 1;
        while (true) {
            if (first.charAt(lastI) == second.charAt(lastJ)) {
                s.append(first.charAt(lastI));
            }
           Point p = arr2[lastI][lastJ];
            if (p.i == -1 || p.j == -1) {
                break;
            }
           lastI = p.i;
           lastJ = p.j;
           if (lastI == 0 && lastJ == 0) {
               if (first.charAt(lastI) == second.charAt(lastJ)) {
                   s.append(first.charAt(lastI));
               }
               break;
           }
        }
        System.out.println(s.reverse());
    }

}

Compiler output:
Main.java:57: error: not a statement
                    } else (arr[i][j] == prev2) {
                           ^
Main.java:57: error: ';' expected
                    } else (arr[i][j] == prev2) {
                                               ^
2 errors
Language: C++

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

int main(){
  string s,t,ans;
  cin>>s>>t;
  int S=s.length();
  int T=t.length();
  vector<vector<int>>dp(S,vector<int>(T));
  vector<vector<string>>dps(S,vector<string>(T));
  if(s[0]==t[0]){
    dp[0][0]=1;
    dps[0][0]=s[0];
  }else{
    dp[0][0]=0;
    if(s[0]==t[1]){
      dp[0][1]=1;
      dps[0][1]=s[0];
    }else if(s[1]==t[0]){
      dp[1][0]=1;
      dps[1][0]=s[1];
    }
  for(int i=1;i<S;i++){
    for(int j=1;j<T;j++){
      if(s[i]==t[j]){
        dp[i][j]=dp[i-1][j-1]+1;
        dps[i][j]=dps[i-1][j-1]+s[i];
      }else{
        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        if(dp[i][j]==dp[i-1][j]){
          dps[i][j]=dps[i-1][j];
        }else{
          dps[i][j]=dps[i][j-1];
        }
      }
    }
  }
  cout<<dps[S-1][T-1]<<endl;
}
  


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

//*******Abhijit Burman***********//
//Jalpaiguri Government Engineering College//

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

#define pb push_back
#define mk make_pair
#define MAXX (1000000000000000000+7)
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
string temp=" ";
string dp[4000][4000];
string s,tt;

//vector<ll> dp(100000100,110);
string LCS(ll i, ll j)
{

    if(i<0 || j<0)
    {
        return "";
    }
   else
    {
        //cout<<i<<" "<<j<<endl;
        if(dp[i][j]!="12")
        {
            //cout<<"Hello"<<i<<" "<<j<<endl;
            return dp[i][j];
        }
        else
        {

            if(s[i]==tt[j])
            {

                dp[i][j] = s[i]+LCS(i-1,j-1);
                return (dp[i][j]);
            }
            else
            {
                return (dp[i][j] = max(LCS(i-1,j),LCS(i,j-1)));
            }

        }
    }

}

void solve(ll t)
{

	cin>>s>>tt;
	ll i=s.size()-1;
	ll j=tt.size()-1;
	for(int i=0;i<4000;i++)
    {
        for(int j=0;j<4000;j++)
        {
            dp[i][j]="12";
        }
    }

	ll jj;
    //cout<<v.size()<<endl;
    string z = LCS(i,j);
    reverse(z.begin(),z.end());
    ll maxi = 0;
    //cout<<z<<endl;
    ll index1,index2;
    for(int i=0;i<4000++)
    {
        for(int j=0;j<4000;j++)
        {
            if(dp[i][j]!="12" && dp[i][j].size()>maxi)
            {
                index1=i;
                index2=j;
                maxi = dp[i][j].size();
            }
        }
    }
    reverse(dp[index1][index2].begin(),dp[index1][index2].end());
    cout<<dp[index1][index2]<<endl;
    //cout<<endl;
}


int main()
{
	ll t=1;
	//cin>>t;
	while(t--)
	{
		solve(t);
	}
	return 0;
}


Compiler output:
a.cc: In function 'void solve(long long int)':
a.cc:72:19: error: lvalue required as increment operand
   72 |     for(int i=0;i<4000++)
      |                   ^~~~
a.cc:72:25: error: expected ';' before ')' token
   72 |     for(int i=0;i<4000++)
      |                         ^
      |                         ;
Language: C++

//*******Abhijit Burman***********//
//Jalpaiguri Government Engineering College//

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

#define pb push_back
#define mk make_pair
#define MAXX (1000000000000000000+7)
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
const int MAX_V = 1000000000;
const int MAX_N = 110;

ll dp[4000][4000];
string s,tt;
ll flag = 0;
vector< string > v;
//vector<ll> dp(100000100,110);
vector<string> LCS(ll i, ll j, string ans)
{
    if(i==0 && j==0)
    {
        if(s[i]==tt[j])
        {
            ans=ans+s[i];
        }
        reverse(ans.begin(),ans.end());
        v.pb(ans);
    }
    else if(i==0)
    {
        if(s[i]==tt[j])
        {
            ans=ans+s[i];
        }
        LCS(i,j-1,ans);

    }
    else if(j==0)
    {
        if(s[i]==tt[j])
        {
            ans = ans+s[i];
        }
        LCS(i-1,j,ans);

    }
    else
    {
        if(s[i]==tt[j])
        {
            ans = ans+s[i];
             LCS(i-1,j-1,ans);
        }
        else
        {
            LCS(i-1,j,ans);
            LCS(i,j-1,ans);
        }
    }

    return v;
}

void solve(ll t)
{

	cin>>s>>tt;
	ll i=s.size()-1;
	ll j=tt.size()-1;
	LCS(i,j,"");
	ll maxi = 0;
	ll j;
    //cout<<v.size()<<endl;
	for(int i=0;i<v.size();i++)
    {
        if(v[i].size()>maxi)
        {
            j= i;
            maxi = v[i].size();
        }
    }
    cout<<v[j]<<endl;
}


int main()
{
	ll t=1;
	//cin>>t;
	while(t--)
	{
		solve(t);
	}
	return 0;
}


Compiler output:
a.cc: In function 'void solve(long long int)':
a.cc:74:12: error: redeclaration of 'long long int j'
   74 |         ll j;
      |            ^
a.cc:71:12: note: 'long long int j' previously declared here
   71 |         ll j=tt.size()-1;
      |            ^
Language: C++

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

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'for'
    1 | for(int i=0;i<size(s)+1;i++)
      | ^~~
a.cc:1:13: error: 'i' does not name a type
    1 | for(int i=0;i<size(s)+1;i++)
      |             ^
a.cc:1:25: error: 'i' does not name a type
    1 | for(int i=0;i<size(s)+1;i++)
      |                         ^
Language: C++


#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

const int inf = 1e9 + 7;
const ll inf_ll = 1e18L + 7;

template <typename T>
void mini(T& a, T b) {
  a = min(a, b);
}

template <typename T>
void maxi(T& a, T b) {
  a = max(a, b);
}

int main() {
  string a, b;
  cin >> a >> b;
  int n = a.size();
  int m = b.size();
  vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
  ostringstream out;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (a[i - 1] == b[j - 1]) {
        maxi(dp[i][j], dp[i - 1][j - 1] + 1);
      } else {
        dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
      }
    }

  int x = n;
  int y = m;
  while (dp[x][y] != 0) {
    if (dp[x][y] == dp[x - 1][y] + 1) {
      out < < < < a[x - 1];
      --x;
    } else if (dp[x][y] == dp[x][y - 1] + 1) {
      ans << b[y - 1];
      --y;
    } else if (dp[x][y] == dp[x - 1][y - 1] + 1) {
      ans << a[x - 1];
      --x;
      --y;
    } else {
      --x;
      --y;
    }
  }
  reverse(begin(ans), end(ans));
  cout << ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:13: error: expected primary-expression before '<' token
   42 |       out < < < < a[x - 1];
      |             ^
a.cc:42:15: error: expected primary-expression before '<' token
   42 |       out < < < < a[x - 1];
      |               ^
a.cc:42:17: error: expected primary-expression before '<' token
   42 |       out < < < < a[x - 1];
      |                 ^
a.cc:45:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   45 |       ans << b[y - 1];
      |       ^~~
      |       abs
a.cc:48:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 |       ans << a[x - 1];
      |       ^~~
      |       abs
a.cc:56:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   56 |   reverse(begin(ans), end(ans));
      |                 ^~~
      |                 abs
Language: C++

#include <bits/stdc++.h>
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define pb push_back
#define show(x) cout << (#x) << " : " << x << endl;
#define ll long long
#define ld long double

#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll, ll>
#define sq(x) ((x) * (x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
const ll MOD = 1000 * 1000 * 1000 + 7;
using namespace std;



ll dp[3001][3001]={0};

bool dpbool[3001][3001];

string s,k;

vector <string> p;

ll seno(ll idx1, ll idx2)
{

if (dpbool[idx1][idx2]!=0)
return dp[idx1][idx2];	

if (idx1<0||idx2<0)
{
	return 0;
}	





if (s[idx1]==k[idx2])
{
	
	dp[idx1][idx2]=1+seno(idx1-1,idx2-1);
}
else
{

dp[idx1][idx2]=max(seno(idx1-1,idx2),seno(idx1,idx2-1));

}

dpbool[idx1][idx2]=1;
return dp[idx1][idx2];
}


bool compareLen(const std::string& a, const std::string& b)
{
    return (a.size() < b.size()); 
}



void print(ll m, ll n)
{


string lcs;

ll i = m, j = n; 
   while (i >0 && j >0) 
   { 

   	  if (s[i]==' ')
   	  i--;
   	  
   	  if (k[j]==' ')
   	  k--;

   	  if (s[i]==' '&&k[j]==' ')
   	  {
   	  	i--;
   	  	k--;
   	  }	

   
      if (s[i] == k[j]) 
      { 
          lcs.pb(s[i]); 
          i--; j--;     
      } 
  
      
      
      else if (dp[i-1][j] > dp[i][j-1]) 
         i--; 
      else
         j--; 
   } 
reverse(lcs.begin(),lcs.end());
cout<<lcs;

}

int main() 
{ 


fastio();


cin>>s>>k;

s=" "+s;
k=" "+k;

ll x=s.length()-1;
ll y=k.length()-1;

memset(dpbool,0,sizeof(dpbool));

ll t=seno(x,y);



print(x,y);

return 0;
} 




Compiler output:
a.cc: In function 'void print(long long int, long long int)':
a.cc:84:12: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
   84 |           k--;
      |           ~^~
a.cc:89:18: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
   89 |                 k--;
      |                 ~^~
Language: C++

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

const int INF = 0x3f3f3f3f;
const int N = 1e3 + 5;

int dp[N][N];
string a, b, ans;

int dpf(int i, int j) {
  if(dp[i][j] != -INF) return dp[i][j];
  if(!i or !j) return dp[i][j] = 0;
  if(a[i-1] == b[j-1]) return dp[i][j] = 1 + dpf(i-1, j-1);
  return dp[i][j] = max(dpf(i-1, j), dpf(i, j-1));
}

void rec(int i, int j) {
  if(!i or !j) return;
  if(a[i-1] == b[j-1]) ans += a[i-1], rec(i-1, j-1);
  else if(dp[i][j] == dp[i-1][j]) rec(i-1, j);
  else rec(i, j-1);
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> a >> b;
  int n = a.size(), m = b.size();
  for(int i = 0; i < N; i++) 
    for(int j = 0; j < N; j++) dp[i][j] = -INF;
  dpf(n, m);
  rec(n, m);
  reverse(ans.begin(), ans.end());
  cout << ans << "\n";
}
[h

Compiler output:
a.cc:35:1: error: expected unqualified-id before '[' token
   35 | [h
      | ^
Language: C++

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

string solve(string x, string y){
    string c[301][301];
    string ret = " ";
    int n = y.length();

    x = ' ' + x;
    y = ' ' + y;

    for(int i = 0; i < m; i++) c[i][0] = "";
    for(int i = 0; i < n; i++) c[0][i] = "";

    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= n; j++){
            if(x[i] == y[j]){
                c[i][j] = c[i-1][j-1] + y[j];
            }else{
                if(c[i][j-1].length() > c[i-1][j].length()){
                    c[i][j] = c[i][j-1];
                }else{
                    c[i][j] = c[i-1][j];
                }
            }
            if(ret.length() < c[i][j].length()){
                ret = c[i][j];
            }
        }
    }
    return ret;
}

int main(){
    string s,t;
    cin >> s >> t;

    cout << solve(s,t) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'std::string solve(std::string, std::string)':
a.cc:12:24: error: 'm' was not declared in this scope
   12 |     for(int i = 0; i < m; i++) c[i][0] = "";
      |                        ^
a.cc:15:25: error: 'm' was not declared in this scope
   15 |     for(int i = 1; i <= m; i++){
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define rrep(i,n) for(int i = (n-1); i>=0; --i)
#define PI 3.14159265
#define INF 1e9
#define LINF 1e18
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(int &a,int b){
	a = min(a,b);
}

int main(){
	string s,t; cin >> s >> t;

	int n = s.size(), m =t.size();

	vector<vector<int>> dp(n+1,vector<int> (m+1));

	rep(i,n+1) rep(j,m+1){
		if(i==0 or j==0 ){
			dp[i][j] = 0;
		}else{
			if(s[i-1] == t[j-1]){
				dp[i][j] = dp[i-1][j-1] + 1;
			}else{
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}

	int i = n,j=m;
	stack<char> st;
	while(i>=1&&j>=1){
		if(dp[i][j] == dp[i-1][j-1] +1){
			st.push(s[i-1]);
			i--;
			j--;
		}else if(dp[i][j] == dp[i-1][j]){
			i--;
		}else{
			j--;
		}
	}

	while(!s.empty()){
		cout<< s.top();
		s.pop();
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:26: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'top'
   50 |                 cout<< s.top();
      |                          ^~~
a.cc:51:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop'
   51 |                 s.pop();
      |                   ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define rrep(i,n) for(int i = (n-1); i>=0; --i)
#define PI 3.14159265
#define INF 1e9
#define LINF 1e18
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(int &a,int b){
	a = min(a,b);
}

int main(){
	string s,t; cin >> s >> t;

	int n = s.size(), m =t.size();

	vector<vector<int>> dp(n+1,vector<int> (m+1));

	rep(i,n+1) rep(j,m+1){
		if(i==0 or j==0 ){
			dp[i][j] = 0;
		}else{
			if(s[i-1] == t[j-1]){
				dp[i][j] = dp[i-1][j-1] + 1;
			}else{
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}

	int i = n,j=m;
	stack<char> s;
	while(i>=1&&j>=1){
		if(dp[i][j] == dp[i-1][j-1] +1){
			s.push(s[i-1]);
			i--;
			j--;
		}else if(dp[i][j] == dp[i-1][j]){
			i--;
		}else{
			j--;
		}
	}

	while(!s.empty()){
		cout<< s.top();
		s.pop();
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:21: error: conflicting declaration 'std::stack<char> s'
   36 |         stack<char> s;
      |                     ^
a.cc:17:16: note: previous declaration as 'std::string s'
   17 |         string s,t; cin >> s >> t;
      |                ^
a.cc:39:27: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push'
   39 |                         s.push(s[i-1]);
      |                           ^~~~
a.cc:50:26: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'top'
   50 |                 cout<< s.top();
      |                          ^~~
a.cc:51:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop'
   51 |                 s.pop();
      |                   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{	
	string s,t;
	cin>>s>>t;
	if((int)s.lenght()>(int)t.length())
	{
		string temp = s;
		t=s;
		s=temp;
	}
	int dp[(int)s.length()+1][(int)t.length()+1];
	for(int i=0; i<=(int)s.length(); i++)
	{
		for(int j=0; j<=(int)t.length(); j++)
		{
			if(i==0 || j==0)
			{
				dp[i][j] = 0;
			}else
			{
				if(s[i-1] == t[j-1])
				{
					dp[i][j] = dp[i-1][j-1]+1;
				}else
				{
					dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
				}
			}
		}
	}

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

	stack<int>stk;
	int i= (int)s.length();
	int j =(int)t.length();
	while(i!=0 && j!=0)
	{
		if(dp[i][j] == dp[i-1][j-1]+1)
		{
			 //cout<<s[i-1];
			stk.push((int)s[i-1]);
			i--;
			j--;
		}else if(dp[i][j] == dp[i-1][j])
		{
			i--;
		}else
		{
			j--;
		}

	}


	while(!stk.empty())
	{
		cout<<(char)stk.top();
		stk.pop();
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lenght'; did you mean 'length'?
    7 |         if((int)s.lenght()>(int)t.length())
      |                   ^~~~~~
      |                   length
Language: C++

  1 #include<bits/stdc++.h>
  2 #define int long long 
  3 #define endl '\n'
  4 #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  5 
  6 using namespace std;
  7 
  8 signed main(){IOS;
  9         string s,t; cin>>s>>t;
 10         int n = s.size() , m = t.size();
 11         vector<vector<int>>dp(n+1,vector<int>(m+1,0));
 12         for(int i=1;i<=n;i++){
 13                 for(int j=1;j<=m;j++){
 14                         if(s[i-1]==t[j-1]){
 15                                 dp[i][j] = max(dp[i][j],max(dp[i-1][j-1]+1,max(dp[i-1][j],dp[i][j-1])));
 16                         }else {
 17                                 dp[i][j] = max(dp[i][j],max(dp[i-1][j],dp[i][j-1]));
 18                         }
 19                 }
 20         }
 21         int i = n , j = m ;
 22         string ans = "";
 23         while(i>0 and j > 0){
 24                 if(s[i-1] == t[j-1]){
 25                         ans+=s[i-1];
 26                         i--;
 27                         j--;
 28                 }else if( dp[i][j-1] > dp[i-1][j]){
 29                         j--;
 30                 }else { 
 31                         i--;
 32                 }       
 33         }
 34         reverse(ans.begin(),ans.end());
 35         cout<<ans<<endl;
 36         return 0;
 37 }
~                                                                                                                
~                                                                                                                
~                                                                                                                
~              

Compiler output:
a.cc:1:5: error: stray '#' in program
    1 |   1 #include<bits/stdc++.h>
      |     ^
a.cc:2:5: error: stray '#' in program
    2 |   2 #define int long long
      |     ^
a.cc:3:5: error: stray '#' in program
    3 |   3 #define endl '\n'
      |     ^
a.cc:4:5: error: stray '#' in program
    4 |   4 #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
      |     ^
a.cc:1:3: error: expected unqualified-id before numeric constant
    1 |   1 #include<bits/stdc++.h>
      |   ^
a.cc:4:46: error: 'cin' does not name a type
    4 |   4 #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
      |                                              ^~~
a.cc:4:57: error: 'cout' does not name a type
    4 |   4 #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
      |                                                         ^~~~
a.cc:7:3: error: expected unqualified-id before numeric constant
    7 |   7
      |   ^
a.cc:39:1: error: expected class-name before '~' token
   39 | ~
      | ^
Language: C++

#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def calc_lcs(s, t):
  dp = numpy.zeros((len(s)+1, len(t)+1))
  for i, si in enumerate(s, 1):
    for j, tj in enumerate(t, 1):
      dp[i][j] = max((dp[i-1][j-1] + (1 if si==tj else 0), dp[i-1][j], dp[i][j-1]))

  lcs = ''
  i, j = len(s), len(t)
  while i > 0 and j > 0:
    if   dp[i][j] == dp[i-1][j-1]+1:
      lcs = s[i-1] + lcs
      i -= 1
      j -= 1
    elif dp[i][j] == dp[i-1][j]:
      i -= 1
    elif dp[i][j] == dp[i][j-1]:
      j -= 1
  return lcs

def main():
  s = input().strip()
  t = input().strip()
  print(calc_lcs(s, t))


if __name__=='__main__':
  main()

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/python3
      |  ^
a.cc:2:3: error: invalid preprocessing directive #-
    2 | # -*- coding:utf-8 -*-
      |   ^
a.cc:12:9: error: empty character constant
   12 |   lcs = ''
      |         ^~
a.cc:31:14: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   31 | if __name__=='__main__':
      |              ^~~~~~~~~~
a.cc:4:1: error: 'import' does not name a type
    4 | import numpy
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'