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

#include <iostream>
#include <cmath>
using namespace std;
static const int MAX_len = 3000;

int main(void){
    // 入力
    string s,t;
    cin >> s >> t;

    // dp[i+1][j+1]=sのi番目とtのj番目を使ったときのLCS
    int dp[MAX_len+1][MAX_len+1];
    int s_len = s.length();
    int t_len = t.length();
    // 初期化
    for(int i=0; i<=s_len; i++){
        for(int j=0; j<=t_len; j++){
            dp[i][j] = 0;  
            }
        }
    }
    for(int i=0; i<s_len; i++){
        for(int j=0; j<t_len; j++){
            if(s[i]==t[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[s_len][t_len];
    
    return 0;
}

Compiler output:
a.cc:22:5: error: expected unqualified-id before 'for'
   22 |     for(int i=0; i<s_len; i++){
      |     ^~~
a.cc:22:18: error: 'i' does not name a type
   22 |     for(int i=0; i<s_len; i++){
      |                  ^
a.cc:22:27: error: 'i' does not name a type
   22 |     for(int i=0; i<s_len; i++){
      |                           ^
a.cc:35:5: error: 'cout' does not name a type
   35 |     cout << dp[s_len][t_len];
      |     ^~~~
a.cc:37:5: error: expected unqualified-id before 'return'
   37 |     return 0;
      |     ^~~~~~
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: C++

#include<bits/stdc++.h>

using namspace std;

string lcs(string &s, string &t, int i, int j, string cur) {
  if(i>=s.length() or j>=t.length())
    return cur;
  
  if(s[i]==t[j]) {
  	cur += s[i];
    i+=1;
    j+=1;
    return lcs(s, t, i, j, cur);
  }
  else {
    string sij = lcs(s, t, i+1, j+1, cur);
    string si = lcs(s, t, i+1, j, cur);
    string sj = lcs(s, t, i, j+1, cur);
    if(sij.length() > si.length()) {
      if(sij.length()> sj.length())
        return sij;
      else 
        return sj;
    }
    else{
      if(si.length()>sj.length())
        return si;
      else 
        return sj;
    }
  }
}

int main() {
  string s, t;
  cin>>s>>t;
  
  lcs(s,t, 0, 0, "");
  
  return 0;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namspace'
    3 | using namspace std;
      |       ^~~~~~~~
a.cc:5:1: error: 'string' does not name a type; did you mean 'stdin'?
    5 | string lcs(string &s, string &t, int i, int j, string cur) {
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:35:3: error: 'string' was not declared in this scope
   35 |   string s, t;
      |   ^~~~~~
a.cc:35:3: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:36:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   36 |   cin>>s>>t;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:36:8: error: 's' was not declared in this scope
   36 |   cin>>s>>t;
      |        ^
a.cc:36:11: error: 't' was not declared in this scope; did you mean 'tm'?
   36 |   cin>>s>>t;
      |           ^
      |           tm
a.cc:38:3: error: 'lcs' was not declared in this scope
   38 |   lcs(s,t, 0, 0, "");
      |   ^~~
Language: C++

#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main() {
  string s1,s2;cin>>s1>>s2;
  int** dp=new int*[s2.length()+1];
  for(int i=0;i<=s2.length();i++){dp[i]=new int[s1.length()];memset(dp[i],0,s1.length()*sizeof(int));}
  for(int i=1;i<=s2.length();i++) {
  	for(int j=1;j<=s1.length();j++) {
      dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
      if(s2[i-1]==s1[j-1]) {
      	dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
      }
    }
  }
  string revOut="";
  /*
  int len=dp[s2.length()][s1.length()];
  int row=s2.length(),col=s1.length();
  while(row>0 && col>0) {
    if(dp[row][col]==dp[row-1][col]) {
      row--;
    } else if(dp[row][col]==dp[row][col-1]) {
      col--;
    } else if(dp[row][col]==dp[row-1][col-1]+1) {
      revOut+=s2[row-1];
      row--;col--;
      //len--;
    }
  }
  */
  int i=s2.length(), j=s1.length();
 
	while(i>=1 && j>=1) {
		if(dp[i][j]==dp[i][j-1])
			j--;
		else if(dp[i][j]==dp[i-1][j])
			i--;
		else{
			revOut+=s[i-1];
			i--;j--;
		}
		// cout<<i<<" "<<j<<endl;
	}
  /*
  for(int i=1;i<=s2.length();i++) {
  	for(int j=1;j<=s1.length();j++) {
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }
  */
  for(int i=revOut.length()-1;i>=0;i--) {cout<<revOut[i];}cout<<endl;
  //cout<<dp[s2.length()][s1.length()]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:33: error: 's' was not declared in this scope
   41 |                         revOut+=s[i-1];
      |                                 ^
Language: C++

#include<bits/stdc++.h>

#define ll long long 
using namespace std;

char lcs[100];

void print_lcs(ll dp[][100],ll i,ll j,char *s1,char *s2,ll l){
	if(i==0 || j==0)
		return ;
	if(s1[i]==s2[j]){
		lcs[l--]=s1[i];
		print_lcs(dp,i-1,j-1,s1,s2,l);}
	else{
		if(dp[i][j]==dp[i-1][j])
			print_lcs(dp,i-1,j,s1,s2,l);
		else print_lcs(dp,i,j-1,s1,s2,l);}}
	






main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string str1,str2;
	map<ll,ll> mp;
	multimap<ll,ll>mp1;
	ll test,n,w,i,j,area,flag=0,a1[100],d=0,m=INT_MAX,amt,r,a2[100],x,y,k,K,I,m1,m2,m3,o,o1,o2,o3,dp[3000][3000];
	char s2[3000],s1[3000];
	cin>>str1>>str2;
	
	n=str1.length();
	m=str2.length();
	for(i=1;i<=n;++i)
		s1[i]=str1[i-1];
	for(i=1;i<=m;++i)
		s2[i]=str2[i-1];
	
	
	
	for(i=0;i<=m;++i)
		dp[0][i]=0;
	for(i=0;i<=n;++i)
		dp[i][0]=0;
	for(i=1;i<=n;++i){
		for(j=1;j<=m;++j){
			if(s1[i]==s2[j])
				dp[i][j]=1+dp[i-1][j-1];
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);}}
	
	
	
	print_lcs(dp,n,m,s1,s2,dp[n][m]);
	
	for(i=1;i<=dp[n][m];++i)
		cout<<lcs[i];
	cout<<endl;
	
	
	}
		
	





Compiler output:
a.cc:25:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   25 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:57:19: error: cannot convert 'long long int (*)[3000]' to 'long long int (*)[100]'
   57 |         print_lcs(dp,n,m,s1,s2,dp[n][m]);
      |                   ^~
      |                   |
      |                   long long int (*)[3000]
a.cc:8:19: note:   initializing argument 1 of 'void print_lcs(long long int (*)[100], long long int, long long int, char*, char*, long long int)'
    8 | void print_lcs(ll dp[][100],ll i,ll j,char *s1,char *s2,ll l){
      |                   ^
Language: C++

#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define sbits(a) __builtin_popcount(a)
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define gcd __gcd
#define lcm(a, b) ((a * b) / gcd(a, b))
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define nani(x) cerr << #x << " is " << x << endl;
#define ch(x) (x - 'a' + 1)
#define mp make_pair
#define pb push_back
#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scan(x, n) loop(i, 0, n) cin >> x[i];
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define print(x, n) loop(i, 0, n) cout << x[i] << " ";
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 10000000000001
#define mod 1000000007

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef pair<long, long> pll;
typedef vector<ii> vii;
typedef vector<pll> vll;
typedef um<int, int> umii;
typedef um<char, int> umci;
typedef map<char, int> mci;
typedef map<int, int> mii;

const int N = 3001;
int dp[N][N];

int main()
{
    fast;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s, t;
    cin >> s >> t;
    s = '.' + s;
    t = '.' + t;

    int i = 1, j;

    for (; i < s.ln; i++) {
        for (j = 1; j < t.ln; j++) {
            if (s[i] == t[j])
                dp[i][j] = dp[i - 1][j - 1] + 1;
            else
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
        }
    }

    i = s.ln, j = t.ln;
    string res;

    while (i && j) {
        --i, --j;
        while (dp[i][j] == dp[i - 1][j] && i)
            --i;
        while (dp[i][j] == dp[i][j - 1] && j)
            --j;
        if (i)
            res += s[i];
    }

    reverse(res.B, res.E);
    cout << strrev(res);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:102:13: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
  102 |     cout << strrev(res);
      |             ^~~~~~
      |             strsep
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,c;
  cin>>s>>c;
  int dp[s.size()+1][c.size()+1];
  for(int i=0;i<s.size()+1;i++)
  {
    dp[i][0]=0;
  }
  for(int i=0;i<c.size()+1;i++)
  {
    dp[0][i]=0;
  }
  for(int i=1;i<s.size()+1;i++)
  {
    for(int j=1;j<c.size()+1;j++)
    {
      if(s[i]==c[j])
      {
        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 i=s.size();
  int j=c.size();
  while(i>=0 && j>=0)
  {
    if(dp[i][j]==dp[i-1][j])
      i--;
    else if(dp[i][j]==dp[i][j-1])
      j--;
    else
    {
      ans.push_back(s[i]);
      i--;
      j--;
    }
  }
  	if(s[0]==c[0])
      ans.push_back(s[0]);
	ans.reverse(ans.begin(),ans.end());
  	cout<<ans;
}

  

Compiler output:
a.cc: In function 'int main()':
a.cc:48:13: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'reverse'; did you mean 'reserve'?
   48 |         ans.reverse(ans.begin(),ans.end());
      |             ^~~~~~~
      |             reserve
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class F {
    public static void main(String[] args) throws IOException {
        BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
        String[] s1 = inp.readLine().split("");
        String[] s2 = inp.readLine().split("");

        solve(s1,s2);
    }
    static void solve(String[] x, String[] y){
        int[][] dp = new int[y.length+1][x.length+1];

        for(int i=1;i<=y.length;i++){
            for(int j=1;j<=x.length;j++){
                if(y[i-1].equals(x[j-1])){
                    dp[i][j] = dp[i-1][j-1]+1;

                }
                else{
                    dp[i][j] = Math.max(dp[i-1][j],dp[i][j-1]);
                }
            }
        }

//        for(int i=0;i<=y.length;i++){
//            for(int j=0;j<=x.length;j++){
//                System.out.print(dp[i][j]+" ");
//            }
//            System.out.println();
//        }
        ArrayList<String> list = new ArrayList<>();
        int max = dp[y.length][x.length];
        int a = x.length;
        int b = y.length;

        while (b>0 || a>0){
            if(dp[b][a-1]==max){
                a--;
            }
            else if(dp[b-1][a]==max){
                b--;
            }
            else{
                a--;b--;
                list.add(y[b]);
                max--;
            }
        }
        for(int i=0;i<list.size();i++){
            System.out.print(list.get(list.size()-1-i));
        }

    }
}


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

#include <iostream>
using namespace std;


int main()
{
  string s, t;
  cin >> s >> t;
  int n = s.length();
  int m = t.length();

  int dp[n][m];

  int D[n][m];

  if(s[0] == t[0])
  {
    dp[0][0] = 1;
  }
  else 
    {
      dp[0][0] = 0;
    }

  for (int i = 1; i < n; ++i)
  {
     if(s[i] == t[0])
     {
       D[i][0] = 2;
       dp[i][0] = 1;
     }
     else 
      {
        D[i][0] = 0;
        dp[i][0] = dp[i-1][0];
      }
  }
  


  for (int i = 1; i < m; ++i)
  {
     if(t[i] == s[0])
     {
       D[0][i] = 2;
       dp[0][i] = 1;
     }
     else 
      {
        D[0][i] = 1;
        dp[0][i] = dp[0][i-1];
      }
  }

  

  for (int i = 1; i < n; ++i)
  {
     for (int j = 1; j < m; ++j)
     {
        int A = dp[i-1][j];
        int B = dp[i][j-1];

        dp[i][j] = max(A, B);

        int d = -1;

        if(A > B) d = 0;
        else d = 1;

        int C;
        if(s[i] == t[j]) 
        {
           C = 1 + dp[i-1][j-1];
           dp[i][j] = max(dp[i][j], C);
           if(C > A && C > B) d = 2;
        }

        D[i][j] = d;
     }
  }

  
  int ans = -1;

  int  rm, cm;

  for (int i = 0; i < n; ++i)
  {
     for (int j = 0; j < m; ++j)
     {
       if(dp[i][j] >= ans)
       {
          ans = dp[i][j];
          rm = i;
          cm = j;
       }
     }
  }

  // cout << ans  << " " << rm <<  " " << cm <<  endl;;

  // cout << D[3][4] << endl;
  string str = "";

  while(1)
  {
    if(rm < 0 || cm < 0 ) break;
    if(rm == 0 && cm == 0)
    {
      if(s[rm] == t[cm]) str += s[rm];
      break;
    }
    if(D[rm][cm] == 0)
    {
       rm -= 1;
       continue;
    }

    if(D[rm][cm] == 1)
    {
      cm -= 1;
      continue;
    }

    if(D[rm][cm] == 2)
    {
      str += s[rm];
      rm -= 1;
      cm -= 1;
      continue;
    }
  }

  reverse(str.begin(), str.end());

  for (int i = 0; i < str.length(); ++i)
  {
     cout << str[i];
  }

 


  return 0;
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: 'u' was not declared in this scope
   39 |                 u=u+s[i-1];
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int  ll;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL);
 
int main() {
 
    fastio;
 
    string s,t,u= "";
    vector<vector<ll>> dp(3005 , vector<ll>(3005));
    
 
    cin >> s >> t;
 
    
 
    for(ll i = 0; i < sizeof(t); i++) dp[0][i] = 0;
    for(ll i = 0; i < sizeof(s); i++) dp[i][0] = 0;
 
   
 
    for(ll i = 1; i <= s.size(); i++)
    {
        for(ll j = 1; j <= t.size(); j++)
        {
            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]);
        }
    }
 
    ll i = s.size(), j = t.size(), p = dp[s.size()][t.size()];
    ll count = 0;
    while (i > 0 && j > 0)
    {
        if (s[i-1] == t[j-1])
        {
            u[p-1] = t[j-1];
            i--; j--;p--;count++;
        }
 
        else if (dp[i-1][j] > dp[i][j-1])
            i--;
        else
            j--;
    }
 
    
 
    for(ll i = 0; i < count; i++) cout << u[i];
 
    return 0;
}#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int  ll;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL);
 
int main() {
 
    fastio;
 
    string s,t,u= "";
    vector<vector<ll>> dp(sizeof(s)+10 , vector<ll>(sizeof(t)+10));
    
 
    cin >> s >> t;
 
    
 
    for(ll i = 0; i < sizeof(t); i++) dp[0][i] = 0;
    for(ll i = 0; i < sizeof(s); i++) dp[i][0] = 0;
 
   
 
    for(ll i = 1; i <= s.size(); i++)
    {
        for(ll j = 1; j <= t.size(); j++)
        {
            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]);
        }
    }
 
    ll i = s.size(), j = t.size(), p = dp[s.size()][t.size()];
    ll count = 0;
    while (i > 0 && j > 0)
    {
        if (s[i-1] == t[j-1])
        {
            u[p-1] = t[j-1];
            i--; j--;p--;count++;
        }
 
        else if (dp[i-1][j] > dp[i][j-1])
            i--;
        else
            j--;
    }
 
    
 
    for(ll i = 0; i < count; i++) cout << u[i];
 
    return 0;
}

Compiler output:
a.cc:56:2: error: stray '#' in program
   56 | }#include <bits/stdc++.h>
      |  ^
a.cc:56:3: error: 'include' does not name a type
   56 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:61:5: error: redefinition of 'int main()'
   61 | int main() {
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main() {
      |     ^~~~
Language: C++

#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int dp[3001][3001];
string s;
LCS(string &a,string &b,int n,int m)
{
    if(n==0 || m==0)
        return 0;
    else if(dp[n][m]!=-1)
        return dp[n][m];
    else if(a[n-1]==b[m-1])
        dp[n][m]=1 + LCS(a,b,n-1,m-1);
    else
        dp[n][m]=max(LCS(a,b,n-1,m),LCS(a,b,n,m-1));
    return dp[n][m];
}
int main()
{   memset(dp,-1,sizeof(dp));
    string a,b;
    cin>>a;
    cin>>b;
    int n=a.length();
    int m=b.length();
    LCS(a,b,n,m);
    while(n>0 && m>0)
    {
        if(a[n-1]==b[m-1])
        {
            s=s+a[n-1];
            n--;
            m--;
        }
        else if(dp[n-1][m]>dp[n][m-1])
            n--;
        else
            m--;
    }

   reverse(s.begin(),s.end());
   cout<<s;
   return 0;
}


Compiler output:
a.cc:7:1: error: ISO C++ forbids declaration of 'LCS' with no type [-fpermissive]
    7 | LCS(string &a,string &b,int n,int m)
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;  
typedef vector<ll> vi; 
typedef pair<int, int> ii; 
typedef vector<ii> vii; 
typedef vector<vi> vvi;
#define F first
#define S second
#define pb emplace_back
#define M 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr(i,a,b) for(int i = a; i<= b; i++)
#define ws " "
#define all(c) c.begin(), c.end()
#define ln "\n" 
 
void printarray(int ar[], int n) {
    for (int i = 0; i < n; i++) {
        cout << ar[i] << ws;
    }
    cout << ln;
}


main() {
    IOS;
    string s, t;
    cin >> s >> t;
    int n = s.length(), m = t.length();
    // n - string s
    // m - string t

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

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            if (i == 0 or j == 0) {
                dp[i][j] = 0;
                continue;
            }
            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]);
            }
        }
    }

    int i = n, j = m;
    int val = dp[n][m];
    string str = "";

    while (i >= 1 and j >= 1) {
        if (s[i - 1] == t[j - 1]) {
            str.push_back(s[i-1]);
            i--, j--;
        } else {
            if (dp[i - 1][j] > dp[i][j - 1]) {
                i = i - 1;
            } else {
                j = j - 1;
            }
        }
    }
    reverse(all(str));
    cout << str;f
}
 
/*  Check for base cases such as n == 1
    and cases like it where code can fail */

Compiler output:
a.cc:29:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   29 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:70:17: error: 'f' was not declared in this scope
   70 |     cout << str;f
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int dp[3005][3005];
int m,n;
int main()
{
  string a,b;
  cin >> a >> b;
  m = a.length();
  n= b.length();
  memset(dp,-1,sizeof dp);
  
  for(int i=0;i<=m;i++)
  {
    for(int j=0;j<=n;j++)
    {
      if(i==0||j==0)
        dp[i][j]=0;
      else if(a[i-1]==b[i-1])
        dp[i][j]=1+dp[i-1][j-1];
      else
        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  }
  
  string ans="";
  int i=0,j=0;
  while(i<m && j<n)
  {   
    if(a[i]==b[j])
    {
      ans+=a[i];
      i++;
      j--;
  	}
    else if(dp[i+1][j]>dp[i][j+1])
      i++;
    else
      j++;
  }
  
  return ans;
  
}






Compiler output:
a.cc: In function 'int main()':
a.cc:42:10: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
   42 |   return ans;
      |          ^~~
      |          |
      |          std::string {aka std::__cxx11::basic_string<char>}
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int do[3100][3100]={0};
    string s,t;
    cin >> s >> t;
    rep(i,s.length()){
        rep(j,t.length()){
            if(s[i]==t[j])chmax(dp[i+1][j+1],dp[i][j]+1);
            chmax(dp[i+1][j+1],dp[i+1][j]);
            chmax(dp[i+1][j+1],dp[i][j+1]);
        }
    }
    string res="";
    int i=(int)s.size();
    int j=(int)t.size();
    while(i>0 && j>0){
        if(dp[i][j]==dp[i-1][j]){
            i--;
        }
        else if(dp[i][j]==dp[i][j-1]){
            j--;
        }
        else{
            res=s[i-1]+res;
            i--;
            j--;
        }
    }
    cout << res << endl;
    


}

/*



 */



Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: expected unqualified-id before 'do'
   17 |     int do[3100][3100]={0};
      |         ^~
a.cc:22:33: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |             if(s[i]==t[j])chmax(dp[i+1][j+1],dp[i][j]+1);
      |                                 ^~
      |                                 dup
a.cc:23:19: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |             chmax(dp[i+1][j+1],dp[i+1][j]);
      |                   ^~
      |                   dup
a.cc:31:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   31 |         if(dp[i][j]==dp[i-1][j]){
      |            ^~
      |            dup
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    int do[3100][3100]={0};
    string s,t;
    cin >> s >> t;
    rep(i,s.length()){
        rep(j,t.length()){
            if(s[i]==t[j])chmax(dp[i+1][j+1],dp[i][j]+1);
            chmax(dp[i+1][j+1],dp[i+1][j]);
            chmax(dp[i+1][j+1],dp[i][j+1]);
        }
    }
    string res="";
    int i=(int)s.size();
    int j=(int)t.size();
    while(i>0 && j>0){
        if(dp[i][j]==dp[i-1][j]){
            i--;
        }
        else if(dp[i][j]==dp[i][j-1]){
            j--;
        }
        else if(dp[i][j]==dp[i-1][j-1]){
            res=s[i-1]+res;
            i--;
            j--;
        }
    }
    cout << res << endl;
    


}

/*



 */


Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: expected unqualified-id before 'do'
   17 |     int do[3100][3100]={0};
      |         ^~
a.cc:22:33: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |             if(s[i]==t[j])chmax(dp[i+1][j+1],dp[i][j]+1);
      |                                 ^~
      |                                 dup
a.cc:23:19: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |             chmax(dp[i+1][j+1],dp[i+1][j]);
      |                   ^~
      |                   dup
a.cc:31:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   31 |         if(dp[i][j]==dp[i-1][j]){
      |            ^~
      |            dup
Language: C++

*/
#include "stdafx.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<complex>
*/

#include<bits/stdc++.h>

#define X real()
#define Y imag()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ff first
#define ss second
#define FastF freopen("in.txt","r",stdin); freopen("out.txt","w",stdout)
#define Fast cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0)
using ll = long long;
using namespace std;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vi::iterator vii;
typedef vector<ll> vl;
typedef vl::iterator vli;
typedef long double C;
typedef complex<C> P;
const int INF = 1e9 + 5;
const ll INFF = 1e18 + 5;
const int M = 1e9 + 7;
const double pi = acos(-1);
int dp[3001][3001];
string s, t, ans;
int LCS(int i, int j) {
	if (s[i] == '\0' || t[j] == '\0') return 0;
	if (dp[i][j] != -1) return dp[i][j];
	if (s[i] == t[j]) return dp[i][j] = 1 + LCS(i + 1, j + 1);
	else return dp[i][j] = max(LCS(i + 1,j), LCS(i,j + 1));
}
void printLCS(int i, int j) {
	if (s[i] == '\0' || t[j] == '\0') {
		cout << ans;
		return;
	}
	if (s[i] == t[j]) {
		ans += s[i];
		printLCS(i + 1, j + 1);
	}
	else {
		if (dp[i + 1][j] > dp[i][j + 1]) printLCS(i + 1, j);
		else printLCS(i, j + 1);
	}
}
int main()
{
	//FastF;
	Fast;
	memset(dp, -1, sizeof(dp));
	cin >> s >> t;
	cout << LCS(0, 0) << endl;
	printLCS(0, 0);
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
void rec(vector<vector<int>> dp, string s, string t)
{
  int i, j, len1, len2;
  len1=s.length();
  len2=t.length();
  int dp[len1+1][len2+1];
  
  for(i=0;i<=len1;i++)
  {
    for(j=0;j<=len2;j++)
    {
       if(i==0 || j==0)
        dp[i][j]=0;
      else if(i>0 && j>0 && 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 main()
{
  string s, t;
  cin>>s>>t;
  int len1, len2;
  len1=s.length();
  len2=t.length();
  vector<vector<int>> dp(len1+1, vector<int> (len2+1));
  rec(dp, s, t);
  int i=s.length();
  int j=t.length();
  string ans="";
  while(dp[i][j]!=0)
  {
    if(s[i-1]==t[j-1])
    {
      ans+=s[i-1];
      i--;
      j--;
    }
    else if(dp[i-1][j]>=dp[i][j-1])
      i--;
    else
      j--;
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'void rec(std::vector<std::vector<int> >, std::string, std::string)':
a.cc:8:7: error: declaration of 'int dp [(len1 + 1)][(len2 + 1)]' shadows a parameter
    8 |   int dp[len1+1][len2+1];
      |       ^~
a.cc:3:30: note: 'std::vector<std::vector<int> > dp' previously declared here
    3 | void rec(vector<vector<int>> dp, string s, string t)
      |          ~~~~~~~~~~~~~~~~~~~~^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
void rec(vector<vector<int>> dp, string s, string t)
{
  int i, j, len1, len2;
  len1=s.length();
  len2=t.length();
  int dp[len1+1][len2+1];
  
  for(i=0;i<=len1;i++)
  {
    for(j=0;j<=len2;j++)
    {
       if(i==0 || j==0)
        dp[i][j]=0;
      else if(i>0 && j>0 && 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 main()
{
  string s, t;
  cin>>s>>t;
  int len1, len2;
  len1=s.length();
  len2=t.length();
  vector<vector<int>> dp(len+1, vector<int> (len2+1));
  rec(dp, s, t);
  int i=s.length();
  int j=t.length();
  string ans="";
  while(dp[i][j]!=0)
  {
    if(s[i-1]==t[j-1])
    {
      ans+=s[i-1];
      i--;
      j--;
    }
    else if(dp[i-1][j]>=dp[i][j-1])
      i--;
    else
      j--;
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'void rec(std::vector<std::vector<int> >, std::string, std::string)':
a.cc:8:7: error: declaration of 'int dp [(len1 + 1)][(len2 + 1)]' shadows a parameter
    8 |   int dp[len1+1][len2+1];
      |       ^~
a.cc:3:30: note: 'std::vector<std::vector<int> > dp' previously declared here
    3 | void rec(vector<vector<int>> dp, string s, string t)
      |          ~~~~~~~~~~~~~~~~~~~~^~
a.cc: In function 'int main()':
a.cc:30:26: error: 'len' was not declared in this scope; did you mean 'len2'?
   30 |   vector<vector<int>> dp(len+1, vector<int> (len2+1));
      |                          ^~~
      |                          len2
Language: C++

#include <bits/stdc++.h>
using namespace std;
void rec(vector<vector<int>> dp, string s, string t)
{
  int i, j, len1, len2;
  len1=s.length();
  len2=t.length();
  int dp[len1+1][len2+1];
  
  for(i=0;i<=len1;i++)
  {
    for(j=0;j<=len2;j++)
    {
       if(i==0 || j==0)
        dp[i][j]=0;
      else if(i>0 && j>0 && 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 main()
{
  string s, t;
  cin>>s>>t;
  vector<vector<int>> dp(len+1, vector<int> (len2+1));
  rec(dp, s, t);
  int i=s.length();
  int j=t.length();
  string ans="";
  while(dp[i][j]!=0)
  {
    if(s[i-1]==t[j-1])
    {
      ans+=s[i-1];
      i--;
      j--;
    }
    else if(dp[i-1][j]>=dp[i][j-1])
      i--;
    else
      j--;
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'void rec(std::vector<std::vector<int> >, std::string, std::string)':
a.cc:8:7: error: declaration of 'int dp [(len1 + 1)][(len2 + 1)]' shadows a parameter
    8 |   int dp[len1+1][len2+1];
      |       ^~
a.cc:3:30: note: 'std::vector<std::vector<int> > dp' previously declared here
    3 | void rec(vector<vector<int>> dp, string s, string t)
      |          ~~~~~~~~~~~~~~~~~~~~^~
a.cc: In function 'int main()':
a.cc:27:26: error: 'len' was not declared in this scope
   27 |   vector<vector<int>> dp(len+1, vector<int> (len2+1));
      |                          ^~~
a.cc:27:46: error: 'len2' was not declared in this scope
   27 |   vector<vector<int>> dp(len+1, vector<int> (len2+1));
      |                                              ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
void rec(vector<vector<int>> dp, string s, string t)
{
  int i, j, len1, len2;
  len1=s.length();
  len2=t.length();
  int dp[len1+1][len2+1];
  
  for(i=0;i<=len1;i++)
  {
    for(j=0;j<=len2;j++)
    {
       if(i==0 || j==0)
        dp[i][j]=0;
      else if(i>0 && j>0 && 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 main()
{
  string s, t;
  cin>>s>>t;
  rec(dp, s, t);
  int i=s.length();
  int j=t.length();
  string ans="";
  while(dp[i][j]!=0)
  {
    if(s[i-1]==t[j-1])
    {
      ans+=s[i-1];
      i--;
      j--;
    }
    else if(dp[i-1][j]>=dp[i][j-1])
      i--;
    else
      j--;
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'void rec(std::vector<std::vector<int> >, std::string, std::string)':
a.cc:8:7: error: declaration of 'int dp [(len1 + 1)][(len2 + 1)]' shadows a parameter
    8 |   int dp[len1+1][len2+1];
      |       ^~
a.cc:3:30: note: 'std::vector<std::vector<int> > dp' previously declared here
    3 | void rec(vector<vector<int>> dp, string s, string t)
      |          ~~~~~~~~~~~~~~~~~~~~^~
a.cc: In function 'int main()':
a.cc:27:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |   rec(dp, s, t);
      |       ^~
      |       dup
Language: C++

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


ll main()
{
       string s,t;
       cin>>s>>t;
       ll n=s.size();
       ll m=t.size();

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

        for(ll i=0;i<=n;i++)
        {
            for(ll 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]=max(dp[i-1][j],dp[i][j-1]+1);}

                           else
                           	dp[i][j]=max(dp[i][j-1],dp[i-1][j]);

                     }
            }

        }
	    
          ll c=1;
	   for(ll i=0;i<=n;i++)
        {
            for(ll j=0;j<=m;j++)
            {
                 if(dp[i][j]==c)
                 {
                 	cout<<s[i-1];
                 	c++;
                 }
            }
        }    

	   //SS cout<<dp[n][m];

	return 0;
}

Compiler output:
a.cc:8:1: error: '::main' must return 'int'
    8 | ll main()
      | ^~
Language: C++

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

#define INF 1000000007
#define mem(dp,a) memset(dp,a,sizeof dp)
#define flash ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define f(i,n) for (ll i=0;i<n;i++)
#define sieve(j,mp) for(ll j=2*i ; j<=mp ; j+=i)
#define pb(x) push_back(x)
#define mp(x,y) push_back(make_pair(x,y))
#define tr(c,it) for(((c).begin())it=(c).begin();it!=(c).end();it++)
#define test ll t=1; while(t--)
#define F first
#define S second
main()
{
    flash
    clock_t launch=clock();
    test
    {
        string s1,s2;
        cin>>s1>>s2;
        ll l1=s1.length(),l2=s2.length();
        vector<char> ans;
        ll dp[l1+1][l2+1],x=l1,y=l2;
        mem(dp,0);
        rep(i,1,l1+1)
        rep(j,1,l2+1)
        if(s1[i-1]==s2[j-1])
        dp[i][j]=dp[i-1][j-1]+1;
        else dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
        while(x!=0&&y!=0)
        if(dp[x][y]==dp[x-1][y-1]+1)ans.pb(s2[y-1]),x--,y--;
        else if(dp[x-1][y]>dp[x][y-1]) x--;
        else y--;
        reverse(ans.begin(),ans.end());
        for(auto i:ans)cout<<i;
        cout<<endl;
    }
    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
    return 0;
}


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

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <assert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
    string S, T; cin >> S >> T;
    int N = (int)S.size();
    int M = (int)T.size();
    
    if(S=="axyb" && T=="abyxb") assert(false);
    
    vector<vector<int>> dp(N+1, vector<int>(M+1));
    vector<PII> V;
    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;
//                cout << i << " " << j << " " << S[i] << endl;
            }
            else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
        }
    }
    

    int i = N;
    int j = M;
    string ans;
    while(i>=0 && j>=0){
        if(S[i]==T[j]){
            ans = S[i] + ans;
            i--;
            j--;
        }
        else if(dp[i][j]==dp[i][j-1]) j--;
        else i--;
    }
    cout << ans << endl;
    
    return 0;
}





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

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
    string S, T; cin >> S >> T;
    int N = (int)S.size();
    int M = (int)T.size();
    
    if(S=="axyb" && T=="abyxb") assert(false);
    
    vector<vector<int>> dp(N+1, vector<int>(M+1));
    vector<PII> V;
    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;
//                cout << i << " " << j << " " << S[i] << endl;
            }
            else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
        }
    }
    

    int i = N;
    int j = M;
    string ans;
    while(i>=0 && j>=0){
        if(S[i]==T[j]){
            ans = S[i] + ans;
            i--;
            j--;
        }
        else if(dp[i][j]==dp[i][j-1]) j--;
        else i--;
    }
    cout << ans << endl;
    
    return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:29:33: error: 'assert' was not declared in this scope
   29 |     if(S=="axyb" && T=="abyxb") assert(false);
      |                                 ^~~~~~
a.cc:13:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   12 | #include <ctime>
  +++ |+#include <cassert>
   13 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
int main(){
    string s,t;cin>>s>>t;
    vector<vector<int> >v(s.size()+1,vector<int>(t.size()+1));
    rep(i,s.size()){
        rep(j,t.size()){
            if(s[i]==t[j])v[i+1][j+1]=max(v[i+1][j],v[i][j+1],v[i][j]+1);
            else v[i][j]=max(v[i+1][j],v[i][j+1]);
        }
    }
    string ans="";
    int i=s.size(),j=t.size();
    while(i>0&&j>0){
        if(v[i-1][j]==v[i][j])i--;
        else if(v[i][j-1]==v[i][j])j--;
        else{
            ans+=s[i];
            i--;j--;
        }
    }
    cout<<ans<<endl;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:14:42:   required from here
   14 |             if(s[i]==t[j])v[i+1][j+1]=max(v[i+1][j],v[i][j+1],v[i][j]+1);
      |                                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

int main() {
	// your code goes here
	string s1,s2;
	cin>>s1>>s2;
	int n1=s1.length();
	int n2=s2.length();
	int LCS[n1+1][n2+1];
	for(int i=0;i<=n1;i++)
	{
		for(int j=0;j<=n2;j++)
			{
				if(i==0 or j==0)LCS[i][j]=0;
				if(i>0 and j>0)
				{
					if(s1[i-1]==s2[j-1])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=0;i<=n1;i++)
	// {
	// 	for(int j=0;j<=n2;j++)
	// 	{
	// 		cout<<LCS[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	}
	int i=n1;
	int j=n2;
	vector<int>v;
	while(i>0 and j>0)
	{
		if(s1[i-1]==s2[j-1])
		{
			v.push_back(i-1);
			i-=1;
			j-=1;
		}
		if(s1[i-1]!=s2[j-1])
		{
			if(LCS[i-1][j]>=LCS[i][j-1])
			{
				i-=1;
			}
			if(LCS[i-1][j]<LCS[i][j-1])
			{
				j-=1;
			}
		}
	}
	sort(v.begin(),v.end());
	for(i=0;i<v.size();i++)
	{
		cout<<s1[v[i]];
	}
	return 0;
}

Compiler output:
a.cc:32:15: error: 'n1' was not declared in this scope; did you mean 'y1'?
   32 |         int i=n1;
      |               ^~
      |               y1
a.cc:33:15: error: 'n2' was not declared in this scope
   33 |         int j=n2;
      |               ^~
a.cc:35:9: error: expected unqualified-id before 'while'
   35 |         while(i>0 and j>0)
      |         ^~~~~
a.cc:55:13: error: expected constructor, destructor, or type conversion before '(' token
   55 |         sort(v.begin(),v.end());
      |             ^
a.cc:56:9: error: expected unqualified-id before 'for'
   56 |         for(i=0;i<v.size();i++)
      |         ^~~
a.cc:56:17: error: 'i' does not name a type
   56 |         for(i=0;i<v.size();i++)
      |                 ^
a.cc:56:28: error: 'i' does not name a type
   56 |         for(i=0;i<v.size();i++)
      |                            ^
a.cc:60:9: error: expected unqualified-id before 'return'
   60 |         return 0;
      |         ^~~~~~
a.cc:61:1: error: expected declaration before '}' token
   61 | }
      | ^
Language: C++

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

int main() {
	// your code goes here
	string s1,s2;
	cin>>s1>>s2;
	int n1=s1.length();
	int n2=s2.length();
	int LCS[n1+1][n2+1];
	for(int i=0;i<=n1;i++)
	{
		for(int j=0;j<=n2;j++)
			{
				if(i==0 or j==0)LCS[i][j]=0;
				if(i>0 and j>0)
				{
					if(s1[i-1]==s2[j-1])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=0;i<=n1;i++)
	// {
	// 	for(int j=0;j<=n2;j++)
	// 	{
	// 		cout<<LCS[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	}
	int i=n1,j=n2;
	vector<int>v;
	while(i>0 and j>0)
	{
		if(s1[i-1]==s2[j-1])
		{
			v.push_back(i-1);
			i-=1;
			j-=1;
		}
		if(s1[i-1]!=s2[j-1])
		{
			if(LCS[i-1][j]>=LCS[i][j-1])
			{
				i-=1;
			}
			if(LCS[i-1][j]<LCS[i][j-1])
			{
				j-=1;
			}
		}
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++)
	{
		cout<<s1[v[i]];
	}
	return 0;
}

Compiler output:
a.cc:32:15: error: 'n1' was not declared in this scope; did you mean 'y1'?
   32 |         int i=n1,j=n2;
      |               ^~
      |               y1
a.cc:34:9: error: expected unqualified-id before 'while'
   34 |         while(i>0 and j>0)
      |         ^~~~~
a.cc:54:13: error: expected constructor, destructor, or type conversion before '(' token
   54 |         sort(v.begin(),v.end());
      |             ^
a.cc:55:9: error: expected unqualified-id before 'for'
   55 |         for(int i=0;i<v.size();i++)
      |         ^~~
a.cc:55:21: error: 'i' does not name a type
   55 |         for(int i=0;i<v.size();i++)
      |                     ^
a.cc:55:32: error: 'i' does not name a type
   55 |         for(int i=0;i<v.size();i++)
      |                                ^
a.cc:59:9: error: expected unqualified-id before 'return'
   59 |         return 0;
      |         ^~~~~~
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^
Language: C++


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(N) for(int i = 0; i < (int)(N); i++)
#define all(x) (x).begin(),(x).end()
#define length(x) ((int)(x).size())
#define prln(s) cout<<s<<endl;

#define str(s) string s;cin>>s;
#define int1(x) int x;cin>>x;
#define int2(x,y) int x,y;cin>>x>>y;

//#define DBG 1
#ifdef DBG
#define dbg(s) cout<<s<<endl;
#else
#define dbg(s) ;
#endif

int main() {
  str(s);
  str(t);
  int ls = length(s);
  int lt = length(t);
  int dp[ls+1][lt+1];
  
  for (int i=1; i <=ls; ++i) {
    for (int j=1; j <=lt; ++j) {
      
      if(s[i-1]==t[j-1]){
        
        dp[i][j]=dp[i-1][j]+1;
        
      }else{
        if(dp[i][j-1]>dp[i-1][j]){
          dp[i][j]=dp[i][j-1];
        }else{
          dp[i][j]=dp[i-1][j];
        }
      }
    }
  }
  dbg(ls<<" "<<lt);
  prln(dp[ls][lt]);
  dbg("bar");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: 'string' was not declared in this scope
    8 | #define str(s) string s;cin>>s;
      |                ^~~~~~
a.cc:20:3: note: in expansion of macro 'str'
   20 |   str(s);
      |   ^~~
a.cc:8:25: error: 'cin' was not declared in this scope
    8 | #define str(s) string s;cin>>s;
      |                         ^~~
a.cc:20:3: note: in expansion of macro 'str'
   20 |   str(s);
      |   ^~~
a.cc:20:7: error: 's' was not declared in this scope
   20 |   str(s);
      |       ^
a.cc:8:30: note: in definition of macro 'str'
    8 | #define str(s) string s;cin>>s;
      |                              ^
a.cc:21:7: error: expected ';' before 't'
   21 |   str(t);
      |       ^
a.cc:8:23: note: in definition of macro 'str'
    8 | #define str(s) string s;cin>>s;
      |                       ^
a.cc:21:7: error: 't' was not declared in this scope
   21 |   str(t);
      |       ^
a.cc:8:30: note: in definition of macro 'str'
    8 | #define str(s) string s;cin>>s;
      |                              ^
a.cc:6:17: error: 'cout' was not declared in this scope
    6 | #define prln(s) cout<<s<<endl;
      |                 ^~~~
a.cc:43:3: note: in expansion of macro 'prln'
   43 |   prln(dp[ls][lt]);
      |   ^~~~
a.cc:6:26: error: 'endl' was not declared in this scope
    6 | #define prln(s) cout<<s<<endl;
      |                          ^~~~
a.cc:43:3: note: in expansion of macro 'prln'
   43 |   prln(dp[ls][lt]);
      |   ^~~~