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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected ',' or ';' before 'vector'
   10 |   vector<vector<int>> dp(n+1,vector<int>(m+1,-1));
      |   ^~~~~~
a.cc:12:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |       dp[i][0] = 0;
      |       ^~
      |       dup
a.cc:14:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |       dp[0][i] = 0;
      |       ^~
      |       dup
a.cc:19:15: error: 'dp' was not declared in this scope; did you mean 'dup'?
   19 |               dp[i][j] = 1 + dp[i-1][j-1];
      |               ^~
      |               dup
a.cc:21:15: error: 'dp' was not declared in this scope; did you mean 'dup'?
   21 |               dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
      |               ^~
      |               dup
a.cc:23:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |   cout << dp[n][m];
      |           ^~
      |           dup
Language: Java

import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();

        int l1 = s.length(), l2 = t.length();
        int[][] dp = new int[l1 + 1][l2 + 1];

        for (int i = 1; i <= l1; ++i) {
            for (int j = 1; j <= l2; ++j) {
                if (s.charAt(i - 1) == t.charAt(j - 1)) {
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                } else {
                    dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
                }
            }
        }

        StringBuilder ans = new StringBuilder();

        int i = l1, j = l2;
        while (i > 0 && j > 0) {
            if (s.charAt(i - 1) == t.charAt(j - 1)) {
                ans.insert(0, s.charAt(i - 1));
                i--;
                j--;
            } else if (dp[i - 1][j] > dp[i][j - 1]) {
                i--;
            } else j--;
        }

        System.out.println(ans.toString());
    }
}


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

import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();

        int l1 = s.length(), l2 = t.length();
        String[][] dp = new String[l1 + 1][l2 + 1];

        for (int i = 0; i <= l1; ++i) {
            for (int j = 0; j <= l2; ++j) {
                if (i == 0 || j == 0) {
                    dp[i][j] = "";
                } else if (s.charAt(i - 1) == t.charAt(j - 1)) {
                    dp[i][j] = dp[i - 1][j - 1] + s.charAt(i - 1);
                } else if (dp[i][j - 1].length() > dp[i - 1][j].length()) {
                    dp[i][j] = dp[i][j - 1];
                } else {
                    dp[i][j] = dp[i - 1][j];
                }
            }
        }

        System.out.println(dp[l1][l2]);
    }
}


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

import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();

        int l1 = s.length(), l2 = t.length();
        String[][] dp = new String[l1 + 1][l2 + 1];

        for (int i = 0; i <= l1; ++i) {
            for (int j = 0; j <= l2; ++j) {
                if (i == 0 || j == 0) {
                    dp[i][j] = "";
                } else if (s.charAt(i - 1) == t.charAt(j - 1)) {
                    dp[i][j] = dp[i - 1][j - 1] + s.charAt(i);
                } else if (dp[i][j - 1].length() > dp[i - 1][j].length()) {
                    dp[i][j] = dp[i][j - 1];
                } else {
                    dp[i][j] = dp[i - 1][j];
                }
            }
        }

        System.out.println(dp[l1][l2]);
    }
}


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

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();
        int n = s.length();
        int m = t.length();
        int[][] dp  = new int[n+1][m+1];

        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if(s.charAt(i-1)==t.charAt(j-1))
                    dp[i][j] = dp[i-1][j-1]+1;
                else
                    dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
            }
        }
        StringBuilder str = new StringBuilder();
        int i=n,j=m;
        while(i>0 && j>0){
            if(dp[i][j] == dp[i-1][j-1]+1) {
                str.append(s.charAt(i - 1));
                i--;
                j--;
            }
            else if(dp[i][j]==dp[i-1][j])
                i--;
            else
                j--;
        }
        for(int[] o : dp){
            for(int k : o)
                System.out.print(k+" ");
            System.out.println();
        }
        if(str.length()==0)
            System.out.println("");
        else
            System.out.println(str.reverse().toString());
    }


Compiler output:
Main.java:42: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include <iostream>
using namespace std;
string s,t,res="";
int len_s, len_t;
int dp[3001][3001];

string getLCS(string s, string t, int len) {
    string res = "";
    int idx_s = 0, idx_t = 0;
    while(len > 0) {
        if(s[idx_s] == t[idx_t]) {
            res+= s[idx_s];
            idx_s++, idx_t++, len--;
        }
        else {
            if(dp[idx_s+1][idx_t] > dp[idx_s][idx_t+1]) idx_s++;
            else idx_t++;
        }
    }
    return res;
}

int lenLCS(int idx_s, int idx_t) {
    if(idx_s == len_s || idx_t == len_t) return 0;
    if(dp[idx_s][idx_t] != -1) return dp[idx_s][idx_t];
    if(s[idx_s] == t[idx_t]) return dp[idx_s][idx_t] = 1+lenLCS(idx_s+1, idx_t+1);
    else {
        int t1 = lenLCS(idx_s+1, idx_t);
        int t2 = lenLCS(idx_s, idx_t+1);
        return dp[idx_s][idx_t] = max(t1, t2);
    }
}

int main() {
    cin>>s>>t;
    memset(dp, -1, sizeof dp);
    len_s = s.length();
    len_t = t.length();
    int len = lenLCS(0,0);
    cout<<getLCS(s, t, len);
    return 0;
}


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

#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std; 
  
int max(int a, int b);  
  
/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
int lcs( char *X, char *Y, int m, int n )  
{  
    if (m == 0 || n == 0)  
        return 0;  
    if (X[m-1] == Y[n-1])  
        return 1 + lcs(X, Y, m-1, n-1);  
    else
        return max(lcs(X, Y, m, n-1), lcs(X, Y, m-1, n));  
}  
  
/* Utility function to get max of 2 integers */
int max(int a, int b)  
{  
    return (a > b)? a : b;  
}  
  
/* Driver code */
int main()  
{  
    string X,Y;
    cin>>X>>Y;
    int m=X.length();
    int n=Y.length();
      
    cout<< lcs( X, Y, m, n ) ;  
      
    return 0;  
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:33:17: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char*'
   33 |     cout<< lcs( X, Y, m, n ) ;
      |                 ^
      |                 |
      |                 std::string {aka std::__cxx11::basic_string<char>}
a.cc:9:16: note:   initializing argument 1 of 'int lcs(char*, char*, int, int)'
    9 | int lcs( char *X, char *Y, int m, int n )
      |          ~~~~~~^
Language: C++

#include <bits/stdc++.h> 
using namespace std; 
  
int max(int a, int b);  
  
/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
int lcs( char *X, char *Y, int m, int n )  
{  
    if (m == 0 || n == 0)  
        return 0;  
    if (X[m-1] == Y[n-1])  
        return 1 + lcs(X, Y, m-1, n-1);  
    else
        return max(lcs(X, Y, m, n-1), lcs(X, Y, m-1, n));  
}  
  
/* Utility function to get max of 2 integers */
int max(int a, int b)  
{  
    return (a > b)? a : b;  
}  
  
/* Driver code */
int main()  
{  
    string X,Y;
  cin>>X>>Y;
      
    int m = strlen(X);  
    int n = strlen(Y);  
      
    cout<<lcs( X, Y, m, n ) ;  
      
    return 0;  
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:29:20: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   29 |     int m = strlen(X);
      |                    ^
      |                    |
      |                    std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/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:30:20: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   30 |     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)
      |                       ~~~~~~~~~~~~^~~
a.cc:32:16: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char*'
   32 |     cout<<lcs( X, Y, m, n ) ;
      |                ^
      |                |
      |                std::string {aka std::__cxx11::basic_string<char>}
a.cc:7:16: note:   initializing argument 1 of 'int lcs(char*, char*, int, int)'
    7 | int lcs( char *X, char *Y, int m, int n )
      |          ~~~~~~^
Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
string lcs(string a,string b,int m,int n)
{
 int l[m+1][n+1];


 for(int i=0;i<=m;i++){
     for(int j=0;j<=n;j++){
         if(i==0||j==0)
            l[i][j]=0;
         else if(a[i-1]==b[j-1]){
            l[i][j]=l[i-1][j-1]+1;
         }
         else{
            l[i][j]=max(l[i-1][j],l[i][j-1]);
         }
     }
 }
int index = l[m][n]; 
char lcs[index+1]; 
lcs[index] = '\0'; 

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

      if (a[i-1] == b[j-1]) 
      { 
          lcs[index-1] = a[i-1]; 
          i--; j--; index--;     
      } 
  
 
      else if (l[i-1][j] > l[i][j-1]) 
         i--; 
      else
         j--; 
   } 
  
  return lcs;

}

int main()
{
  string a,b;cin>>a>>b 
  int m = a.length();
  int n = b.length()
  cout<<lcs(a, b, m, n);  
  return 0;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:23: error: expected ';' before 'int'
   48 |   string a,b;cin>>a>>b
      |                       ^
      |                       ;
   49 |   int m = a.length();
      |   ~~~                  
a.cc:51:3: error: expected ',' or ';' before 'cout'
   51 |   cout<<lcs(a, b, m, n);
      |   ^~~~
a.cc: At global scope:
a.cc:54:1: error: expected declaration before '}' token
   54 | }
      | ^
Language: C++

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

const ll INF = 1e18L + 9;

int main(){
    string s, t, ans = "";
    cin >> s >> t;
    int n = s.length(), m = t.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;
            else if (s[i-1]==t[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
    int i = n, j = m;
    while(i && j){
        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--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
    // return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long

const ll INF = 1e18L + 9;

int main(){
    string s, t, ans = "";
    cin >> s >> t;
    int n = s.length(), m = t.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;
            else if (s[i-1]==t[j-1])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
    int i = n, j = m;
    while(i && j){
        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--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
    // return 0;
}


Compiler output:
a.cc:41:10: error: redefinition of 'const long long int INF'
   41 | const ll INF = 1e18L + 9;
      |          ^~~
a.cc:5:10: note: 'const long long int INF' previously defined here
    5 | const ll INF = 1e18L + 9;
      |          ^~~
a.cc:43:5: error: redefinition of 'int main()'
   43 | int main(){
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main(){
      |     ^~~~
Language: C++

#include<iostream>
#include<mem.h>
#include<string>
#include<algorithm>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
ll power(ll x,ll y,ll p){
ll res = 1;x = x % p;
while (y > 0){
if (y & 1){res = (res*x) % p;}
y = y>>1;
x = (x*x) % p;}
return res;}
ll mcd(ll a,ll b){
    if(b>a)swap(a,b);
    if(b==0)return a;
    else return mcd(b,a%b);
}
ll t,n,m,k;
bool esprimo(ll n){
ll s=0;
for(ll i=1;i*i<=n;i++){
    if(n%i==0){s++;}}
if(s>=2){return false;}
return true;
}
int main(){
    //    cout<<fixed<<setprecision(2);
//cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
string a,b;
cin>>a>>b;
n=a.size();
m=b.size();
int aa[n+2][m+2];
memset(aa,0,sizeof aa);
for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
        if(a[i-1]==b[j-1]){
            aa[i][j]=max(aa[i-1][j-1]+1,max(aa[i-1][j],aa[i][j-1]));
        }else{
            aa[i][j]=max(aa[i-1][j-1],max(aa[i-1][j],aa[i][j-1]));
        }
    }
}
int s=0;
for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
        s=max(s,aa[i][j]);
    }
}
ll ii,jj;
for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
        //cout<<aa[i][j]<<" ";
        if(aa[i][j]==s){
            ii=i;
            jj=j;
        }
    }
//    cout<<endl;
}
string ans="";
for(int i=n;i>0;i--){
    for(int j=1;j<=m;j++){
        if(aa[i][j]==s&&a[i-1]==b[j-1]){
            ans+=a[i-1];
            s--;
        }

    }
}

reverse(ans.begin(),ans.end());
cout<<ans;

}


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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:66:7: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char*'
   66 |   lcs(X, Y, m, n);
      |       ^
      |       |
      |       std::string {aka std::__cxx11::basic_string<char>}
a.cc:8:17: note:   initializing argument 1 of 'void lcs(char*, char*, int, int)'
    8 | void lcs( char *X, char *Y, int m, int n )
      |           ~~~~~~^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:64:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   64 |   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:65:18: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   65 |   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)
      |                       ~~~~~~~~~~~~^~~
a.cc:66:7: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char*'
   66 |   lcs(X, Y, m, n);
      |       ^
      |       |
      |       std::string {aka std::__cxx11::basic_string<char>}
a.cc:8:17: note:   initializing argument 1 of 'void lcs(char*, char*, int, int)'
    8 | void lcs( char *X, char *Y, int m, int n )
      |           ~~~~~~^
Language: C++

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

int main(){
	string s1,s2;
  	cin >> s1 >> s2;
  	vector<vector<int>> dp(s1.size()+1,vector<int>(s2.size()+1,0));
    
    for(int i=1;i<=s1.size();i++){
     for(int j=1 ; j<=s2.size();j++){
    	if(s1[i-1] == s2[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=s1.size();
  	int j = s2.size();
  	int index = dp[i][j];
   vector<int> v(index,0);
	while(i!=0 && j!=0){
    	if(s1[i-1]==s2[j-1]){
          v[index-1] = s1[i];
          index--;
          i--;j--;
        }
        else{
        	if(dp[i-1][j] > dp[i][j-1]){
              i--;
            }
          	else{
              j--;
            }
        }
    }
  	
  for(int k=0;k<v.size();k++) cout << v[k];
  return0;

}
                                          
                    


Compiler output:
a.cc: In function 'int main()':
a.cc:37:3: error: 'return0' was not declared in this scope
   37 |   return0;
      |   ^~~~~~~
Language: C++

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

int main(){
	string s1,s2;
  	cin >> s1 >> s2;
  	vector<vector<int>> dp(s1.size()+1,vector<int>(s2.size()+1,0));
    
    for(int i=1;i<=s1.size();i++){
     for(int j=1 ; j<=s2.size();j++){
    	if(s1[i-1] == s2[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=s1.size();
  	int j = s2.size();
  	int index = dp[i][j];
   vector<int> v(index,0);
	while(i!=0 && j!=0){
    	if(s1[i-1]==s2[j-1]){
          v[index-1] = s1[i];
          index--;
          i--;j--;
        }
        else{
        	if(dp[i-1][j] > dp[i][j-1]){
              i--;
            }
          	else{
              j--;
            }
        }
    }
  	
  for(int k=0;k<v.size();k++) cout << v[k];
  return0;

}
                                          
                    


Compiler output:
a.cc: In function 'int main()':
a.cc:37:3: error: 'return0' was not declared in this scope
   37 |   return0;
      |   ^~~~~~~
Language: C++

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

int main(){
	string s1,s2;
  	cin >> s1 >> s2;
  	vector<vector<int>> dp(s1.size()+1,vector<int>(s2.size()+1,0));
    
    for(int i=1;i<=s1.size();i++){
     for(int j=1 ; j<=s2.size();j++){
    	if(s1[i-1] == s2[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=s1.size();
  	int j = s2.size();
  	int index = dp[i][j];
   vector<int> v(index,0);
	while(i!=0 && j!=0){
    	if(s1[i-1]==s2[j-1]){
          v[index-1] = s1[i];
          index--;
          ii--;j--;
        }
        else{
        	if(dp[i-1][j] > dp[i][j-1]){
              i--;
            }
          	else{
              j--;
            }
        }
    }
  	
  for(int k=0;k<v.size();k++) cout << v[k];
  return0;

}
                                          
                    

Compiler output:
a.cc: In function 'int main()':
a.cc:24:11: error: 'ii' was not declared in this scope; did you mean 'i'?
   24 |           ii--;j--;
      |           ^~
      |           i
a.cc:37:3: error: 'return0' was not declared in this scope
   37 |   return0;
      |   ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3000 + 10;
struct Pos
{
    int val , x , y;
};
Pos meilleur[MAXN][MAXN];
int main()
{
    for (int i = 0 ; i < MAXN ; i++)
    {
        for (int j = 0 ; j < MAXN ; j++)
        {
            meilleur[i][j].val = {0 , -1 , -1};
        }
    }
    string s;
    string t;
    cin>> s >> t;
    int N = s.size();
    int M = t.size();
    meilleur[0][0] = {0 , -1, - 1};
    for (int i = 0 ; i < N ; i++)
    {
        for (int j = 0 ; j < M ; j++)
        {
            if (meilleur[i + 1][j].val > meilleur[i + 1][j + 1].val)
            {
                meilleur[i + 1][j + 1] = meilleur[i + 1][j];
            }
            if (meilleur[i][j + 1].val > meilleur[i + 1][j + 1].val)
            {
                meilleur[i + 1][j + 1] = meilleur[i][j + 1];
            }
            if (s[i] == t[j])
            {
                if (meilleur[i][j].val + 1 > meilleur[i + 1][j + 1].val)
                {
                    meilleur[i  +1][j + 1] = {meilleur[i][j].val + 1 , i , j};
                }
            }
            else
            {
                if (meilleur[i][j].val > meilleur[i + 1][j + 1].val)
                {
                    meilleur[i  +1][j + 1] = meilleur[i][j];
                }
            }
        }
    }
    Pos actu = meilleur[N][M];
    vector <char> sol;
    while (actu.x != -1)
    {
        sol.push_back(s[actu.x]);
        actu = meilleur[actu.x][actu.y];
    }
    for (int i = sol.size() - 1 ; i >= 0 ; i--)
    {
        cout<<sol[i];
    }
    cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:46: error: cannot convert '<brace-enclosed initializer list>' to 'int' in assignment
   15 |             meilleur[i][j].val = {0 , -1 , -1};
      |                                              ^
Language: C++

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

#define ll long long
#define INF 1e9
#define fi first
#define se second

typedef vector <int> vi;
typedef pair <int, int> ii;


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

    int dp[n+1][m+1];
    memset(dp, 0, sizeof(dp));

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

    // for (int i = 0; i <= n; i++) {
    //     for (int j = 0; j <= m; j++) {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    string res = "";
    for (int i = n, j = m; i > 0 || j > 0; i--, j--) 
        while(i > 1 && dp[i-1][j] == dp[i][j]) i--;
        while(j > 1 && dp[i][j-1] == dp[i][j]) j--;
        res += s[i-1];
    }
    reverse(res.begin(), res.end());

    // cout << dp[n][m] << endl;
    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:15: error: 'j' was not declared in this scope
   38 |         while(j > 1 && dp[i][j-1] == dp[i][j]) j--;
      |               ^
a.cc:38:27: error: 'i' was not declared in this scope
   38 |         while(j > 1 && dp[i][j-1] == dp[i][j]) j--;
      |                           ^
a.cc:39:18: error: 'i' was not declared in this scope
   39 |         res += s[i-1];
      |                  ^
a.cc: At global scope:
a.cc:41:12: error: expected constructor, destructor, or type conversion before '(' token
   41 |     reverse(res.begin(), res.end());
      |            ^
a.cc:44:5: error: 'cout' does not name a type
   44 |     cout << res << endl;
      |     ^~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <string>
using namespace std;
string actionFunction(string x,string y) {
    vector<vector<int>> dp(x.length()+1,vector<int>(y.length()+1,0));
    if(x.length()==0 || y.length()==0)return "";
    for(int row=1;row<=x.length();row++) {
        for(int col=1;col<=y.length();col++) {
            if(x[row-1]==y[col-1])dp[row][col]={dp[row-1][col-1]+1;
            else dp[row][col]=max(dp[row-1][col],dp[row][col-1]);
        }
    }
    int maxlength=dp[x.length()][y.length()];
    int row=x.length(),col=y.length();
    string out;
    while(maxlength!=0 && col>0 && row>0) {
        if(dp[row][col-1]==maxlength) {
            col--;continue;
        }
      	if(dp[row-1][col]==maxlength) {
        	row--;continue;
        }
        if(dp[row-1][col-1]==maxlength-1) {
            out.push_back(y[col-1]);
            row--;
            maxlength--;
            col--;
        }
    }
    return out;
}
string reverseString(string a) {
    for(int i=0;i<a.length()/2;i++) {
        swap(a[i],a[a.length()-i-1]);
    }
    return a;
}
int main(void){
    string x,y;
    cin>>x>>y;
    cout<<reverseString(actionFunction(x,y))<<endl;
}


Compiler output:
a.cc: In function 'std::string actionFunction(std::string, std::string)':
a.cc:12:67: error: expected '}' before ';' token
   12 |             if(x[row-1]==y[col-1])dp[row][col]={dp[row-1][col-1]+1;
      |                                                ~                  ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

string x;
string y;
int dp[3030][3030];
lcs (int a, int b)
{
    if(dp[a][b]>=0){return dp[a][b];}
    if(a==x.size() or b==y.size()){return dp[a][b]=0;}

    if(x[a]==y[b]){return dp[a][b]=1+lcs(a+1,b+1);}

    else{return dp[a][b]=max(lcs(a+1,b),lcs(a,b+1));}
}
vector<char> v;
void recover (int i, int j)
{
    if(i==x.size() or j==y.size())return;

    int pega = -191919;
    if(x[i]==y[j]){pega=lcs(i+1,j+1);}
    int passa1 = lcs(i+1,j);
    int passa2 = lcs(i,j+1);

    if(pega>=passa1 and pega>=passa2){v.push_back(x[i]); return recover(i+1,j+1);}
    else if (passa1>pega and passa1>passa2){return recover(i+1,j);}
    else {return recover(i,j+1);}
}

int main ()
{

cin>>x;
cin>>y;
memset(dp,-1,sizeof(dp));
recover(0,0);
for(int i=0;i<v.size();i++)
{
    cout<<v[i];
}
cout<<endl;
    return 0;
}


Compiler output:
a.cc:8:1: error: ISO C++ forbids declaration of 'lcs' with no type [-fpermissive]
    8 | lcs (int a, int b)
      | ^~~
Language: C++

#include <iostream>
#include <cmath>
#include <cstring>
#include <limits>

const int nax = 3e3+5;
int dp[nax][nax];
int tp[nax][nax];

const int  UL=1;
const int  L=2;
const int  U=3;

int main() {

	std::string s, t;
	std::cin >> s >> t;

	for (int i=0; i<=s.size(); i++) {
		for (int j=0; j<=t.size(); j++) {
			if (i==0 || j==0) {
				dp[i][j] = 0;
				continue;
			}
			if (s[i-1] == t[j-1]) {
				dp[i][j] = dp[i-1][j-1]+1;
				tp[i][j] = UL;
			}
			else if (dp[i-1][j] > dp[i][j-1]) {
				dp[i][j] = dp[i-1][j];
				tp[i][j] = U;
			} else {
				dp[i][j] = dp[i][j-1];
				tp[i][j] = L;
			}
		}
	}

//	for (int i=0; i<=s.size(); i++) {
	//	for (int j=0; j<=t.size(); j++) {
		//	std::cout << dp[i][j] << " ";
	//	}
//		std::cout << "\n";
//	}

	std::string ans;

	int x = s.size(), y = t.size();

	while (x!=0 && y!=0) {
		if (tp[x][y] == UL) {
			ans.push_back(s[x-1]);
			x--; y--;
		} else if (tp[x][y] == U) {
			x--;
		} else {
			y--;
		}
	}

	std::reverse(ans.rbegin(), ans.rend());

	std::cout << ans << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:14: error: 'reverse' is not a member of 'std'
   61 |         std::reverse(ans.rbegin(), ans.rend());
      |              ^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define IOS                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define ll long long
using namespace std;

int maxLength(string &s, string &t, int i, int j,vector<vector<int>> &dp){

    if(i == s.length() || j == t.length()){
        return 0;
    }
    if(dp[i][j] != -1){
        return dp[i][j];
    }
  
    if(s[i] == t[j]){
        dp[i][j] = maxLength(s, t, i + 1, j + 1,dp) + 1;
    }else{
        int i1 = maxLength(s, t, i + 1, j,dp);
        int i2 = maxLength(s, t, i, j + 1,dp);
        dp[i][j] = max(i1, i2);
    }
    return dp[i][j];
}

void solve()
{
    string s;
    string t;
    cin >> s;
    cin >> t;
  	if(s.length() == 0 || t.length() == 0){
      return "";
    }
  	
  	vector<vector<int>> dp(s.length()+1,vector<int>(t.length()+1,-1));
    int maxLengthfound = maxLength(s, t, 0, 0,dp);
    string ans = "";
    int i = s.length()-1;
    int j = t.length()-1;
    while(i>=0 and j>=0){
        if(s[i] == t[j]){
            ans = s[i] + ans;
            i--;
            j--;
        }
        else
        {
            if(dp[i-1][j] > dp[i][j-1]){
                i--;
            }else{
                j--;
            }
        }
    }
    cout << ans << endl;
}
int main()
{
    IOS;
    // int t;
    // cin>>t;
    // while(t>0)
    {
        solve();
        // t--;
    }
    return 0;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:34:14: error: return-statement with a value, in function returning 'void' [-fpermissive]
   34 |       return "";
      |              ^~
Language: C++

int main()
{
    string s,t;
    cin>>s;
    int n=s.length();
    string ans="";
    if(n==0)
    {
        cout<<ans;
        return 0;
    }
    cin>>t;
    int m=t.length();
    if(n==0 || m==0) 
        {
            cout<<ans;
            return 0;
        }
        vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(s[i-1]==t[j-1])
            dp[i][j]=dp[i-1][j-1]+1;
            else
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }

    int i=n;
    int j=m;
    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;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'string' was not declared in this scope
    3 |     string s,t;
      |     ^~~~~~
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin>>s;
      |     ^~~
a.cc:4:10: error: 's' was not declared in this scope
    4 |     cin>>s;
      |          ^
a.cc:6:11: error: expected ';' before 'ans'
    6 |     string ans="";
      |           ^~~~
      |           ;
a.cc:9:9: error: 'cout' was not declared in this scope
    9 |         cout<<ans;
      |         ^~~~
a.cc:9:15: error: 'ans' was not declared in this scope
    9 |         cout<<ans;
      |               ^~~
a.cc:12:10: error: 't' was not declared in this scope
   12 |     cin>>t;
      |          ^
a.cc:16:13: error: 'cout' was not declared in this scope
   16 |             cout<<ans;
      |             ^~~~
a.cc:16:19: error: 'ans' was not declared in this scope
   16 |             cout<<ans;
      |                   ^~~
a.cc:19:9: error: 'vector' was not declared in this scope
   19 |         vector<vector<int>> dp(n+1,vector<int>(m+1,0));
      |         ^~~~~~
a.cc:19:23: error: expected primary-expression before 'int'
   19 |         vector<vector<int>> dp(n+1,vector<int>(m+1,0));
      |                       ^~~
a.cc:25:13: error: 'dp' was not declared in this scope
   25 |             dp[i][j]=dp[i-1][j-1]+1;
      |             ^~
a.cc:27:13: error: 'dp' was not declared in this scope
   27 |             dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
      |             ^~
a.cc:27:22: error: 'max' was not declared in this scope
   27 |             dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
      |                      ^~~
a.cc:35:12: error: 'dp' was not declared in this scope
   35 |         if(dp[i][j]==dp[i-1][j])
      |            ^~
a.cc:41:13: error: 'ans' was not declared in this scope
   41 |             ans=s[i-1]+ans;
      |             ^~~
a.cc:46:5: error: 'cout' was not declared in this scope
   46 |     cout<<ans;
      |     ^~~~
a.cc:46:11: error: 'ans' was not declared in this scope
   46 |     cout<<ans;
      |           ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    char s[3005],t[3005];
    gets(s);
    gets(t);
    int slen=strlen(s),i,j;
    int tlen=strlen(t);
    int dp[slen+1][tlen+1];
    for(i=0;i<=slen;i++)
    {
        for(j=0;j<=tlen;j++)
        {
            if(!i||!j)dp[i][j]=0;
            else if(s[i-1]==t[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int anslen=dp[slen][tlen];
    char ans[anslen+1];
    ans[anslen]=0;
    i=slen;j=tlen;
    while(anslen>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans[anslen-1]=s[i-1];
            i--;
            j--;
            anslen--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
        {
            i--;
        }
        else j--;

    }
     puts(ans);

}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |     gets(s);
      |     ^~~~
      |     getw
Language: Java

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

public class LCS {

	public static String s, t;
	public static int[][] dp;

	public static String recurse(int i, int j) {
		if (dp[i][j] == 0)
			return "";
		if (s.charAt(i-1) == t.charAt(j-1))
			return recurse(i - 1, j - 1) + s.charAt(i-1);
		else if (dp[i - 1][j] > dp[i][j - 1])
			return recurse(i - 1, j);
		else
			return recurse(i, j - 1);

	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		s = br.readLine();
		t = br.readLine();

		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.charAt(i-1) == t.charAt(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]);
			}
		}
		System.out.println(recurse(s.length(), t.length()));
	}

}


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

#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    string S,T;
    cin>>S>>T;
    int n=S.size(), m=T.size();
    /*
    vector<vector<int> > dp(n+1,vector<int>(m+1,0));
    //vector<vector<vector<char> > > c(n+1,vector<vector<char> >(m+1));
    for (int i=1;i<n+1;i++){
        for (int j=1;j<m+1;j++){
            if (S[i-1]==T[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
                //c[i][j]=c[i-1][j-1];
                //c[i][j].push_back(S[i-1]);    
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
                //if (dp[i-1][j]>dp[i][j-1]) c[i][j]=c[i-1][j];
               // else c[i][j]=c[i][j-1];
            }
        }
    }
    */
    vector<char> st;
    int x=m;
    for (int i=n;i>=1;i--){
        for(int j=x;j>=1;j--){
            if (S[i-1]==T[j-1]){
                st.push_back(S[i-1]);
                x=j-1;
                break;
            }
        }
    }
  // cout<<dp[n][m]<<endl;
    int l=st.size();
    rep (i,l) cout<<st[l-1-i];
    if (l==0) cout<<'';
    cout<<endl;
    return 0;
}

Compiler output:
a.cc:51:21: error: empty character constant
   51 |     if (l==0) cout<<'';
      |                     ^~
Language: C++

#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    string S,T;
    cin>>S>>T;
    int n=S.size(),m=T.size();
    int l=st.size();
    rep (i,l){
        cout<<st.top();
        st.pop();
    }
    cout<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'st' was not declared in this scope; did you mean 'std'?
   19 |     int l=st.size();
      |           ^~
      |           std
Language: C++

/*
	Longest Common Subsequence
	Problem: Given two strings, find the longest common subsequence for the two 
			 strings. A subsequence is a sequence of characters in the string 
			 which may or may not be a continuous part of a string.

			 For e.g.: if fdshia is the given string, the possible subsequences are:
			 		   fd, fsi, fa, dhia, sha, fdshia, a, .... and so on.

			 		   sf, hdai, fdhfive, aisdf are not subsequences of the above string
*/

//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<string.h>

using namespace std;

int main()
{
	string s1, s2;
	//cout << "Enter the first string: " << '\n';
	cin >> s1;
	//cout << "Enter the second string: " << '\n';
	cin >> s2;

	int dp[s1.length() + 1][s2.length() + 1] = {};
	for (int i = 0; i < s1.length(); i++)
	{
		for (int j = 0; j < s2.length(); j++)
		{
			if (s1[i] == s2[j])
			{
				dp[i + 1][j + 1] = dp[i][j] + 1; 
			}
			else
			{
				dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
			}
		}
	}

	//for (int i = 0; i <= s1.length(); i++)
	//{
	//	for (int j = 0; j <= s2.length(); j++)
	//	{
	//		cout << dp[i][j] << " ";
	//	}
	//	cout << '\n';
	//}

	//cout << "The length of longest common subsequence is: " << '\n';
	//cout << dp[s1.length()][s2.length()] << '\n';

//Length of longest subsequence is found.

	vector<char>sub;
	int i = s1.length(), j = s2.length();
	while (i > 0 and j > 0)
	{
		if (dp[i][j] == dp[i - 1][j])
		{
			i--;
		}
		else if (dp[i][j] == dp[i][j - 1])
		{
			j--;
		}
		else
		{
			sub.push_back(s1[i - 1]);
			i--;
			j--;
		}
	}

	//cout << "The longest common subsequence is: " << '\n';
	for (int i = sub.size() - 1; i >= 0; i--)
	{
		cout << sub[i];
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:9: error: 'vector' was not declared in this scope
   59 |         vector<char>sub;
      |         ^~~~~~
a.cc:18:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
   17 | #include<string.h>
  +++ |+#include <vector>
   18 | 
a.cc:59:16: error: expected primary-expression before 'char'
   59 |         vector<char>sub;
      |                ^~~~
a.cc:73:25: error: 'sub' was not declared in this scope; did you mean 'fsub'?
   73 |                         sub.push_back(s1[i - 1]);
      |                         ^~~
      |                         fsub
a.cc:80:22: error: 'sub' was not declared in this scope; did you mean 'fsub'?
   80 |         for (int i = sub.size() - 1; i >= 0; i--)
      |                      ^~~
      |                      fsub
Language: C++

#include<bits/stdc++.h>
using namespace std;
 int main()
 {
   string str="";
 string a,b;
   cin>>a>>b;
   int sa=a.length();
   int sb=b.length();
  int dp[sb+1][sa+1];
   for(int i=0;i<sa+1;i++)
     dp[0][i]=0;
     for(int i=0;i<sb+1;i++)
     dp[i][0]=0;
   for(int i=1;i<sb+1;i++)
   for(int j=1;j<sa+1;j++)
   {  
     if(b[i-1]==a[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=sb;
   int j=sa;
   while(i||j)
   {
   if(a[j]==b[i])
   {
   str+=a[j];
     i--;
     j--
       continue;
   }
     if(dp[i-1][j]>dp[i][j-1])
       i--;
     else
       j--;
   
   }
 }
   

Compiler output:
a.cc: In function 'int main()':
a.cc:34:9: error: expected ';' before 'continue'
   34 |      j--
      |         ^
      |         ;
   35 |        continue;
      |        ~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 int main()
 {
   string str="";
 string a,b;
   cin>>a>>b;
   int sa=a.length();
   int sb=b.length();
  int dp[sb+1][sa+1];
   for(int i=0;i<sa+1;i++)
     dp[0][i]=0;
     for(int i=0;i<sb+1;i++)
     dp[i][0]=0;
   for(int i=1;i<sb+1;i++)
   for(int j=1;j<sa+1;j++)
   {  
     if(b[i-1]==a[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=sb;
   int j=sa;
   while(i||j)
   {
   if(a[j]==b[i])
   {
   str+=a[j];
     i--;
     j--
       continue;
   }
     if(dp[i-1][j]>dp[i][j-1])
       i--;
     else
       j--;
   
   }
   

Compiler output:
a.cc: In function 'int main()':
a.cc:34:9: error: expected ';' before 'continue'
   34 |      j--
      |         ^
      |         ;
   35 |        continue;
      |        ~~~~~~~~
a.cc:42:5: error: expected '}' at end of input
   42 |    }
      |     ^
a.cc:4:2: note: to match this '{'
    4 |  {
      |  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 int main()
 {
   string str="";
 string a,b;
   cin>>a>>b;
   int sa=a.length();
   int sb=b.length();
  int dp[sb+1][sa+1];
   for(int i=0;i<sa+1;i++)
     dp[0][i]=0;
     for(int i=0;i<sb+1;i++)
     dp[i][0]=0;
   for(int i=1;i<sb+1;i++)
   for(int j=1;j<sa+1;j++)
   {  
     if(b[i-1]==a[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=sb;
   int j=sa;
   while(i||j)
   {
   if(a[j]==b[i])
   {
   str+=a[j];
     i--;
     j--
       continue
   }
     if(dp[i-1][j]>dp[i][j-1])
       i--;
     else
       j--;
   
   }
   
   
 
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:34:9: error: expected ';' before 'continue'
   34 |      j--
      |         ^
      |         ;
   35 |        continue
      |        ~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
 
 
 
 int main()
 {
   string str=""
 string a,b;
   cin>>a>>b;
   int sa=a.length();
   int sb=b.length();
  int dp[sb+1][sa+1];
   for(int i=0;i<sa+1;i++)
     dp[0][i]=0;
     for(int i=0;i<sb+1;i++)
     dp[i][0]=0;
   for(int i=1;i<sb+1;i++)
   for(int j=1;j<sa+1;j++)
   {  
     if(b[i-1]==a[j-1])
     {
       dp[i][j]=1+dp[i-1][j-1];
       str+=a[i-1];
     }
     else
       dp[i][j]=max(dp[i-1][j],dp[i][j-1]); 
   }
   return str;
   
   
 
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:2: error: expected ',' or ';' before 'string'
   10 |  string a,b;
      |  ^~~~~~
a.cc:11:9: error: 'a' was not declared in this scope
   11 |    cin>>a>>b;
      |         ^
a.cc:11:12: error: 'b' was not declared in this scope
   11 |    cin>>a>>b;
      |            ^
a.cc:30:11: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
   30 |    return str;
      |           ^~~
      |           |
      |           std::string {aka std::__cxx11::basic_string<char>}
Language: C++

#include<bits/stdc++.h>
using namespace std;
int LCS(string a,string b, int sa,int sb)
{
  if(sa==0||sb==0)
    return 0;
  if(a[sa-1]==b[sb-1])
  return 1+LCS(a,b,sa-1,sb-1)
         else 
         return max(LCS(a,b,sa-1,sb),LCS(a,b,sa,sb-1));
 
 
}
 int main()
 {
 string a,b;
   cin>>a>>b;
   int sa=a.length();
   int sb=b.length();
   return LCS(a,b,sa,sb);
   
 
 }

Compiler output:
a.cc: In function 'int LCS(std::string, std::string, int, int)':
a.cc:8:30: error: expected ';' before 'else'
    8 |   return 1+LCS(a,b,sa-1,sb-1)
      |                              ^
      |                              ;
    9 |          else
      |          ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int LCS(string a,string b, int sa,int sb)
{
  if(sa==0||sb==0)
    return 0;
  if(a[sa-1]==b[sb-1])
  return(1+LCS(a,b,sa-1,sb-1);
         else 
         return max(LCS(a,b,sa-1,sb),LCS(a,b,sa,sb-1));
 
 
}
 int main()
 {
 string a,b;
   cin>>a>>b;
   int sa=a.length();
   int sb=b.length();
   return LCS(a,b,sa,sb);
   
 
 }

Compiler output:
a.cc: In function 'int LCS(std::string, std::string, int, int)':
a.cc:8:30: error: expected ')' before ';' token
    8 |   return(1+LCS(a,b,sa-1,sb-1);
      |         ~                    ^
      |                              )