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

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

int main(){
  string a,b;
  cin >> a >> b;
  vector<vector<int>> dp(a.size()+1, vector<int>(b.size()+1));

  for(int i=0; i <= a.size(); i++){
    dp[i][0] = 0;
  }
  for(int i=0; i <= b.size(); i++){
    dp[0][i] = 0;
  }
  if(a.empty() || b.empty()){ 
    return "";
  }
  for(int i=0; i < a.size(); i++){
    for(int j=0; j < b.size(); j++){
      if(a[i] == b[j]){
        dp[i+1][j+1] = dp[i][j] + 1;
      }else{
        dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
      }
    }
  }
  //cout << dp[a.size()][b.size()] << endl;

  //int lcs = dp[a.size()][b.size()];
  string ans;
  for(int i=a.size(); i > 0; i--){
    for(int j=b.size(); j > 0; j--){
      if(dp[i-1][j-1] == dp[i][j] - 1){
        if(dp[i-1][j-1] == dp[i][j-1] && dp[i-1][j-1] == dp[i-1][j]){
          ans.push_back(b[j-1]);
          i--;
        }
      }else if(dp[i-1][j-1] == dp[i][j]){
        i--;
      }
    }
  }
  for(int i=dp[a.size()][b.size()]; i >=0; i--){
    cout << ans[i];
  }
  cout << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   16 |     return "";
      |            ^~
      |            |
      |            const char*
Language: C++

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

int main(){
  string a,b;
  cin >> a >> b;
  vector<vector<int>> dp(a.size()+1, vector<int>(b.size()+1));

  for(int i=0; i <= a.size(); i++){
    dp[i][0] = 0;
  }
  for(int i=0; i <= b.size(); i++){
    dp[0][i] = 0;
  }
  if(a.empty() || b.empty()) return "";
  for(int i=0; i < a.size(); i++){
    for(int j=0; j < b.size(); j++){
      if(a[i] == b[j]){
        dp[i+1][j+1] = dp[i][j] + 1;
      }else{
        dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1]);
      }
    }
  }
  //cout << dp[a.size()][b.size()] << endl;

  //int lcs = dp[a.size()][b.size()];
  string ans;
  for(int i=a.size(); i > 0; i--){
    for(int j=b.size(); j > 0; j--){
      if(dp[i-1][j-1] == dp[i][j] - 1){
        if(dp[i-1][j-1] == dp[i][j-1] && dp[i-1][j-1] == dp[i-1][j]){
          ans.push_back(b[j-1]);
          i--;
        }
      }else if(dp[i-1][j-1] == dp[i][j]){
        i--;
      }
    }
  }
  for(int i=dp[a.size()][b.size()];; i >=0; i--){
    cout << ans[i];
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   15 |   if(a.empty() || b.empty()) return "";
      |                                     ^~
      |                                     |
      |                                     const char*
a.cc:41:43: error: expected ')' before ';' token
   41 |   for(int i=dp[a.size()][b.size()];; i >=0; i--){
      |      ~                                    ^
      |                                           )
a.cc:41:45: error: 'i' was not declared in this scope
   41 |   for(int i=dp[a.size()][b.size()];; i >=0; i--){
      |                                             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
string dp(int i,int j,string s1,string s2,map<pair<int,int>,string> &mp){
  if(i>=s1.size() || j>= s2.size())
    return;
  if(mp.find({i,j})!=mp.end())
    return mp[{i,j}];
  
  string ans;
  
  if(s1[i]==s2[j])
  {
    ans=s1[i]+dp(i+1,j+1,s1,s2,mp);
  }
  else{
    ans=max(dp(i+1,j,s1,s2,mp),dp(i,j+1,s1,s2,mp);
  }

   mp[{i,j}]=ans;
 return ans;
}
int main(){
  string s1,s2;
  cin>>s1>>s2;
  map<pair<int,int> ,string> mp;
  cout<<dp(0,0,s1,s2,mp);
}
        

Compiler output:
a.cc: In function 'std::string dp(int, int, std::string, std::string, std::map<std::pair<int, int>, std::__cxx11::basic_string<char> >&)':
a.cc:5:5: error: return-statement with no value, in function returning 'std::string' {aka 'std::__cxx11::basic_string<char>'} [-fpermissive]
    5 |     return;
      |     ^~~~~~
a.cc:16:50: error: expected ')' before ';' token
   16 |     ans=max(dp(i+1,j,s1,s2,mp),dp(i,j+1,s1,s2,mp);
      |            ~                                     ^
      |                                                  )
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
template <typename T> void max_self(T& a, T b) {
    a = max(a, b);
}

// dp[n][m]

bool first_row_or_column(pair<int,int> p) {
    return p.first == 0 || p.second == 0;
}

const int INF = 1e9 + 5;

int main() {
    string a, b;
    cin >> a >> b;
    vector<vector<pair<int,pair<int,int>>>> dp(a.length() + 1,
        vector<pair<int,pair<int,int>>>(b.length() + 1, {-INF,{0,0}}));
    dp[0][0] = {0, {0,0}};
    // dp[i][j] - the max total length so far
    for(int i = 0; i < (int) a.length(); ++i) {
        for(int j = 0; j < (int) b.length(); ++j) {
            if(a[i] == b[j]) {
                max_self(dp[i+1][j+1], make_pair(dp[i][j].first + 1, make_pair(i,j)));
            }
            max_self(dp[i+1][j], make_pair(dp[i][j].first, make_pair(i,j)));
            max_self(dp[i][j+1], make_pair(dp[i][j].first, make_pair(i,j)));
        }
    }
    pair<int,pair<int,int>> answer = {0,{0,0}};
    for(int i = 0; i <= (int) a.length(); ++i) {
        for(int j = 0; j <= (int) b.length(); ++j) {
            max_self(answer, make_pair(dp[i][j].first, make_pair(i, j)));
        }
    }
    string s;
    pair<int,int> cur = answer.second;
    while(!first_row_or_column(cur)) {
        int i = cur.first;
        int j = cur.second;
        pair<int,int> previous = dp[i][j].second; // a cell from which we came to (i,j)
        
        if(previous == make_pair(i - 1, j - 1)) {
            assert(a[i-1] == b[j-1]);
            s += a[i-1];
        }
        cur = previous;
    }
    
    reverse(s.begin(), s.end());
    cout << s << endl;
}
}

Compiler output:
a.cc:55:1: error: expected declaration before '}' token
   55 | }
      | ^
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    String s1=s.next();
    String s2=s.next();
    String[][] dp=new String[s1.length()+1][s2.length()+1];
    for(int i=0;i<dp.length;i++)
      Arrays.fill(dp[i],"");
    for(int i=1;i<dp.length;i++){
      for(int j=1;j<dp[0].length;j++){
        if(s1.charAt(i-1)==s2.charAt(j-1){
          dp[i][j]=dp[i-1][j-1]+s1.charAt(i-1);
        }
        else{
             dp[i][j]=dp[i-1][j].length()>dp[i][j-1].length()?dp[i-1][j]:dp[i][j-1];
        }
           }
           }
           
           System.out.println(dp[s1.length()][s2.length()]);
           }
           }
           
           
           
          
        
    
    

Compiler output:
Main.java:12: error: ')' expected
        if(s1.charAt(i-1)==s2.charAt(j-1){
                                         ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  string t;
  cin >> s >> t;
  vector<vector<string>> dp(t.size()+1,vector<string>(s.size()+1,""));
  int S = s.size()+1;
  int T = t.size()+1;
  for (int i = 0;i < S+1;i++;){
    for (int j = 0; j < T+1 ; j++;){
      if (s[i-1]==t[j-1]){
        dp[i][j]=dp[i-1][j-1]+s[i-1];
      }else{
        int A = dp[i-1][j].size();
        int B = dp[i][j-1].size();
        if (A >= B){
          dp[i][j]=dp[i-1][j]
        }else{
          dp[i][j]=dp[i][j-1]
        }
      }
    }
  }
  cout << dp[-1][-1]<< endl;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: expected ')' before ';' token
   10 |   for (int i = 0;i < S+1;i++;){
      |       ~                     ^
      |                             )
a.cc:10:30: error: expected primary-expression before ')' token
   10 |   for (int i = 0;i < S+1;i++;){
      |                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string s,t;
int len1,len2;
//dp[i][j]: i번째부터와 j번째 부터의 문자열에서 얻을 수 있는 최대 길이
int dp[3000][3000];

int solve(int i,int j){
	int& ret=dp[i][j];
	if(ret!=-1) return ret;
	if(i==len1 || j==len2) return ret=0;
	ret=0;
	ret=max(ret,(s[i]==t[j])+solve(i+1,j+1));
	ret=max(ret,solve(i+1,j));
	ret=max(ret,solve(i,j+1));
	return ret;
}

int main(){
	cin>>s>>t;
	len1=s.size();
	len2=t.size();
	memset(dp, -1, sizeof(dp));
	int v=solve(0,0);
	int i=0;
	int j=0;
	if(v==0){
		cout<<'';
		return 0;
	}
	while(i!=len1 && j!=len2){
		if(solve(i+1,j+1)+1==v){
			printf("%c",s[i]);
			i++;
			j++;
			v--;
		}else if(solve(i+1,j)==v){
			i++;
		}else if(solve(i,j+1)==v){
			j++;
		}
	}
	return 0;
}

Compiler output:
a.cc:31:23: error: empty character constant
   31 |                 cout<<'';
      |                       ^~
Language: Java

import java.util.*;
import java.lang.*;
import java.io.*;
 
public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();

        int n = s.length();
        int m = t.length();
        int[][] dp =new int[n+1][m+1];

        for(int i =1; i<=n; i++){
            for(int j = 1; j<=m; j++ ){
                if(s.charAt(i)==t.charAt(j)){
                    dp[i][j] = dp[i-1][j-1]+1;
                } else {
                    dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }
        StringBuilder res = new StringBuilder();
        while(dp[n][m]>0){
            if(s.charAt(n-1)==t.charAt(n-1)){
                res.append(s.charAt(n-1));
                m--; n--;
            } else {
                if(dp[n][m]==dp[n-1][m]) m--;
                else n--;
            }
        } 

        System.out.println(res.reverse.toString());
    }
}


Compiler output:
Main.java:36: error: cannot find symbol
        System.out.println(res.reverse.toString());
                              ^
  symbol:   variable reverse
  location: variable res of type StringBuilder
1 error
Language: Java

import java.util.*;
import java.lang.*;
import java.io.*;
 
public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String t = in.next();

        int n = s.length(), m = t.length();
        int[][] dp = int[n+1][m+1];

        for(int i =1; i<=n; i++){
            for(int j = 1; j<=m; j++ ){
                if(s.charAt(i)==t.charAt(j)){
                    dp[i][j] = dp[i-1][j-1]+1;
                } else {
                    dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }
        StringBuilder res = new StringBuilder();
        while(dp[n][m]>0){
            if(s.charAt(n-1)==t.charAt(n-1)){
                res.append(s.charAt(n-1));
                m--; n--;
            } else {
                if(dp[n][m]==dp[n-1][m]) m--;
                else n--;
            }
        } 

        System.out.println(res.reverse.toString());
    }
}

Compiler output:
Main.java:13: error: ']' expected
        int[][] dp = int[n+1][m+1];
                         ^
Main.java:13: error: not a statement
        int[][] dp = int[n+1][m+1];
                          ^
Main.java:13: error: ';' expected
        int[][] dp = int[n+1][m+1];
                            ^
Main.java:13: error: not a statement
        int[][] dp = int[n+1][m+1];
                               ^
Main.java:13: error: ';' expected
        int[][] dp = int[n+1][m+1];
                                 ^
5 errors
Language: C++

using namespace std;
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>

#define MOD1e9 1000000007
#define INT_MAX       2147483647
#define INT_MIN     (-2147483647 - 1)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(c) for(int i = 0; i <(c); ++i)
#define rrep(n) for(int i = (n) ; i >=0 ; --i)
#define fora(i, s, c) for(int i = (s); i < (c); ++i)
#define forr(i, s, c) for(int i = (s); i > (c); --i)
#define endl "\n"
#define ret(n) return n
#define pb push_back
#define eb emplace_back
#define ff first;
#define ss second;
#define mp make_pair;
#define all(p) p.begin(),p.end()
#define mid(s,e) (s+(e-s)/2)
//Typedefs
typedef long long ll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef priority_queue<int> pqint;
typedef priority_queue<ll> pqll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<long> vl;
typedef vector<vl> vvl;


vector<char> printlcsIter(string& s, string& t)
{
    //lcs array
    vvi lcs(s.size() + 1, vi(t.size() + 1, 0));
    for (int i = 1; i <= s.size(); ++i)
    {
        for (int j = 1; j <= t.size(); ++j)
        {
            if (s[i - 1] == t[j - 1])
            {
                lcs[i][j] = 1 + lcs[i - 1][j - 1];
            }
            else
            {
                lcs[i][j] = max(lcs[i][j - 1], lcs[i - 1][j]);
            }
        }
    }

    int lcslen = lcs[s.size()][t.size()];
    vector<char> subseq(lcslen + 1);
    subseq[lcslen] = '\0';
    int i = s.size();
    int j = t.size();
    int lcsindex = lcslen;
    while (i > 0 && j > 0)
    {
        if (s[i - 1] == t[j - 1])
        {
            subseq[lcsindex - 1] = s[i - 1];
            --lcsindex;
            --i;
            --j;
        }
        else
        {
            if (lcs[i - 1][j] > lcs[i][j - 1])
            {
                --i;
            }
            else
            {
                --j;
            }
        }
    }
    return subseq;
}
int main()
{
  string s;
  string t;
  cin>>s>>t;
  auto ans = printlcsIter(s,t);
  if(ans.empty())
  {
    cout<<""<<endl;
  }
  else
  {
    for(auto c: ans)
      cout<<c
    cout<<endl;
  }
  ret(0);

Compiler output:
a.cc: In function 'int main()':
a.cc:104:14: error: expected ';' before 'cout'
  104 |       cout<<c
      |              ^
      |              ;
  105 |     cout<<endl;
      |     ~~~~      
a.cc:107:10: error: expected '}' at end of input
  107 |   ret(0);
      |          ^
a.cc:92:1: note: to match this '{'
   92 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
ll mod=1000000007;
ll n,k,t,m,q,flag=0;
ll po(ll k ,ll n,ll ans,ll temp,ll ans1){
    if(n==0)return ans;
    while(temp<=n){
        ans*=ans1;ans%=mod;ans1=ans1*ans1;ans1%=mod;n=n-temp;temp*=2;
    }
    return po(k,n,ans,1,k)%mod;
    //eg. po(2,78,1,1,2);
}
string s1,s2;
string dp[30001][30001]  ;
bool mark[30001][30001] = {} ;
string ans(ll a,ll b){
    if(a==0||b==0){string s; return s;}
    if(mark[a][b])return dp[a][b] ;
  if(s1[a-1]==s2[b-1]){
    string s=ans(a-1,b-1);
    s.pb(s1[a-1]);
    mark[a][b]=1 ;
    return dp[a][b] = s;
  }
  else {
    string sa=ans(a,b-1);
    string sb=ans(a-1,b);
    mark[a][b]=1 ;
    if(sa.size()>sb.size()){
        return dp[a][b] = sa;
    }
    else return dp[a][b] = sb;
  }
}

ll min(ll a,ll b){if(a>b)return b;else return a;}
ll max(ll a,ll b){if(a>b)return a;else return b;}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    t=1;
    while(t--){
        cin>>s1>>s2;
        cout<<ans(s1.size(),s2.size());
        
    }

    return 0;
}


Compiler output:
/tmp/ccMz3IBm.o: in function `ans[abi:cxx11](long long, long long)':
a.cc:(.text+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `mark' defined in .bss section in /tmp/ccMz3IBm.o
a.cc:(.text+0x207): relocation truncated to fit: R_X86_64_PC32 against symbol `mark' defined in .bss section in /tmp/ccMz3IBm.o
a.cc:(.text+0x2b1): relocation truncated to fit: R_X86_64_PC32 against symbol `mark' defined in .bss section in /tmp/ccMz3IBm.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
    string text1, text2, str;
    getline(cin, text1);
    getline(cin, text2);
	int m=text1.size()+1;
    int n=text2.size()+1;
        
    text1='*'+text1;
    text2='*'+text2;

    int lcs[m][n];
    for(int i=0;i<n;i++)
        lcs[0][i]=0;
    for(int i=0;i<m;i++)
        lcs[i][0]=0;
    for(int i=1;i<m;i++){
        for(int j=1;j<n;j++) {
            if(text1[i] == text2[j]) 
                lcs[i][j]=1+lcs[i-1][j-1];
                
             
            else
                lcs[i][j]=max(lcs[i-1][j], lcs[i][j-1]);
        }
    }
    int i=m-1;
    int j=n-1;
	while(i >= 0)
    	while(j>=0 && i>= 0)
    		if(lcs[i][j] == 1 + lcs[i-1][j-1] && text1[i] == text2[j]) {
    			str=text1[i]+str;
    			i=i-1;
    			j=j-1;
    		}
    		else if(lcs[i][j] == lcs[i-1][j])
    			i=i-1;
    		else if(lcs[i][j] == lcs[i][j-1])
    			j=j-1;
    		
    		
    	}
    }
     cout<<str<<"\n";
}
        

Compiler output:
a.cc:44:5: error: expected declaration before '}' token
   44 |     }
      |     ^
a.cc:45:6: error: 'cout' does not name a type
   45 |      cout<<str<<"\n";
      |      ^~~~
a.cc:46:1: error: expected declaration before '}' token
   46 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
    string text1, text2, str;
    getline(cin, text1);
    getline(cin, text2);
	int m=text1.size()+1;
    int n=text2.size()+1;
        
    text1='*'+text1;
    text2='*'+text2;

    int lcs[m][n];
    for(int i=0;i<n;i++)
        lcs[0][i]=0;
    for(int i=0;i<m;i++)
        lcs[i][0]=0;
    for(int i=1;i<m;i++){
        for(int j=1;j<n;j++) {
            if(text1[i] == text2[j]) 
                lcs[i][j]=1+lcs[i-1][j-1];
                
             
            else
                lcs[i][j]=max(lcs[i-1][j], lcs[i][j-1]);
        }
    }
    
    for(int i=m-1;i>=1 && j >= 1;) {
    	for(int j=n-1;j>=1 && i>= 1;) {
    		if(lcs[i][j] == 1 + lcs[i-1][j-1] && text1[i] == text2[j]) {
    			str=text1[i]+str;
    			i=i-1;
    			j=j-1;
    		}
    		else if(lcs[i][j] == lcs[i-1][j])
    			i=i-1;
    		else if(lcs[i][j] == lcs[i][j-1])
    			j=j-1;
    		else
    			break;
    		
    	}
    }
     cout<<str<<"\n";
}
        

Compiler output:
a.cc: In function 'int main()':
a.cc:29:27: error: 'j' was not declared in this scope
   29 |     for(int i=m-1;i>=1 && j >= 1;) {
      |                           ^
Language: Java

import java.io.IOException;

public class Main{

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		String xx = sc.next();
		String yy = sc.next();
		char[] x = xx.toCharArray();
		char[] y = yy.toCharArray();
		int[][] L = new int[x.length + 1][y.length + 1];

		for (int i = 1; i <= x.length; i++)
			for (int j = 1; j <= y.length; j++)
				if (x[i - 1] == y[j - 1]) {
					L[i][j]=L[i-1][j-1]+1;
				}
				else 
					L[i][j]=Math.max(L[i][j-1], L[i-1][j]);
		
		boolean [] take=new boolean[x.length];
		
		int i=x.length;
		int j=y.length;
		
		while(i>0 && j>0 ) {
			
			while(j>0 && L[i][j]==L[i][j-1])
					j--;
			while(i>0 && L[i][j]==L[i-1][j])
				i--;
			if(i>0) {
				take[i-1]=true;
				j--;
			}
		}
		int ctr=0;
		for(Boolean b:take) {
			if(b)
				System.out.print(x[ctr]);
			ctr++;
		}
	}
	

}


Compiler output:
Main.java:6: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C

// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
int rev[3100][3100];
int dp[3100][3100];
char s[3100];
char t[3100];
char ans[3100];
int main(){
	scanf("%s%s",s,t);
	int N=strlen(s);
	int M=strlen(t);
	for(int i=0;i<3100;i++)for(int j=0;j<3100;j++)
		dp[i][j]=0;
	dp[0][0]=0;
	for(int i=0;i<=N;i++){
		for(int j=0;j<=M;j++){
			if(i+1<=N){
				if(dp[i+1][j]<dp[i][j]){
					dp[i+1][j]=dp[i][j];
					rev[i+1][j]=0;
				}
			}
			if(j+1<=M){
				if(dp[i][j+1]<dp[i][j]){
					dp[i][j+1]=dp[i][j];
					rev[i][j+1]=1;
				}
			}
			if(i+1<=N&&j+1<=M&&s[i]==t[j]){
				if(dp[i+1][j+1]<dp[i][j]+1){
					dp[i+1][j+1]=dp[i][j]+1;
					rev[i+1][j+1]=2;
				}
			}
		}
	}
	int ns=N;
	int nt=M;
	int at=dp[N][M]-1;
	while(ns||nt){
		if(rev[ns][nt]==0)ns--;
		else if(rev[ns][nt]==1)nt--;
		else{
			ns--;nt--;
			ans[at]=s[ns];
			at--;
		}
	}
	printf("%s\n",ans);
}


Compiler output:
main.c:6:9: fatal error: algorithm: No such file or directory
    6 | #include<algorithm>
      |         ^~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

/**
 * Created by Harry on 4/1/20.
 */
//https://atcoder.jp/contests/dp/tasks/dp_f
public class main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();

        int n = s.length();
        int m = t.length();
        int[][] dp = new int[n+1][m+1];
        for(int i=1; i<=n; i++){
            for(int j=1; j<=m; j++){
                if(s.charAt(i-1)==t.charAt(j-1)){
                    dp[i][j] = dp[i-1][j-1]+1;
                }
                else{
                    dp[i][j] = Math.max(dp[i][j-1], dp[i-1][j]);
                }
            }
        }
        char[] res = new char[dp[n][m]];
        int index = dp[n][m]-1;
        int i = n;
        int j = m;
        while(i>0 && j>0){
            if(s.charAt(i-1)==t.charAt(j-1)){
                res[index--] = s.charAt(i-1);
                i--;
                j--;
            }
            else if(dp[i-1][j]>dp[i][j-1]){
                i--;
            }
            else{
                j--;
            }
        }
        System.out.print(new String(res));
    }
}


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

#include<iostream> 
#include<vector> 
#include<algorithm> 
using namespace std; 
#define lld long long int
#define X 1000000007
#define fast();  ios_base::sync_with_stdio(false); cin.tie(0);
# define rec(i,n) for(int i=0;i<n;i++) 
#define w(t) int t; cin>>t; while(t--)
int n,m; 
string s,t; 
int dp[3002][3002]; 
void sub()
{ 
   string a; 
 for(int i=1;i<=m;i++)
  { for(int j=1;j<=n;j++) 
    {
        if(t[i-1]==s[j-1])
        {
          int x=dp[i][j-1]+1; 
            if(x>i || x>j) 
              x=dp[i][j-1]; 
           dp[i][j]=max(dp[i-1][j] ,x);
        }
        else
        dp[i][j]=max(dp[i-1][j] ,dp[i][j-1]); 
    }
  }
  int x=1; 
   if(n<=m) 
     { rec(i,n+1)
        { if(dp[m][i]==x) 
            {a=a+s[i-1]; 
              x++; 
            }
        }           
     }
   else 
      { rec(i,m+1) 
       { if(dp[i][n]==x) 
           { a=a+t[i-1]; 
              x++; 
           }
       } 
      }
      cout<<a<<endl;
  return ; 
}
int main()
{
    fast(); 
    cin>>s; 
    cin>>t; 
     n=s.size(); 
    m=t.size(); 
    memset(dp,0,sizeof(dp)); 
    sub(); 
	return 0;
}

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

/*
输入： 
xzyzzyx
zxyyzxz
输出： 
4
xyzz
*/

#include<bits\stdc++.h>
#define N 10005
using namespace std;
string s1,s2;
int dp[N][N],z[N][N];
char ans[N]; 
int k=0;
void getans(int i,int j){
	if(i<=0||j<=0)
		return ;
	if(z[i][j]==1){
		ans[k++]=s1[i-1];
		getans(i-1,j-1);
	}
	else if(z[i][j]==2){
		getans(i-1,j);
	}
	else if(z[i][j]==3){
		getans(i,j-1);
	} 
}
int main(){
	cin>>s1>>s2;
	int len1=s1.length();
	int len2=s2.length();
	for(int i=1;i<=len1;i++){
		for(int j=1;j<=len2;j++){
			if(s1[i-1]==s2[j-1]){
				dp[i][j]=dp[i-1][j-1]+1;
				z[i][j]=1;
			}
			else{
				if(dp[i-1][j]>=dp[i][j-1]){
					z[i][j]=2;
					dp[i][j]=dp[i-1][j];
				}
				else{
					z[i][j]=3;
					dp[i][j]=dp[i][j-1];
				}
			}
		}
	}
	cout<<dp[len1][len2]<<endl;
	getans(len1,len2);
	for(int i=k-1;i>=0;i--){
		cout<<ans[i];
	}
	cout<<endl;
	return 0;
}

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

#include <iostream>

using namespace std;

int main()
{
    string s1,s2,s="";
    cin>>s1>>s2;
    int a,b,l=0,x,y,i,j;
    a=s1.length();
    b=s2.length();
    int t[a+1][b+1];
    for(i=0;i<=b;i++)
    {
        t[0][i]=0;
    }
    for(i=1;i<=a;i++)
    {
        t[i][0]=0;
    }
    for(i=1;i<=a;i++)
    {
        for(j=1;j<=b;j++)
        {
            if(s1[i-1]==s2[j-1])
            {
                t[i][j]=t[i-1][j-1]+1;
                if(t[i][j]>l)
                {
                    l=t[i][j];
                    x=i;
                    y=j;
                }
            }
            else{
                t[i][j]=max(t[i-1][j],t[i][j-1]);
            }
        }
    }
    //cout<<x<<" "<<y<<endl;
    while(t[x][y]!=0)
    {
        if(t[x][y]!=t[x-1][y]&&t[x][y]!=t[x][y-1])
        {
            s=s1[x-1]+s;
            x--;y--;
            //cout<<"step1 "<<x<<" "<<y<<endl;


        }
       else if(t[x-1][y]>t[x][y-1])
        {
            x--;
            //cout<<"step2 "<<x<<" "<<y<<endl;


        }
        else{y--;
        //cout<<"step3 "<<x<<" "<<y<<endl;}
    }
    //cout<<t[a][b]<<endl;
    cout<<s<<endl;
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
  
int main(){
    string s,t;
    cin>>s>>t;
    int sl=s.length();
    int tl=t.length();
    int dp[3001][3001];
    rep(i,sl+1)dp[i][0]=0;
    rep(i,tl+1)dp[0][i]=0;
    rep2(1,i,sl+1){
        rep2(1,j,tl+1){
            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]);
            }
        }
    }
    string ans="";
    ]int x = sl;
	int y = tl;
	while(x > 0 && y > 0){
		if(dp[x][y] == dp[x-1][y]){
			x--;
		}else if(dp[x][y] == dp[x][y-1]){
			y--;
		}else{
			x--;
			y--;
			ans.push_back(s[x]);
		}
	}
    reverse(ans.begin(), ans.end());
	cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: expected primary-expression before ']' token
   26 |     ]int x = sl;
      |     ^
a.cc:28:15: error: 'x' was not declared in this scope
   28 |         while(x > 0 && y > 0){
      |               ^
Language: Java

public class Main {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char[] a = scanner.nextLine().toCharArray();
        char[] b = scanner.nextLine().toCharArray();
        Node[][] dp = new Node[a.length][b.length];
        boolean flag = false;
        for (int i = 0; i < a.length; i++) {
            if(a[i] == b[0]) {
                dp[i][0] = new Node(1, i-1, 0);
            } else {
                dp[i][0] = new Node(0, i-1, 0);
            }

        }
        flag = false;
        for (int i = 0; i < b.length; i++) {
            if(a[0] == b[i] || flag) {
                dp[0][i] = new Node(1, 0, i-1);
            } else {
                dp[0][i] = new Node(0, 0, i-1);
            }
        }

        for (int i = 1; i < a.length; i++) {
            for (int j = 1; j < b.length; j++) {
                if(a[i] == b[j]) {
                    dp[i][j] = new Node(dp[i-1][j-1].len + 1, i-1, j-1);
                } else {
                    if(dp[i-1][j].len>=dp[i][j-1].len) {
                        dp[i][j] = new Node(dp[i-1][j].len, i-1, j);
                    } else {
                        dp[i][j] = new Node(dp[i][j-1].len, i, j-1);
                    }
                }
            }
        }

        StringBuilder sb = new StringBuilder();
        int i = a.length -1, j = b.length - 1;
        while(i>=0&&j>=0) {
            if(a[i]==b[j]){
                sb.append(a[i]);
            }
            int tmpI=dp[i][j].x;
            int tmpJ=dp[i][j].y;
            i = tmpI;
            j = tmpJ;
        }
        System.out.println(sb.reverse());
    }

    static class Node {
        public int len;
        public int x;
        public int y;
        public Node(int len, int x, int y) {
            this.len = len;
            this.x = x;
            this.y = y;
        }
    }

}

Compiler output:
Main.java:5: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
                              ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

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

#define N 100 
  
int L[N][N]; 

set<string> findLCS(string X, string Y, int m, int n) 
{ 
    set<string> s; 
  
    if (m == 0 || n == 0) 
    { 
        s.insert(""); 
        return s; 
    } 
  
    if (X[m - 1] == Y[n - 1]) 
    { 
        set<string> tmp = findLCS(X, Y, m - 1, n - 1); 
  
        for (string str : tmp) 
            s.insert(str + X[m - 1]); 
    } 
  
    else
    { 
        if (L[m - 1][n] >= L[m][n - 1]) 
            s = findLCS(X, Y, m - 1, n); 
  
        if (L[m][n - 1] >= L[m - 1][n]) 
        { 
            set<string> tmp = findLCS(X, Y, m, n - 1); 
            s.insert(tmp.begin(), tmp.end()); 
        } 
    } 
    return s; 
} 

int LCS(string X, string Y, int m, int n) 
{ 
    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]); 
        } 
    } 
    return L[m][n]; 
} 
  

int main()
{
	string a,b;
	cin>>a>>b;
	
	LCS(a,b,a.length(),b.length());
	
	set<string> s = findLCS(a, b, a.length(), b.length());
	
	cout<<s[0];
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:16: error: no match for 'operator[]' (operand types are 'std::set<std::__cxx11::basic_string<char> >' and 'int')
   67 |         cout<<s[0];
      |                ^
Language: C++

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

set<string> findLCS(string X, string Y, int m, int n) 
{ 
    set<string> s; 
  
    if (m == 0 || n == 0) 
    { 
        s.insert(""); 
        return s; 
    } 
  
    if (X[m - 1] == Y[n - 1]) 
    { 
        set<string> tmp = findLCS(X, Y, m - 1, n - 1); 
  
        for (string str : tmp) 
            s.insert(str + X[m - 1]); 
    } 
  
    else
    { 
        if (L[m - 1][n] >= L[m][n - 1]) 
            s = findLCS(X, Y, m - 1, n); 
  
        if (L[m][n - 1] >= L[m - 1][n]) 
        { 
            set<string> tmp = findLCS(X, Y, m, n - 1); 
            s.insert(tmp.begin(), tmp.end()); 
        } 
    } 
    return s; 
} 

int main()
{
	string a,b;
	cin>>a>>b;
	
	set<string> s = findLCS(X, Y, m, n);
	
	cout<<s[0];
	
	return 0;
}

Compiler output:
a.cc: In function 'std::set<std::__cxx11::basic_string<char> > findLCS(std::string, std::string, int, int)':
a.cc:24:13: error: 'L' was not declared in this scope
   24 |         if (L[m - 1][n] >= L[m][n - 1])
      |             ^
a.cc:27:13: error: 'L' was not declared in this scope
   27 |         if (L[m][n - 1] >= L[m - 1][n])
      |             ^
a.cc: In function 'int main()':
a.cc:41:33: error: 'X' was not declared in this scope
   41 |         set<string> s = findLCS(X, Y, m, n);
      |                                 ^
a.cc:41:36: error: 'Y' was not declared in this scope
   41 |         set<string> s = findLCS(X, Y, m, n);
      |                                    ^
a.cc:41:39: error: 'm' was not declared in this scope
   41 |         set<string> s = findLCS(X, Y, m, n);
      |                                       ^
a.cc:41:42: error: 'n' was not declared in this scope
   41 |         set<string> s = findLCS(X, Y, m, n);
      |                                          ^
a.cc:43:16: error: no match for 'operator[]' (operand types are 'std::set<std::__cxx11::basic_string<char> >' and 'int')
   43 |         cout<<s[0];
      |                ^
Language: C++

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <set>
#include <queue>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <map>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace gnu_pbds;

#define F first
#define S second
#define ll long long
#define pb push_back
#define ppb pop_back
#define pii pair<int, int>
#define piii pair<int, pii>
#define __ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(x) cout << (#x) << " is " << (x) << endl
#define int long long
// #define ld long double


const int N = 1e5 + 20, mod = 1e9 + 7, inf = 2e9 + 9;
const ll INF = 1e18 + 20;

string a, b;
int n, m, dp[3003][3003];
pii p[3003][3003];

signed main() { __
    // freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
    cin>>a>>b;
    n = a.size();
    m = b.size();
    a = "-" + a;
    b = "#" + b;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(a[i] == b[j]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
                p[i][j] = {i - 1, j - 1};
            }
            else {
                if(dp[i - 1][j] < dp[i][j - 1]) {
                    dp[i][j] = dp[i][j - 1];
                    p[i][j] = {i, j - 1};
                }
                else {
                    dp[i][j] = dp[i - 1][j];
                    p[i][j] = {i - 1, j};
                }
            }
        }
    }
    int i = n, j = m;
    string ans = "";
    while(dp[i][j]) {
        if(p[i][j] == {i - 1, j - 1}) {
            ans += a[i];
            i--;
            j--;
        }
        else if(p[i][j] = {i - 1, j}) {
            i--;
        }
        else j--;
    }
    reverse(ans.begin(), ans.end());
    cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:23: error: expected primary-expression before '{' token
   71 |         if(p[i][j] == {i - 1, j - 1}) {
      |                       ^
a.cc:71:22: error: expected ')' before '{' token
   71 |         if(p[i][j] == {i - 1, j - 1}) {
      |           ~          ^~
      |                      )
a.cc:76:25: error: could not convert 'p[i][j].std::pair<long long int, long long int>::operator=(std::pair<long long int, long long int>((i - 1), j))' from 'std::pair<long long int, long long int>' to 'bool'
   76 |         else if(p[i][j] = {i - 1, j}) {
      |                 ~~~~~~~~^~~~~~~~~~~~
      |                         |
      |                         std::pair<long long int, long long int>
Language: C++

n = 0
m = []

def lcs(s, t, a, b, ans):
    global n
    global m
    if a == 0 or b == 0:
        return 0;
    elif s[a-1] == t[b-1]:
        ans.append(s[a-1])
        owo = 1 + lcs(s, t, a-1, b-1, ans)
        if owo > n:
            n = owo
            m = ans
        return owo
    else:
        return max(lcs(s, t, a-1, b, ans), lcs(s, t, a, b-1, ans))

s = [char for char in input()]
t = [char for char in input()]


l = lcs(s, t, len(s), len(t), [])

for a in range(l-1, -1, -1):
    print(m[a], end="")

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = 0
      | ^
a.cc:9:5: error: 'elif' does not name a type
    9 |     elif s[a-1] == t[b-1]:
      |     ^~~~
Language: C++

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

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

    // ex s = "axyb", t = "abyxb";
    int m = (int)s.size(), n = (int)t.size();

    vector<vector<int>> nums(m+2, vector<int>(n+2,0));
    
    for (int i = 0; i < m; i++){
        for (int j = 0; j < n; j++){
            if (s[i] == t[j]) nums[i+1][j+1] = max(nums[i+1][j+1], nums[i][j] + 1);
            nums[i+1][j] = max(nums[i+1][j], nums[i][j]);
            nums[i][j+1] = max(nums[i][j+1], nums[i][j]);            
        }
    }

    // find one longest string
    string ans = "";

    int i = n-1, j m-1;
    while (i >= 0 && j >= 0){
        if (nums[i+1][j+1] == nums[i][j] + 1) ans = s[i] + ans, i--, j--;
        else if (nums[i+1][j+1] == nums[i][j+1]) i--;
        else if (nums[i+1][j+1] == nums[i+1][j]) j--;
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: expected initializer before 'm'
   24 |     int i = n-1, j m-1;
      |                    ^
a.cc:25:22: error: 'j' was not declared in this scope
   25 |     while (i >= 0 && j >= 0){
      |                      ^
Language: C++

#include<iostream>
//#include<bits/stdc++.h>
#include<string>
#include<climits>
#include<queue>
#include<stack>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include <algorithm>
#include<utility>
using namespace std;
#define IOS ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
#define int long long

#define pi pair<int,int>
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007 

#define N 100000
int32_t main()
{
	    IOS;
 
	    string s,t;

	    cin>>s>>t;

	    int n = s.length();
	    int m = t.length();

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


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

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


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:40:33: error: expected ')' before ';' token
   40 |                 if(int j=0; j<=m ; j++)
      |                   ~             ^~
      |                                 )
a.cc:40:36: error: 'j' was not declared in this scope
   40 |                 if(int j=0; j<=m ; j++)
      |                                    ^
Language: C++

#include<iostream>
//#include<bits/stdc++.h>
#include<string>
#include<climits>
#include<queue>
#include<stack>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include <algorithm>
#include<utility>
using namespace std;
#define IOS ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
#define int long long

#define pi pair<int,int>
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007 

#define N 100000
int32_t main()
{
	    IOS;
 
	    string s,t;

	    cin>>s>>t;

	    int n = s.length():
	    int m = t.length();

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


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

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


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:32:31: error: expected ',' or ';' before ':' token
   32 |             int n = s.length():
      |                               ^
a.cc:35:25: error: 'm' was not declared in this scope
   35 |             int dp[n+1][m+1];
      |                         ^
a.cc:40:33: error: expected ')' before ';' token
   40 |                 if(int j=0; j<=m ; j++)
      |                   ~             ^~
      |                                 )
a.cc:40:36: error: 'j' was not declared in this scope
   40 |                 if(int j=0; j<=m ; j++)
      |                                    ^
a.cc:55:19: error: 'dp' was not declared in this scope
   55 |             cout<<dp[n][m]<<endl;
      |                   ^~
Language: C++

int LCS(string s, string t){
  int n = s.size();
  int m = t.size();
  int dp[n+1][m+1];
  for (int i=0; i<n; ++i) {
    for (int j=0; j<m; ++j) {
      if (s[i] == t[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]);
      }
    }
  }
  return dp[n][m];
}

int main(){
  string S, T;
  cin >> S >> T;
  cout << LCS(S,T) << endl;
}

Compiler output:
a.cc:1:9: error: 'string' was not declared in this scope
    1 | int LCS(string s, string t){
      |         ^~~~~~
a.cc:1:19: error: 'string' was not declared in this scope
    1 | int LCS(string s, string t){
      |                   ^~~~~~
a.cc:1:27: error: expression list treated as compound expression in initializer [-fpermissive]
    1 | int LCS(string s, string t){
      |                           ^
a.cc: In function 'int main()':
a.cc:19:3: error: 'string' was not declared in this scope
   19 |   string S, T;
      |   ^~~~~~
a.cc:20:3: error: 'cin' was not declared in this scope
   20 |   cin >> S >> T;
      |   ^~~
a.cc:20:10: error: 'S' was not declared in this scope
   20 |   cin >> S >> T;
      |          ^
a.cc:20:15: error: 'T' was not declared in this scope
   20 |   cin >> S >> T;
      |               ^
a.cc:21:3: error: 'cout' was not declared in this scope
   21 |   cout << LCS(S,T) << endl;
      |   ^~~~
a.cc:21:14: error: 'LCS' cannot be used as a function
   21 |   cout << LCS(S,T) << endl;
      |           ~~~^~~~~
a.cc:21:23: error: 'endl' was not declared in this scope
   21 |   cout << LCS(S,T) << endl;
      |                       ^~~~
Language: C++

/* Dynamic Programming implementation of LCS problem */
#include<iostream> 
#include<cstring> 
#include<cstdlib> 
using namespace std; 
  
/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
void lcs( char *X, char *Y, int m, int n ) 
{ 
   int L[m+1][n+1]; 
  
   /* Following steps build L[m+1][n+1] in bottom up fashion. Note 
      that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-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]); 
     } 
   } 
  
   // Following code is used to print LCS 
   int index = L[m][n]; 
  
   // Create a character array to store the lcs string 
   char lcs[index+1]; 
   lcs[index] = '\0'; // Set the terminating character 
  
   // Start from the right-most-bottom-most corner and 
   // one by one store characters in lcs[] 
   int i = m, j = n; 
   while (i > 0 && j > 0) 
   { 
      // If current character in X[] and Y are same, then 
      // current character is part of LCS 
      if (X[i-1] == Y[j-1]) 
      { 
          lcs[index-1] = X[i-1]; // Put current character in result 
          i--; j--; index--;     // reduce values of i, j and index 
      } 
  
      // If not same, then find the larger of two and 
      // go in the direction of larger value 
      else if (L[i-1][j] > L[i][j-1]) 
         i--; 
      else
         j--; 
   } 
  
   // Print the lcs 
   cout <<lcs; 
} 
  
/* Driver program to test above function */
int main() 
{ 
  char X[] ;
  char Y[] ; 
  cin>>X>>Y;
  int m = strlen(X); 
  int n = strlen(Y); 
  lcs(X, Y, m, n); 
  return 0; 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:62:8: error: storage size of 'X' isn't known
   62 |   char X[] ;
      |        ^
a.cc:63:8: error: storage size of 'Y' isn't known
   63 |   char Y[] ;
      |        ^
Language: Java

// "static void main" must be defined in a public class.
public class Main {
    static int n;
    static int m;
    static String S;
    static String T;
    static Map<List,String> cache = new HashMap<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        S = sc.nextLine();
        T = sc.nextLine();
        n = S.length();
        m = T.length();
        //System.out.println(n);
        System.out.println(dfs(0,0));
        
    }
    public static String dfs(int i, int j){
        List<Integer> key = new ArrayList();
        key.add(i);
        key.add(j);
        if(cache.containsKey(key)){
            return cache.get(key);
        }
        String res;
        if(i >= n || j >= m) return "";
        if(S.charAt(i) == T.charAt(j)){
            res = S.charAt(i) + dfs(i + 1, j + 1); 
        }else{
            String res1 = dfs(i + 1,j);
            String res2 = dfs(i, j + 1);
            if (Math.max(res1.length(),res2.length()) == res1.length()){
                res = res1;
            }else{
                res = res2;
            }
        }
        cache.put(key,res);
        return res;
        //return null;
    }
}

Compiler output:
Main.java:7: error: cannot find symbol
    static Map<List,String> cache = new HashMap<>();
           ^
  symbol:   class Map
  location: class Main
Main.java:7: error: cannot find symbol
    static Map<List,String> cache = new HashMap<>();
               ^
  symbol:   class List
  location: class Main
Main.java:7: error: cannot find symbol
    static Map<List,String> cache = new HashMap<>();
                                        ^
  symbol:   class HashMap
  location: class Main
Main.java:9: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:9: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:19: error: cannot find symbol
        List<Integer> key = new ArrayList();
        ^
  symbol:   class List
  location: class Main
Main.java:19: error: cannot find symbol
        List<Integer> key = new ArrayList();
                                ^
  symbol:   class ArrayList
  location: class Main
7 errors