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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: error: no matching function for call to 'size()'
    6 |   int S=size();
      |         ~~~~^~
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note:   candidate expects 1 argument, 0 provided
Language: C++

#include <iostream>
using namespace std;
struct Result{    
  string lcs;;
  int len;

  Result(){}

  Result(int l, string& s){
    len = l;
    lcs = s;
  }
};

Result** memoTable = 0;//[3000][3000];

Result LCS(int i, int j, const string& text1, const string& text2){
        
        if(i >= text1.length() || j>= text2.length()){
            return Result(0, "");
        }
        
        if(memoTable[i][j].len != -1){
            return memoTable[i][j];
        }
        
        if(text1[i] == text2[j]){
            
            Result r = LCS(i+1, j+1, text1, text2);
            r.len += 1;
            string s = r.lcs;
            r.lcs.~string();

            r.lcs = string(text1[i] + s);
            
            memoTable[i][j] = r;
            
        }else{
            
            Result r1 = LCS(i+1, j, text1, text2);
            Result r2 = LCS(i, j+1, text1, text2);
            
            if(r1.len < r2.len){
                r1 = r2;
            }
            
            memoTable[i][j] = r1;
         
        }
        
        return memoTable[i][j];
    }




int main(){

  string text1, text2;
  cin >> text1;
  cin >> text2;

    memoTable = new Result*[text1.length()];
    for(int i=0; i<text1.length(); ++i){
        memoTable[i] = new Result[text2.length()];
    }

  for(int i=0; i<text1.length(); ++i)
    for(int j=0; j<text2.length(); ++j){
      memoTable[i][j].len = -1;
    }

  Result r = LCS(0, 0, text1, text2);
  cout<<r.lcs;
  return 0;
}

Compiler output:
a.cc: In function 'Result LCS(int, int, const std::string&, const std::string&)':
a.cc:20:30: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   20 |             return Result(0, "");
      |                              ^~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:646:7: note:   after user-defined conversion: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with <template-parameter-2-1> = std::allocator<char>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  646 |       basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
      |       ^~~~~~~~~~~~
a.cc:9:25: note:   initializing argument 2 of 'Result::Result(int, std::string&)'
    9 |   Result(int l, string& s){
      |                 ~~~~~~~~^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
 
int dp[N][N];
string a,b;
 
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	memset(dp,0,sizeof(dp));
 
	cin>>a>>b;
	int n = a.size();
	int m = b.size();
 
	for(int i=0;i<=n;++i)
		for(int j=0;j<=m;++j)
		{
			if(i) dp[i][j] = max(dp[i][j],dp[i-1][j]);
 
			if(j) dp[i][j] = max(dp[i][j],dp[i][j-1]);
 
			if(i && j)
			{
				if(a[i-1] == b[j-1]) dp[i][j] = max(dp[i][j],dp[i-1][j-1] + 1);
				else dp[i][j] = max(dp[i][j],dp[i-1][j-1]);
			}
		}
 
	string ans = "";
	int i = n,j = m;
 
	while(i > 0 && j> 0)
	{
		int x = i - 1,y = j - 1;		
 
		if(a[x] == b[y]) i = x,j = y,ans += a[x];
		else
		{
			if(dp[x][j] < dp[i][y]) j = y;
			else i = x;
		}
	}
 
	reverse(ans.begin(),ans.end());
	cout<<ans;
}

Compiler output:
/tmp/ccPb7E3k.o: in function `main':
a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `a[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `b[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x8d): relocation truncated to fit: R_X86_64_PC32 against symbol `a[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x9f): relocation truncated to fit: R_X86_64_PC32 against symbol `b[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x209): relocation truncated to fit: R_X86_64_PC32 against symbol `a[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x226): relocation truncated to fit: R_X86_64_PC32 against symbol `b[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x3e3): relocation truncated to fit: R_X86_64_PC32 against symbol `a[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x3fd): relocation truncated to fit: R_X86_64_PC32 against symbol `b[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x42c): relocation truncated to fit: R_X86_64_PC32 against symbol `a[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
/tmp/ccPb7E3k.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x54f): relocation truncated to fit: R_X86_64_PC32 against symbol `a[abi:cxx11]' defined in .bss section in /tmp/ccPb7E3k.o
a.cc:(.text+0x568): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
struct node{
	int s,sw;
}dp[3001][3001];
char a[3001],b[3001];
int max(int a,int b)
{
	if(a>b)return a;
	return b;
}
int main()
{
	gets(a);
	gets(b);
	int l1=strlen(a),l2=strlen(b);
	for(int i=1;i<=l1;++i)
	for(int j=1;j<=l2;++j)
	{
		if(a[i-1]==b[j-1]){
			dp[i][j].s=dp[i][j-1].s+1;
		}
		else{
			if(dp[i-1][j].s>dp[i][j-1].s){
				dp[i][j].s=dp[i-1][j].s;
				dp[i][j].sw=1;
			}
			else{
				dp[i][j].s=dp[i][j-1].s;
				dp[i][j].sw=-1;
			}
		}
	}
	char s[3001];int  d=0;
	while(l1>0&&l2>0)
	{
		if(dp[l1][l2].sw==0){
			s[++d]=a[l1-1];
			l1--;
			l2--;
		}
		else if(dp[l1][l2].sw==1)l1--;
		else l2--;
	}
	for(int i=d;i>0;--i)
	{
		cout<<s[i];
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   14 |         gets(a);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
string x,y;
int dp[3050][3050];
int go(int i,int j)
{if(i==x.length() || j== y.length())
  return 0;
 if(dp[i][j]!=-1)
   return dp[i][j];
 int op1=INT_MIN;
 if(x[i]==y[j])
   op1=max(op1,1+go(i+1,j+1));
 op1=max(op1,go(i+1,j))
 op1=max(op1,go(i,j+1));
   return dp[i][j]=op1;
   
}
int main()
{cin>>x>>y;
 int d=go(0,0);
 cout<<d<<endl;
}

Compiler output:
a.cc: In function 'int go(int, int)':
a.cc:13:24: error: expected ';' before 'op1'
   13 |  op1=max(op1,go(i+1,j))
      |                        ^
      |                        ;
   14 |  op1=max(op1,go(i,j+1));
      |  ~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
string x,y;
int dp[3050][3050];
int go(int i,int j)
{if(i==x.length() || j== y.length())
  return 0;
 if(dp[i][j]!=-1)
   return dp[i][j];
 int op1=INT_MIN;
 if(x[i]==y[j])
   op1=max(op1,1+go(i+1,j+1);
 op1=max(op1,go(i+1,j))
 op1=max(op1,go(i,j+1));
   return dp[i][j]=op1;
   
}
int main()
{cin>>x>>y;
 int d=go(0,0);
 cout<<d<<endl;
}

Compiler output:
a.cc: In function 'int go(int, int)':
a.cc:12:29: error: expected ')' before ';' token
   12 |    op1=max(op1,1+go(i+1,j+1);
      |           ~                 ^
      |                             )
a.cc:13:24: error: expected ';' before 'op1'
   13 |  op1=max(op1,go(i+1,j))
      |                        ^
      |                        ;
   14 |  op1=max(op1,go(i,j+1));
      |  ~~~
Language: C++

#include <iostream>
#include <map>
#include <vector>

using namespace std;
vector<vector<int>> l;

int dp(int i, int j, string& s, string& t) {
  if (i == -1 || j == -1) {
    return 0;
  } else {
    if (dp[i][j] != -1) return dp[i][j];
    if (s[i] == t[j]) {
      l[i][j] = 1 + dp(i - 1, j - 1, s, t);
    } else {
      int r1 = dp(i - 1, j, s, t);
      int r2 = dp(i, j - 1, s, t);
      l[i][j] = max(r1, r2);
    }
    return l[i][j];
  }
}
int main() {
  string s, t;
  cin >> s;
  cin >> t;
  l.resize(s.length());
  for (int i = 0; i < l.size(); ++i) l[i].resize(t.length(), -1);
  int ansl = dp(s.length() - 1, t.length() - 1, s, t);
  string ans = "";
  int i = s.length() - 1;
  int j = t.length() - 1;
  while (i >= 0 && j >= 0) {
    if (s[i] == t[j]) {
      ans += s[i];
      i--;
      j--;
    } else {
      if (i == 0)
        --j;
      else if (j == 0)
        --i;
      else if (l[i - 1][j] > l[i][j - 1])
        i--;
      else
        j--;
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}



Compiler output:
a.cc: In function 'int dp(int, int, std::string&, std::string&)':
a.cc:12:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   12 |     if (dp[i][j] != -1) return dp[i][j];
      |             ^
a.cc:12:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   12 |     if (dp[i][j] != -1) return dp[i][j];
      |                ^
a.cc:12:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |     if (dp[i][j] != -1) return dp[i][j];
      |         ~~~~~~~~~^~~~~
a.cc:12:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   12 |     if (dp[i][j] != -1) return dp[i][j];
      |                                    ^
a.cc:12:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   12 |     if (dp[i][j] != -1) return dp[i][j];
      |                                       ^
a.cc:12:39: error: invalid conversion from 'int (*)(int, int, std::string&, std::string&)' {aka 'int (*)(int, int, std::__cxx11::basic_string<char>&, std::__cxx11::basic_string<char>&)'} to 'int' [-fpermissive]
   12 |     if (dp[i][j] != -1) return dp[i][j];
      |                                       ^
      |                                       |
      |                                       int (*)(int, int, std::string&, std::string&) {aka int (*)(int, int, std::__cxx11::basic_string<char>&, std::__cxx11::basic_string<char>&)}
a.cc: In function 'int main()':
a.cc:49:3: error: 'reverse' was not declared in this scope
   49 |   reverse(ans.begin(), ans.end());
      |   ^~~~~~~
Language: C++


void LCS(string text1 ,string text2 ){
    int dp[text1.length()+1][text2.length()+1];
    for(int i=0;i<=text1.length();i++){
        for(int j=0;j<=text2.length();j++){
            if(i==0 || j==0){
                dp[i][j]=0;
            }
           else if(text1[i-1]==text2[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 index= dp[text1.length()][text2.length()];
    char lcs[index+1];
    lcs[index] = '\0';
    int i=text1.length();
    int j=text2.length();
    while(i>0 && j>0){
        if(text1[i-1]==text2[j-1]){
            lcs[index-1]=text1[i-1];
            i--;
            j--;
            index--;

        }
        else if(dp[i-1][j]>dp[i][j-1]){
            i--;
        }
        else {
            j--;
        }
    }
    
        cout<<lcs;
    
}


Compiler output:
a.cc:2:6: error: variable or field 'LCS' declared void
    2 | void LCS(string text1 ,string text2 ){
      |      ^~~
a.cc:2:10: error: 'string' was not declared in this scope
    2 | void LCS(string text1 ,string text2 ){
      |          ^~~~~~
a.cc:2:24: error: 'string' was not declared in this scope
    2 | void LCS(string text1 ,string text2 ){
      |                        ^~~~~~
Language: C++


void LCS(string text1,string text2){
    int dp[text1.length()+1][text2.length()+1];
    for(int i=0;i<=text1.length();i++){
        for(int j=0;j<=text2.length();j++){
            if(i==0 || j==0){
                dp[i][j]=0;
            }
           else if(text1[i-1]==text2[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 index= dp[text1.length()][text2.length()];
    char lcs[index+1];
    lcs[index] = '\0';
    int i=len1;
    int j=len2;
    while(i>0 && j>0){
        if(text1[i-1]==text2[j-1]){
            lcs[index-1]=text1[i-1];
            i--;
            j--;
            index--;

        }
        else if(dp[i-1][j]>dp[i][j-1]){
            i--;
        }
        else {
            j--;
        }
    }
    
        cout<<lcs;
    
}



Compiler output:
a.cc:2:6: error: variable or field 'LCS' declared void
    2 | void LCS(string text1,string text2){
      |      ^~~
a.cc:2:10: error: 'string' was not declared in this scope
    2 | void LCS(string text1,string text2){
      |          ^~~~~~
a.cc:2:23: error: 'string' was not declared in this scope
    2 | void LCS(string text1,string text2){
      |                       ^~~~~~
Language: C++

#include<bits/stdc++.h>
#define F first
#define S second
#define pii pair<int, int>
#define endl "\n"
using namespace std;
const int N = 3001;
int dp[N][N];
string s, t;
int LCS( int i, int j){
 
	if(i == s.size() or j == t.size() ) 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);
 
	int one = LCS( i + 1, j);
	int two = LCS( i, j + 1);
 
	return dp[i][j] = max(one, two);
}
 
int main(){
 
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
 
	// int t; cin >> t; while(t--)
	{
		
		cin >> s >> t;
		memset(dp, -1, sizeof( dp ) );
		int ans = LCS(s, t, 0, 0);
		int i,j;
		i = j = 0;
 
		while(i < s.size() and j < t.size() ) {
 
			while(j < t.size() and i < s.size() ) {
 
				if(s[i] == t[j]) {
					cout << s[i];
					i++;
					j++;
				}
				else{
					if(dp[i + 1][j] > dp[i][j + 1]) i++;
					else j++;
				}
			}
		}
 
 
	}
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:31: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int'
   33 |                 int ans = LCS(s, t, 0, 0);
      |                               ^
      |                               |
      |                               std::string {aka std::__cxx11::basic_string<char>}
a.cc:10:14: note:   initializing argument 1 of 'int LCS(int, int)'
   10 | int LCS( int i, int j){
      |          ~~~~^
Language: C++

int main()
{
	string s,t;
	cin>>s>>t;
//	string str=lcs(s,t,"");
//	cout<<str<<"\n";
  int m=s.size(),n=t.size();
	vector<vector<int> >dp(m+1,vector<int>(n+1,0));
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(s[i-1]==t[j-1])
			   dp[i][j]=dp[i-1][j-1]+1;
			else
			{
				if(dp[i-1][j]>=dp[i][j-1])
				   dp[i][j]=dp[i-1][j];
				else
				   dp[i][j]=dp[i][j-1];
				  
			}
		}
	}
  int index=dp[m][n];
  string x="";
  int i=m,j=n;
  while(i>0 && j>0)
  {
    if(s[i-1]==t[j-1]){
      x=x+s[i-1];
      i--;
      j--;
    }
    else if(dp[i-1][j]>dp[i][j-1])
      i--;
    else
      j--;
  }
	cout<<x<<"\n";
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'string' was not declared in this scope
    3 |         string s,t;
      |         ^~~~~~
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin>>s>>t;
      |         ^~~
a.cc:4:14: error: 's' was not declared in this scope
    4 |         cin>>s>>t;
      |              ^
a.cc:4:17: error: 't' was not declared in this scope
    4 |         cin>>s>>t;
      |                 ^
a.cc:8:9: error: 'vector' was not declared in this scope
    8 |         vector<vector<int> >dp(m+1,vector<int>(n+1,0));
      |         ^~~~~~
a.cc:8:23: error: expected primary-expression before 'int'
    8 |         vector<vector<int> >dp(m+1,vector<int>(n+1,0));
      |                       ^~~
a.cc:11:32: error: 'n' was not declared in this scope
   11 |                 for(int j=1;j<=n;j++)
      |                                ^
a.cc:14:28: error: 'dp' was not declared in this scope
   14 |                            dp[i][j]=dp[i-1][j-1]+1;
      |                            ^~
a.cc:17:36: error: 'dp' was not declared in this scope
   17 |                                 if(dp[i-1][j]>=dp[i][j-1])
      |                                    ^~
a.cc:25:13: error: 'dp' was not declared in this scope
   25 |   int index=dp[m][n];
      |             ^~
a.cc:25:19: error: 'n' was not declared in this scope
   25 |   int index=dp[m][n];
      |                   ^
a.cc:26:9: error: expected ';' before 'x'
   26 |   string x="";
      |         ^~
      |         ;
a.cc:31:7: error: 'x' was not declared in this scope
   31 |       x=x+s[i-1];
      |       ^
a.cc:40:9: error: 'cout' was not declared in this scope
   40 |         cout<<x<<"\n";
      |         ^~~~
a.cc:40:15: error: 'x' was not declared in this scope
   40 |         cout<<x<<"\n";
      |               ^
Language: C++

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int dp[3005][3005];
int main()
{
    string s,t;
    cin >> s >> t;
    int sl = s.length();
    int tl = t.length();

    for (int i = 1; i <= sl; i++)
    {
        for (int j = 1; j <= tl; j++)
        {
            if(s[i-1] == t[j-1])dp[i][j]=dp[i-1][j-1]+1;
            chmax(dp[i][j], dp[i - 1][j]);
            chmax(dp[i][j], dp[i][j-1]);
        }
    }
    //cout << dp[sl][tl] << endl;
    int si, ti;
    si = sl;
    ti = tl;
    string ans = "";
    while(si > 0 && ti > 0)
    {
        (dp[si][ti] == dp[si][ti - 1])
        {
            ti--;
        }
        else if (dp[si][ti] == dp[si - 1][ti])
        {
            si--;
        }
        else if (dp[si][ti] == dp[si - 1][ti - 1] + 1)
        {
            ans = s[si - 1] + ans;
            si--;
            ti--;
        }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:39: error: expected ';' before '{' token
   40 |         (dp[si][ti] == dp[si][ti - 1])
      |                                       ^
      |                                       ;
   41 |         {
      |         ~                              
a.cc:44:9: error: 'else' without a previous 'if'
   44 |         else if (dp[si][ti] == dp[si - 1][ti])
      |         ^~~~
a.cc:55:2: error: expected '}' at end of input
   55 | }
      |  ^
a.cc:18:1: note: to match this '{'
   18 | {
      | ^
Language: C++

#include<stdio.h>
#include<math.h>
#include<string.h>
int max(int a, int b){
	if (a>b) {
		return a;
	} else {
		return b;
	}
}
int main() {
	char s[3000];
	char t[3000];
	
	scanf("%s",s);
	scanf("%s",t);
	
	int Vert = strlen(s);
	int Side = strlen(t);
	
	int dp[Vert+1][Side+1];
	
	for(int i=0; i<Vert+1; i++) {
		dp[i][0] = 0;
	}
	for(int i=0; i<Side+1; i++) {
		dp[0][i] = 0;
	}
	
	int new=0;
	for( int i=1; i<Vert+1; i++ ) {
		for( int j=1; j<Side+1 ; 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] );
			}  
			if ( new < dp[i][j] ) {
				printf("%c",s[i-1]);
				new++;
			}
		}
	}
	
	return 0;
}
	

Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: expected unqualified-id before 'new'
   30 |         int new=0;
      |             ^~~
a.cc:38:34: error: expected type-specifier before '<' token
   38 |                         if ( new < dp[i][j] ) {
      |                                  ^
a.cc:40:36: error: expected type-specifier before '++' token
   40 |                                 new++;
      |                                    ^~
Language: C++

#include<stdio.h>
#include<math.h>
#include<string.h>

int main() {
	char s[3000];
	char t[3000];
	
	scanf("%s",s);
	scanf("%s",t);
	
	int Vert = strlen(s);
	int Side = strlen(t);
	
	int dp[Vert+1][Side+1];
	
	for(int i=0; i<Vert+1; i++) {
		dp[i][0] = 0;
	}
	for(int i=0; i<Side+1; i++) {
		dp[0][i] = 0;
	}
	
	char ans[3000];
	int new=0;
	for( int i=1; i<Vert+1; i++ ) {
		for( int j=1; j<Side+1 ; j++ )	{
			if ( dp [i-1][j] > dp[i][j-1] ) {
				dp[i][j] = dp[i-1][j];
				if( s[i-1] == t[j-1] ) {
					dp[i][j] += 1;
				}
			} else {
				dp[i][j] = dp[i][j-1];
				 if( s[i-1] == t[j-1] ) {
					dp[i][j] += 1;
				}
			}
			if ( new < dp[i][j] ) {
				printf("%c",s[i-1]);
				new++;
			}
		}
	}
	
	return 0;
}
				
	

Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: expected unqualified-id before 'new'
   25 |         int new=0;
      |             ^~~
a.cc:39:34: error: expected type-specifier before '<' token
   39 |                         if ( new < dp[i][j] ) {
      |                                  ^
a.cc:41:36: error: expected type-specifier before '++' token
   41 |                                 new++;
      |                                    ^~
Language: C++

#include<stdio.h>
#include<math.h>
#include<string.h>

int main() {
	char s[3000];
	char t[3000];
	
	scanf("%s",s);
	scanf("%s",t);
	
	int Vert = strlen(s);
	int Side = strlen(t);
	
	int dp[Vert+1][Side+1];
	
	for(int i=0; i<Vert+1; i++) {
		dp[i][0] = 0;
	}
	for(int i=0; i<Side+1; i++) {
		dp[0][i] = 0;
	}
	
	char ans[3000];
	int new=0;
	for( int i=1; i<Vert+1; i++ ) {
		for( int j=1; j<Side+1 ; j++ )	{
			if ( dp [i-1][j] > dp[i][j-1] ) {
				dp[i][j] = dp[i-1][j];
				if( s[i-1] == t[j-1] ) {
					dp[i][j] += 1;
				}
			} else {
				dp[i][j] = dp[i][j-1];
				 if( s[i-1] == t[j-1] ) {
					dp[i][j] += 1;
				}
			}
			if ( new < dp[i][j] ) {
				printf("%c",s[i-1]);
				new++;
			}
		}
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: expected unqualified-id before 'new'
   25 |         int new=0;
      |             ^~~
a.cc:39:34: error: expected type-specifier before '<' token
   39 |                         if ( new < dp[i][j] ) {
      |                                  ^
a.cc:41:36: error: expected type-specifier before '++' token
   41 |                                 new++;
      |                                    ^~
Language: C++

#include<bits/stdc++.h>
 
 
using namespace std;
 
#define max(a,b) ((a>b)?a:b)
 
 
 
vector< vector<int> > dp(3001,vector<int>(3001,0));
 
 
int longestComSub(string s,string t,int n,int m)
{
    if(n==0||m==0)
        return 0;
 
    if(dp[n][m])
        return dp[n][m];
 
 
    if(s[n-1]==t[m-1])  
        dp[n][m]=1+longestComSub(s,t,n-1,m-1);
    else dp[n][m]=max(longestComSub(s,t,n,m-1),longestComSub(s,t,n-1,m));
 
    return dp[n][m];
 
 
}
 
 
 
 
 
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(precision);
  cout.setf(ios_base::fixed);

    string s,t;



    getline(cin,s);
    getline(cin,t);
 
    int n=s.size(),m=t.size();
 
    int x=longestComSub(s,t,n,m);
 
 
string alpha="";
 
while(m>0&&n>0)
    {
        if(s[n-1]==t[m-1])
            {
                alpha+=s[n-1];
                n--;
                m--;
 
            }
        else if(dp[n-1][m]>dp[n][m-1])
            n--;
        else m--;
    }
 
 
for(--x;x>-1;x--)
    cout<<alpha[x];
 
 
 
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:18: error: 'precision' was not declared in this scope
   41 |   cout.precision(precision);
      |                  ^~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int lcs_mem(string s, string t, int **output) {
	int m = s.size();
	int n = t.size();
	
	// Base case
	if(s.size() == 0 || t.size() == 0) {
		return 0;
	}

	// Check if ans already exists
	if(output[m][n] != -1) {
		return output[m][n];
	}

	int ans;
	// Recursive calls
	if(s[0] == t[0]) {
		ans = 1 + lcs_mem(s.substr(1), t.substr(1), output);
	}
	else {
		int a = lcs_mem(s.substr(1), t, output);
		int b = lcs_mem(s, t.substr(1), output);
		int c = lcs_mem(s.substr(1), t.substr(1), output);
		ans = max(a, max(b, c));
	}

	// Save your calculation
	output[m][n] = ans;

	// Return ans
	return ans;
}
int main() {
	string s, t;
	cin >> s >> t;
  int m=s.size();
  int n=t.size();
  int ** output[m+1][n+1];
for(int i = 0; i <= m; i++) {
		output[i] = new int[n+1];
		for(int j = 0; j <= n; j++) {
			output[i][j] = -1;
		}
	}
	cout << lcs_mem(s,t,output) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:27: error: incompatible types in assignment of 'int*' to 'int** [(n + 1)]'
   43 |                 output[i] = new int[n+1];
      |                 ~~~~~~~~~~^~~~~~~~~~~~~~
a.cc:45:40: error: invalid conversion from 'int' to 'int**' [-fpermissive]
   45 |                         output[i][j] = -1;
      |                                        ^~
      |                                        |
      |                                        int
a.cc:48:29: error: cannot convert 'int** (*)[(n + 1)]' to 'int**'
   48 |         cout << lcs_mem(s,t,output) << endl;
      |                             ^~~~~~
      |                             |
      |                             int** (*)[(n + 1)]
a.cc:4:39: note:   initializing argument 3 of 'int lcs_mem(std::string, std::string, int**)'
    4 | int lcs_mem(string s, string t, int **output) {
      |                                 ~~~~~~^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
string A,B;
  cin>>A>>B;
  int n=A.length();
  int m=B.length();
  int t[n+1][m+1]={0};
  for(int i=1;i<=n;i++){
  for(int j=1;j<=m;j++){
  if(A[i-1]==B[j-1])
    t[i][j]=t[i-1][j-1]+1;
  
    else{
      t[i][j]=max(t[i-1][j],t[i][j-1]);
    }}
  }
  int i=n;
  int j=m;
  string C;
  while(i>0&&j>0){
    if(A[i-1]==B[j-1])
    {
      C.push_back(A[i-1]);
      i--;
      j--;
    }
    else{
    if(t[i-1][j]>t[i][j-1])
      i--;
    }
    else{
    j--;
    }
  }}
if(C.length()!=0){
for(int p=C.length()-1;p>=0;p--){
cout<<C[p];
}}
  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'else' without a previous 'if'
   32 |     else{
      |     ^~~~
a.cc: At global scope:
a.cc:36:1: error: expected unqualified-id before 'if'
   36 | if(C.length()!=0){
      | ^~
a.cc:40:3: error: expected unqualified-id before 'return'
   40 |   return 0;
      |   ^~~~~~
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
#define int long long int
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll m = 998244353;
int power(int x,int y, int m) 
{ 
    if (y == 0) 
        return 1;
    int p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 
int modInverse(int a, int m) 
{     
        return power(a, m-2, m); 
}
int mod(int x)
 {
	if(x<0)return -x;
	else return x;
 } 
signed main()
{
 string s,t;
 cin>>s>>t;
 int n=s.size();
 int m=t.size();
 int ans[n+1][m+1];
 FOR(i,0,n)
 {
 	FOR(j,0,m)
 	{
 		ans[i][j]=0;
	 }
  } 
  FOR(i,1,n)
  {
  	FOR(j,1,m)
  	{
  		if(s[i]==t[j])
  		{
  		ans[i][j]=ans[i-1][j-1]+1;	
		}
		else
		{
			ans[i][j]=max(ans[i-1][j],ans[i][j-1]);
		}
	}
  }
  //cout<<ans[n][m]<<endl;
  if(ans[n][m]==0)
  cout<<" ";
  else
  {
  vi v;
 // v.pb(0);
  int i=n-1,j=m-1;
  while(i>=0 && j>=0)
  {
  if(s[i]==t[j])
  {
  v.pb(i);
  i--;j--;
  }
  else
  {
  	if(ans[i][j]==ans[i-1][j])
  	i--;	
	else if(ans[i][j]==ans[i][j-1])
	j--;
  }
 }
 FORD(i,ans[n][m]-1,0)
 {
 	cout<<s[v[i]];
 }
}
v.clear();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:102:1: error: 'v' was not declared in this scope
  102 | v.clear();
      | ^
Language: Java

import java.io.*;
public class Main{
  public static void main(String[] args) throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    String str1=br.readLine();
    String str2=br.readLine();
int n=str1.length();
        int m=str2.length();
        
       int dp[][]=new int[n+1][m+1];
        for(int i=0;i<=m;i++)
            dp[0][i]=0;
        for(int i=0;i<=n;i++)
            dp[i][0]=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {

                if(str1.charAt(i-1)==str2.charAt(j-1))
                {
                    dp[i][j]=1+dp[i-1][j-1];
                }
                else
                {
                    dp[i][j]=Math.max(dp[i][j-1],dp[i-1][j]);
                }
            }
        }
        return dp[n][m];
} 
}

Compiler output:
Main.java:31: error: incompatible types: unexpected return value
        return dp[n][m];
                    ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
    int main() {
        string text1, string text2;
      	cin >> text1 >> text2;
        vector<vector<int>> dp(text1.size()+1, vector<int>(text2.size()+1, 0));
        
        for(int i = 1; i <= text1.size(); i++)
        {
            for(int j = 1; j < text2.size(); j++)
            {
                if(text1[j]==text2[j])
                    dp[i][j] = max(dp[i][j], dp[i][j-1]+1);
            }
        }
        
        for(auto& v: dp)
        {
            for(auto& e: v)
                cout << e << " ";
            cout << endl;
        }
        
        return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:4:30: error: expected initializer before 'text2'
    4 |         string text1, string text2;
      |                              ^~~~~
a.cc:5:25: error: 'text2' was not declared in this scope; did you mean 'text1'?
    5 |         cin >> text1 >> text2;
      |                         ^~~~~
      |                         text1
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
  	cin>>s;
  	cin>>t;
  	int n=s.length(),m=t.length();
  	int dp[n+1][m+1];
  	string ans;
  	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][j-1],max[i-1][j]);
            }
        }
    }
  	int index = L[m][n]; 
   	char s[index+1]; 
   	s[index] = '\0';
    int i = m, j = n; 
    while (i > 0 && j > 0) 
    { 
        if (X[i-1] == Y[j-1]) 
        { 
            s[index-1] = X[i-1]; 
            i--; j--; index--;   
        }
        else if (L[i-1][j] > L[i][j-1]) 
           i--; 
        else
           j--; 
     } 
  	cout<<s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:44: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   17 |                 dp[i][j]=max(dp[i][j-1],max[i-1][j]);
      |                                            ^
a.cc:21:21: error: 'L' was not declared in this scope
   21 |         int index = L[m][n];
      |                     ^
a.cc:22:14: error: conflicting declaration 'char s [(index + 1)]'
   22 |         char s[index+1];
      |              ^
a.cc:4:16: note: previous declaration as 'std::string s'
    4 |         string s,t;
      |                ^
a.cc:27:13: error: 'X' was not declared in this scope
   27 |         if (X[i-1] == Y[j-1])
      |             ^
a.cc:27:23: error: 'Y' was not declared in this scope
   27 |         if (X[i-1] == Y[j-1])
      |                       ^
Language: Java

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Class5Hmk {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	
	static int[][]F;
	public static void main(String args[]) throws IOException{
		//problem/dpf
		String s = next(), s2 = next(); int N = s.length(), M = s2.length();
		char[]F = new char[N]; for(int i = 0;i<N;i++) F[i] = s.charAt(i);
		char[]F2 = new char[M]; for(int i = 0;i<M;i++) F2[i] = s2.charAt(i);
		int[][]dp = new int[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(F[i-1]==F2[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]);
			}
		}
		int r = N, c = M, temp = dp[N][M]; char[]lcs = new char[temp];
		while(r>0&&c>0){
			if(F[r-1]==F2[c-1]){
				lcs[temp-1]=F[r-1];temp--; r--; c--;
			}else if(dp[r-1][c]>dp[r][c-1]){
				r--;
			}else c--;
		}
		for(int i = 0;i<dp[N][M];i++) System.out.print(lcs[i]);
	}
	static String next() throws IOException{
		while(st==null||!st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static int readInt() throws IOException{
		return Integer.parseInt(next());
	}
	static long readLong() throws IOException{
		return Long.parseLong(next());
	}
}


Compiler output:
Main.java:5: error: class Class5Hmk is public, should be declared in a file named Class5Hmk.java
public class Class5Hmk {
       ^
Main.java:6: error: cannot find symbol
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	       ^
  symbol:   class BufferedReader
  location: class Class5Hmk
Main.java:6: error: cannot find symbol
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	                               ^
  symbol:   class BufferedReader
  location: class Class5Hmk
3 errors
Language: C++

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

int main() {
    string s;
    string t;
    cin>>s>>t;
    int n = s.size();
    int m = t.size();
    int dp[n][m];
    int k = 0;
    for(int i = 0 ; i < m ; i++){
        if(s[0] == t[i])k = 1;
        dp[0][i] = k;
    }
    k= 0 ;
    for(int i = 1 ; i < n ; i++){
        if(t[0] == s[i]) k = 1;
        dp[i][0] == k;
    }
    for(int i = 1 ; i < n ; i++){
        for(int j = 1; j < m ; j++){
            if(s[i] == t[j]){
                dp[i][j] = 1 + dp[i-1][j-1];
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    
 	char ans[dp[n-1][m-1] + 1];
  	char ans[dp[n-1][m-1]] = '\0';
  	int index = dp[n-1][m-1] - 1;
  	for(int i = n - 1, int j = m - 1; i >= 0, j >= 0){
      if(s[i] == t[j]){
        ans[index] = s[i];
        index--;
        i--;
        j--;
      }else{
        if(dp[i-1][j] > dp[i][j-1])i--;
        else j--;
      }
    }
  	cout<<ans;
	// your code goes here
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:14: error: conflicting declaration 'char ans [dp[(n + -1)][(m + -1)]]'
   34 |         char ans[dp[n-1][m-1]] = '\0';
      |              ^~~
a.cc:33:14: note: previous declaration as 'char ans [(dp[(n + -1)][(m + -1)] + 1)]'
   33 |         char ans[dp[n-1][m-1] + 1];
      |              ^~~
a.cc:36:28: error: expected unqualified-id before 'int'
   36 |         for(int i = n - 1, int j = m - 1; i >= 0, j >= 0){
      |                            ^~~
a.cc:36:27: error: expected ';' before 'int'
   36 |         for(int i = n - 1, int j = m - 1; i >= 0, j >= 0){
      |                           ^~~~
      |                           ;
Language: C++

#include<bits/stdc++.h>
#include <unistd.h>

#define pb push_back
#define ll long long
int dp[3005][3005];
using namespace std;

set<string> comstr(string x, string y, int m,int  n, int dp[][1000]){
	if (m == 0|| n== 0)
	{
		set<string> a;
		a.insert("");
		return a;
	}
	if (x[m-1] == y[n-1])
	{
		set<string> s, g;
		g= comstr(x,y,m-1, n-1, dp);
		for(string str : g){
			s.insert(str+x[m-1]);
		}
		return s;
	}
	if(x[m-1] != y[n-1]){
		set<string> s, k;
		if (dp[m-1][n] >= dp[m][n-1])
		{
			s=comstr(x,y, m-1, n, dp);
		}
		if(dp[m][n-1] >= dp[m-1][n]){
			k=comstr(x, y, m, n-1, dp);
		}
		for(string str : s){
			k.insert(str);
		}
		return k;

	}

}

int main(int argc, char const *argv[])
{
	// vector<char> final;
	string a, b, final = "";
	cin>>a>>b;
	 int n = a.length(), m = b.length();
	 memset(dp, 0, sizeof(dp));
	// int dp[n+1][m+1];

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

	set<string> commonstrings = comstr(a, b, n, m, dp);
	if(commonstrings.size() > 0){
		set<string>::iterator it = commonstrings.begin();
		cout<<*it;
	}
	else{
		cout<<"";
	}
	// for(string str : commonstrings){
	// 	cout<<str<<" ";
	// }
	// printf("\n");
	// printf("%d\n", dp[n][m]);
	// cout<<final;
	// for (int i = 0; i <= n; ++i)
	// {
	// 	for (int j = 0; j <= m; ++j)
	// 	{
	// 		printf("%d ", dp[i][j]);
	// 	}
	// 	printf("\n");
	// }

	// printf("s\n");
	// for (int i = 0; i < 7; ++i)
	// {
	// 	for (int j = 0; j < 7; ++j)
	// 	{
	// 		printf("%d ", s[i][j]);
	// 	}
	// 	printf("\n");
	// }
	// printBrac(1,6);
	return 0;
}




Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:68:56: error: cannot convert 'int (*)[3005]' to 'int (*)[1000]'
   68 |         set<string> commonstrings = comstr(a, b, n, m, dp);
      |                                                        ^~
      |                                                        |
      |                                                        int (*)[3005]
a.cc:9:58: note:   initializing argument 5 of 'std::set<std::__cxx11::basic_string<char> > comstr(std::string, std::string, int, int, int (*)[1000])'
    9 | set<string> comstr(string x, string y, int m,int  n, int dp[][1000]){
      |                                                      ~~~~^~~~~~~~~~
a.cc: In function 'std::set<std::__cxx11::basic_string<char> > comstr(std::string, std::string, int, int, int (*)[1000])':
a.cc:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^
Language: Java

// Dynamic Programming implementation of LCS problem in Java 
import java.io.*; 
import java.util.*;

class Main
{ 
	// Returns length of LCS for X[0..m-1], Y[0..n-1] 
	static void lcs(String X, String Y, int m, int n) 
	{ 
		int[][] L = new int[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.charAt(i-1) == Y.charAt(j-1)) 
					L[i][j] = L[i-1][j-1] + 1; 
				else
					L[i][j] = Math.max(L[i-1][j], L[i][j-1]); 
			} 
		} 

		// Following code is used to print LCS 
		int index = L[m][n]; 
		int temp = index; 

		// Create a character array to store the lcs string 
		char[] lcs = new char[index+1]; 
		lcs[index] = ''; // 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.charAt(i-1) == Y.charAt(j-1)) 
			{ 
				// Put current character in result 
				lcs[index-1] = X.charAt(i-1); 
				
				// reduce values of i, j and index 
				i--; 
				j--; 
				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 
		System.out.print("LCS of "+X+" and "+Y+" is "); 
		for(int k=0;k<=temp;k++) 
			System.out.print(lcs[k]); 
	} 
	
	// driver program 
	public static void main (String[] args) 
	{ 	Scanner sc = new Scanner(System.in);
		String X = sc.next();
		String Y = sc.next(); 
		int m = X.length(); 
		int n = Y.length(); 
		lcs(X, Y, m, n); 
	} 
} 

// Contributed by Pramod Kumar 


Compiler output:
Main.java:33: error: empty character literal
		lcs[index] = ''; // Set the terminating character 
		             ^
1 error
Language: Java

// Dynamic Programming implementation of LCS problem in Java 
import java.io.*; 
import java.util*;

class Main
{ 
	// Returns length of LCS for X[0..m-1], Y[0..n-1] 
	static void lcs(String X, String Y, int m, int n) 
	{ 
		int[][] L = new int[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.charAt(i-1) == Y.charAt(j-1)) 
					L[i][j] = L[i-1][j-1] + 1; 
				else
					L[i][j] = Math.max(L[i-1][j], L[i][j-1]); 
			} 
		} 

		// Following code is used to print LCS 
		int index = L[m][n]; 
		int temp = index; 

		// Create a character array to store the lcs string 
		char[] lcs = new char[index+1]; 
		lcs[index] = ''; // 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.charAt(i-1) == Y.charAt(j-1)) 
			{ 
				// Put current character in result 
				lcs[index-1] = X.charAt(i-1); 
				
				// reduce values of i, j and index 
				i--; 
				j--; 
				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 
		System.out.print("LCS of "+X+" and "+Y+" is "); 
		for(int k=0;k<=temp;k++) 
			System.out.print(lcs[k]); 
	} 
	
	// driver program 
	public static void main (String[] args) 
	{ 	Scanner sc = new Scanner(System.in);
		String X = sc.next();
		String Y = sc.next(); 
		int m = X.length(); 
		int n = Y.length(); 
		lcs(X, Y, m, n); 
	} 
} 

// Contributed by Pramod Kumar 


Compiler output:
Main.java:3: error: ';' expected
import java.util*;
                ^
Main.java:33: error: empty character literal
		lcs[index] = ''; // Set the terminating character 
		             ^
2 errors
Language: C

#include <stdio.h>
void lcs( char *X, char *Y, int m, int n ) 
{ 
   int L[m+1][n+1]; 
   for (int i=0; i<=m; i++) 
   { 
     for (int j=0; j<=n; j++) 
     { 
       if (i == 0 || j == 0) 
         L[i][j] = 0; 
       else if (X[i-1] == Y[j-1]) 
         L[i][j] = L[i-1][j-1] + 1; 
       else
         L[i][j] = max(L[i-1][j], L[i][j-1]); 
     } 
   } 
   int index = L[m][n]; 
   char lcs[index+1]; 
   lcs[index] = '\0'; 
   int i = m, j = n; 
   while (i > 0 && j > 0) 
   { 
      if (X[i-1] == Y[j-1]) 
      { 
          lcs[index-1] = X[i-1];
          i--; j--; index--;     
      } 
      else if (L[i-1][j] > L[i][j-1]) 
         i--; 
      else
         j--; 
   } 
   printf("%s",lcs);
} 
int main() 
{ 
  char X[3010],Y[3010];
  scanf("%s %s",X,Y);
  int m = strlen(X);
  int  n = strlen(Y); 
  lcs(X, Y, m, n); 
  return 0; 
} 

Compiler output:
main.c: In function 'lcs':
main.c:14:20: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   14 |          L[i][j] = max(L[i-1][j], L[i][j-1]);
      |                    ^~~
main.c: In function 'main':
main.c:39:11: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   39 |   int m = strlen(X);
      |           ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | void lcs( char *X, char *Y, int m, int n )
main.c:39:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   39 |   int m = strlen(X);
      |           ^~~~~~
main.c:39:11: note: include '<string.h>' or provide a declaration of 'strlen'
Language: C++

#include <bits/stdc++.h>
int LCS(char a[],char b[])
{
    int m = strlen(a),n = strlen(b);
    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] == b[j])
                L[i][j] = L[i-1][j]+1;
            else
                L[i][j] = max(L[i-1][j],L[i][j-1]);
        }
    }
    //printf("%d\n",L[m][n]);
    // Print All LCS
    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])
        {
            i--;j--;index--;
            lcs[index] = a[i];
        }
        else if (L[i-1][j] > L[i][j-1])
         i--;
      else
         j--;
    }
    printf("%s",lcs);
    // End of function
}
int main()
{
	char str1[] = "AGGTAB";
	char str2[] = "GXTXAYB";
	scanf("%s",str1);
	scanf("%s",str2);
	//printf("%d %d",len1,len2);
	LCS(str1,str2);
}


Compiler output:
a.cc: In function 'int LCS(char*, char*)':
a.cc:15:27: error: 'max' was not declared in this scope; did you mean 'std::max'?
   15 |                 L[i][j] = max(L[i-1][j],L[i][j-1]);
      |                           ^~~
      |                           std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^