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

#include <stdio.h>

int c[1001][1001];

int length(const char *s[])
{
  int len;
  len=0;
  while(*s[len]++){
    len++;
  }
  return len;
}

int lcs(char X[],char Y[],int m,int n)

  int i,j,max1;
  max1=0;
  for(i=0;i<=m;i++){
    c[i][0]=0;
  }
  for(j=1;j<=n;j++){
    c[0][j]=0;
  }
  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(X[i]==Y[j]){
        c[i][j]=c[i-1][j-1]+1;
      }
      else if(c[i-1][j]>=c[i][j-1]){
        c[i][j]=c[i-1][j];
      }
      else{
        c[i][j]=c[i][j-1];
      }
    if(max1>c[i][j]){
      max1=c[i][j];
    }
  }
  return max1;
}

int main()
{
  int N,max[151],ml,nl;
  char m[1001],n[1001];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%s",&m[i]);
    scanf("%s",&n[i]);
    ml=length(m);
    nl=length(n);
    max[i]=lcs(ml,nl,m,n);
    printf("%d\n",max[i]);
  }
  return 0;
}

Compiler output:
main.c: In function 'lcs':
main.c:18:3: error: expected declaration specifiers before 'max1'
   18 |   max1=0;
      |   ^~~~
main.c:19:3: error: expected declaration specifiers before 'for'
   19 |   for(i=0;i<=m;i++){
      |   ^~~
main.c:19:11: error: expected declaration specifiers before 'i'
   19 |   for(i=0;i<=m;i++){
      |           ^
main.c:19:16: error: expected declaration specifiers before 'i'
   19 |   for(i=0;i<=m;i++){
      |                ^
main.c:22:3: error: expected declaration specifiers before 'for'
   22 |   for(j=1;j<=n;j++){
      |   ^~~
main.c:22:11: error: expected declaration specifiers before 'j'
   22 |   for(j=1;j<=n;j++){
      |           ^
main.c:22:16: error: expected declaration specifiers before 'j'
   22 |   for(j=1;j<=n;j++){
      |                ^
main.c:25:3: error: expected declaration specifiers before 'for'
   25 |   for(i=1;i<=m;i++){
      |   ^~~
main.c:25:11: error: expected declaration specifiers before 'i'
   25 |   for(i=1;i<=m;i++){
      |           ^
main.c:25:16: error: expected declaration specifiers before 'i'
   25 |   for(i=1;i<=m;i++){
      |                ^
main.c:44:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   44 | {
      | ^
main.c:15:5: error: old-style parameter declarations in prototyped function definition
   15 | int lcs(char X[],char Y[],int m,int n)
      |     ^~~
main.c:59: error: expected '{' at end of input
Language: C

#include <stdio.h>

int c[1001][1001];

int length(const char *s[])
{
  int len;
  len=0;
  while(*s[len]++){
    len++;
  }
  return len;
}

int lcs(char X[],char Y[],int m,int n)

  int i,j,max1;
  max1=0;
  for(i=0;i<=m;i++){
    c[i][0]=0;
  }
  for(j=1;j<=n;j++){
    c[0][j]=0;
  }
  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(X[i]==Y[j]){
        c[i][j]=c[i-1][j-1]+1;
      }
      else if(c[i-1][j]>=c[i][j-1]){
        c[i][j]=c[i-1][j];
      }
      else{
        c[i][j]=c[i][j-1];
      }
    if(max1>c[i][j]){
      max1=c[i][j];
    }
  }
  return max1;
}

int main()
{
  int i,N,max[151],ml,nl;
  char m[1001],n[1001];

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%s",&m[i]);
    scanf("%s",&n[i]);
    ml=length(m);
    nl=length(n);
    max[i]=lcs(ml,nl,m,n);
    printf("%d\n",max[i]);
  }
  return 0;
}

Compiler output:
main.c: In function 'lcs':
main.c:18:3: error: expected declaration specifiers before 'max1'
   18 |   max1=0;
      |   ^~~~
main.c:19:3: error: expected declaration specifiers before 'for'
   19 |   for(i=0;i<=m;i++){
      |   ^~~
main.c:19:11: error: expected declaration specifiers before 'i'
   19 |   for(i=0;i<=m;i++){
      |           ^
main.c:19:16: error: expected declaration specifiers before 'i'
   19 |   for(i=0;i<=m;i++){
      |                ^
main.c:22:3: error: expected declaration specifiers before 'for'
   22 |   for(j=1;j<=n;j++){
      |   ^~~
main.c:22:11: error: expected declaration specifiers before 'j'
   22 |   for(j=1;j<=n;j++){
      |           ^
main.c:22:16: error: expected declaration specifiers before 'j'
   22 |   for(j=1;j<=n;j++){
      |                ^
main.c:25:3: error: expected declaration specifiers before 'for'
   25 |   for(i=1;i<=m;i++){
      |   ^~~
main.c:25:11: error: expected declaration specifiers before 'i'
   25 |   for(i=1;i<=m;i++){
      |           ^
main.c:25:16: error: expected declaration specifiers before 'i'
   25 |   for(i=1;i<=m;i++){
      |                ^
main.c:44:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   44 | {
      | ^
main.c:15:5: error: old-style parameter declarations in prototyped function definition
   15 | int lcs(char X[],char Y[],int m,int n)
      |     ^~~
main.c:59: error: expected '{' at end of input
Language: C

#include<stdio.h>
#include<string.h>
#define N 1000

char X[N], Y[N];

void LCS(char X[], Y[])
{
   int i, j;
   int C[1000][1000];





}

int main()
{
   int i, q;

   scanf("%d", &q);

   for (i=0; i<q; i++)
      scanf("%d %d", X, Y);
      LCS(X, Y);
   }

   return 0;
}

Compiler output:
main.c:7:20: error: expected declaration specifiers or '...' before 'Y'
    7 | void LCS(char X[], Y[])
      |                    ^
main.c: In function 'main':
main.c:26:7: error: implicit declaration of function 'LCS' [-Wimplicit-function-declaration]
   26 |       LCS(X, Y);
      |       ^~~
main.c: At top level:
main.c:29:4: error: expected identifier or '(' before 'return'
   29 |    return 0;
      |    ^~~~~~
main.c:30:1: error: expected identifier or '(' before '}' token
   30 | }
      | ^
Language: C

#include<stdio.h>
#include<string.h>
#define N 1001

char x[N],y[N];
int a[N][N];
int u,v;
int main(void){
int n,i;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%s %s",x,y);
printf("%d\n",lcs(x,y));
}
return 0;
}
int lcs(char x[] ,char y[]){
int i,j;
u=strlen(x);
v=strlen(y);
for(i=1;i<=u;i++){
a[i][0] = 0;
}
for(j=0;j<=v;j++){
a[0][j] = 0;
}
for(i=1;i<=u;i++){
for(j=1;j<=v;j++){
if(x[i]==y[j]){
a[i][j]=a[i-1][j-1]+1;}
else if(a[i-1][j]>=a[i][j-1]){
a[i][j]=a[i-1][j];}
else{
a[i][j]=a[i][j-1];}
}
}
return a[x][y];
}

Compiler output:
main.c: In function 'main':
main.c:13:15: error: implicit declaration of function 'lcs' [-Wimplicit-function-declaration]
   13 | printf("%d\n",lcs(x,y));
      |               ^~~
main.c: In function 'lcs':
main.c:37:9: error: array subscript is not an integer
   37 | return a[x][y];
      |         ^
Language: C

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


int main(void){
int n,i;
int x[1000],y[1000];
scanf("%d",&n);
for(i=0;i<=n;i++){
scanf("%s %s",x,y);
printf("%d\n",lcs(x,y));
}
return 0;
}
int lcs(char x[] ,char y[]){
int a[u+1][v+1];
int i,j;
u=strlen(x);
v=strlen(y);
for(i=0;i<=u;i++){
a[i][0] = 0;
}
for(j=0;j<=v;j++){
a[0][j] = 0;
}
for(i=1;i<=u;i++){
for(j=1;j<=v;j++){
if(x[i-1]==y[j-1])
a[i][j]=a[i-1][j-1]+1;
else if(a[i-1][j]>=a[i][j-1])
a[i][j]=a[i-1][j];
else
a[i][j]=a[i][j-1];}

}
return a[u][v];
}

Compiler output:
main.c: In function 'main':
main.c:11:15: error: implicit declaration of function 'lcs' [-Wimplicit-function-declaration]
   11 | printf("%d\n",lcs(x,y));
      |               ^~~
main.c: In function 'lcs':
main.c:16:7: error: 'u' undeclared (first use in this function)
   16 | int a[u+1][v+1];
      |       ^
main.c:16:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:12: error: 'v' undeclared (first use in this function)
   16 | int a[u+1][v+1];
      |            ^
Language: C

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


int main(void){
int n,i;
int x[1000],y[1000];
scanf("%d",&n);
for(i=0;i<=n;i++){
scanf("%s %s",x,y);
printf("%d\n",lcs(x,y));
}
return 0;
}
int lcs(char x[] ,char y[]){
int a[u+1][v+1];
int i,j;
int u=strlen(x);
int v=strlen(y);
for(i=0;i<=u;i++){
a[i][0] = 0;
}
for(j=0;j<=v;j++){
a[0][j] = 0;
}
for(i=1;i<=u;i++){
for(j=1;j<=v;j++){
if(x[i-1]==y[j-1])
a[i][j]=a[i-1][j-1]+1;
else if(a[i-1][j]>=a[i][j-1])
a[i][j]=a[i-1][j];
else
a[i][j]=a[i][j-1];}

}
return a[u][v];
}

Compiler output:
main.c: In function 'main':
main.c:11:15: error: implicit declaration of function 'lcs' [-Wimplicit-function-declaration]
   11 | printf("%d\n",lcs(x,y));
      |               ^~~
main.c: In function 'lcs':
main.c:16:7: error: 'u' undeclared (first use in this function)
   16 | int a[u+1][v+1];
      |       ^
main.c:16:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:12: error: 'v' undeclared (first use in this function)
   16 | int a[u+1][v+1];
      |            ^
Language: C

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

int max(int a,int b){
 if(a>b)return a;

return b;
}

int LCS(char X[],char Y[]){
int i,j;
int dp[100][100];

for(i=0;i<=strlen(X);i++){
 for(j=0;j<=strlen(Y);j++){
  dp[j][i]=-1;
 }
}

for(i=0;i<=strlen(X);i++)dp[0][i]=0;
for(i=0;i<=strlen(Y);i++)dp[i][0]=0;

for(i=1;i<=strlen(X);i++){
 for(j=1;j<=strlen(Y);j++){
   if(X[i]==Y[j])dp[j][i]=dp[j-1][i-1]+1;
   else dp[j][i]=max(dp[j][i-1],dp[j-1][i]);
 }
}

return dp[strlen(Y)][strlen(X)];
}



int main(){
char X[100];
char Y[100];
int i,j,n;
int dp[100][100];

scanf("%d",&n);


for(i=0;i<n;i++){
 scanf("%s",X);
 scanf("%s",Y);

 a=LCS(X,Y);

 printf("%d\n",a);
}

return 0;
}


Compiler output:
main.c: In function 'main':
main.c:48:2: error: 'a' undeclared (first use in this function)
   48 |  a=LCS(X,Y);
      |  ^
main.c:48:2: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<string.h>
  
#define MAX 1010
#define max(a,b) ((a<b)?b:a)
  
char s[MAX], t[MAX];
int dp[MAX][MAX]==0;
  
int LCS() {
  int n = strlen(s);
  int m = strlen(t);

  int i,j,maxi=0;
  for(i=0;i<n;i++) {
    for(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( s[i] == t[j] ) {
    dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+1);
    maxi = max(maxi,dp[i+1][j+1]);
      }
    }
  }
  return maxi;
}
  
int main() {
  int n,i;
  scanf("%d",&n);
  for(i=0;i<n;i++) {
  scanf(" %s",&s[0]);
  scanf(" %s",&t[0]);
  printf("%d\n",LCS());
  }
  return 0;
}


Compiler output:
main.c:8:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '==' token
    8 | int dp[MAX][MAX]==0;
      |                 ^~
main.c: In function 'LCS':
main.c:17:15: error: 'dp' undeclared (first use in this function)
   17 |       if( i ) dp[i][j] = max(dp[i][j],dp[i-1][j]);
      |               ^~
main.c:17:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

from string import ascii_letters

def llcs(x, y):
    pm = dict((zip(ascii_letters, [0] * 52)))
    for c in pm:
        for i, xc in enumerate(x):
            if c == xc:
                pm[c] |= (1 << i)
    
    V = (1 << len(x)) - 1
    
    for yc in y:
        V = ((V + (V & pm[yc])) | (V & ~pm[yc]))
    
    ans = bin(V)[-len(x):].count('0')
    
    return ans

from sys import stdin

def solve():
    file_input = stdin
    q = int(file_input.readline())
    for i in range(q):
        s1 = file_input.readline().rstrip()
        s2 = file_input.readline().rstrip()
        print(llcs(s1, s2))

solve()


Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from string import ascii_letters
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(n,a) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


void f(){
  string x,y;
  cin>>x>>y;
  int dp[1100][1100]={};
  
  rep(i,x.length()+1){
    rep(j,y.length()+1){
      if(i==0||j==0) continue;
      if(x[i-1]==y[j-1]) dp[i][j]=dp[i-1][j-1]+1;
      else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
      }
    }
  }

  cout<<dp[(int)x.length()][(int)y.length()]<<endl;
}


int main(){
  int q;
  cin>>q;
  while(q--){
    f();
  }
}


Compiler output:
a.cc:33:3: error: expected declaration before '}' token
   33 |   }
      |   ^
a.cc:35:3: error: 'cout' does not name a type
   35 |   cout<<dp[(int)x.length()][(int)y.length()]<<endl;
      |   ^~~~
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

n=int(input())
ans=[]
for k in range(n):
    s1=input()
    s2=input()
    dp=[[0 for i in range(len(s2)+1)] for j in range(len(s1)+1)]
    for i in range(1,len(s1)+1):
        for j in range(1,len(s2)+1):
            if s1[i-1]==s2[j-1]:
                dp[i][j]=dp[i-1][j-1]+1
            else:
                dp[i][j]=max(dp[i-1][j],dp[i][j-1])


    ans.append(dp[len(s1)][len(s2)])
for a in ans:
    print(a)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: C++

n=int(input())
ans=[]
for k in range(n):
    s1=input()
    s2=input()
    dp=[[0 for i in range(len(s2)+1)] for j in range(len(s1)+1)]
    for i in range(1,len(s1)+1):
        for j in range(1,len(s2)+1):
            if s1[i-1]==s2[j-1]:
                dp[i][j]=dp[i-1][j-1]+1
            else:
                dp[i][j]=max(dp[i-1][j],dp[i][j-1])


    ans.append(dp[len(s1+1)][len(s2+1)])
for a in ans:
    print(a)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: C++

#include <iostream>
#include <string>

/*int LCS(std::string str1, std::string str2, int i, int j){
  if(str1[i] == str2[j]){
    return 1;
  }
  else{
    return 0;
  }
 }
*/

int max(int a, int b, int c){
  int m = a;
  if(b > m){
    m = b;
  }
  if(c > m){
    m = c;
  }
  return m;
}

int main(){
  int q;
  std::cin >> q;
  //int ans[q];
  std::string str1, str2;
  for(int z=0; z<q; z++){
    std::cin >> str1 >> str2;
    int l1 = str1.size();
    int l2 = str2.size();
    int DP[l1+1][l2+1];

    for(int i=0; i<=l1; i++){
      DP[i][0] = 0;
    }
    for(int j=0; j<=l2; j++){
      DP[0][j] = 0;
    }

    for(int i=1; i<=l1; i++){
      for(int j=1; j<=l2; j++){
	if(str1[i-1] == str2[j-1]){
	  DP[i][j] = max(DP[i-1][j], DP[i][j-1], DP[i-1][j-1] + 1);
	}
	else{
	  DP[i][j] = max(DP[i-1][j], DP[i][j-1], DP[i-1][j-1]);
      }
    }
    //ans[z] = DP[l1][l2];
    std::cout << DP[l1][l2] << std::endl;
  }

  /*for(int z=0; z<q; z++){
    std::cout << ans[z] << std::endl;
    }*/
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:2: error: expected '}' at end of input
   60 | }
      |  ^
a.cc:25:11: note: to match this '{'
   25 | int main(){
      |           ^
Language: C++

def lcs(l1,l2):
    dp=[[0 for x in range(len(l2)+1)] for y in range(len(l1)+1)]

    for i in range(1,len(l1)+1):
        for j in range(1,len(l2)+1):
            if l1[i-1]==l2[j-1]:
                dp[i][j]=dp[i-1][j-1]+1
            else:
                dp[i][j]=max(dp[i-1][j],dp[i][j-1])
                
    return dp[len(l1)][len(l2)]


a=[]
n=int(input())
for i in range(n):
    l1=list(input())
    l2=list(input())
    a+=[lcs(l1,l2)]

for i in range(n):
    print(a[i])



Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def lcs(l1,l2):
      | ^~~
Language: C++

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

string X, Y;
int v[1001][1001];

int  dp(string X, string Y) {
	int n = X.size();
	int m = Y.size();
	memset(v, 0, sizeof(v));
	for (int i = 0; i <= n; i++) {
		v[i][0] = 0;											///０のテーブル
		for (int j = 0; j <= m; j++) {
			v[0][j] = 0;
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (X[i-1] == Y[j-1]) {
				v[i][j] = v[i - 1][j - 1] + 1;
			}
			else {
				v[i][j] = max(v[i - 1][j], v[i][j - 1]);
			}
		}
	}
	return v[n][m];
}

int main(void)
{
	int x;
	cin >> x;
	
	for (int i = 0; i < x; i++) {
		cin >> X >> Y;
		int ans = dp(X, Y);
		cout << ans << endl;
	}
	
	system("pause");
}


Compiler output:
a.cc: In function 'int dp(std::string, std::string)':
a.cc:12:9: error: 'memset' was not declared in this scope
   12 |         memset(v, 0, sizeof(v));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

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

string X, Y;
int v[1001][1001];

int  dp(string X, string Y) {
	int n = X.size();
	int m = Y.size();
	memset(v, 0, sizeof(v));
	for (int i = 0; i <= n; i++) {
		v[i][0] = 0;											///０のテーブル
		for (int j = 0; j <= m; j++) {
			v[0][j] = 0;
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (X[i-1] == Y[j-1]) {
				v[i][j] = v[i - 1][j - 1] + 1;
			}
			else {
				v[i][j] = max(v[i - 1][j], v[i][j - 1]);
			}
		}
	}
	return v[n][m];
}

int main(void)
{
	int x;
	cin >> x;
	
	for (int i = 0; i < x; i++) {
		cin >> X >> Y;
		int ans = dp(X, Y);
		cout << ans << endl;
	}
	
	
}


Compiler output:
a.cc: In function 'int dp(std::string, std::string)':
a.cc:12:9: error: 'memset' was not declared in this scope
   12 |         memset(v, 0, sizeof(v));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<string>
#include<algoritm>
using namespace std;
static const int N = 1000;
int lcs(string X,string Y){
  int c[N+1][N+1];
  int m = X.size();
  int n = Y.size();
  int maxl = 0;
  X = ' ' + X;
  Y = ' ' + Y;
  for(int i = 1;i<=m;i++) c[i][0] = 0;
  for(int j = 1; j<=n;j++) c[0][j] = 0;

  for(int i = 1; i<= m; i++){
    for(int j = 1; j <= n; j++){
      if(X[i] == Y[j]){
	c[i][j] = c[i-1][j-1]+1;
      }else{
	c[i][j] = max(c[i-1][j],c[i][j-1]);
      }
      maxl = max(maxl,c[i][j]);
    }
  }
  return maxl;
}

int main(){
  string s1,s2;
  int n;
  cin>>n;
  for(int i = 0; i<n;i++){
    cin>>s1>>s2;
    cout<<lcs(s1,s2)<<endl;
  }
  return 0;
}



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

#include<string>
#include<iostream>

using namespace std;

#define N=1000;
int lcs(string x,string y){
    int c[N+1][N+1];
    int m=x.size();
    int n=y.size();
    int maxl=0;
    x=' '+x;
    y=' '+y;
    for(int i=1;i<=m;i++)    c[i][0]=0;
    for(int j=1;j<=n;j++)    c[0][j]=0;
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if(x[i]==y[j]){
                c[i][j]=c[i-1][j-1]+1;
            }else{
                c[i][j]=max(c[i-1][j],c[i][j-1]);
            }
            maxl=max(maxl,c[i][j]);
        }
    }
    return maxl;
}
int main(){
    string s1,s2;
    int n;  cin>>n;
    for(int i=0;i<n;i++){
        cin>>s1>>s2;
        cout<<lcs(s1,s2)<<endl;
    }
    return 0;
}


Compiler output:
a.cc:6:9: warning: ISO C++11 requires whitespace after the macro name
    6 | #define N=1000;
      |         ^
a.cc: In function 'int lcs(std::string, std::string)':
a.cc:6:10: error: expected primary-expression before '=' token
    6 | #define N=1000;
      |          ^
a.cc:8:11: note: in expansion of macro 'N'
    8 |     int c[N+1][N+1];
      |           ^
a.cc:6:15: error: expected ']' before ';' token
    6 | #define N=1000;
      |               ^
a.cc:8:11: note: in expansion of macro 'N'
    8 |     int c[N+1][N+1];
      |           ^
a.cc:8:14: error: expected ';' before ']' token
    8 |     int c[N+1][N+1];
      |              ^
      |              ;
a.cc:8:19: error: expected ';' before ']' token
    8 |     int c[N+1][N+1];
      |                   ^
      |                   ;
a.cc:14:30: error: 'c' was not declared in this scope
   14 |     for(int i=1;i<=m;i++)    c[i][0]=0;
      |                              ^
a.cc:15:30: error: 'c' was not declared in this scope
   15 |     for(int j=1;j<=n;j++)    c[0][j]=0;
      |                              ^
a.cc:19:17: error: 'c' was not declared in this scope
   19 |                 c[i][j]=c[i-1][j-1]+1;
      |                 ^
a.cc:21:17: error: 'c' was not declared in this scope
   21 |                 c[i][j]=max(c[i-1][j],c[i][j-1]);
      |                 ^
a.cc:23:27: error: 'c' was not declared in this scope
   23 |             maxl=max(maxl,c[i][j]);
      |                           ^
Language: C++


#include<string>
#include<iostream>
#include<algorithm>

using namespace std;

#define N 1000;
int lcs(string x,string y){
    int c[N+1][N+1];
    int m=x.size();
    int n=y.size();
    int maxl=0;
    x=' '+x;
    y=' '+y;
    for(int i=1;i<=m;i++)    c[i][0]=0;
    for(int j=1;j<=n;j++)    c[0][j]=0;
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if(x[i]==y[j]){
                c[i][j]=c[i-1][j-1]+1;
            }else{
                c[i][j]=max(c[i-1][j],c[i][j-1]);
            }
            maxl=max(maxl,c[i][j]);
        }
    }
    return maxl;
}
int main(){
    string s1,s2;
    int n;  cin>>n;
    for(int i=0;i<n;i++){
        cin>>s1>>s2;
        cout<<lcs(s1,s2)<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int lcs(std::string, std::string)':
a.cc:8:15: error: expected ']' before ';' token
    8 | #define N 1000;
      |               ^
a.cc:10:11: note: in expansion of macro 'N'
   10 |     int c[N+1][N+1];
      |           ^
a.cc:10:14: error: expected ';' before ']' token
   10 |     int c[N+1][N+1];
      |              ^
      |              ;
a.cc:10:19: error: expected ';' before ']' token
   10 |     int c[N+1][N+1];
      |                   ^
      |                   ;
a.cc:16:30: error: 'c' was not declared in this scope
   16 |     for(int i=1;i<=m;i++)    c[i][0]=0;
      |                              ^
a.cc:17:30: error: 'c' was not declared in this scope
   17 |     for(int j=1;j<=n;j++)    c[0][j]=0;
      |                              ^
a.cc:21:17: error: 'c' was not declared in this scope
   21 |                 c[i][j]=c[i-1][j-1]+1;
      |                 ^
a.cc:23:17: error: 'c' was not declared in this scope
   23 |                 c[i][j]=max(c[i-1][j],c[i][j-1]);
      |                 ^
a.cc:25:27: error: 'c' was not declared in this scope
   25 |             maxl=max(maxl,c[i][j]);
      |                           ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N=1000;

int lcs(string X,string Z)
{
  int c[N+1][N+1];
  int m=X.size();
  int n=Z.size();
  int maxl=0;
  X=' '+X;
  Y=' '+Z;
  for(int i=1;i<=m;i++)c[i][0]=0;
  for(int j=1;j<=n;j++)c[0][j]=0;

  for(int i=1;i<=m;i++)
    {
      for(int i=1;j<=n;j++)
	{
	  if(X[i]==Z[j])
	    {
	      c[i][j]=c[i-1][j-1]+1;
	    }
	  else
	    {
	      c[i][j]=max(c[i-1][j],c[i][j-1]);
	    }
	  maxl=max(maxl,c[i][j]);
	}
    }

  return maxl;
}

int main()
{
  stirng s1,s2;
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
    {
      cin>>s1>>s2;
      cout<<lcs(s1,s2)<<endl;
    }
  return 0;
}



Compiler output:
a.cc: In function 'int lcs(std::string, std::string)':
a.cc:14:3: error: 'Y' was not declared in this scope
   14 |   Y=' '+Z;
      |   ^
a.cc:20:19: error: 'j' was not declared in this scope
   20 |       for(int i=1;j<=n;j++)
      |                   ^
a.cc: In function 'int main()':
a.cc:39:3: error: 'stirng' was not declared in this scope
   39 |   stirng s1,s2;
      |   ^~~~~~
a.cc:44:12: error: 's1' was not declared in this scope
   44 |       cin>>s1>>s2;
      |            ^~
a.cc:44:16: error: 's2' was not declared in this scope
   44 |       cin>>s1>>s2;
      |                ^~
Language: C++

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

int main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int N;
  cin>>N;
  string S1,S2;
  for (int k=0; k<N; k++) {
    cin>>S1>>S2;
    int m=S1.length();
    int n=S2.length();
    S1=' '+S1;
    S2=' '+S2;
    int lcs[1001][1001];
    for (int i=1; i<=m; i++) {
      lcs[i][0]=0;
    }
    for (int j=1; j<=n; j++) {
      lcs[0][j]=0;
    }
    int maxl=0;
    for (int i=1; i<=m; i++) {
      for (int j=1; j<=n; j++) {
        if (S1[i]==S2[j]) {
          lcs[i][j]=lcs[i-1][j-1]+1;
        }
        else {
          lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
        }
        maxl=max(maxl,lcs[i][j]);
      }
    }
    cout<<maxl<<endl;
  }
  return 0;
}



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

import sys
sys.setrecursionlimit(10000)

def calc(x,y):
    i = len(x)
    j = len(y)
    if not d[i][j] == None:
        return d[i][j]
    else:
        if x[-1] == y[-1]:
            tmp = calc(x[:-1],y[:-1])+1
            d[i][j] = tmp
            return tmp
        else:
            tmp = max(calc(x[:-1],y),calc(x,y[:-1]))
            d[i][j] = tmp
            return tmp
        
q = int(input())
for i in range(q):
    x = input()
    y = input()
    d = [[0 if i == 0 or j == 0 else None for i in range(len(y)+1)] for j in range(len(x)+1)]
    print(calc(x,y))


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

q = int(input())
for i in range(q):
    x = input()
    y = input()
    n = len(x)
    m = len(y)
    dp = [0]*((n+1)*(m+1))
    for i in range(n):
        for j in range(m):
            a = (n+1)*(j+1)+i+1
            if x[i] == y[j]:
                b = (n+1)*j+i
                dp[a] = dp[b]+1
            else:
                c = (n+1)*j+i+1
                d = (n+1)*(j+1)+i
                dp[a] = max(dp[c],dp[d])
    print(dp[-1])


Compiler output:
a.cc:1:1: error: 'q' does not name a type
    1 | q = int(input())
      | ^
Language: C++

q = int(input())
for i in range(q):
    x = input().rstrip()
    y = input().rstrip()
    n = len(x)
    m = len(y)
    d = [[0 for _ in range(m+1)] for _ in range(n+1)]
    for i in range(n):
        for j in range(m):
            if x[i] == y[j]:
                d[i+1][j+1] = d[i][j]+1
            else:
                d[i+1][j+1] = max(d[i+1][j],d[i][j+1])
    print(d[n][m])


Compiler output:
a.cc:1:1: error: 'q' does not name a type
    1 | q = int(input())
      | ^
Language: C++

q = int(input())
ans = []
for i in range(q):
    x = input()
    y = input()
    n = len(x)
    m = len(y)
    dp1 = [0]*(m+1)
    for i in range(n):
        s = x[i]
        dp2 = dp1[:]
        for j in range(m):
            if s == y[j]:
                dp1[j+1] = dp2[j]+1
            elif dp1[j+1] < dp1[j]:
                dp1[j+1] = dp1[j]
    ans.append(dp1[-1])
print(*ans, sep="\n")


Compiler output:
a.cc:1:1: error: 'q' does not name a type
    1 | q = int(input())
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    int Q;
    string X, Y;
    cin >> Q;
    for (int q = 0; q < Q; ++q) {
        cin >> X >> Y;
        int DP[1001][1001];
        memset(DP, 0, sizeof(DP));
        for (int sx = 1; sx <= X.size(); ++sx) {
            for (int sy = 1; sy <= Y.size(); ++sy) {
                DP[sx][sy] = max(DP[sx][sy-1], DP[sx][sy-1]);
                if (X[sx] == Y[sy]) {
                    DP[sx][sy] = max(DP[sx][sy], DP[sx-1][sy-1]+1);
                }
            }
        }
        cout << DP[X.size()][Y.size()] << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:31:9: error: 'memset' was not declared in this scope
   31 |         memset(DP, 0, sizeof(DP));
      |         ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <map>
  +++ |+#include <cstring>
    8 |
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <stdlib>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    int Q;
    string X, Y;
    cin >> Q;
    for (int q = 0; q < Q; ++q) {
        cin >> X >> Y;
        int DP[1001][1001];
        memset(DP, 0, sizeof(DP));
        for (int sx = 1; sx <= X.size(); ++sx) {
            for (int sy = 1; sy <= Y.size(); ++sy) {
                DP[sx][sy] = max(DP[sx][sy-1], DP[sx][sy-1]);
                if (X[sx] == Y[sy]) {
                    DP[sx][sy] = max(DP[sx][sy], DP[sx-1][sy-1]+1);
                }
            }
        }
        cout << DP[X.size()][Y.size()] << endl;
    }
    return 0;
}



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

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <stdlib.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    int Q;
    string X, Y;
    cin >> Q;
    for (int q = 0; q < Q; ++q) {
        cin >> X >> Y;
        int DP[1001][1001];
        memset(DP, 0, sizeof(DP));
        for (int sx = 1; sx <= X.size(); ++sx) {
            for (int sy = 1; sy <= Y.size(); ++sy) {
                DP[sx][sy] = max(DP[sx][sy-1], DP[sx][sy-1]);
                if (X[sx] == Y[sy]) {
                    DP[sx][sy] = max(DP[sx][sy], DP[sx-1][sy-1]+1);
                }
            }
        }
        cout << DP[X.size()][Y.size()] << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:31:9: error: 'memset' was not declared in this scope
   31 |         memset(DP, 0, sizeof(DP));
      |         ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <stdlib.h>
  +++ |+#include <cstring>
    9 | using namespace std;
Language: C++

#include <stdio.h>

int score[1010][1010];

int max2 (int a, int b){
  if (a >= b) return a;
  else return b;
}

int len_of_str(const char s[]){
  int num = 0;

  while(s[num]) num++;

  return num;
}


int main() {
  char a[1010];
  char b[1010];
  int datanum;
  scanf("%d",&datanum);
  for(int c = 0; c < datanum; c++){

  scanf("%999s",a);
  scanf("%999s",b);
  int num1 = len_of_str(a);
  int num2 = len_of_str(b);


  for(int i = num1; i > 0; i--) a[i] = a[i - 1];
  a[0] = ' ';
  for(int j = num2; j > 0; j--) b[j] = b[j - 1];
  b[0] = ' ';

  for(int i = 0; i <= num1; i++) score[i][0] = 0;
  for(int j = 0; j <= num2; j++) score[0][j] = 0;

  int maximum = 0;

  for(int i = 1; i<= num1; i++){
    for (int j = 1; j <= num2; j++){
      if (a[i] == b[j])score[i][j] = score[i-1][j-1] + 1;
      else max2(score[i][j-1],score[i-1][j]);
      maximum = max2(maximum,score[i][j]);
    }
  }

  printf("%d\n",maximum)
}
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:25: error: expected ';' before '}' token
   50 |   printf("%d\n",maximum)
      |                         ^
      |                         ;
   51 | }
      | ~
Language: C++

import sys

def dp_init(m, n):
    return [[0] * n] * m

def solve(str_a, str_b):
    dp = dp_init(len(str_a), len(str_b))
    return rec(len(str_a), len(str_b), str_a, str_b, dp)

def rec(i, j, str_a, str_b, dp):
    if i == 0 or j == 0:
        return 0
    if dp[i][j] > 0:
        return dp[i][j]
    if str_a[i-1] == str_b[j-1]:
        dp[i][j] = rec(i-1, j-1, str_a, str_b, dp) + 1
        return dp[i][j]
    dp[i][j] = max(rec(i, j-1, str_a, str_b, dp), rec(i-1, j, str_a, str_b, dp))
    return dp[i][j]

nb_pairs = int(input())
pairs = []
for i in range(0, nb_pairs):
    pairs.append((input(), input()))

for i in range(0, nb_pairs):
    str_a, str_b = pairs[i]
    print(solve(str_a, str_b))




Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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



static const int N = 1000;

int lcs(string X, string Y) 
{
	int c[N + 1][N + 1];
	int m = X.size;
	int n = Y.size;
	int maxl = 0;
	X = ' ' + X;
	Y = ' ' + Y;
	for (int i = 0; i <= m; i++)c[i][0] = 0;
	for (int j = 1; j <= n; j++)c[0][j] = 0;

	for (int i = 1; i <= m; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (X[i] == Y[j])
			{
				c[i][j] = c[i - 1][j - 1] + 1;
			}
			else
			{
				c[i][j] = max(c[i - 1][j], c[i][j - 1]);
			}
			maxl = max(maxl, c[i][j]);
		}
	}
	return maxl;
}



int main()
{
	string s1, s2;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> s1 >> s2;
		cout << lcs(s1, s2) << endl;
	}

    return 0;
}


Compiler output:
a.cc: In function 'int lcs(std::string, std::string)':
a.cc:13:19: error: cannot convert 'std::__cxx11::basic_string<char>::size' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
   13 |         int m = X.size;
      |                   ^~~~
a.cc:14:19: error: cannot convert 'std::__cxx11::basic_string<char>::size' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
   14 |         int n = Y.size;
      |                   ^~~~
Language: C++

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

int main()
{
	int n, p[N + 1], m[N + 1][N + 1];
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> p[i - 1] >> p[i];
	for (int i = 1; i <= n; i++) m[i][i] = 0;

	for (int l = 2; l <= n; l++)
	{
		for (int i = 1; i <= n; i++)
		{
			int j = i + l - 1;
			m[i][j] = 1 << 21;
			for (int k = i; k <= j - 1; k++)
			{
				m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] * p[i - 1] * p[k] * p[j]);
			}
		}
	}

	cout << m[1][n] << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'N' was not declared in this scope
    7 |         int n, p[N + 1], m[N + 1][N + 1];
      |                  ^
a.cc:9:45: error: 'p' was not declared in this scope
    9 |         for (int i = 1; i <= n; i++) cin >> p[i - 1] >> p[i];
      |                                             ^
a.cc:10:38: error: 'm' was not declared in this scope
   10 |         for (int i = 1; i <= n; i++) m[i][i] = 0;
      |                                      ^
a.cc:17:25: error: 'm' was not declared in this scope
   17 |                         m[i][j] = 1 << 21;
      |                         ^
a.cc:20:80: error: 'p' was not declared in this scope
   20 |                                 m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] * p[i - 1] * p[k] * p[j]);
      |                                                                                ^
a.cc:25:17: error: 'm' was not declared in this scope
   25 |         cout << m[1][n] << endl;
      |                 ^
Language: C++

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

int main() {
  int q; cin >> q;
  string A, B; cin >> A >> B;
  for (int i=0; i<q; i++) {
    vector<vector<int>> LCS(A.length()+1, vector<int>(B.length()+1,0));
    for (int j=1; j<=A.length(); j++) {
      for (int k=1; k<=B.length(); k++) {
        if(A[j]==B[k]) LCS[j][k]=LCS[j-1][k-1]+1;
        else LCS[j][k] = max(LCS[j-1][k],LCS[j][k-1]);
      }
    }
    cout << LCS[A.length()][B.length()]
  }
}

    




Compiler output:
a.cc: In function 'int main()':
a.cc:15:40: error: expected ';' before '}' token
   15 |     cout << LCS[A.length()][B.length()]
      |                                        ^
      |                                        ;
   16 |   }
      |   ~
Language: C++

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

int main() {
  int q; cin >> q;
  string A, B;
  for (int i=0; i<q; i++) {
    cin >> A >> B;
    vector<vector<int>> LCS(A.length()+1, vector<int>(B.length()+1,0));
    int ans=0;
    for (int j=1; j<=A.length(); j++) {
      for (int k=1; k<=B.length(); k++) {
        if(A[j]==B[k]) LCS[j][k]=LCS[j-1][k-1]+1;
        else LCS[j][k]=max(LCS[j-1][k],LCS[j][k-1]);
        ans = max(ans, LCS[j][k];
      }
    }
    cout << ans << "\n";
  }
}




Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: expected ')' before ';' token
   15 |         ans = max(ans, LCS[j][k];
      |                  ~              ^
      |                                 )
Language: C++

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

#define MAX_N 1000
#define MAX_M 1000

void solve();

string s, t;
int dp[MAX_N + 1][MAX_M + 1];

void solve(){
	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];
					dp[i + 1][j + 1] = dp[i][j] + 1;
				} else {
					dp[i + 1][j + 1] = max(dp[i][j], dp[i + 1][j]);
				}
			}
		}
		cout << dp[s.size()][t.size()] << endl;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> s >> t;
		solve();
	}
　return 0;
}

Compiler output:
a.cc:35:1: error: extended character 　 is not valid in an identifier
   35 | 　return 0;
      | ^
a.cc: In function 'int main()':
a.cc:35:1: error: '\U00003000return' was not declared in this scope
   35 | 　return 0;
      | ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

int lcs(string X, string Y){
  int x = X.size();
  int y = Y.size();

  int d[y+1][x+1];
  memset(d, 0, sizeof(d));

  for(int i = 1; i <= y; i++){
    char a = Y[i];

    for(int j = 1; j <= x; j++){
      char b = X[j];

      if(a == b){
        d[i][j] = max(d[i][j], d[i-1][j-1] + 1);
      }else{
        d[i][j] = max(d[i][j], max(d[i-1][j], d[i][j-1]));
      }
    }
  }

  return d[y][x];
}

int main(){
  int n;
  string x, y;
  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> x;
    cin >> y;

    cout << lcs(x, y) << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int lcs(std::string, std::string)':
a.cc:15:3: error: 'memset' was not declared in this scope
   15 |   memset(d, 0, sizeof(d));
      |   ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 |
Language: C++

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


int main(int argc, char *argv[]){
  int n;
  cin >> n;
  for (int r = 0; r < n; r++) {

    string x, y;
    cin >> x >> y;
    string dp[y.length() + 1][x.length() + 1];

    for (int i = 0; i < y.length(); i++) {
      for (int j = 0; j < x.length(); j++) {
        if(y[i] == x[j]){
          dp[i + 1][j + 1] = dp[i][j] + y[i];
        }else{
          dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
        }
      }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
      ans = max(ans, dp[y.length()][i].length());
    }
    std::cout << ans << std::endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:25:16: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)'
   25 |       ans = max(ans, dp[y.length()][i].length());
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:25:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   25 |       ans = max(ans, dp[y.length()][i].length());
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:25:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   25 |       ans = max(ans, dp[y.length()][i].length());
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

template<class T>
bool chmax(T &a, const T &b) {
    if(a<b) {
        a=b;
        return false;
    }
    return true;
}

using namespace std;

int dp[1003][1003];
int main() {
    int q; cin>>q;
    rep(_,q) {
        memset(dp,0,sizeof(dp));
        string s,t;
        cin>>s>>t;
        s=" "+s;
        t=" "+t;
        rep(i,s.size()){
            rep(j,t.size()) {
                if(i&&j) {
                    if(s[i]==t[j]) dp[i][j]=dp[i-1][j-1]+1;
                    else {
                        chmax(dp[i][j],dp[i-1][j]);
                        chmax(dp[i][j],dp[i][j-1]);
                    }
                }
            }
            //rep(j,t.size()) cout<<dp[i][j]<<" ";
            //cout<<endl;
        }
        int ans=0;

        rep(i,s.size()) chmax(ans,*max_element(dp[i],dp[i]+t.size()));
        cout<<ans<<endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'memset' was not declared in this scope
   21 |         memset(dp,0,sizeof(dp));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
using namespace std;

//int dat[1024][1024];
int getLcbLen(char* x, int xe, char* y, int ye){
	if(xe <= 0 || ye <= 0) return 0;
	//if(dat[xe][ye] != -1) return dat[xe][ye];
	if(x[xe-1] == y[ye-1]) return 1 + getLcbLen(x, xe-1, y, ye-1);
	return max(getLcbLen(x, xe-1, y, ye), getLcbLen(x, xe, y, ye-1));
}

int main() {
	int set;
	scanf("%d", &set);
	
	while(set--){
		char x[1024], y[1024];
		scanf("%s %s", x, y);
		
		printf("%d\n", getLcbLen(x, (int)strlen(x), y, (int)strlen(y)));
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:50: error: 'strlen' was not declared in this scope
   33 |                 printf("%d\n", getLcbLen(x, (int)strlen(x), y, (int)strlen(y)));
      |                                                  ^~~~~~
a.cc:15:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include <climits>
  +++ |+#include <cstring>
   15 | using namespace std;
Language: C++

leng :: Int
leng = 1001

getPos :: Int -> Int -> Int
getPos y x = y * leng + x

lcs :: String -> String -> Int -> Int
lcs in1 in2 = (map lcs_func [0 ..] !!)
    where
      lcs_func n
          | (length in1) == 1 || (length in2) == 1 = if (head in1) == (head in2) then 1 else 0
          | (head in1) == (head in2) = (lcs (tail in1) (tail in2) (getUpLeft n)) + 1
          | otherwise = max (lcs (tail in1) in2 (getUp n)) (lcs in1 (tail in2) (getLeft n))
      getUp n = n - leng
      getLeft n = n - 1
      getUpLeft n = n - leng - 1

solve :: String -> String -> Int
solve in1 in2 = lcs in1 in2 (getPos ((length in1) - 1) ((length in2) - 1))

input :: Int -> IO ()
input n
    | n == 0 = return ()
    | otherwise = do
  str1 <- getLine
  str2 <- getLine
  putStrLn $ show $ solve str1 str2
  input $ n-1
                         

main :: IO()
main = do
  n <- readLn
  input n

Compiler output:
a.cc:1:1: error: 'leng' does not name a type; did you mean 'long'?
    1 | leng :: Int
      | ^~~~
      | long
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
int main(){
  char str1[1000],str2[1000];
  int LCS[1000][1000]={0};
  int length1,length2;
  int n;
  std::ios::sync_with_stdio(false);
  scanf("%d",&n);
  for(int s=1;s<=n;s++){
   while(cin>>str1>>str2){
     length1=strlen(str1);
     length2=strlen(str2);
     for(int i=0;i<=length1-1;i++){
       LCS[i][0]=0;
     }
     for(int j=0;j<=length2-1;j++){
       LCS[0][j]=0;
     }
     for(int i=1;i<=length1;i++){
       for(int j=1;j<=length2;j++){
         if(str1[i-1]==str2[j-1]) {
           LCS[i][j]=LCS[i-1][j-1]+1;
         }
         else LCS[i][j]=max(LCS[i-1][j],LCS[i][j-1]);
       }
     }
     printf("%d\n",LCS[length1][length2]);
   }
 }
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   13 |    while(cin>>str1>>str2){
      |          ^~~
      |          std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:27:25: error: 'max' was not declared in this scope; did you mean 'std::max'?
   27 |          else LCS[i][j]=max(LCS[i-1][j],LCS[i][j-1]);
      |                         ^~~
      |                         std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

def lcs(x, y)
  for i in range(1, len(x)):
    for j in range(1, lem(y)):
      if x[i] = y[j]:
        c[i][j] = c[i-1][j-1] + 1
      elif c[i-1][j]>c[i][j-1]:
        c[i][j] = c[i-1][j]
      else:
        c[i][j] = c[i][j-1]






q  = input()
x = [' ' for row in range(n+1)]
y = [' ' for row in range(n+1)]
c = [[' ' for col in range(1000)] for row in range(1000)]
for i in range(q):
  x = input()
  y = input()
  print lcs(x, y)

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def lcs(x, y)
      | ^~~