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

#include <iostream>
#include <unistd.h>
#include <cmath>
#include <vector>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    string s,t; cin >> s >> t;
    //DPtable
    const int maxlen = 3000+10;
    vector<vector<int> >dp(maxlen, vector<int>(maxlen));
    rep(i, s.size()){
        rep(j, t.size()){
            if(s[i] == t[j]){
                dp[i+1][j+1] = dp[i][j] + 1;
            }else{
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
            }
        }
    }
    //restor
    string ans; 
    int i = s.size(), j = t.size();
    while(i>0 && j>0){
        if(dp[i][j] == dp[i][j-1])  --j;
        else if(dp[i][j] == dp[i-1][j]) --i;
        else{
            ans += s[i-1];
            --i;    --j;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


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

#include <bits/stdc++.h> 
/** * author: j o s e m a g o * date: **/ 
using namespace std; 
#pragma GCC optimize ("Ofast")
 #define f first
 #define s second 
#define mp make_pair
 #define lb lower_bound 
#define ub upper_bound
 #define all(v) (v).begin(),(v).end()
 #define mset(a,v) memset(a,v,sizeof(a))
 #define pb push_back 
#define sz(x) ((int)(x).size()) 
#define rsz resize
 #define ln "\n"
 typedef double db;
 typedef unsigned long long ull;
 typedef long long ll;
 typedef long double ld; 
const ld PI = 2*acos(0.0);
 const int MOD = 1000000007; 
const int JJJ = 100009; int N,A; vector<int>grafo[JJJ]; bool visited[JJJ]; int dp[JJJ]; int sol = 0; void dfs(int nod){ visited[nod] = true; dp[nod] = -1; for(int i = 0;i < (int)grafo[nod].size();i++){ int xx = grafo[nod][i]; if(!visited[xx]){ dfs(xx); } dp[nod] = max(dp[nod],dp[xx]); } dp[nod]++; } int main(){ //freopen("input.in","r",stdin); //freopen("input.out","w",stdout); ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> A; for(int i = 0;i < A;i++){ int a,b; cin >> a >> b; grafo[a].pb(b); } for(int i = 1;i <= N;i++){ if(!visited[i]){ dfs(i); } sol = max(sol,dp[i]); } cout<<sol; return 0; } /* 4 5 1 2 1 3 3 2 2 4 3 4 6 3 2 3 4 5 5 6 5 8 5 3 2 3 2 4 5 2 5 1 1 4 4 3 1 3 */

Compiler output:
a.cc: In function 'int main()':
a.cc:22:313: error: expected '}' at end of input
   22 | const int JJJ = 100009; int N,A; vector<int>grafo[JJJ]; bool visited[JJJ]; int dp[JJJ]; int sol = 0; void dfs(int nod){ visited[nod] = true; dp[nod] = -1; for(int i = 0;i < (int)grafo[nod].size();i++){ int xx = grafo[nod][i]; if(!visited[xx]){ dfs(xx); } dp[nod] = max(dp[nod],dp[xx]); } dp[nod]++; } int main(){ //freopen("input.in","r",stdin); //freopen("input.out","w",stdout); ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> A; for(int i = 0;i < A;i++){ int a,b; cin >> a >> b; grafo[a].pb(b); } for(int i = 1;i <= N;i++){ if(!visited[i]){ dfs(i); } sol = max(sol,dp[i]); } cout<<sol; return 0; } /* 4 5 1 2 1 3 3 2 2 4 3 4 6 3 2 3 4 5 5 6 5 8 5 3 2 3 2 4 5 2 5 1 1 4 4 3 1 3 */
      |                                                                                                                                                                                                                                                                                                                        ~^
Language: C++


// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
   string s,ss;
   cin >> s >> ss;
   int n=s.length();
   int k=ss.length();
   int dp[n+1][k+1];
   for(int i=0; i<=n; i++){
       for(int j=0; j<=k; j++){
           if(i==0 || j==0)dp[i][j]=0;
           else{
               if(s[i-1]==ss[j-1])dp[i][j]=dp[i-1][j-1]+1;
               else dp[i][j]=max({ dp[i-1][j] , dp[i][j-1]});
           }
       }
   }
   string ans="";
   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+=ss[j-1];
                i--;
                j--;
            }
       }
   }
   reverse(all(ans));
   cout << ans << endl;
   
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:10: error: 'i' was not declared in this scope
   45 |    while(i>0 && j>0){
      |          ^
a.cc:45:17: error: 'j' was not declared in this scope
   45 |    while(i>0 && j>0){
      |                 ^
a.cc: At global scope:
a.cc:55:11: error: expected constructor, destructor, or type conversion before '(' token
   55 |    reverse(all(ans));
      |           ^
a.cc:56:4: error: 'cout' does not name a type
   56 |    cout << ans << endl;
      |    ^~~~
a.cc:58:4: error: expected unqualified-id before 'return'
   58 |    return 0;
      |    ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using Vi = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    string s;
    string t;
    cin>>s>>t;
    int n,m;
    n=s.size();
    m=t.size();
    int dp[n+1][m+1];
    rep(i,n+1) rep(j,m+1) dp[i][j]=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]):
            }
        }
    }    

    string ans="";
    int x=n;
    int y=m;
    while(x>0&&y>0){
        if(dp[x][y]==dp[x-1][y]){
            x--;
        }
        else if(dp[x][y]==dp[x][y-1]){
            y--;
        }
        else{
            x--;
            y--;
            ans.push_back(s[x]);
        }
    }
    reverse(all(ans));
    cout<<ans<<endl;
}

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

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

vector<vector<int>> dp(3005,vector<int>(3005,0));

void reconstruct(int n,int m,string& res,string s,string t)
{
	if(n<=0 || m<=0)
		return;
	if(s[n-1]==t[m-1])
	{
		res=s[n-1]+res;
		reconstruct(n-1,m-1,dp,res,s,t);
	}
	else
	{
		if(dp[n-1][m]>dp[n][m-1])
			reconstruct(n-1,m,res,s,t);
		else
			reconstruct(n,m-1,res,s,t);
	}
}

int main() 
{
    fastio;

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif

	string s;
	string t; 
	cin>>s>>t;
	

	for(int i=1;i<=s.size();i++)
	{
		for(int j=1;j<=t.size();j++)
		{
			if(s[i-1]==t[j-1])
				dp[i][j]=dp[i-1][j-1]+1;
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}   
	string res;
	reconstruct(s.size(),t.size(),res,s,t);
	cout<<res<<endl;

    return 0;
}		

Compiler output:
a.cc: In function 'void reconstruct(int, int, std::string&, std::string, std::string)':
a.cc:15:37: error: invalid initialization of reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} from expression of type 'std::vector<std::vector<int> >'
   15 |                 reconstruct(n-1,m-1,dp,res,s,t);
      |                                     ^~
a.cc:8:38: note: in passing argument 3 of 'void reconstruct(int, int, std::string&, std::string, std::string)'
    8 | void reconstruct(int n,int m,string& res,string s,string t)
      |                              ~~~~~~~~^~~
Language: C++

int cmp(ll a, ll b, ll c, ll d){
	if(b < 0){
		a *= -1;
		b *= -1;
	}
	if(d < 0){
		d *= -1;
		c *= -1;
	}

	/*
	__int128 x = a, y = b;
	x *= d,  y *= c;
	if(x > y)
		return 1;
	if(x < y)
		return -1;
	return 0;
	*/
	
	if(b == 0 && d == 0){
		return 0;
	}
	if(b == 0){
		return 1;
	}
	if(d == 0){
		return -1;
	}

	if(a / b > c / d)
		return 1;
	else if(a / b < c / d)
		return -1;
	return -cmp(b, a % b, d, c % d);
	
}


Compiler output:
a.cc:1:9: error: 'll' was not declared in this scope
    1 | int cmp(ll a, ll b, ll c, ll d){
      |         ^~
a.cc:1:15: error: 'll' was not declared in this scope
    1 | int cmp(ll a, ll b, ll c, ll d){
      |               ^~
a.cc:1:21: error: 'll' was not declared in this scope
    1 | int cmp(ll a, ll b, ll c, ll d){
      |                     ^~
a.cc:1:27: error: 'll' was not declared in this scope
    1 | int cmp(ll a, ll b, ll c, ll d){
      |                           ^~
a.cc:1:31: error: expression list treated as compound expression in initializer [-fpermissive]
    1 | int cmp(ll a, ll b, ll c, ll d){
      |                               ^
Language: C++

#define taskname ""

#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;
#define long long long

const int N = 2e3 + 10;

int n, m, f[N][N], trace[N][N];
char s[N], t[N];

int main()
{
//    freopen(taskname".INP", "r", stdin);
//    freopen(taskname".OUT", "w", stdout);
    cin.tie(nullptr); ios_base::sync_with_stdio(false);

    cin >> s + 1 >> t + 1;
    n = strlen(s + 1), m = strlen(t + 1);

    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j) {
            f[i][j] = f[i - 1][j], trace[i][j] = 0;

            if (f[i][j - 1] > f[i][j]) f[i][j] = f[i][j - 1], trace[i][j] = 1;
            if (s[i] == t[j] && f[i][j] < f[i - 1][j - 1] + 1) {
                f[i][j] = f[i - 1][j - 1] + 1;
                trace[i][j] = 2;
            }
        }

    vector<char> res;
    int i = n, j = m;
    while (i > 0 && j > 0) {
        if (trace[i][j] == 2) {
            res.push_back(s[i]);
            --i, --j;
            continue;
        }
        if (!trace[i][j]) --i;
        else --j;
    }
    reverse(res.begin(), res.end());
    for (char cur : res) cout << cur;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:5: error: 'vector' was not declared in this scope
   35 |     vector<char> res;
      |     ^~~~~~
a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    5 | #include <cstring>
  +++ |+#include <vector>
    6 | 
a.cc:35:12: error: expected primary-expression before 'char'
   35 |     vector<char> res;
      |            ^~~~
a.cc:39:13: error: 'res' was not declared in this scope
   39 |             res.push_back(s[i]);
      |             ^~~
a.cc:46:13: error: 'res' was not declared in this scope
   46 |     reverse(res.begin(), res.end());
      |             ^~~
Language: C

#include <stdio.h>
#include <string.h>
 
int max(int a,int b){
  if(a > b){
    return a;
  }
  return b;
}
 
int main(void){
  char s[3010], t[3010];
  scanf("%s", s);
  scanf("%s", t);
 
  int N, M;
  N = strlen(s);
  M = strlen(t);
 
  int dp[N+1][M+1];
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= M; j++) {
      dp[i][j] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j]+1;
      else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
    }
  }
 
  char ans[3010];
  int num = 0;
  while(N > 0 && M > 0){
    if(dp[N][M] == dp[N-1][M]) N--;
    else if(dp[N][M] == dp[N][M-1]) M--;
    else{
      N--, M--;
      ans[num++] = s[N];
    }
  }

Compiler output:
main.c: In function 'main':
main.c:42:3: error: expected declaration or statement at end of input
   42 |   }
      |   ^
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

const int INF = 1<<29;        // 十分大きい値にする

// 入力
string S, T;

// DP テーブル

int main() {
  cin >> S >> T;
  vector<vector<string>> dp(3010,vector<string>(3010));


  memset(dp, 0, sizeof(dp));    // 初期化
  for (int i = 0; i < S.size(); ++i) {
    for (int j = 0; j < T.size(); ++j) {
      if (S[i] == T[j]) dp[i+1][j+1].push_back(s[i]);
      if(dp[i+1][j+1].size()<dp[i+1][j].size()) dp[i+1][j+1]=dp[i+1][j];
      if(dp[i+1][j+1].size()<dp[i][j+1].size()) dp[i+1][j+1]=dp[i][j+1];
    }
  }

  cout << dp[S.size()][T.size()] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'vector' was not declared in this scope
   15 |   vector<vector<string>> dp(3010,vector<string>(3010));
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:15:23: error: expected primary-expression before '>>' token
   15 |   vector<vector<string>> dp(3010,vector<string>(3010));
      |                       ^~
a.cc:15:47: error: expected primary-expression before '>' token
   15 |   vector<vector<string>> dp(3010,vector<string>(3010));
      |                                               ^
a.cc:15:26: error: 'dp' was not declared in this scope
   15 |   vector<vector<string>> dp(3010,vector<string>(3010));
      |                          ^~
a.cc:21:48: error: 's' was not declared in this scope
   21 |       if (S[i] == T[j]) dp[i+1][j+1].push_back(s[i]);
      |                                                ^
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

const int INF = 1<<29;        // 十分大きい値にする

// 入力
string S, T;

// DP テーブル
vector<vector<string>> dp(3010,vector<string>(3010));

int main() {
  cin >> S >> T;

   // 初期化
  for (int i = 0; i < S.size(); ++i) {
    for (int j = 0; j < T.size(); ++j) {
      if (S[i] == T[j]) dp[i+1][j+1].push_back(s[i]);
      if(dp[i+1][j+1].size()<dp[i+1][j].size()) dp[i+1][j+1]=dp[i+1][j];
      if(dp[i+1][j+1].size()<dp[i][j+1].size()) dp[i+1][j+1]=dp[i][j+1];
    }
  }

  cout << dp[S.size()][T.size()] << endl;
}


Compiler output:
a.cc:12:1: error: 'vector' does not name a type
   12 | vector<vector<string>> dp(3010,vector<string>(3010));
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:20:25: error: 'dp' was not declared in this scope
   20 |       if (S[i] == T[j]) dp[i+1][j+1].push_back(s[i]);
      |                         ^~
a.cc:20:48: error: 's' was not declared in this scope
   20 |       if (S[i] == T[j]) dp[i+1][j+1].push_back(s[i]);
      |                                                ^
a.cc:21:10: error: 'dp' was not declared in this scope
   21 |       if(dp[i+1][j+1].size()<dp[i+1][j].size()) dp[i+1][j+1]=dp[i+1][j];
      |          ^~
a.cc:22:10: error: 'dp' was not declared in this scope
   22 |       if(dp[i+1][j+1].size()<dp[i][j+1].size()) dp[i+1][j+1]=dp[i][j+1];
      |          ^~
a.cc:26:11: error: 'dp' was not declared in this scope
   26 |   cout << dp[S.size()][T.size()] << endl;
      |           ^~
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

const int INF = 1<<29;        // 十分大きい値にする

// 入力
string S, T;

// DP テーブル
vector<vector<string>> dp(3010,vector<string>(3010));

int main() {
  cin >> S >> T;

  memset(dp, 0, sizeof(dp));    // 初期化
  for (int i = 0; i < S.size(); ++i) {
    for (int j = 0; j < T.size(); ++j) {
      if (S[i] == T[j]) dp[i+1][j+1].push_back(s[i]);
      if(dp[i+1][j+1].size()<dp[i+1][j].size()) dp[i+1][j+1]=dp[i+1][j];
      if(dp[i+1][j+1].size()<dp[i][j+1].size()) dp[i+1][j+1]=dp[i][j+1];
    }
  }

  cout << dp[S.size()][T.size()] << endl;
}


Compiler output:
a.cc:12:1: error: 'vector' does not name a type
   12 | vector<vector<string>> dp(3010,vector<string>(3010));
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:17:10: error: 'dp' was not declared in this scope
   17 |   memset(dp, 0, sizeof(dp));    // 初期化
      |          ^~
a.cc:20:48: error: 's' was not declared in this scope
   20 |       if (S[i] == T[j]) dp[i+1][j+1].push_back(s[i]);
      |                                                ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)

using namespace std;

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
const ll mod = 1e9+7;

template<typename T> ostream& operator << (ostream& os, vector<T> v) {
  for (auto& i : v) os << i << " "; return os; 
}
template<typename T> istream& operator >> (istream& is, vector<T>& v) {
  for (auto& i : v) is >> i; return is;
}
template<typename K, typename V> ostream& operator << (ostream& os, unordered_map<K, V> m) {
  for (auto& i : m) os << i.first << ":" << i.second << endl; return os;
}
template<typename T> inline bool chmin(T& x, T y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template<typename T> inline bool chmax(T& x, T y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}

string S, T;
int dp[3010][3010];

int main() {
  cin >> S >> T;

  rep(i, 0, S.size()) rep(j, 0, T.size()) {
    if (s[i] == t[j]) chmax(dp[i+1][j+1], dp[i][j] + 1);
    chmax(dp[i+1][j+1], dp[i+1][j]);
    chmax(dp[i+1][j+1], dp[i][j+1]);
  }

  string res = "";
  int i = S.size(), j = T.size();
  while (i >0 && j > 0) {
    // (i-1, j) -> (i, j)
    if (dp[i][j] == dp[i-1][j]) i--;
    // (i, j-1) -> (i, j)
    else if (dp[i][j] == dp[i][j-1]) j--;
    // (i-1, j-1) -> (i, j)
    else {
      res = s[i-1] + res;
      i--; j--;
    }
  }
  cout << res << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: 's' was not declared in this scope
   42 |     if (s[i] == t[j]) chmax(dp[i+1][j+1], dp[i][j] + 1);
      |         ^
a.cc:42:17: error: 't' was not declared in this scope
   42 |     if (s[i] == t[j]) chmax(dp[i+1][j+1], dp[i][j] + 1);
      |                 ^
a.cc:56:13: error: 's' was not declared in this scope
   56 |       res = s[i-1] + res;
      |             ^
Language: C++

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

Compiler output:
a.cc: In function 'std::string LCS(std::string, std::string, int, int)':
a.cc:20:7: error: declaration of 'int t' shadows a parameter
   20 |   int t=dp[n][m];
      |       ^
a.cc:3:28: note: 'std::string t' previously declared here
    3 | string LCS(string s,string t,int n,int m)
      |                     ~~~~~~~^
Language: C++

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
    string s1, s2;
    getline(cin,s1);
    getline(cin,s2);
  	
  	vector<vector<int> > L;
      
	for(int i = 0 ; i < s1.length() ; i++)
    {
      for(int i = 0 ; i < s2.length() ; j++)
      {
        if(i == 0 || j == 0)
          L[i][j] = 0 ;
        else if(s1[i-1] == s2[j-1])
          L[i][j] = L[i-1][j-1] + 1;
        else
          L[i][j] = max(L[i-1][j] , L[i][j-1]);
      }
    }
  cout<<L[s1.length()][s2.length()];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:41: error: 'j' was not declared in this scope
   16 |       for(int i = 0 ; i < s2.length() ; j++)
      |                                         ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s1, s2;
    getline(cin,s1);
    getline(cin,s2);
  	
  	vector<vector<int> > L;
      
	for(int i = 0 ; i < s1.length() ; i++)
    {
      for(int i = 0 ; i < s2.length() ; j++)
      {
        if(i == 0 || j == 0)
          L[i][j] = 0 ;
        else if(s1[i-1] == s2[j-1])
          L[i][j] = L[i-1][j-1] + 1;
        else
          L[i][j] = max(L[i-1][j] , L[i][j-1]);
      }
    }
  cout<<L[s1.length()][s2.length()];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'vector' was not declared in this scope
   11 |         vector<vector<int> > L;
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:11:23: error: expected primary-expression before 'int'
   11 |         vector<vector<int> > L;
      |                       ^~~
a.cc:15:41: error: 'j' was not declared in this scope
   15 |       for(int i = 0 ; i < s2.length() ; j++)
      |                                         ^
a.cc:18:11: error: 'L' was not declared in this scope
   18 |           L[i][j] = 0 ;
      |           ^
a.cc:20:11: error: 'L' was not declared in this scope
   20 |           L[i][j] = L[i-1][j-1] + 1;
      |           ^
a.cc:22:11: error: 'L' was not declared in this scope
   22 |           L[i][j] = max(L[i-1][j] , L[i][j-1]);
      |           ^
a.cc:25:9: error: 'L' was not declared in this scope
   25 |   cout<<L[s1.length()][s2.length()];
      |         ^
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main()
{
    String s1, s2;
    getline(cin,s1);
    getline(cin,s2);
  	
  	vector<vector<int> > L;
      
	for(int i = 0 ; i < s1.length() ; i++)
    {
      for(int i = 0 ; i < s2.length() ; j++)
      {
        if(i == 0 || j == 0)
          L[i][j] = 0 ;
        else if(s1[i-1] == s2[j-1])
          L[i][j] = L[i-1][j-1] + 1;
        else
          L[i][j] = max(L[i-1][j] , L[i][j-1]);
      }
    }
  cout<<L[s1.length()][s2.length()];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'String' was not declared in this scope
    7 |     String s1, s2;
      |     ^~~~~~
a.cc:8:17: error: 's1' was not declared in this scope
    8 |     getline(cin,s1);
      |                 ^~
a.cc:9:17: error: 's2' was not declared in this scope
    9 |     getline(cin,s2);
      |                 ^~
a.cc:11:9: error: 'vector' was not declared in this scope
   11 |         vector<vector<int> > L;
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:11:23: error: expected primary-expression before 'int'
   11 |         vector<vector<int> > L;
      |                       ^~~
a.cc:15:41: error: 'j' was not declared in this scope
   15 |       for(int i = 0 ; i < s2.length() ; j++)
      |                                         ^
a.cc:18:11: error: 'L' was not declared in this scope
   18 |           L[i][j] = 0 ;
      |           ^
a.cc:20:11: error: 'L' was not declared in this scope
   20 |           L[i][j] = L[i-1][j-1] + 1;
      |           ^
a.cc:22:11: error: 'L' was not declared in this scope
   22 |           L[i][j] = max(L[i-1][j] , L[i][j-1]);
      |           ^
a.cc:25:9: error: 'L' was not declared in this scope
   25 |   cout<<L[s1.length()][s2.length()];
      |         ^
Language: C++

#include <bitsstdc++.h>
using namespace std;
const int MAX_NUMBER=3000;
#define FOR(i , x , n) for(int i = x ; i < n ; ++i)
#define REP(i , x) for(int i = 0 ; i < x ; ++i)
#define FORD(i , x , n) for(int i = x ; i >= n ; --i)
#define INT_NUMBER(i) sizeof(i)/sizeof(char)

string s, t;
int dp[MAX_NUMBER][MAX_NUMBER];
typedef struct _point {
	char letter;
	int flag=0;
}ptr;
ptr tt[MAX_NUMBER], ss[MAX_NUMBER];

int main() {

	std::cin >>  t>>s;
	dp[0][0] = 0; //dp[t][s]
	REP(i, t.size()) tt[i].letter = t[i];
	REP(i, s.size()) ss[i].letter = s[i];
	
	FOR( i, 0, (int)t.size()) {
		for(int j=0;j<(int)s.size();j++) {
			if (ss[j].letter == tt[i].letter) dp[i + 1][j + 1] = max(max(dp[i][j] + 1 , dp[i][j + 1]), dp[i + 1][j]);
			else dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
		}

	}
	string ans = "";
	int x = s.size();
	int y = t.size();
	while (x > 0 && 0 < y)
		if (s[x-1] == t[y-1]) {
			ans += s[x-1];
			x--;
			y--;
		}
		else
			if (dp[x][y - 1] > dp[x - 1][y])
				y--;
			else
				x--;
	reverse(ans.begin(), ans.end());
	cout << ans;
}

	

Compiler output:
a.cc:1:10: fatal error: bitsstdc++.h: No such file or directory
    1 | #include <bitsstdc++.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 of " << X << " and " << Y << " is " << lcs; 
} 

/* Driver program to test above function */
int main() 
{ 
 char m[300],n[300];
  cin>>m>>n;
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:5: error: conflicting declaration 'int m'
   64 | int m = strlen(X);
      |     ^
a.cc:62:7: note: previous declaration as 'char m [300]'
   62 |  char m[300],n[300];
      |       ^
a.cc:64:16: error: 'X' was not declared in this scope
   64 | int m = strlen(X);
      |                ^
a.cc:65:5: error: conflicting declaration 'int n'
   65 | int n = strlen(Y);
      |     ^
a.cc:62:14: note: previous declaration as 'char n [300]'
   62 |  char m[300],n[300];
      |              ^
a.cc:65:16: error: 'Y' was not declared in this scope
   65 | int n = strlen(Y);
      |                ^
Language: C++

# include <iostream>
# include <vector>
using namespace std;

#include <algorithm>

int main(){
  string S, T;
  cin >> S >> T;

  int n = S.length();
  int m = T.length();

  string ans = "";
  
  int dp[n+1][m+1];

  for (int i=0;i<n+1;i++){
    for (int j=0;j<n+1;j++){
      dp[i][j] = 0;
    }
  }

  for (int i=1;i<=n;i++){
    for (int j=1;j<=m;j++){
      // if (i==n-1 && j==m-1) cout << dp[i][j+1] << dp[i][j+1]<<"c";
      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], dp[i-1][j]);
      }
    }
  }
  int d = dp[n][m];
  int x = n;
  int y = m;

  while(x>0 && y>0){
    //cout << d;
    if(dp[x][y]==d[x][y-1]){
      y--;
    }
    else if(dp[x][y]==d[x-1][y]){
      x--;
    }
    else{
      //cout << S[x-1];
      x--, y--, d--;
      ans.push_back(S[x]);
    }
  }
  //for (int i=dp[n][m];i>=0;i--)  cout <<  ans[i];
  reverse(ans.begin(), ans.end());
  cout << ans <<endl;
  // cout <<"aa" <<dp[n][m] << dp[n-1][m]<<dp[n][m-1] <<ans << endl;
   return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:41:19: error: invalid types 'int[int]' for array subscript
   41 |     if(dp[x][y]==d[x][y-1]){
      |                   ^
a.cc:44:24: error: invalid types 'int[int]' for array subscript
   44 |     else if(dp[x][y]==d[x-1][y]){
      |                        ^
Language: C

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

int main(){

char t[3000];
char s[3000];
char x[3000][3000];
int a = 0, b=0, c=0, d, e, f;

scanf("%s", s);
scanf("%s", t);

d = strlen(s);
e = strlen(t);

if(d>e){
    
  for(int i = 0; i<d; i++){
	for(int j = i; j<d; j++){
	if(s[i] == t[j]){
    	x[c] = s[i];
    	c++;
  }
}
}
}else{

  for(int i = 0; i<e; i++){
	for(int j = 0; j<e; j++){
	if(t[i] == s[j]){
    	x[a][c] = t[i];
    	c++;
    	i++;
  }else{
  	i++;
  }
  }
}
}


  
 	for(int i = 0; i < c; i++){
    		printf("%c", x[i]);	
  }

    
  return 0;

}











Compiler output:
main.c: In function 'main':
main.c:23:14: error: assignment to expression with array type
   23 |         x[c] = s[i];
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std; 
int main(){
	int i, j;
	int tamX, tamY;
	int woo[100000][100000];
    string x, y, aux;
    cin >> x >> y;
    tamX = x.size();
    tamY = y.size();
    for(i = 0; i < tamX; ++i)
        for(j = 0; j < tamY; ++j)
            woo[i+1][j+1] = max({woo[i+1][j], woo[i][j+1], (x[i] == y[j]) + woo[i][j]});
    while(i and j){
        if(woo[i][j-1] > woo[i-1][j])
            j--;
        else if(x[i-1] == y[j-1]){
            aux += x[i-1];
            i--;
            j--;
         	}   
        else
            i--;
    }
    
    res = reverse(aux.begin(), aux.end());
    cout << res;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'res' was not declared in this scope
   26 |     res = reverse(aux.begin(), aux.end());
      |     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std; 
int main(){
	int i, j;
	int tamX, tamY;
	int woo[100000][100000];
    string x, y, aux;
    cin >> x >> y;
    tamX = x.size();
    tamY = y.size();
    for(i = 0; i < tamX; ++i)
        for(j = 0; j < tamY; ++j)
            woo[i+1][j+1] = max({woo[i+1][j], woo[i][j+1], (x[i] == y[j]) + woo[i][j]});
    while(i and j){
        if(woo[i][j-1] > woo[i-1][j])
            j--;
        else if(x[i-1] == y[j-1])
            aux += x[i-1];
            i--;
            j--;
        else
            i--;
    }
    
    lcs = reverse(aux.begin(), aux.end());
    cout << lcs;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'else' without a previous 'if'
   21 |         else
      |         ^~~~
a.cc:25:5: error: 'lcs' was not declared in this scope
   25 |     lcs = reverse(aux.begin(), aux.end());
      |     ^~~
Language: C++

#include <iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
#define FOR(i,a) for(int i=0;i<a;i++)
int main()
{
	string str1, str2; cin >> str1 >> str2;
	int len1 = str1.length();
	int len2 = str2.length();

	int dp[3002][3002];
	memset(dp, 0, sizeof(dp));
	bool dir[3002][3002];
	
	//false meaning increase first 
	//true meaning increase second
	FOR(i, len1) {
		FOR(a, len2) {
			if (str1[i] == str2[a]) {
				dp[i + 1][a+1] = dp[i][a] + 1;
			}
			else if (dp[i + 1][a]> dp[i][a+1]) {
				dp[i + 1][a+1] = dp[i + 1][a];
				dir[i + 1][a+1] = true;
			}
			else {
				dp[i + 1][a+1] = dp[i][a+1];
				dir[i + 1][a + 1] = false;
			}
		}
	}
	string out = "";
	
	int i, a; i = len1 - 1; a = len2 - 1;
	
	while (i>=0&&a>=0) {
		//cout << i << " " << a << "\n";
		//cout << dir[i + 1][a + 1] << "\n";
		if (str1[i] == str2[a]) {
			out += str1[i];
			i--;
			a--;
		}
		else if (dir[i+1][a+1]) {
			a--;
		}
		else {
			i--;
		}
	}
	reverse(out.begin(), out.end());
	cout << out<< "\n";
}


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

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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define abrep(i, a, b) for(int i = a; i < b; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define abrrep(i, a, b) for(int i = b-1; i >= a; --i)
typedef long long ll;


int main(){
  	string s1, s2;
  	cin>>s1>>s2;
  	int ls1,ls2;
  	ls1 = s1.length();
  	ls2 = s2.length();
  	int dp[ls1][ls2];
  	char p[ls1][ls2];
  	rep(i, ls1)
      rep(j, ls2){
      	dp[i][j] = 0;
  		p[i][j] = 'c';
      }
  	int idx;
  	idx = s1.find(s2.front(), 0);
  	if(idx != string::npos)
  		abrep(i, idx, ls1)
      		dp[i][0] = 1;
  	idx = s2.find(s1.front(), 0);
  	if(idx != string::npos)
  		abrep(i, idx, ls2)
      		dp[0][i] = 1;
  	abrep(i, 1, ls1)
      abrep(j, 1, ls2){
    	if(s1.at(i) == s2.at(j)){
          	dp[i][j] = dp[i-1][j-1] + 1;
      		p[i][j] = 'c';
        }
      	else{
          	dp[i][j] = dp[i-1][j]>dp[i][j-1]?dp[i-1][j]:dp[i][j-1];
      		p[i][j] = dp[i-1][j]>dp[i][j-1]?'l':'u';
        }
    }
  	char s[dp[ls1-1][ls2-1]];
	int i = dp[ls1-1][ls2-1] - 1;
  	int ax = ls1 - 1, ay = ls2 - 1;
  	while(i>=0){
      	while(p[ax][ay] != 'c'){
        	if(p[ax][ay] == 'l'){
              ax -= 1;
            }
          	else{
              ay -= 1;
            }
        }
      	if ax != 0:
      		s[i] = s2.at(ay);
      	else:
      		s[i] = s1.at(0);
      	--i;--ax;--ay;
    }
	rep(i, dp[ls1-1][ls2-1])
      	cout<<s[i];
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:12: error: expected '(' before 'ax'
   56 |         if ax != 0:
      |            ^~
      |            (
a.cc:58:9: error: 'else' without a previous 'if'
   58 |         else:
      |         ^~~~
a.cc:58:13: error: expected primary-expression before ':' token
   58 |         else:
      |             ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
	char s[100000],s2[100000],res[100000];
	long long dp[1000][1000],n,m,k,dem,i,j;
	cin>>s>>s2;
	n=strlen(s);
	m=strlen(s2);
	for(long long i=0;i<n;i++){
		for(long long j=0;j<m;j++){
			if(s[i]==s2[j]){
				dp[i][j]=1+dp[i-1][j-1];
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	dem=dp[n-1][m-1];
	char res[dem+1];
	i=n-1,j=m-1;
	dem--;
	while(i>=0&&j>=0){
		if(s[i]==s2[j]){
			res[dem]=s[i];
			i--;
			j--;
			dem--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
		i--;
		else
		j--;
	}
	cout<<res;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: conflicting declaration 'char res [(dem + 1)]'
   22 |         char res[dem+1];
      |              ^~~
a.cc:6:35: note: previous declaration as 'char res [100000]'
    6 |         char s[100000],s2[100000],res[100000];
      |                                   ^~~
Language: C++

#include<string>
#include<string.h>
#include<algorithm>

using namespace std;
char s[100000],s2[100000],res[100000];
long long dp[1000][1000],n,m,k,dem,i,j;
void comp(){
	for(long long i=0;i<n;i++){
		for(long long j=0;j<m;j++){
			if(s[i]==s2[j]){
				dp[i][j]=1+dp[i-1][j-1];
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
}
void find(){
	dem=dp[n-1][m-1];
	i=n-1,j=m-1;
	dem--;
	while(i>=0&&j>=0){
		if(s[i]==s2[j]){
			res[dem]=s[i];
			i--;
			j--;
			dem--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
		i--;
		else
		j--;
	}
}
int main(){
	gets(s);
	gets(s2);
	n=strlen(s);
	m=strlen(s2);
	comp();
	find();
	puts(res);
}

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

#include<bits/stdc++.h>

using namespace std;
char s[100000],s2[100000],res[100000];
long long dp[1000][1000],n,m,k,dem,i,j;
void comp(){
	for(long long i=0;i<n;i++){
		for(long long j=0;j<m;j++){
			if(s[i]==s2[j]){
				dp[i][j]=1+dp[i-1][j-1];
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
}
void find(){
	dem=dp[n-1][m-1];
	i=n-1,j=m-1;
	dem--;
	while(i>=0&&j>=0){
		if(s[i]==s2[j]){
			res[dem]=s[i];
			i--;
			j--;
			dem--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
		i--;
		else
		j--;
	}
}
int main(){
	gets(s);
	gets(s2);
	n=strlen(s);
	m=strlen(s2);
	comp();
	find();
	printf("%s", res);
}


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

#include<bits/stdc++.h>

using namespace std;
char s[100000],s2[100000],res[100000];
long long dp[100][100],n,m,k,dem;
void nhap(){
	gets(s); gets(s2);
	n=strlen(s);
	m=strlen(s2);
}
void comp(){
	for(long long i=0;i<n;i++){
		for(long long j=0;j<m;j++){
			if(s[i]==s2[j]){
				dp[i][j]=1+dp[i-1][j-1];
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
}
void print(){
	for(long long i=0;i<n;i++){
		for(long long j=0;j<m;j++){
			printf("%lld ", dp[i][j]);
		}
		printf("\n");
	}
}
void find(){
	dem=k=dp[n-1][m-1];
	dem--;
	long long i=n-1;
	long long j=m-1;
	while(dem>=0){
		if(dp[i][j-1]==k)
		j--;
		else{
			res[dem]=s2[i];
			dem--;
			i--;
			j--;
		}
	}
}
int main(){
	nhap();
	comp();
//	print();
	find();
	puts(res);
	
}


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

#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
    ll int jhogeo = 1;
    rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
    return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}

int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}

int dp[3010][3010]={0};

int main(){
  string s,t; cin>>s,t;
  int Ls=s.length();
  int Lt=t.length();

  //横軸t、縦軸s
  rep(i,0,Ls){

    rep(j,0,Lt){
      const char* S = s[i];
      const char* T = t[i];
      if(j>0&&i>0){
        dp[i][j]=max(dp[i-1][j],dp[i][j-1])+!strncmp(S,T,1);
      }else if(j>0&&i==0){
        dp[i][j]=dp[i][j-1]+!strncmp(S,T,1);
      }else if(j==0&&i>0){
        dp[i][j]=dp[i-1][j]+!strncmp(S,T,1);
      }
      
        
    }
  }

  cout<<dp[Ls-1][Lt-1];
  cout<<endl;

  rep(i,0,Ls+1){
    rep(j,0,Lt+1){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }


//    cout<<(!strncmp(s[0],t[0],1))*INF;
  
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順

Compiler output:
a.cc: In function 'int main()':
a.cc:60:26: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   60 |       const char* S = s[i];
      |                          ^
      |                          |
      |                          __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
a.cc:61:26: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   61 |       const char* T = t[i];
      |                          ^
      |                          |
      |                          __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
Language: Java

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

public class dpf {

	public static void main(String[] args) {

		FastReader sc = new FastReader(System.in);
		
		String s1 = sc.next();
		String s2 = sc.next();
		
		String [][] dp = new String [s1.length()+1][s2.length()+1];
		
		for (int i=0; i<=s1.length(); i++) {
			for (int j=0; j<=s2.length(); j++) {
				if (i == 0 || j == 0)
					dp[i][j] = "";
				else if (s1.charAt(i-1) == s2.charAt(j-1))
					dp[i][j] = dp[i-1][j-1] + s1.charAt(i-1);
				else
					dp[i][j] = dp[i-1][j].length() > dp[i][j-1].length() ? dp[i-1][j] : dp[i][j-1];
			}
		}
		
		System.out.println(dp[s1.length()][s2.length()]);
		
	}
	
	static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream I) {
            br = new BufferedReader(new InputStreamReader(I));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

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

#include <stdio.h>
#include <string.h>
#define ok printf("ok\n");
#define inf 100000

char s[3100];
char t[3100];
int dp[3100][3100];
int rev[3100][3100];

int main(){
    scanf("%s%s", s, t);

    int sl=strlen(s);
    int tl=strlen(t);

    for(int i=0; i<3100; i++){
        for(int j=0; j<3100; j++){
            dp[i][j]=-inf;
        }
    }
    dp[0][0]=0;

    for(int i=0; i<=sl; i++){
        for(int j=0; j<=tl;j++){
            if(i+1<=sl){
                if(dp[i+1][j]<dp[i][j]){
                    dp[i+1][j]=dp[i][j];
                    rev[i+1][j]=0;
                }
            }
            if(j+1<=tl){
                if(dp[i][j+1]<dp[i][j]){
                    dp[i][j+1]=dp[i][j]+;
                    rev[i][j+1]=1;
                }
            }
            if(i+1<=sl && j+1<=tl && s[i]==t[j]){
                if(dp[i+1][j+1]<dp[i][j]+1){
                    dp[i+1][j+1]=dp[i][j]+1;
                    rev[i+1][j+1]=2;
                }
            }
        }
    }

    int ns=sl;
    int nt=tl;
    int at=dp[sl][tl]-1;
    while(ns || nt){
        if(rev[ns][nt]==0)
            ns--;
        else if(rev[ns][nt]==1) nt--;
        else {
            ns--;nt--;
            ans[at]=s[ns];
            at--;
        }
    }

    printf("%s", ans);

}


Compiler output:
main.c: In function 'main':
main.c:34:41: error: expected expression before ';' token
   34 |                     dp[i][j+1]=dp[i][j]+;
      |                                         ^
main.c:56:13: error: 'ans' undeclared (first use in this function); did you mean 'ns'?
   56 |             ans[at]=s[ns];
      |             ^~~
      |             ns
main.c:56:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
#include<String>
#include<math.h>

using namespace std;


string LCS(string a, string b){
	
	int tamLinha = a.length(), tamCol = b.length();
	
	int LCS[tamLinha+1][tamCol+1] = {};
	
	for(int i = 1; i <= tamLinha; i++){
		for(int j = 1; j <= tamCol; j++){
			if(a[i-1] == b[j-1])
				LCS[i][j] = 1 + LCS[i-1][j-1];
			else
				LCS[i][j] = max(LCS[i-1][j], LCS[i][j-1]);
		}
	}
	
	//achar a LCS
	int tamLCS = LCS[tamLinha][tamCol];
	char palavra[tamLCS+1];
	palavra[tamLCS] = '\0';
	
	while(tamLCS > 0 && tamLinha > 0 && tamCol > 0){
		if(LCS[tamLinha - 1][tamCol] == LCS[tamLinha][tamCol - 1]){
			if(LCS[tamLinha-1][tamCol-1] < LCS[tamLinha][tamCol]){
				palavra[tamLCS-1] = a[tamLinha-1];
				tamLCS--;
			}
			tamLinha--;
			tamCol--;
		}
		else if(LCS[tamLinha][tamCol] == LCS[tamLinha - 1][tamCol]){
			tamLinha--;
		}
		else if(LCS[tamLinha][tamCol] == LCS[tamLinha][tamCol - 1]){
			tamCol--;
		}
		
	} 
	
	return palavra;
}


int main(){

	string A, B, C;
	
	cin>>A>>B;
	
	cout<<LCS(A, B)<<endl;
	

return 0;
}


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

#include<stdio.h>
#define int long long
int maxx(int a,int b){
	if(a>b)
		return a;
	else 
		return b;	
}
int main()
{
	// scanf("%d %d",&n,&m)/;
	char a[max];
	char b[max];
	scanf("%s",a);
	scanf("%s",b);
	int n = strlen(a);
	int m = strlen(b);
	int lcs[n+1][m+1];
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			if(i==0 || j==0)
				lcs[i][j]=0;
			else if(a[i-1]==b[j-1])
				lcs[i][j]=1+lcs[i-1][j-1];
			else
				lcs[i][j]=maxx(lcs[i-1][j],lcs[i][j-1]);
		}
	}
	printf("%ld\n",lcs[n][m]);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:16: error: 'max' undeclared (first use in this function); did you mean 'maxx'?
   12 |         char a[max];
      |                ^~~
      |                maxx
main.c:12:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:17: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   16 |         int n = strlen(a);
      |                 ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | #define int long long
main.c:16:17: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   16 |         int n = strlen(a);
      |                 ^~~~~~
main.c:16:17: note: include '<string.h>' or provide a declaration of 'strlen'