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

/* Dynamic Programming implementation of LCS problem */
#include<iostream> 
#include<cstring> 
#include<cstdlib> 
#include<bits/stdc++.h>
using namespace std; 
  
/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
void lcs( string X,string 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() 
{ 
  string X;
  string 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:65:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   65 |   int m = strlen(X);
      |                  ^
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:3:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
a.cc:66:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   66 |   int n = strlen(Y);
      |                  ^
      |                  |
      |                  std::string {aka std::__cxx11::basic_string<char>}
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
Language: C++

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


int main(){

	string s1, s2;
	cin >> s1 >> s2;
	int n = s1.length(), m = s2.length();

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

	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			if(!i || !j) dp[i][j] = 0;
			else if(s1[i - 1] == s2[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 printing the subsequece :8(
	int l = dp[n][m];
	char temp[l + 1];
	temp[index] = '\0';
	int row = n, col = m;
	while(row && col){
		if(s1[row - 1] == s2[col - 1]){
			temp[--l] = s1[row - 1];
			row--;
			col--;
			
		}else if(dp[row - 1][col] > dp[row][col - 1]){
			row--;
		}else{
			col--;
		}
	}
	for(auto x : temp ) cout << x; 

	
	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:13: error: invalid types 'char [(l + 1)][<unresolved overloaded function type>]' for array subscript
   24 |         temp[index] = '\0';
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
string a,b;
int dp[3001][3001];
string xy(string a,string b)
{
  if(a.size()>=b.size())
    return a;
  else
    return b;
}  
string solve(int m,int n)
{
  for(int i=0;i<=m;i++)
  {
    for(int j=0;j<=n;j++)
    {
      if(!(i&j))
        dp[i][j]=0;
      else if(a[i-1]==b[j-1])
        dp[i][j]=dp[i-1][j-1]+1;
      else
        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  }
  return dp[m][n];
}
int main()
{
  cin>>a>>b;
  cout<<solve(a.size(),b.size());
  return 0;
}

Compiler output:
a.cc: In function 'std::string solve(int, int)':
a.cc:26:17: error: could not convert 'dp[m][n]' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   26 |   return dp[m][n];
      |          ~~~~~~~^
      |                 |
      |                 int
Language: C++

#include<bits/stdc++.h>
using namespace std;
string a,b;
string dp[3001][3001];
string xy(string a,string b)
{
  if(a.size()>=b.size())
    return a;
  else
    return b;
}  
string solve(int m,int n)
{
  for(int i=0;i<=m;i++)
  {
    for(int j=0;j<=n;j++)
    {
      if(!(i&j))
        dp[i][j]+='';
      else if(a[i-1]==b[j-1])
        dp[i][j]=dp[i-1][j-1]+a[i];
      else
        dp[i][j]=xy(dp[i-1][j],dp[i][j-1]);
    }
  }
  return dp[m][n];
}
int main()
{
  cin>>a>>b;
  cout<<solve(a.size(),b.size());
  return 0;
}

Compiler output:
a.cc:19:19: error: empty character constant
   19 |         dp[i][j]+='';
      |                   ^~
Language: C++

#include<bits/std++.h>
using namespace std;
string a,b;
string dp[3001][3001];
string xy(string a,string b)
{
  if(a.size()>=b.size())
    return a;
  else
    return b;
}  
string solve(int m,int n)
{
  for(int i=0;i<=m;i++)
  {
    for(int j=0;j<=n;j++)
    {
      if(!(i&j))
        dp[i][j]+='';
      else if(a[i-1]==b[j-1])
        dp[i][j]=dp[i-1][j-1]+a[i];
      else
        dp[i][j]=xy(dp[i-1][j],dp[i][j-1]);
    }
  }
  return dp[m][n];
}
int main()
{
  cin>>a>>b;
  cout<<solve(a.size(),b.size());
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
string a,b;
string dp[3001][3001];
string xy(string a,string b)
{
  if(a.size()>=b.size())
    return a;
  else
    return b;
}  
string solve(int m,int n)
{
  for(int i=0;i<=m;i++)
  {
    for(int j=0;j<=n;j++)
    {
      if(!(i&j))
        dp[i][j]='';
      else if(a[i-1]==b[j-1])
        dp[i][j]=dp[i-1][j-1]+a[i];
      else
        dp[i][j]=xy(dp[i-1][j],dp[i][j-1]);
    }
  }
  return dp[m][n];
}
int main()
{
  cin>>a>>b;
  cout<<solve(a.size(),b.size());
  return 0;
}

Compiler output:
a.cc:19:18: error: empty character constant
   19 |         dp[i][j]='';
      |                  ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
string a,b;
string dp[3001][3001];
string xy(string a,string b)
{
  if(a.size()>=b.size())
    return a;
  else
    return b;
}  
string solve(int m,int n)
{
  for(i=0;i<=m;i++)
  {
    for(j=0;j<=n;j++)
    {
      if(!(i&j))
        dp[i][j]='';
      else if(a[i-1]==[j-1])
        dp[i][j]=dp[i-1][j-1]+a[i];
      else
        dp[i][j]=xy(dp[i-1][j],dp[i][j-1]);
    }
  }
  return dp[m][n];
}
int main()
{
  cin>>a>>b;
  cout<<solve(a.size(),b.size());
  return 0;
}


Compiler output:
a.cc:19:18: error: empty character constant
   19 |         dp[i][j]='';
      |                  ^~
a.cc: In function 'std::string solve(int, int)':
a.cc:14:7: error: 'i' was not declared in this scope
   14 |   for(i=0;i<=m;i++)
      |       ^
a.cc:16:9: error: 'j' was not declared in this scope
   16 |     for(j=0;j<=n;j++)
      |         ^
a.cc:20:25: error: expected ',' before '-' token
   20 |       else if(a[i-1]==[j-1])
      |                         ^
      |                         ,
a.cc:20:25: error: expected identifier before '-' token
a.cc: In lambda function:
a.cc:20:28: error: expected '{' before ')' token
   20 |       else if(a[i-1]==[j-1])
      |                            ^
Language: C++

#include<bits/std++.h>
using namespace std;
string a,b;
string dp[3001][3001];
string xy(string a,string b)
{
  if(a.size()>=b.size())
    return a;
  else
    return b;
}  
string solve(int m,int n)
{
  for(i=0;i<=m;i++)
  {
    for(j=0;j<=n;j++)
    {
      if(!(i&j))
        dp[i][j]='';
      else if(a[i-1]==[j-1])
        dp[i][j]=dp[i-1][j-1]+a[i];
      else
        dp[i][j]=xy(dp[i-1][j],dp[i][j-1]);
    }
  }
  return dp[m][n];
}
int main()
{
  cin>>a>>b;
  cout<<solve(a.size(),b.size());
  return 0;
}

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

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

public class F_LCS {
	
	public static void main(String[] args) {
		FastScanner sc=new FastScanner();

            char[] s = sc.next().toCharArray();
            StringBuilder sb = new StringBuilder();
            char[] t = sc.next().toCharArray();
            int dp[][] = new int[s.length + 1][t.length + 1];
            for(int i =1; i<=s.length; i++){
                for(int j =1; j<=t.length; j++){
                    if(s[i-1]==t[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]); 
                }
            }

            int i = s.length;
            int j = t.length;
            while(i>0 && j>0){
                if(dp[i-1][j] == dp[i][j])
                    i--;
                else if(dp[i][j-1] == dp[i][j])
                    j--;
                else{
                    sb.append(s[i-1]);
                    i--;
                    j--;
                }
            }
        
            System.out.println(sb.reverse().toString());
    }
	static final Random random = new Random();
	
	static void sort(int[] a) {
		int n = a.length;
		for(int i =0; i<n; i++) {
			int val = random.nextInt(n);
			int cur = a[i];
			a[i] = a[val];
			a[val] = cur;
		}
		Arrays.sort(a);
	}
	
	static void sortl(long[] a) {
		int n = a.length;
		for(int i =0; i<n; i++) {
			int val = random.nextInt(n);
			long cur = a[i];
			a[i] = a[val];
			a[val] = cur;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (st == null  || !st.hasMoreTokens()) {
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		String nextLine() { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
		} 
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() { 
            return Double.parseDouble(next()); 
        } 
	}

}


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

#include <iostream>

using namespace std;

int dp[3000][3000];


void lcs(string s1,string s2){
	
	int count = 1;
	for(int i=0;i<s1.size();i++){
		for(int j=0;j<s2.size();j++){
			if(s1[i]==s2[j]){
				count++;
				dp[i][j] = count;
				index = i+j;
			}
		}
	}

}

int main(){
	string s1;
	string s2;

	getline(cin,s1);
	getline(cin,s2);

	int l1 = s1.size();
	int l2 = s2.size();
	lcs(s1,s2);

	int count = 5000;
	int start = l2-1;
	string s3 = "";                  	
	
	for(int i = l1-1; i>=0; i--){
		for(int j=start;j>=0;j--){
			if(dp[i][j] < count && dp[i][j]>0){
				count = dp[i][j];
				s3 = s1[i] + s3;
				start = j-1;
				break;
			}
		}
	}


	cout << s3 << '\n';

	return 0;

}



Compiler output:
a.cc: In function 'void lcs(std::string, std::string)':
a.cc:16:33: error: 'index' was not declared in this scope
   16 |                                 index = i+j;
      |                                 ^~~~~
Language: C++

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

#define pb push_back

const int N = 333333333333333333333333333333333e3+5;

string s , t;
char a[N] , b[N];
int dp[N][N];
vector<char> vec;

int LCS(int n , int m){
  if(dp[n][m] != -2) return dp[n][m];
  if(!n || !m) return dp[n][m] = 0;
  if(a[n] == b[m]) return dp[n][m] = 1+LCS(n-1,m-1);
  return dp[n][m] = max(LCS(n-1,m),LCS(n,m-1));
}

void rec(int n , int m){
  if(!n || !m || dp[n][m] == -2) return;
  if(dp[n][m] == dp[n-1][m-1]+1) vec.pb(a[n]) , rec(n-1,m-1);
  else if(dp[n][m] == dp[n-1][m]) rec(n-1,m);
  else if(dp[n][m] == dp[n][m-1]) rec(n,m-1);
}

int main(){

  cin >> s >> t;
  for(int i = 0 ; i < N ; i++)
    for(int j = 0 ; j < N ; j++) dp[i][j] = -2;
  for(int i = 0 ; i < s.size() ; i++) a[i+1] = s[i];
  for(int i = 0 ; i < t.size() ; i++) b[i+1] = t[i];
  
  LCS(s.size(),t.size()) , rec(s.size(),t.size());
  for(int i = vec.size()-1 ; i >= 0 ; i--) cout << vec[i];
  cout << "\n";

}


Compiler output:
a.cc:6:50: warning: overflow in conversion from 'double' to 'int' changes value from '3.3333333333333332e+35' to '2147483647' [-Woverflow]
    6 | const int N = 333333333333333333333333333333333e3+5;
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
a.cc:9:8: error: size of array 'a' exceeds maximum object size '9223372036854775807'
    9 | char a[N] , b[N];
      |        ^
a.cc:9:15: error: size of array 'b' exceeds maximum object size '9223372036854775807'
    9 | char a[N] , b[N];
      |               ^
a.cc:10:11: error: size of array 'dp' exceeds maximum object size '9223372036854775807'
   10 | int dp[N][N];
      |           ^
a.cc:10:8: error: size of array 'dp' exceeds maximum object size '9223372036854775807'
   10 | int dp[N][N];
      |        ^
Language: C++

#include<std/bitc++.h>

using namespace std;

int main(){

	string s;
	string t;

	cin >> s >> t;


	vector<vector<int>> DP(s.size(),vector<int>(t.size(),0));

	DP[0][0] = s[0]==t[0];

	for(int j=1;j<t.size();j++){

		if(s[0]==t[j]){
			DP[0][j] = 1;
		}else{
			DP[0][j] = DP[0][j-1];
		}

	}

	//init
	for(int i=1;i<s.size();i++){
		if(t[0]==s[i]){
			DP[i][0] = 1;
		}else{
			DP[i][0] = DP[i-1][0];
		}
	}

	//bottom up approach
	for(int i=1;i<s.size();i++){
		for(int j=1;j<t.size();j++){

			if(s[i]==t[j]){
				DP[i][j] = max(DP[i-1][j-1]+1,max(DP[i-1][j],DP[i][j-1]));
			}else{
				DP[i][j] = max(DP[i-1][j],DP[i][j-1]);
			}

		}
	}

	//extract the string from DP
	
	string ans;

	int i=s.size()-1;
	int j=t.size()-1;


	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{
				ans = s[i]+ ans;
				i--;
				j--;
			}

	}

	if((i==0)&&(DP[0][j]==1)){
		
		while((j>=0)&&(DP[0][j]==1)){
			j--;
		}
			ans = t[j+1] + ans;
	}


	if((j==0)&&(DP[i][0]==1)){

		while((i>=0)&&(DP[i][0]==1)){
			i--;
		}
			ans = s[i+1] + ans;
	}


	cout << ans << endl;


	return 0;
}

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

#include<bits/stdc++.h>
#define MAXN 1e5
#test test

using namespace std;

string a1,a2;

int dp (string s1, string s2, int n, int m){
    int l[n+1][m+1];

    for (int i=0; i<=n; i++){
        for (int j=0; j<=m; j++){
            if (i==0 or j==0){
                l[i][j]=0;
            }
            else if (s1[i-1]==s2[j-1]){
                l[i][j]=l[i-1][j-1]+1;
            }
            else{
                l[i][j]=max(l[i-1][j], l[i][j-1]);
            }
        }
    }
    while (m>0 and n>0){
        if (s1[n-1]==s2[m-1]){
            a1+=s1[n-1];
            n--;
            m--;
        }
        else if (l[n-1][m]>l[n][m-1]){
            n--;
        }
        else{
            m--;
        }
    }
}

long long n,m,a,b,c;
string s1,s2;

int main(){
    cin>>s1>>s2;
    n=s1.size();
    m=s2.size();
    dp(s1, s2, n, m);
    cout<<a1<<endl;
}


Compiler output:
a.cc:3:2: error: invalid preprocessing directive #test
    3 | #test test
      |  ^~~~
a.cc: In function 'int dp(std::string, std::string, int, int)':
a.cc:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^
Language: C++

// Ivan Carvalho
// Problem F - Educational Dynamic Programming Contest - AtCoder
// Link : https://atcoder.jp/contests/dp
#include <iostream>
#include <vector>
using namespace std;

const int MAXN = 3010;

string s,t;
int dp[MAXN][MAXN],N,M;
stack<char> resposta;

int solve(int a,int b){

	if(a < 0 || b < 0) return 0;

	if(dp[a][b] != -1) return dp[a][b];

	if(s[a] == t[b]) return dp[a][b] = 1 + solve(a-1,b-1);

	return dp[a][b] = max(solve(a-1,b),solve(a,b-1));

}

void build(int a,int b){

	if(a < 0 || b < 0) return;

	if(s[a] == t[b]){
		resposta.push(s[a]);
		build(a-1,b-1);
		return;
	}

	if(solve(a-1,b) > solve(a,b-1)) build(a-1,b);
	else build(a,b-1);

}

int main(){

	memset(dp,-1,sizeof(dp));

	cin >> s;
	cin >> t;

	N = (int)s.size();
	M = (int)t.size();

	build(N-1,M-1);

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

	return 0;

}

Compiler output:
a.cc:12:1: error: 'stack' does not name a type; did you mean 'obstack'?
   12 | stack<char> resposta;
      | ^~~~~
      | obstack
a.cc: In function 'void build(int, int)':
a.cc:31:17: error: 'resposta' was not declared in this scope
   31 |                 resposta.push(s[a]);
      |                 ^~~~~~~~
a.cc: In function 'int main()':
a.cc:43:9: error: 'memset' was not declared in this scope
   43 |         memset(dp,-1,sizeof(dp));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <vector>
  +++ |+#include <cstring>
    6 | using namespace std;
a.cc:53:16: error: 'resposta' was not declared in this scope
   53 |         while(!resposta.empty()){
      |                ^~~~~~~~
Language: Java

import java.util.Scanner;

public class LCS {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String a = scanner.next();
        String b = scanner.next();
        String ans[][] = new String[a.length()][b.length()];

        System.out.println(getLCS(a, b));
        System.out.println(getLCSMemo(a, b, 0, 0, ans) + " visited is " + visited);

    }

    public static int visited = 0;

    public static String getLCS(String a, String b) {
        if (b.length() == 0 || a.length() == 0) {
            return "";
        }
        String hans = "";
        if (a.charAt(0) == b.charAt(0)) {
            hans = a.substring(0, 1) + getLCS(a.substring(1), b.substring(1));
        } else {
            for (int i = 0; i < b.length(); i++) {
                if (a.charAt(0) == b.charAt(i)) {
                    hans = a.substring(0, 1) + getLCS(a.substring(1), b.substring(i + 1));
                    break;
                }
            }
        }
        String hans2 = getLCS(a.substring(1), b);
        // if (hans == null) {
        // return hans2;
        // } else if (hans2 == null) {
        // return hans;
        // } else {
        return (hans.length() > hans2.length() ? hans : hans2);
        // }

    }

    public static String getLCSMemo(String a, String b, int x, int y, String ans[][]) {

        if (b.length() - 1 < y || a.length() - 1 < x) {
            return "";
        }
        if (ans[x][y] != null) {
            visited++;
            return ans[x][y];
        }
        String hans = "";
        if (a.charAt(x) == b.charAt(y)) {
            hans = a.substring(x, x + 1) + getLCSMemo(a, b, x + 1, y + 1, ans);
        } else {
            for (int i = y; i < b.length(); i++) {
                if (a.charAt(x) == b.charAt(i)) {
                    hans = a.substring(x, x + 1) + getLCSMemo(a, b, x + 1, i + 1, ans);
                    break;
                }
            }
        }
        String hans2 = getLCSMemo(a, b, x + 1, y, ans);
        // if (hans == null) {
        // return hans2;
        // } else if (hans2 == null) {
        // return hans;
        // } else {
        ans[x][y] = (hans.length() > hans2.length() ? hans : hans2);
        return ans[x][y];
        // }

    }
}

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

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'

string ans=" ";
int helper(string &str1, int pt1, string &str2, int pt2, vector<vector<int> > &dp)
    {
         int a1=str1.length();
         int a2=str2.length();
        if(pt1 ==a1  || pt2==a2)
        {
            dp[pt1][pt2]= 0;
            return 0;
        }

        if(dp[pt1][pt2] != -1)
            return dp[pt1][pt2];

        int res;
        if(str1[pt1] == str2[pt2])
        {
           ans += str1[pt1];
            res= 1 +  helper(str1, pt1+1, str2 ,pt2+1, dp);
        }
        else
        {
            int first =helper(str1, pt1+1, str2, pt2, dp);
            int second =helper(str1, pt1, str2, pt2+1, dp);
            res =max(first, second);
        }
        dp[pt1][pt2]=res;
       return res;
    }

int longestCommonSubsequence(string str1, string str2)
    {
        int row=str1.length()+1;
        int col=str2.length()+1;
    if(str1.length() ==0 && str2.length()==0)
      reuturn 1;

        vector<vector<int> > dp(row, vector<int> (col, -1));
        return helper(str1, 0, str2, 0, dp);
    }

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

    string s1,s2;
    cin>>s1>>s2;
    
     longestCommonSubsequence(s1, s2);
    //cout << lcsfulldp(s1, s2) <<endl;
     cout<<ans<<'\n';




    return 0;
}



Compiler output:
a.cc: In function 'int longestCommonSubsequence(std::string, std::string)':
a.cc:40:7: error: 'reuturn' was not declared in this scope
   40 |       reuturn 1;
      |       ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'

string ans="";
int helper(string str1, int pt1, string str2, int pt2, vector<vector<int> > &dp)
    {
         int a1=str1.length();
         int a2=str2.lenght();
        if(pt1 ==a1  || pt2==a2)
        {
            dp[pt1][pt2]= 0;
            return 0;
        }

        if(dp[pt1][pt2] != -1)
            return dp[pt1][pt2];

        int res;
        if(str1[pt1] == str2[pt2])
        {
           ans += str1[pt1];
            res= 1 +  helper(str1, pt1+1, str2 ,pt2+1, dp);
        }
        else
        {
            int first =helper(str1, pt1+1, str2, pt2, dp);
            int second =helper(str1, pt1, str2, pt2+1, dp);
            res =max(first, second);
        }
        dp[pt1][pt2]=res;
       return res;
    }

int longestCommonSubsequence(string str1, string str2)
    {
        int row=str1.length()+1;
        int col=str2.length()+1;

        vector<vector<int> > dp(row, vector<int> (col, -1));
        return helper(str1, 0, str2, 0, dp);
    }

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

    string s1,s2;
    cin>>s1>>s2;
    
     longestCommonSubsequence(s1, s2);
    //cout << lcsfulldp(s1, s2) <<endl;
     cout<<ans<<'\n';




    return 0;
}



Compiler output:
a.cc: In function 'int helper(std::string, int, std::string, int, std::vector<std::vector<int> >&)':
a.cc:9:22: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lenght'; did you mean 'length'?
    9 |          int a2=str2.lenght();
      |                      ^~~~~~
      |                      length
Language: C++

#include <iostream>
using namespace std;
int main()
{
  string s, t;
  cin >> s >> t;
  int m = s.size();
  int n = t.size();
  ans[m][n];
  for(int i=0; i<m; i++)
    for(int j=0; j<n; j++)
    {
      if(i==0 || j==0)
        ans[i][j] = 0;
      else if(s[i-1]==t[j-1])
        ans[i][j] = ans[i-1][j-1]+1;
      else
        ans[i][j] = max(ans[i-1][j-1], max(ans[i][j-1], ans[i-1][j]);
                        }
     cout << ans[m-1][n-1] << endl;
                        }

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |   ans[m][n];
      |   ^~~
      |   abs
Language: C++

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

#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define mp12            make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pq1             priority_queue<int>
#define pqr1            priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int modInv(int a,int b,int m){int res=1;a=a%m;while(b>0){if(b&1){res=(res*a)%m;}a=(a*a)%m;b=b>>1;}return res;}

int dp[3001][3001];

int func(int i,int j,int x,int y,string s1,string s2){
    if(i==x or j==y) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    
    if(s1[i]==s2[j]) return dp[i][j]=1+func(i+1,j+1,x,y,s1,s2);
    
    int op1=func(i+1,j,x,y,s1,s2);
    int op2=func(i,j+1,x,y,s1,s2);
    return dp[i][j]=max(op1,op2);
}

void solve(){
	string s1,s2;
	cin>>s1>>s2;
	memset(dp,-1,sizeof(dp));
    cout<<func(0,0,x,y,s1,s2);
	
}
    

int32_t main()
{
 //   FIO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    solve();


    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:48:20: error: 'x' was not declared in this scope
   48 |     cout<<func(0,0,x,y,s1,s2);
      |                    ^
a.cc:48:22: error: 'y' was not declared in this scope; did you mean 'yn'?
   48 |     cout<<func(0,0,x,y,s1,s2);
      |                      ^
      |                      yn
Language: C++

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

#define ff              first
#define ss              second
#define int             long long int
#define pb              push_back
#define mp12            make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pq1             priority_queue<int>
#define pqr1            priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int modInv(int a,int b,int m){int res=1;a=a%m;while(b>0){if(b&1){res=(res*a)%m;}a=(a*a)%m;b=b>>1;}return res;}

int dp[3001][3001];

int func(int i,int j,int x,int y,string s1,string s2){
    if(i==x or j==y) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    
    if(s1[i]==s2[j]) return dp[i][j]=1+func(i+1,j+1,x,y,s1,s2);
    
    int op1=func(i+1,j,x,y,s1,s2);
    int op2=func(i,j+1,x,y,s1,s2);
    return dp[i][j]=max(op1,op2);
}

void solve(){
	string s1,s2;
	cin>>s1>>s2;
	memset(dp,-1,sizeof(dp));
    cout<<func(0,0,x,y,s1,s2);
	
}
    

int32_t main()
{
    FIO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    solve();


    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:48:20: error: 'x' was not declared in this scope
   48 |     cout<<func(0,0,x,y,s1,s2);
      |                    ^
a.cc:48:22: error: 'y' was not declared in this scope; did you mean 'yn'?
   48 |     cout<<func(0,0,x,y,s1,s2);
      |                      ^
      |                      yn
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr(a,b) for(ll i = a; i < b; i++)
#define mod 1000000007
#define inf 1e9 + 1
#define all(x) (x).begin(), (x).end()
#define prDouble(x) cout << fixed << setprecision(10) << x
#define triplet pair<ll,pair<ll,ll>>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define MAX 3000
 
int dp[MAX+1][MAX+1];
string getLCS(string& s, string& t, int len)
{
        string LCS;
        int i = 0, j = 0;
        while(len > 0)
        {
            if(s[i] == t[j])
            {
                LCS.push_back(s[i]);
                i++;
                j++;
                len--;
            }
            else
            {
                if(dp[i][j+1] > dp[i+1][j])
                    j++;
                else i++;
            }
        }
        return LCS;
}
 
int lenLCS(string& s, string& t, int i, int j)
{
        if(i >= s.length() || j >= t.length())
            return 0;
        
        if(dp[i][j] != -1)
            return dp[i][j];
 
        if(s[i] == t[j])
            return dp[i][j] = 1 + lenLCS(s,t,i+1,j+1);
        else 
        {
            return dp[i][j] = max(lenLCS(s,t,i,j+1), lenLCS(s,t,i+1,j));
        }
}
 
string solve(string s, string t)
{
        memset(dp, -1, sizeof dp);
        int len = lenLCS(s,t,0,0);
        return getLCS(s,t,len);
}
 
int main() {
    string s, t;
    cin >> s >> t;
    cout << solve(s, t

Compiler output:
a.cc: In function 'int main()':
a.cc:64:23: error: expected ')' at end of input
   64 |     cout << solve(s, t
      |                  ~    ^
      |                       )
a.cc:64:23: error: expected '}' at end of input
a.cc:61:12: note: to match this '{'
   61 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int             long long
int dp[3000][3000]={0};
 
    int ff(string &a, string &b, int n,int m, int i, int j) {
 
 
  if (dp[i][j] != 0) {
 
    return dp[i][j];
  }
  if (i >= n || j >= m) {
 
    return 0;
  }
  if (a[i] == b[j]) {
    return dp[i][j] = 1 + ff(a, b, n,m, i + 1, j + 1);
 
  }
  else {
    return dp[i][j] = max(ff(a, b, n,m,i + 1, j), ff(a, b, n, m,i, j + 1));
 
  }
}
    string longestPalindrome(string &a,string &b) {
        
 int n=a.length();
       int m=b.length();
      
  int len = ff(a, b, n,m, 0, 0);
  
  int i = 0;
  int j = 0;
  string c;
  while (len) {
    if (a[i] == b[j]) {
      c.push_back( a[i]);
      i++;
      j++;
      len--;
    } else {
      if (dp[i + 1][j] > dp[i][j + 1])
        i++;
      else j++;
    }
 
  }
  return c;
    }
int32_t main() {
 
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
  string a,b;
  getline(cin, a);
 getline(cin, b);
 
 
  cout << f(a,b);
 
  return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:60:11: error: 'f' was not declared in this scope
   60 |   cout << f(a,b);
      |           ^
Language: C++

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

int dp[3000][3000]={0};
 
    int ff(string &a, string &b,  int i, int j) {
 
 
  if (dp[i][j] != 0) {
 
    return dp[i][j];
  }
  if (i >= a.length() || j >= b.length()) {
 
    return 0;
  }
  if (a[i] == b[j]) {
    return dp[i][j] = 1 + ff(a, b, n, i + 1, j + 1);
 
  }
  else {
    return dp[i][j] = max(ff(a, b, n, i + 1, j), ff(a, b, n, i, j + 1));
 
  }
}
    string longestPalindrome(string &a,string &b) {
        
 
  int len = ff(a, b,  0, 0);
  
  int i = 0;
  int j = 0;
  string c;
  while (len) {
    if (a[i] == b[j]) {
      c.push_back( a[i]);
      i++;
      j++;
      len--;
    } else {
      if (dp[i + 1][j] > dp[i][j + 1])
        i++;
      else j++;
    }
 
  }
  return c;
    }
int32_t main() {
 
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
  string a,b;
  getline(cin, a);
 getline(cin, b);
 
 
  cout << f(a,b);
 
  return 0;
}

Compiler output:
a.cc: In function 'int ff(std::string&, std::string&, int, int)':
a.cc:18:36: error: 'n' was not declared in this scope
   18 |     return dp[i][j] = 1 + ff(a, b, n, i + 1, j + 1);
      |                                    ^
a.cc:22:36: error: 'n' was not declared in this scope
   22 |     return dp[i][j] = max(ff(a, b, n, i + 1, j), ff(a, b, n, i, j + 1));
      |                                    ^
a.cc: In function 'int32_t main()':
a.cc:58:11: error: 'f' was not declared in this scope
   58 |   cout << f(a,b);
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int             long long
int dp[3000][3000]={0};
 
    int ff(string &a, string &b,  int i, int j) {
 
 
  if (dp[i][j] != 0) {
 
    return dp[i][j];
  }
  if (i >= a.length() || j >= b.length()) {
 
    return 0;
  }
  if (a[i] == b[j]) {
    return dp[i][j] = 1 + ff(a, b, n, i + 1, j + 1);
 
  }
  else {
    return dp[i][j] = max(ff(a, b, n, i + 1, j), ff(a, b, n, i, j + 1));
 
  }
}
    string longestPalindrome(string &a,string &b) {
        

  int len = ff(a, b,  0, 0);
  
  int i = 0;
  int j = 0;
  string c;
  while (len) {
    if (a[i] == b[j]) {
      c.push_back( a[i]);
      i++;
      j++;
      len--;
    } else {
      if (dp[i + 1][j] > dp[i][j + 1])
        i++;
      else j++;
    }
 
  }
  return c;
    }
int32_t main() {
 
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
  string a,b;
  getline(cin, a);
 getline(cin, b);
 
 
  cout << f(a,b);
 
  return 0;
}

Compiler output:
a.cc: In function 'long long int ff(std::string&, std::string&, long long int, long long int)':
a.cc:18:36: error: 'n' was not declared in this scope
   18 |     return dp[i][j] = 1 + ff(a, b, n, i + 1, j + 1);
      |                                    ^
a.cc:22:36: error: 'n' was not declared in this scope
   22 |     return dp[i][j] = max(ff(a, b, n, i + 1, j), ff(a, b, n, i, j + 1));
      |                                    ^
a.cc: In function 'int32_t main()':
a.cc:58:11: error: 'f' was not declared in this scope
   58 |   cout << f(a,b);
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int             long long
int dp[3000][3000]={0};

    int ff(string &a, string &b, int n, int i, int j) {


  if (dp[i][j] != 0) {

    return dp[i][j];
  }
  if (i >= a.length() || j >= b.length()) {

    return 0;
  }
  if (a[i] == b[j]) {
    return dp[i][j] = 1 + ff(a, b, n, i + 1, j + 1);

  }
  else {
    return dp[i][j] = max(ff(a, b, n, i + 1, j), ff(a, b, n, i, j + 1));

  }
}
    string longestPalindrome(string a) {
        string b;
  int n = a.length();
  for (int i = n - 1; i >= 0; i--)
    b.push_back(a[i]);
 
  int len = ff(a, b, n, 0, 0);
  
  int i = 0;
  int j = 0;
  string c;
  while (len) {
    if (a[i] == b[j]) {
      c.push_back( a[i]);
      i++;
      j++;
      len--;
    } else {
      if (dp[i + 1][j] > dp[i][j + 1])
        i++;
      else j++;
    }

  }
  return c;
    }
int32_t main() {

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

  string a;
  getline(cin, a);



  cout << f(a);

  return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:61:11: error: 'f' was not declared in this scope
   61 |   cout << f(a);
      |           ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define int long long
signed main(){
  string a,b;
  cin >> a >> b;
  
  int n=a.size();
  int m=b.size();
  int dp[n+1][m+1];
  
  for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
      if(i==0 || j==0)
        dp[i][j]=0;
      
      else if(a[i-1]==b[j-1]){
        dp[i][j]=1+dp[i-1][j-1];
      }
      else{
        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
      }
    }
  }
 
  i=n;
  j=m;
  string ans;
  while(!(i==0 && j==0)){
    
    if(a[i]==b[j]){
      ans+=a[i];
      if(i)i--;   
      if(j)j--;
    }
    
    else if(dp[i][j-1]>=dp[i-1][j]){
      j--;
    }
    else{
      i--;
    }
    
  }
  
    reverse(ans.begin(), ans.end()); 
cout<<ans;
  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'i' was not declared in this scope
   26 |   i=n;
      |   ^
a.cc:27:3: error: 'j' was not declared in this scope
   27 |   j=m;
      |   ^
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   10 |   dp[n+1][m+1];
      |   ^~
      |   dup
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   10 |   dp[n+1][m+1];
      |   ^~
      |   dup
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main( ){
    string a, b;
    cin >> a;
    cin >> b;
    int n = (int)a.length() + 1;
    int m = (int)b.length() + 1;
    int dp[n] [m];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(i == 0 || j == 0)
                dp[i] [j] = 0;
            else if(a[i - 1] == b[j - 1])
                dp[i] [j] = dp[i - 1] [j - 1] + 1;
            else
                dp[i] [j] = max(dp[i] [j - 1], dp[i - 1] [j]); 
        }
    }
    string ans;
    int i = n - 1, j = m - 1;
    while(i != 0 && j != 0){
        if(dp[i] [j] > dp[i - 1] [j] && dp[i] [j] > dp[i] [j - 1]){
            --i;
            --j;
            ans += a[i];
        }else if(dp[i] [j] == dp[i - 1] [j])
            --i;
        else if(dp[i] [j] == dp[i] [j - 1])
            --j;
    }
    reverse(ans.begin(), ans.end());
    cout << (ans.size() == 0 ? ' ' : ans ) << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:30: error: operands to '?:' have different types 'char' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   33 |     cout << (ans.size() == 0 ? ' ' : ans ) << '\n';
      |              ~~~~~~~~~~~~~~~~^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  string x,y;
  cin>>x>>y;
  int n=x.length();
  int m=y.length();
  int dp[n+1][m+1];
  for(int i=0;i<=n;i++)
    for(int j=0;j<=m;j++)
    {
      if(i==0 || j==0)
        dp[i][j]=0;
    }
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)
    {
      if(x[i-1]==y[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];
  int i=n;j=m;
  string s;
  while(i>0 && j>0)
  {
    if(x[i]==y[j])
    {
      s+=x[i-1];
      i--;
      j--'
    }
    else
    {
      if(dp[i-1][j]>dp[i][j-1])
        i--;
      else
        j--;
    }
    cout<<s;
}

Compiler output:
a.cc:34:10: warning: missing terminating ' character
   34 |       j--'
      |          ^
a.cc:34:10: error: missing terminating ' character
a.cc: In function 'int main()':
a.cc:23:44: error: expected ';' before '}' token
   23 |         dp[i][j]=max(dp[i-1][j],dp[i][j-1])
      |                                            ^
      |                                            ;
   24 |     }
      |     ~                                       
a.cc:26:11: error: 'j' was not declared in this scope
   26 |   int i=n;j=m;
      |           ^
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

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

int main()
{
  string x,y;
  cin>>x>>y;
  int n=x.length();
  int m=y.length();
  int dp[n+1][m+1];
  for(int i=0;i<=n;i++)
    for(int j=0;j<=m;j++)
    {
      if(i==0 || j==0)
        dp[i][j]=0;
    }
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)
    {
      if(x[i-1]==y[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];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:44: error: expected ';' before '}' token
   23 |         dp[i][j]=max(dp[i-1][j],dp[i][j-1])
      |                                            ^
      |                                            ;
   24 |     }
      |     ~
Language: C++

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

#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MAX (int)1e9 + 99
#define vi vector<int>
#define vb vector<bool>
#define ll long long
#define ull unsigned long long
#define vll vector<ll>
#define pa pair<int, int>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define MOD 998244353
#define bitcnt(x) __builtin_popcount(x)
#define gcd(a,b) __gcd(a,b)
#define all(x) (x).begin(),(x).end()
#define ts(x) to_string(x)
#define set0(x) memset(x, 0, sizeof(x))
ll fastPowMod(ll a, ll p,ll mod){ if(p==0) return 1; ll z = fastPowMod(a,p/2,mod); z = (z*z)%mod; if(p%2) z = (z*a)%mod; return z; }
template<class T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) {if (!v.empty()) {os << v.front();for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];} return os;}



void solve()
{
    
    cin>>s;
    cin>>t;
    int sLen = s.length();
    int tLen = t.length();
    int dp[sLen+1][tLen+1];

    set0(dp);
    srep(i,1,sLen)
    {
        srep(j,1,tLen)
        {
            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 lenResult = dp[sLen][tLen];
    
    string res(lenResult,'a');

    int i = sLen, j = tLen, idx = lenResult-1;

    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1])
        {
            res[idx] = s[i-1];
            i--;j--;idx--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
            i--;
        else
            j--;

    }

    cout<<res;

}

int main()
{
    fastio;
    
    solve();
    cout<<"\n";
    
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:34:10: error: 's' was not declared in this scope; did you mean 'se'?
   34 |     cin>>s;
      |          ^
      |          se
a.cc:35:10: error: 't' was not declared in this scope; did you mean 'tm'?
   35 |     cin>>t;
      |          ^
      |          tm
Language: C++

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define int long long
# define F first
# define S second
# define pb push_back
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define mset multiset
# define umap unordered_map
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 3005;
 
string s,t,ans;
int used[N],dp[N][N];

void solve(){
	cin>>s>>t;
	s="#"+s;
	t="#"+t;
	for(int i=1;i<=sz(s);++i){
		for(int j=1;j<=sz(t);++j){
			if(s[i]==t[j]){
				dp[i][j]=dp[i-1][j-1]+1;
				if(!used[dp[i][j]]){
					used[dp[i][j]]=1;
					ans+=s[i];
				}
			}
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	cout<<ans;
}

int main(){
	Speed();
	//int T;cin>>T;while(T--)
	solve();
	return 0;
}

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

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define int long long
# define F first
# define S second
# define pb push_back
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define mset multiset
# define umap unordered_map
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 3005;
 
string s,t,ans;
int used[N],dp[N][N];

void solve(){
	cin>>s>>t;
	s="#"+s;
	t="#"+t;
	for(int i=1;i<=sz(s);++i){
		for(int j=1;j<=sz(t);++j){
			if(s[i]==t[j]){
				dp[i][j]=dp[i-1][j-1]+1;
				if(!used[dp[i][j]]){
					used[dp[i][j]]=1;
					ans+=s[i];
				}
			}
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	cout<<ans;
}

int main(){
	Speed();
	//int T;cin>>T;while(T--)
	solve();
}

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

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

string dp[3001][3001];
void resett(){
    for(ll i=0;i<=3000;i++){
        for(ll j=0;j<=3000;j++){
            dp[i][j] = "";
        }
    }
}

string lcs(string &s,string &t){
    
    if(dp[s.length()][t.length()] != ""){
        return dp[s.length()][t.length()];
    }

    if( (s.length() == 0 && t.length() == 0) || (s.length() == 0 && t.length() != 0) || (s.length() != 0 && t.length() == 0)) {
        string output = "";
        dp[s.length()][t.length()] = output;
        return output;
    }

    ll maxx = INT_MIN;
    string ret = "";
    if(s[0] == t[0]){
        string ss;
        ss.push_back(s[0]);
        // cout<<ss<<endl;
        string kk = lcs(s.substr(1),t.substr(1));
        string out = ss + kk;
        if(out.length() > maxx){
            maxx = out.length();
            ret = out;
        }
    }
    
    string second = lcs(s,t.substr(1));
    string third = lcs(s.substr(1),t);

    if(second.length() > maxx){
        ret = second;
        maxx = second.length();
    }

    if(third.length() > maxx){
        ret = third;
        maxx = third.length();
    }
    dp[s.length()][t.length()] = ret;
    return ret;
}

int main(){
    string s,t;
    cin>>s;
    cin>>t;
    resett();
    cout<<lcs(s,t)<<endl;
    resett();
    return 0;
}

Compiler output:
a.cc: In function 'std::string lcs(std::string&, std::string&)':
a.cc:34:33: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   34 |         string kk = lcs(s.substr(1),t.substr(1));
      |                         ~~~~~~~~^~~
a.cc:16:20: note:   initializing argument 1 of 'std::string lcs(std::string&, std::string&)'
   16 | string lcs(string &s,string &t){
      |            ~~~~~~~~^
a.cc:42:35: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   42 |     string second = lcs(s,t.substr(1));
      |                           ~~~~~~~~^~~
a.cc:16:30: note:   initializing argument 2 of 'std::string lcs(std::string&, std::string&)'
   16 | string lcs(string &s,string &t){
      |                      ~~~~~~~~^
a.cc:43:32: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   43 |     string third = lcs(s.substr(1),t);
      |                        ~~~~~~~~^~~
a.cc:16:20: note:   initializing argument 1 of 'std::string lcs(std::string&, std::string&)'
   16 | string lcs(string &s,string &t){
      |            ~~~~~~~~^