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

// http://algorithms.blog55.fc2.com/blog-entry-66.html

#include <iostream>
using namespace std;
#include <stdio.h>
#include <string.h>

#define M 100

int N,R[M+1],C[M][M],B[M][M];

void compute(){
	int i=0,j,k,cost;
	memset(C,99,sizeof(C));
	for(;i<N;i++)C[i][i]=0;
	for(j=1;j<N;j++)
		for(i=0;i<N - j; i++ ){
			for (k = i; k < i + j; k++ ){
				cost = C[i][k] + C[k+1][i+j] + R[i]*R[k+1]*R[i+j+1];
				if(cost<C[i][i+j])C[i][i+j]=cost,B[i][i+j]=k; 
			}
		}
	}
}

void order( int i, int j ){
	if ( i == j ) cout << "M" << i;
	else{
		cout << "(";
		order( i, B[i][j]-1 ); order(B[i][j], j);
		cout << ")";
	}
}

void input(){
	cin >> N;
	int z,i=0;
	for (; i < N; i++ ) cin >> R[i]>>z;
	R[i]=z;
	//SIZE++;
}

void output(){
	cout <<  C[0][N-1] << endl;
	//order(0, N);
	//cout << endl;
}

main(){
	input();
	compute();
	output();
}

Compiler output:
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
a.cc:49:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   49 | main(){
      | ^~~~
Language: C++

#include<iostream>
#include<climits>
#include<algorithm>
using namespace std;
struct mat{
  int w,h;
};
vector<mat> v;
int memo[101][101];

int solve(int l,int r){
  if(memo[l][r] > 0)return memo[l][r];
  //cout << l << ' ' << r << endl;
  if(l == r)return 0;
  int ret = INT_MAX;
  for(int i = l; i < r; i++){
    int ans = solve(l,i) + solve(i+1,r) + v[l].h * v[i].w * v[r].w;
    ret = min(ret,ans);
  }
  return memo[l][r] = ret;
}
int main(){
  fill(*memo,*(memo+101),-1);
  int n;
  cin >> n;
  for(int i = 0;i < n;i++){
    int r,c;
    cin >> r >> c;
    v.push_back({c,r});
  }
  cout << solve(0,n-1) << endl;
}

Compiler output:
a.cc:8:1: error: 'vector' does not name a type
    8 | vector<mat> v;
      | ^~~~~~
a.cc: In function 'int solve(int, int)':
a.cc:17:43: error: 'v' was not declared in this scope
   17 |     int ans = solve(l,i) + solve(i+1,r) + v[l].h * v[i].w * v[r].w;
      |                                           ^
a.cc: In function 'int main()':
a.cc:29:5: error: 'v' was not declared in this scope
   29 |     v.push_back({c,r});
      |     ^
Language: Java

import java.util.*;
public class LongestCommonSubsequence{
    public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int q=sc.nextInt();
	int[] ans=new int[q];
	for(int n=0;n<q;n++){
	    String X=sc.next();
	    String Y=sc.next();
	    int[][] A=new int[X.length()+1][Y.length()+1];
	    for(int i=1;i<X.length()+1;i++){
		for(int j=1;j<Y.length()+1;j++){
		    if((X.substring(i-1,i)).equals(Y.substring(j-1,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][j-1];
			}else{
			    A[i][j]=A[i-1][j];
			}
		    }
			
		}
	    }
	    ans[n]=A[X.length()][Y.length()];
	}
	for(int num:ans){
	    System.out.println(num);
	}
    }
}


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

import java.util.*;

public class LongestCommon {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int datasetNum = sc.nextInt();
        sc.nextLine();

        for (int datasetidx = 0; datasetidx < datasetNum; datasetidx++) {
            String A = sc.nextLine();
            String B = sc.nextLine();
            int NA = A.length();
            int NB = B.length();

            int[][] dp = new int[NA+1][NB+1];

            for (int i = 0; i < NA; i++) {
                for (int j = 0; j < NB; j++) {
                    if (A.charAt(i) == B.charAt(j)) {
                        dp[i+1][j+1] = dp[i][j] + 1;
                    } else {
                        dp[i+1][j+1] = Math.max(dp[i+1][j], dp[i][j+1]);
                    }
                }
            }

            System.out.println(dp[NA][NB]);
        }
    }
}


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

import java.util.Scanner;

public class copylcs{
    public static void main(String[] args){
	
	Scanner scan = new Scanner(System.in);
	
	int n = scan.nextInt();
	String X = "";
	String Y = "";
	char[] cX = new char[1001];
	char[] cY = new char[1001];
	int i = 0;
	int j = 0; 
 
	for(int k = 0; k < cX.length; k++) m[i][0] = 0;
	for(int k = 0; k < cY.length; k++) m[0][i] = 0;
	
	for(int k = 0; k < n; k++){
	    X = " "+scan.next();
	    cX = X.toCharArray();
	    Y = " "+scan.next();
	    cY = Y.toCharArray();
	    i = cX.length - 1;
	    j = cY.length - 1;
	    System.out.println(lcs(cX,cY,i,j));
	}
    }
    
    static int[][] m = new int[1001][1001];
    static int lcs(char[] cX,char[] cY,int i,int j){
	if(i == 0 || j == 0) {return 0;} 
	else if(cX[i] == cY[j]) {return lcs(cX,cY,i-1,j-1)+1;}
	else {return Math.max(lcs(cX,cY,i-1,j),lcs(cX,cY,i,j-1));}	    
    }
}

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

import java.util.Scanner;

public class dpLcs{
    
    static int[][] m = new int[1001][1001];
    
    public static void main(String[] args){
	
	Scanner scan = new Scanner(System.in);
	
	int n = scan.nextInt();
	String X = "";
	String Y = "";
	char[] cX = new char[1001];
	char[] cY = new char[1001];
	int i = 0;
	int j = 0; 
 
	for(int k = 0; k < cX.length; k++) m[i][0] = 0;
	for(int k = 0; k < cY.length; k++) m[0][i] = 0;
	for(int k = 1; k < 1001; k++){
	    for(int l = 1; l < 1001; l++){
		m[k][l] = -1;
	    }
	}
	
	for(int k = 0; k < n; k++){
	    X = " "+scan.next();
	    cX = X.toCharArray();
	    Y = " "+scan.next();
	    cY = Y.toCharArray();
	    i = cX.length - 1;
	    j = cY.length - 1;
	    System.out.println(lcs(cX,cY,i,j));
	}
    }
    
    static int lcs(char[] cX,char[] cY,int i,int j){
	if(m[i][j] != -1){
	    return m[i][j];
	}else if(i == 0 || j == 0) {
	    return 0;
	}else if(cX[i] == cY[j]) {
	    int tmp = lcs(cX,cY,i-1,j-1)+1;
	    m[i][j] = tmp;
	    return tmp;
	}else{
	    int tmp = Math.max(lcs(cX,cY,i-1,j),lcs(cX,cY,i,j-1));
	    m[i][j] = tmp;
	    return tmp;
	}
    }
    
}

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

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	
	Scanner scan = new Scanner(System.in);
	
	int n = scan.nextInt();
	String X = "";
	String Y = "";
	
	for(int i = 0; i < n; i++){
	    X[i] = " "+scan.next();
	    Y[i] = " "+scan.next();
	    System.out.println(lcs(X,Y));
	}
	
    }

    public static int lcs(String X,String Y){
	char[] cX = X.toCharArray();
	char[] cY = Y.toCharArray();
	int Xl = cX.length;
	int Yl = cY.length;
	int maxl = 0;
	int[][] m = new int[Xl][Yl];

	for(int i = 0; i < Xl; i++){m[i][0] = 0;}
	for(int i = 0; i < Yl; i++){m[0][i] = 0;}

	for(int i = 1; i < Xl; i++){
	    for(int j = 1; j < Yl; j++){
		if(cX[i] == cY[j]){
		    m[i][j] = m[i-1][j-1]+1;
		}else{
		    m[i][j] = Math.max(m[i-1][j],m[i][j-1]);
		}
		maxl = Math.max(maxl,m[i][j]);
	    }
	}
	return maxl;
    }
}

Compiler output:
Main.java:13: error: array required, but String found
	    X[i] = " "+scan.next();
	     ^
Main.java:14: error: array required, but String found
	    Y[i] = " "+scan.next();
	     ^
2 errors
Language: Java

def lcs(str1,str2):
    c=[[0 for _ in range(100000000000)] for _ in range(10000000000000)]
    m=len(str1)
    n=len(str2)
    maxl=0
    str1=" "+str1
    str2=" "+str2

    i=1
    j=1
    while(i<=m):
        while(j<=n):
            if(str1[i]==str2[j]):
                c[i][j]=c[i-1][j-1]+1
              #  print(c[i][j])
            else:
                c[i][j]=max(c[i-1][j],c[i][j-1])
            maxl=max(maxl,c[i][j])
            j+=1
        i+=1
        j=0

    return maxl

def main():
    n=int(input())
    i=0
    while(i<n):
        str1=str(input())
        str2=str(input())
        print(int(lcs(str1,str2)))
        i+=1

main()



Compiler output:
Main.java:15: error: illegal character: '#'
              #  print(c[i][j])
              ^
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
def lcs(str1,str2):
^
  (use --enable-preview to enable unnamed classes)
Main.java:1: error: <identifier> expected
def lcs(str1,str2):
                 ^
Main.java:1: error: ';' expected
def lcs(str1,str2):
                  ^
Main.java:26: error: class, interface, enum, or record expected
    n=int(input())
      ^
5 errors
Language: Java

def lcs(str1,str2):
    c=[[0 for _ in range(1010)] for _ in range(1010)]
    m=len(str1)
    n=len(str2)
    maxl=0
    str1=" "+str1
    str2=" "+str2

    i=1
    j=1
    while(i<=m):
        while(j<=n):
            if(str1[i]==str2[j]):
                c[i][j]=c[i-1][j-1]+1
              #  print(c[i][j])
            else:
                c[i][j]=max(c[i-1][j],c[i][j-1])
            maxl=max(maxl,c[i][j])
            j+=1
        i+=1
        j=0

    return maxl

def main():
    n=int(input())
    i=0
    while(i<n):
        str1=str(input())
        str2=str(input())
        print(int(lcs(str1,str2)))
        i+=1

main()



Compiler output:
Main.java:15: error: illegal character: '#'
              #  print(c[i][j])
              ^
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
def lcs(str1,str2):
^
  (use --enable-preview to enable unnamed classes)
Main.java:1: error: <identifier> expected
def lcs(str1,str2):
                 ^
Main.java:1: error: ';' expected
def lcs(str1,str2):
                  ^
Main.java:26: error: class, interface, enum, or record expected
    n=int(input())
      ^
5 errors
Language: Java

def lcs(str1,str2):
    c=[[0 for _ in range(1001)] for _ in range(1001)]
    m=len(str1)
    n=len(str2)
    maxl=0
    str1=" "+str1
    str2=" "+str2

    i=1
    j=1
    while(i<=m):
        while(j<=n):
            if(str1[i]==str2[j]):
                c[i][j]=c[i-1][j-1]+1
              #  print(c[i][j])
            else:
                c[i][j]=max(c[i-1][j],c[i][j-1])
            maxl=max(maxl,c[i][j])
            j+=1
        i+=1
        j=0

    return maxl

def main():
    n=int(input())
    i=0
    while(i<n):
        str1=str(input())
        str2=str(input())
        print(int(lcs(str1,str2)))
        i+=1

main()



Compiler output:
Main.java:15: error: illegal character: '#'
              #  print(c[i][j])
              ^
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
def lcs(str1,str2):
^
  (use --enable-preview to enable unnamed classes)
Main.java:1: error: <identifier> expected
def lcs(str1,str2):
                 ^
Main.java:1: error: ';' expected
def lcs(str1,str2):
                  ^
Main.java:26: error: class, interface, enum, or record expected
    n=int(input())
      ^
5 errors
Language: C

#include <stdio.h>
#include <string.h>
char X[1001],Y[1001];
int q;
int LCSLength(){
  int m,n,i,j;
  int c[1000][1000];
  m=strlen(X);
  n=strlen(Y);
  for(i=1;i<=m;i++){
    c[i][0]=0;
  }
  for(j=0;j<=n;j++){
    c[0][j]=0;
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
 
      if(X[i-1]==Y[j-1]){
	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];
      }
    }
    printf("%d\n",c[m][n]);
 
 
 
  }
  int main(){
    int i;
    scanf("%d",&q);
 
    for(i=1;i<=q;i++){
      scanf("%s",X);
      scanf("%s",Y);
      LCSLength();
    }
    return 0;
  }



Compiler output:
main.c: In function 'LCSLength':
main.c:22:15: error: expected '(' before '{' token
   22 |       }else if{
      |               ^
      |               (
main.c:23:33: error: expected ';' before 'c'
   23 |         (c[i-1][j] >= c[i][j-1]) c[i][j]=c[i-1][j];
      |                                 ^~
      |                                 ;
main.c:44:3: error: expected declaration or statement at end of input
   44 |   }
      |   ^
Language: C

#include <stdio.h>
#include <string.h>
char X[1001],Y[1001];
int q;
int LCSLength(){
  int m,n,i,j;
  int c[1000][1000];
  m=strlen(X);
  n=strlen(Y);
  for(i=1;i<=m;i++){
    c[i][0]=0;
  }
  for(j=0;j<=n;j++){
    c[0][j]=0;
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
 
      if(X[i-1]==Y[j-1]){
	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];
      }
    }
}
    printf("%d\n",c[m][n]);
 
 
 
  }
  int main(){
    int i;
    scanf("%d",&q);
 
    for(i=1;i<=q;i++){
      scanf("%s",X);
      scanf("%s",Y);
      LCSLength();
    }
    return 0;
  }



Compiler output:
main.c: In function 'LCSLength':
main.c:22:15: error: expected '(' before '{' token
   22 |       }else if{
      |               ^
      |               (
main.c:23:33: error: expected ';' before 'c'
   23 |         (c[i-1][j] >= c[i][j-1]) c[i][j]=c[i-1][j];
      |                                 ^~
      |                                 ;
Language: C

#include <stdio.h>
#include <string.h>
char X[1001],Y[1001];
int q;
int LCSLength(){
  int m,n,i,j;
  int c[1000][1000];
  m=strlen(X);
  n=strlen(Y);
  for(i=1;i<=m;i++){
    c[i][0]=0;
  }
  for(j=0;j<=n;j++){
    c[0][j]=0;
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
 
      if(X[i-1]==Y[j-1]){
	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];
      }
    }
  }
    printf("%d\n",c[m][n]);
 
 
 
  }
  int main(){
    int i;
    scanf("%d",&q);
 
    for(i=1;i<=q;i++){
      scanf("%s",X);
      scanf("%s",Y);
      LCSLength();
    }
    return 0;
  }



Compiler output:
main.c: In function 'LCSLength':
main.c:22:15: error: expected '(' before '{' token
   22 |       }else if{
      |               ^
      |               (
main.c:23:33: error: expected ';' before 'c'
   23 |         (c[i-1][j] >= c[i][j-1]) c[i][j]=c[i-1][j];
      |                                 ^~
      |                                 ;
Language: C

#include<iostream>
#include<string>

std::string x,y;
int lcs[1000][1000] = {0};

int max(int k,int l){
  if(k>l){
    return k;
  }else{
    return l;
  }
}

void LCS(int i,int j){
  if(x[i] == y[j]){
    lcs[i][j] = lcs[i-1][j-1]+1;
  }else{
    lcs[i][j] = max(lcs[i-1][j],lcs[i][j-1]);
  }
}

void pre(){
  for(int i=0;i<(int)y.size();i++){
    if(x[0] == y[i]){
      lcs[0][i] = 1;
    }else{
      lcs[0][i] = 0;
    }
  }
  for(int i=0;i<(int)x.size();i++){
    if(x[i] == y[0]){
      lcs[i][0] = 1;
    }else{
      lcs[i][0] = 0;
    }
  }
}

int main(){
  int q;
  std::cin >> q;
  for(int k=0;k<q;k++){
    std::cin >> x;
    std::cin >> y;
    int size_x=x.size(),size_y=y.size();
    pre();
    for(int i=1;i<size_x;i++){
      for(int j=1;j<size_y;j++){
	LCS(i,j);
      }
    }

    /*for(int i=0;i<size_x;i++){
      for(int j=0;j<size_y;j++){
	std::cout << lcs[i][j] << ' ';
      }
      std::cout << '\n';
    }
    */
    std::cout << lcs[size_x-1][size_y-1] << '\n'; 

  }
  return 0;
}



Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
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:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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

static const int N = 1000;

int lcs(string x, string y){
  int c[N + 1][N + 1];
  int i, j, m = x.size(), n = y.size(), maxl = 0;

  x = ' ' + x;
  y = ' ' + y;
  for(i = 1 ; i <= m ; i++) c[i][0] = 0;
  for(j = 1 ; j <= n ; i++) c[0][j] = 0;

  for(i = 1 ; i <= m ; i++){
    for(j = 1 ; j <= n ; i++){
      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];
        if(c[i - 1][j] < c[i][j - 1]) c[i][j] = c[i][j - 1];
      }
      if(maxl > c[i][j]) maxl = c[i][j];
    }
  }
  return maxl;
}


int main(){
  string s1, s2;
  int n, i;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    scanf("%d %d", &s1, &s2);
    printf("%d\n", lcs(s1, s2));
  }
  return 0;
}


Compiler output:
main.c:6:9: error: unknown type name 'string'; did you mean 'stdin'?
    6 | int lcs(string x, string y){
      |         ^~~~~~
      |         stdin
main.c:6:19: error: unknown type name 'string'; did you mean 'stdin'?
    6 | int lcs(string x, string y){
      |                   ^~~~~~
      |                   stdin
main.c: In function 'main':
main.c:32:3: error: unknown type name 'string'; did you mean 'stdin'?
   32 |   string s1, s2;
      |   ^~~~~~
      |   stdin
main.c:38:20: error: implicit declaration of function 'lcs' [-Wimplicit-function-declaration]
   38 |     printf("%d\n", lcs(s1, s2));
      |                    ^~~
Language: C

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

static const int N = 1000;

int lcs(string x, string y){
  int c[N + 1][N + 1];
  int i, j, m = x.size(), n = y.size(), maxl = 0;

  x = ' ' + x;
  y = ' ' + y;
  for(i = 1 ; i <= m ; i++) c[i][0] = 0;
  for(j = 1 ; j <= n ; i++) c[0][j] = 0;

  for(i = 1 ; i <= m ; i++){
    for(j = 1 ; j <= n ; i++){
      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];
        if(c[i - 1][j] < c[i][j - 1]) c[i][j] = c[i][j - 1];
      }
      if(maxl > c[i][j]) maxl = c[i][j];
    }
  }
  return maxl;
}


int main(){
  char s1[10], s2[10];
  int n, i;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    scanf("%s %s", &s1, &s2);
    printf("%d\n", lcs(s1, s2));
  }
  return 0;
}


Compiler output:
main.c:6:9: error: unknown type name 'string'; did you mean 'stdin'?
    6 | int lcs(string x, string y){
      |         ^~~~~~
      |         stdin
main.c:6:19: error: unknown type name 'string'; did you mean 'stdin'?
    6 | int lcs(string x, string y){
      |                   ^~~~~~
      |                   stdin
main.c: In function 'main':
main.c:38:20: error: implicit declaration of function 'lcs' [-Wimplicit-function-declaration]
   38 |     printf("%d\n", lcs(s1, s2));
      |                    ^~~
Language: C

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

static const int N = 1000;

int lcs(char x[10], char y[10]){
  int c[N + 1][N + 1];
  int i, j, m = x.size(), n = y.size(), maxl = 0;

  x = ' ' + x;
  y = ' ' + y;
  for(i = 1 ; i <= m ; i++) c[i][0] = 0;
  for(j = 1 ; j <= n ; i++) c[0][j] = 0;

  for(i = 1 ; i <= m ; i++){
    for(j = 1 ; j <= n ; i++){
      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];
        if(c[i - 1][j] < c[i][j - 1]) c[i][j] = c[i][j - 1];
      }
      if(maxl > c[i][j]) maxl = c[i][j];
    }
  }
  return maxl;
}


int main(){
  char s1[10], s2[10];
  int n, i;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    scanf("%s %s", &s1, &s2);
    printf("%d\n", lcs(s1, s2));
  }
  return 0;
}


Compiler output:
main.c: In function 'lcs':
main.c:8:18: error: request for member 'size' in something not a structure or union
    8 |   int i, j, m = x.size(), n = y.size(), maxl = 0;
      |                  ^
main.c:8:32: error: request for member 'size' in something not a structure or union
    8 |   int i, j, m = x.size(), n = y.size(), maxl = 0;
      |                                ^
Language: C

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

static const int N = 1000;

int lcs(string x, string y){
  int c[N + 1][N + 1];
  int i, j, m = x.size(), n = y.size(), maxl = 0;

  x = ' ' + x;
  y = ' ' + y;

  for(i = 1 ; i <= m ; i++){
    c[i][0] = 0;
    for(j = 1 ; j <= n ; i++){
      c[0][j] = 0;
      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];
        if(c[i - 1][j] < c[i][j - 1]) c[i][j] = c[i][j - 1];
      }
      if(maxl > c[i][j]) maxl = c[i][j];
    }
  }
  return maxl;
}


int main(){
  char s1[10], s2[10];
  int n, i;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    scanf("%s %s", &s1, &s2);
    printf("%d\n", lcs(s1, s2));
  }
  return 0;
}


Compiler output:
main.c:6:9: error: unknown type name 'string'; did you mean 'stdin'?
    6 | int lcs(string x, string y){
      |         ^~~~~~
      |         stdin
main.c:6:19: error: unknown type name 'string'; did you mean 'stdin'?
    6 | int lcs(string x, string y){
      |                   ^~~~~~
      |                   stdin
main.c: In function 'main':
main.c:38:20: error: implicit declaration of function 'lcs' [-Wimplicit-function-declaration]
   38 |     printf("%d\n", lcs(s1, s2));
      |                    ^~~
Language: C

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

static const int N = 1000;

int lcs(char x[10], char y[10]){
  int c[N + 1][N + 1];
  int i, j, m = x.size(), n = y.size(), maxl = 0;

  x = ' ' + x;
  y = ' ' + y;

  for(i = 1 ; i <= m ; i++){
    c[i][0] = 0;
    for(j = 1 ; j <= n ; i++){
      c[0][j] = 0;
      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];
        if(c[i - 1][j] < c[i][j - 1]) c[i][j] = c[i][j - 1];
      }
      if(maxl > c[i][j]) maxl = c[i][j];
    }
  }
  return maxl;
}


int main(){
  char s1[10], s2[10];
  int n, i;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    scanf("%s %s", &s1, &s2);
    printf("%d\n", lcs(s1, s2));
  }
  return 0;
}


Compiler output:
main.c: In function 'lcs':
main.c:8:18: error: request for member 'size' in something not a structure or union
    8 |   int i, j, m = x.size(), n = y.size(), maxl = 0;
      |                  ^
main.c:8:32: error: request for member 'size' in something not a structure or union
    8 |   int i, j, m = x.size(), n = y.size(), maxl = 0;
      |                                ^
Language: C

#include <stdio.h>
#include <string.h>
#define L_MAX 1001
int max(int ,int);
int lcs(char *,char *);

int main(){
  int c;
  char x[L_MAX];
  char y[L_MAX];
  
  scanf("%d",&q);
  while(c>0){
    scanf("%s",x);
    scanf("%s",y);

    printf("%d\n",lcs(x,y));
    c--;
  }
  return 0;
}

int max(int a,int b){
  if(a<b)return b;
  else return a;
}

int lcs(char *x,char *y){
  int i,j;
  int xlen,ylen;
  int dp[L_MAX][L_MAX];
  
  xlen = strlen(x);
  ylen = strlen(y);
  
  for(i=0;i<=xlen;i++)
    for(j=0;j<=ylen;j++)
      dp[i][j]=0;
   
  for(i=0;i<xlen;i++){
    for(j=0;j<ylen;j++){
      if(x[i]==y[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]);//値が異ったら、上か左の大きいほうの値を書く
    }
  }
  return dp[xlen][ylen];
}





Compiler output:
main.c: In function 'main':
main.c:12:15: error: 'q' undeclared (first use in this function)
   12 |   scanf("%d",&q);
      |               ^
main.c:12:15: note: each undeclared identifier is reported only once for each function it appears in
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], m=X.size(), n=Y.size(), LMAX=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]);
      }
      LMAX=max(LMAX, c[i][j]);
    }
  }

  return LMAX;
}

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:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void LCS(char *x, char *y){
	int m = strlen(x+1);
	int n = strlen(y+1);
	int i, j, **c;
	
	c = malloc(sizeof(int)*(m+2));
	for (i = 0; i <= m+2; i++)
		c[i] = malloc(sizeof(int)*(n+2));
	
	for (i = 0; i <= m; i++){
		for (j = 0; j <= n; j++){
			c[i][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];
		}
	}
	
	printf("%d\n", c[i-1][j-1]);
	for (i = 0; i < m; i++)free(c[i]);
	free(c);
	
}

int main(){
	int i, n;
	char x[2000], y[2000];

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s%s", x + 1, y + 1);
		LCS(x, y);
	}
	return 0;
}

Compiler output:
main.c:1:1: error: unknown type name 'define'
    1 | define _CRT_SECURE_NO_WARNINGS
      | ^~~~~~
main.c:1:31: error: expected ';' before 'typedef'
    1 | define _CRT_SECURE_NO_WARNINGS
      |                               ^
      |                               ;
Language: C

define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void LCS(char *x, char *y){
	int m = strlen(x+1);
	int n = strlen(y+1);
	int i, j, **c;
	
	c = malloc(sizeof(int)*(1001));
	for (i = 0; i <= m; i++)
		c[i] = malloc(sizeof(int)*(n+1));
	
	for (i = 0; i <= m; i++){
		for (j = 0; j <= n; j++){
			c[i][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];
		}
	}
	
	printf("%d\n", c[i-1][j-1]);
	for (i = 0; i < m; i++)free(c[i]);
	free(c);
	
}

int main(){
	int i, n;
	char x[1001], y[1001];

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s%s", x + 1, y + 1);
		LCS(x, y);
	}
	return 0;
}

Compiler output:
main.c:1:1: error: unknown type name 'define'
    1 | define _CRT_SECURE_NO_WARNINGS
      | ^~~~~~
main.c:1:31: error: expected ';' before 'typedef'
    1 | define _CRT_SECURE_NO_WARNINGS
      |                               ^
      |                               ;
Language: C

define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void LCS(char *x, char *y){
	int m = strlen(x+1);
	int n = strlen(y+1);
	int i, j, **c;

	c = malloc(sizeof(int)*(1000));
	for (i = 0; i <= m; i++)
		c[i] = malloc(sizeof(int)*(n+1));
	
	for (i = 0; i <= m; i++){
		for (j = 0; j <= n; j++){
			c[i][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];
		}
	}
	
	printf("%d\n", c[i-1][j-1]);
	for (i = 0; i < m; i++)free(c[i]);
	free(c);
	
}

int main(){
	int i, n;
	char x[1001], y[1001];

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s%s", x + 1, y + 1);
		LCS(x, y);
	}
	return 0;
}

Compiler output:
main.c:1:1: error: unknown type name 'define'
    1 | define _CRT_SECURE_NO_WARNINGS
      | ^~~~~~
main.c:1:31: error: expected ';' before 'typedef'
    1 | define _CRT_SECURE_NO_WARNINGS
      |                               ^
      |                               ;
Language: C

define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

void LCS(char *x, char *y){
	int m = strlen(x+1);
	int n = strlen(y+1);
	int i, j, **c;

	c = malloc(sizeof(int)*(10009));
	for (i = 0; i <= m; i++)
		c[i] = malloc(sizeof(int)*(n+1));
	
	for (i = 0; i <= m; i++){
		for (j = 0; j <= n; j++){
			c[i][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];
		}
	}
	
	printf("%d\n", c[i-1][j-1]);
	for (i = 0; i < m; i++)free(c[i]);
	free(c);
	
}

int main(){
	int i, n;
	char x[1001], y[1001];

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%s%s", x + 1, y + 1);
		LCS(x, y);
	}
	return 0;
}

Compiler output:
main.c:1:1: error: unknown type name 'define'
    1 | define _CRT_SECURE_NO_WARNINGS
      | ^~~~~~
main.c:1:31: error: expected ';' before 'typedef'
    1 | define _CRT_SECURE_NO_WARNINGS
      |                               ^
      |                               ;
Language: C

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

char x[1001], y[1001];

void LCS(char x[], char y[]){
  int i,j;
  int c[m][n];  
  int m = strlen(x+1), n = strlen(y+1);

  for(i = 1; i <= m; i++){
    c[i][0] = 0;
  }

  for(j = 0; 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];
      }
    }
  }

  printf("%d\n",c[i-1][j-1]);
}

int main(){
  int i,len;

  scanf("%d",&len);
  for(i = 0; i < len; i++){
    scanf("%s",x+1);
    scanf("%s",y+1);
    LCS(x,y);
  }

  return 0;
}

Compiler output:
main.c: In function 'LCS':
main.c:8:9: error: 'm' undeclared (first use in this function)
    8 |   int c[m][n];
      |         ^
main.c:8:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:12: error: 'n' undeclared (first use in this function)
    8 |   int c[m][n];
      |            ^
Language: C

#include <stdio.h>
#include <string.h>
void LCSL(char* X,char* Y){
  int m,n,i,j,c[1050][1050];
  m=strlen(X+1);
  n=strlen(Y+1);
  for(i=0;i<=m+1;i++){
    c[i][0]=0;
  }
  for(i=0;i<=n+1;i++){
    c[0][i]=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];
    }
    
  }
 /*  for(i=0;i<=m;i++){ */
/*     for(j=0;j<=n;j++){printf(" %d",c[i][j]);} */
/*     printf("\n"); */
}


  printf("%d\n",c[i-1][j-1]);
}

main(){
  int n,i,j;
  char x[1050],y[1050];
  scanf("%d",&n);
  while(n){
    scanf("%s",x+1);
    scanf("%s",y+1);
    LCSL(x,y);
    n--;
  }
  return 0;

}

Compiler output:
main.c:33:10: error: expected declaration specifiers or '...' before string constant
   33 |   printf("%d\n",c[i-1][j-1]);
      |          ^~~~~~
main.c:33:17: error: unknown type name 'c'
   33 |   printf("%d\n",c[i-1][j-1]);
      |                 ^
main.c:34:1: error: expected identifier or '(' before '}' token
   34 | }
      | ^
main.c:36:1: error: return type defaults to 'int' [-Wimplicit-int]
   36 | main(){
      | ^~~~
Language: C

#include<stdio.h>

int LongestCommonSubsequence(char x[],char y[]){
  int i,j,n,m,c[100][100];
  m = strlen(x);
  n = strlen(y);
  for(i = 1; i <=m  ;i ++){
    c[i][0] = 0;
  }
  for(j = 1; j <=n  ;j ++){
    c[0][i] = 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];
    }
  }
  return c[i-1][j-1];
}

int main(){
  int n,i;
  char x[105],y[105];
  scanf("%d",&n);
  for(i = 1; i <= n; i ++){
    scanf("%s%s",x,y);
    printf("%d\n",LongestCommonSubsequence(x,y));
  }
  return 0;
}

Compiler output:
main.c: In function 'LongestCommonSubsequence':
main.c:5:7: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    5 |   m = strlen(x);
      |       ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:5:7: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    5 |   m = strlen(x);
      |       ^~~~~~
main.c:5:7: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:20:27: error: expected ']' before ';' token
   20 |         c[i][j] = c[i-1][j;
      |                           ^
      |                           ]
main.c:20:28: error: expected ';' before '}' token
   20 |         c[i][j] = c[i-1][j;
      |                            ^
      |                            ;
   21 |       }
      |       ~
Language: C

#include<stdio.h>
#include<string.h>
char x[1000],y[1000]; 
int c[1000][1000];
void LongestCommonSubsequence(){
  int i,j,n,m;
  m = strlen(x);
  n = strlen(y);
 
  for(i = 1; i <=m  ;i ++){
    c[i][0] = 0;
  }
  for(j = 0; j <=n  ;j ++){
    c[0][j] = 0;
  }
  for(i = 1; i <= m  ;i ++){
    for(j = 1; j <= n  ;j ++){
      if(x[i-1] == y[j-1]){
    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];
    }
  }
}
 
int main(){
  int n,i;
  scanf("%d",&n);
  for(i = 0; i < n; i ++){
    scanf("%s%s",x,y);
    printf("%d\n",c[i-1][j-1]);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:34:26: error: 'j' undeclared (first use in this function)
   34 |     printf("%d\n",c[i-1][j-1]);
      |                          ^
main.c:34:26: note: each undeclared identifier is reported only once for each function it appears in
Language: C

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

#define MAX 1000

char x[MAX], y[MAX];
int c[MAX][MAX], res;

void LCS(){
  int xlen, ylen, i, j;
  xlen=strlen(x);
  ylen=strlen(y);

  for(i = 1; i <= xlen; i++){
    c[i][0] = 0;
  }
  for(j = 0; j <= ylen; j++){
    c[0][j] = 0;
  }

  for(i = 1; i <= xlen; i++){
    for(j = 1; j <= ylen; j++){

      if(x[i-1] == y[j-1]){
	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];
      }

    }
  }

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

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

#define MAX 1000

char x[MAX], y[MAX];
int c[MAX][MAX], res;

void LCS(){
  int xlen, ylen, i, j;
  xlen=strlen(x);
  ylen=strlen(y);

  for(i = 1; i <= xlen; i++){
    c[i][0] = 0;
  }
  for(j = 0; j <= ylen; j++){
    c[0][j] = 0;
  }

  for(i = 1; i <= xlen; i++){
    for(j = 1; j <= ylen; j++){

      if(x[i-1] == y[j-1]){
	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];
      }

    }
  }

  res = c[xlen][ylen];
}

main(){
  int i,n;

  scanf("%d",&n);

  for(i = 1;i <= n;i++){
    scanf("%s",x);
    scanf("%s",y);
    LCS();
    if(i != MAX-1){
      printf("%d\n",res);
    }else{
      printf("%d",res)
    }
  }
  return 0;
}

Compiler output:
main.c:40:1: error: return type defaults to 'int' [-Wimplicit-int]
   40 | main(){
      | ^~~~
main.c: In function 'main':
main.c:52:23: error: expected ';' before '}' token
   52 |       printf("%d",res)
      |                       ^
      |                       ;
   53 |     }
      |     ~
Language: C

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

#define MAX 1000

char x[MAX], y[MAX];
int c[MAX][MAX], res;

void LCS(){
  int xlen, ylen, i, j;
  xlen=strlen(x);
  ylen=strlen(y);

  for(i = 1; i <= xlen; i++){
    c[i][0] = 0;
  }
  for(j = 0; j <= ylen; j++){
    c[0][j] = 0;
  }

  for(i = 1; i <= xlen; i++){
    for(j = 1; j <= ylen; j++){

      if(x[i-1] == y[j-1]){
	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];
      }

    }
  }

  res = c[xlen][ylen];
}

main(){
  int i,n;

  scanf("%d",&n);

  for(i = 1;i <= n;i++){
    scanf("%s",x);
    scanf("%s",y);
    LCS();
    if(i != n-1XSxsx){
      printf("%d\n",res);
    }else{
      printf("%d",res);
    }
  }
  return 0;
}

Compiler output:
main.c:40:1: error: return type defaults to 'int' [-Wimplicit-int]
   40 | main(){
      | ^~~~
main.c: In function 'main':
main.c:49:15: error: invalid suffix "XSxsx" on integer constant
   49 |     if(i != n-1XSxsx){
      |               ^~~~~~
Language: C

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

 
void LCS_Length(char *high,char *width){
    int k,l;
    int i,j;
    int c[MAX][MAX];
    k = strlen(high);
    l = strlen(width);

    /*なぜか答えが合わないので追加*/
    k=k+1;
    l=l+1;


    for(i = 0;i < k;i++){

 c[i][0] = 0;
    }

    for(j=0;j<l;j++){

 c[0][j] = 0;
    } 
    for(i=1;i<k;i++)
    {
        for(j=1;j<l;j++) 
        {
            if (high[i-1] == width[j-1]) 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];
          
        }
    }
    printf("%d\n",c[i-1][j-1]);
}

int main()
{
    char A[MAX],B[MAX];
    int n=0,i;
    scanf("%d",&n);
    

    for(i = 0;i < n; i++) 
    {
        scanf("%s",A);
        scanf("%s",B);
        LCS_Length(A,B);
    }
    retrn 0;
}

Compiler output:
main.c: In function 'main':
main.c:55:5: error: 'retrn' undeclared (first use in this function)
   55 |     retrn 0;
      |     ^~~~~
main.c:55:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:55:10: error: expected ';' before numeric constant
   55 |     retrn 0;
      |          ^~
      |          ;
Language: C

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

 
void LCS_Length(char *high,char *width){
  int k,=0,l=0,i,j;
    int c[MAX][MAX];
    


    k = strlen(high);
    l = strlen(width);

    /*なぜか答えが合わないので追加*/
    k=k+1;
    l=l+1;


    for(i = 0;i < k;i++){

 c[i][0] = 0;
    }

    for(j = 0;j < l; j++){

 c[0][j] = 0;
    } 
    for(i = 1;i <= k-1; i++)
    {
        for(j = 1;j < l; j++) 
        {
            if (high[i-1] == width[j-1]) 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];
          
        }
    }
    printf("%d\n",c[i-1][j-1]);
}

int main()
{
    char A[MAX],B[MAX];
    int n=0,i;
    scanf("%d",&n);
    

    for(i = 0;i < n; i++) 
    {
        scanf("%s",A);
        scanf("%s",B);
        LCS_Length(A,B);
    }
    return 0;
}

Compiler output:
main.c: In function 'LCS_Length':
main.c:7:9: error: expected identifier or '(' before '=' token
    7 |   int k,=0,l=0,i,j;
      |         ^
main.c:13:5: error: 'l' undeclared (first use in this function)
   13 |     l = strlen(width);
      |     ^
main.c:13:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:9: error: 'i' undeclared (first use in this function)
   20 |     for(i = 0;i < k;i++){
      |         ^
main.c:25:9: error: 'j' undeclared (first use in this function)
   25 |     for(j = 0;j < l; j++){
      |         ^
Language: C

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

char len1[1001], len2[1001];

LCS(int x, int y){
  int i,j,c[1001][1001];

   for(i=0;i<=x;i++){
      c[i][0]=0;
  }

  for(j=0;j<=y;j++){
    c[0][j]=0;
  }

  for(i=1;i<=x;i++){
    for(j=1;j<=y;j++){
      if(len1[i-1]==len2[j-1]){
	c[i][j]=c[i-1][j-1]+1;
      }else if(c[i-1][j-1]>=c[i][j-1]){
	c[i][j] = c[i-1][j];
      }else{
	c[i][j] = c[i][j-1];
      }
    }
  }

  if(i==0 || j==0){
    return 0;
  }else if(i>0 && j>0 && x == y){
    return c[i-1][j-1];
  }else if(i>0 && j>0 && x!=y){
    return c[X][Y];
  }
}

main(){
  int n,i,l1,l2,result;

  scanf("%d", &n);
  
  for(i=0;i<n;i++){
    scanf("%s",len1);
    scanf("%s",len2);
    l1=strlen(len1);
    l2=strlen(len2);
   
    result=LCS(l1,l2);
    printf("%d\n",result);
  }
}

Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | LCS(int x, int y){
      | ^~~
main.c: In function 'LCS':
main.c:35:14: error: 'X' undeclared (first use in this function)
   35 |     return c[X][Y];
      |              ^
main.c:35:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:35:17: error: 'Y' undeclared (first use in this function)
   35 |     return c[X][Y];
      |                 ^
main.c: At top level:
main.c:39:1: error: return type defaults to 'int' [-Wimplicit-int]
   39 | main(){
      | ^~~~
Language: C

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

int getLCS(char*, char*);

main(){
	char x[1001], y[1001];
	int q, i;

	scanf("%d", &q);
	for (i = 0; i < q; i++){
		scanf("%s%s", x, y);
		printf("%d\n", getLCS(x, y));
	}

	return 0;
}

int getLCS(char *x, char *y){
	int lengthX, lengthY, i, j, **arr, *tmpArr;
	int max = 0;

	lengthX = strlen(x);
	lengthY = strlen(y);

	tmpArr = malloc(sizeof(int) * (lengthX+1) * (lengthY+1));
	arr = malloc(sizeof(int) * lengthX+1);
	for (i = 0; i <= lengthX; i++){
		arr[i] = tmpArr + i * (lengthY+1);
	}

	for (i = 0; i <= lengthX; i++){
		for (j = 0; j <= lengthY; j++){
			if (i == 0 || j == 0) arr[i][j] = 0; ???
			else if (x[i-1] == y[j-1]){ 
				arr[i][j] = arr[i - 1][j - 1] + 1;
			}
			else { 
				arr[i][j] = ((arr[i - 1][j] > arr[i][j - 1]) ? arr[i - 1][j] : arr[i][j - 1]);
			}

			if (arr[i][j] > max)max = arr[i][j];
		}
	}

	return max;
}

Compiler output:
main.c:7:1: error: return type defaults to 'int' [-Wimplicit-int]
    7 | main(){
      | ^~~~
main.c: In function 'getLCS':
main.c:35:62: error: expected expression before '?' token
   35 |                         if (i == 0 || j == 0) arr[i][j] = 0; ???
      |                                                              ^
Language: C

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


int LCS(char *x, char *y){
    
    int i, j, m, n, c[1001][1001];
    
    m = strlen(x);
    n = strlen(y);
    
    for(i = 1; i <= m; i++) c[i][0] = 0;
    for(j = 0; 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];
        }
    }
    
    return c[m][n];
    
}

int main(){
    
    char x[1001], y[1001];
    int i, q;
    
    scanf("%d", &q);
    
    for(i = 0; i < q; i++){
        scanf("%s%s", x, y);
        printf("%d\n", LCS(x, y));
    }
    
    return 0;
    
}
#include<stdio.h>
#include<string.h>


int LCS(char *x, char *y){
    
    int i, j, m, n, c[1001][1001];
    
    m = strlen(x);
    n = strlen(y);
    
    for(i = 1; i <= m; i++) c[i][0] = 0;
    for(j = 0; 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];
        }
    }
    
    return c[m][n];
    
}

int main(){
    
    char x[1001], y[1001];
    int i, q;
    
    scanf("%d", &q);
    
    for(i = 0; i < q; i++){
        scanf("%s%s", x, y);
        printf("%d\n", LCS(x, y));
    }
    
    return 0;
    
}

Compiler output:
main.c:46:5: error: redefinition of 'LCS'
   46 | int LCS(char *x, char *y){
      |     ^~~
main.c:5:5: note: previous definition of 'LCS' with type 'int(char *, char *)'
    5 | int LCS(char *x, char *y){
      |     ^~~
main.c:68:5: error: redefinition of 'main'
   68 | int main(){
      |     ^~~~
main.c:27:5: note: previous definition of 'main' with type 'int()'
   27 | int main(){
      |     ^~~~
Language: C

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


int LCS(char *x, char *y){
    
    int i, j, m, n, c[1001][1001];
    
    m = strlen(x);
    n = strlen(y);
    
    for(i = 0; i <= m; i++){
        for(j = 0; j <= n; j++){
            if(i = 0 || j = 0) c[i][j] = 0;
            if(x[i] == y[j]) c[i+1][j+1] = c[i][j] + 1;
            else if(c[i][j+1] > c[i+1][j]) c[i+1][j+1] = c[i][j+1];
            else c[i+1][j+1] = c[i+1][j];
            
        }
    }
    
    return c[m][n];
    
}

int main(){
    
    char x[1001], y[1001];
    int i, q;
    
    scanf("%d", &q);
    
    for(i = 0; i < q; i++){
        scanf("%s%s", x, y);
        printf("%d\n", LCS(x, y));
    }
  
    return 0;
    
}

Compiler output:
main.c: In function 'LCS':
main.c:14:27: error: lvalue required as left operand of assignment
   14 |             if(i = 0 || j = 0) c[i][j] = 0;
      |                           ^
Language: C

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

int LCS(char *x, char *y){
    
    int i, j, m, n, c[1001][1001];
    
    m = strlen(x);
    n = strlen(y);
 
     for(i = 0; i <= m; i++){
        for(j = 0; j <= n; j++){
            if(i == 0 || j == 0) c[i][j] = 0;
            if(x[i] == y[j]) c[i+1][j+1] = c[i][j] + 1;
            else if(c[i][j+1] >= c[i+1][j]) c[i+1][j+1] = c[i][j+1];
            else c[i+1][j+1] = c[i+1][j];
        }
     }
    
    return c[m][n];
    
}

int main(){
    
    char x[1001], y[1001];
    int q;
    
    scanf("%d", &q);
    
    while(1){
        scanf("%s%s", x, y);
        printf("%d\n", LCS(x, y));
        q--;
        if(q == 0) berak;
    }
   
    return 0;
    
}

Compiler output:
main.c: In function 'main':
main.c:35:20: error: 'berak' undeclared (first use in this function)
   35 |         if(q == 0) berak;
      |                    ^~~~~
main.c:35:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <string.h>
#define MAX 1005
 
int main()
{ 
  int t, m, n, i, j, c[MAX][MAX];
  char a[MAX], b[MAX];
 
  scanf("%d", &t);
 
  while(t--){
    scanf("%s", a);
    scanf("%s", b);
    m = strlen(a);
    n = strlen(b);
    for(i=1; i<=m; i++){
      c[i][0] = 0;
    }
    for(j=0; j<=n; j++){
      c[0][j] = 0;
    }
    for(i=1; i<=m; i++){
      for(j=1; j<=n; j++){
		if(x[i-1] == y[j-1]){
		  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];
		}
      }
    }
    printf("%d\n", c[m][n]);
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:20: error: 'x' undeclared (first use in this function)
   25 |                 if(x[i-1] == y[j-1]){
      |                    ^
main.c:25:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:30: error: 'y' undeclared (first use in this function)
   25 |                 if(x[i-1] == y[j-1]){
      |                              ^
Language: C

#include<stdio.h>
#include<string.h>
#define _A_ 1
 
  
int main(){
  int n,AC=0,i,j,A,B;
  int dp[1010][1010];
  char A[1001],B[1001];
  scanf("%d",&n);
  while(_A_){
    if(AC == n)break;
    scanf("%s",A);
    scanf("%s",B);
    for(i=0;i<1010;i++)for(j=0;j<1010;j++)dp[i][j]=0;
    A=strlen(A);
    B=strlen(B); 
 
    for(i=0;i<A;i++){
      for(j=0;j<B;j++){
    if(A[i] == B[j]){
      dp[i+1][j+1]=dp[i][j]+1;
    }
    else{
      if(dp[i+1][j] > dp[i][j+1]){
        dp[i+1][j+1]=dp[i+1][j];
      }
      else {
        dp[i+1][j+1] = dp[i][j+1];
      }
    }
      }
    }
    printf("%d\n",dp[A][B]);
    AC++;
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:8: error: conflicting types for 'A'; have 'char[1001]'
    9 |   char A[1001],B[1001];
      |        ^
main.c:7:18: note: previous declaration of 'A' with type 'int'
    7 |   int n,AC=0,i,j,A,B;
      |                  ^
main.c:9:16: error: conflicting types for 'B'; have 'char[1001]'
    9 |   char A[1001],B[1001];
      |                ^
main.c:7:20: note: previous declaration of 'B' with type 'int'
    7 |   int n,AC=0,i,j,A,B;
      |                    ^