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

#include<cstdio>
#include<vector>

using namespace std;

int main(void){
	int n;
	while(scanf("%d", &n) && n != 0){
		int array[100005]={0};
		int count = 1;
		int temp;
		
		for(int i = 1; i <= n; i++){
			scanf("%d", &temp);
			//ÈçO
			//ÈçPªüÍ³êéB
			
			//Èç³Ì
			//ÈçÌðzñÉ¢êéB
			
			if(i%2){
				if(array[count-1] < 0 && temp == 1)array[count-1]--;
				else if(array[count-1] > 0 && temp == 0)array[count-1]++;
				else if(temp == 0){
					array[count] ++;
					count++;
				}
				else {
					array[count] --;
					count++;
				}
			}else{
				if(temp == 0){
					if(array[count-1] > 0){
						array[count-1]++;
					}else if(array[count-1] < 0){
						array[count-2] += abs( array[count-1] )+1;
						array[count-1] = 0;
						count--;
					}
				}else{
					if(array[count-1] < 0){
						array[count-1]--;
					}else if(array[count-1] > 0){
						array[count-2] -= abs(array[count-1])+1;
						array[count-1] = 0;
						count--;
					}
				}
			}
			/*
			printf("count -> %d\n",count);
			for(int i = 0; i <= count ; i++){
				printf("%d%s",array[i],i>=0?" ":"");
			}puts("");
			/*
			for(int i = 1; i < count; i++){
				for(int j = 0; j < abs(array[i]); j++){
					printf("%s", array[i]>0?"":"");
				}
			}puts("");
			*/
		}
		int ans = 0;
		for(int i = 0; i <= count; i++){
			if(array[i] > 0)ans+=array[i];
		}
		printf("%d\n",ans);
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:67: error: 'abs' was not declared in this scope
   37 |                                                 array[count-2] += abs( array[count-1] )+1;
      |                                                                   ^~~
a.cc:45:67: error: 'abs' was not declared in this scope
   45 |                                                 array[count-2] -= abs(array[count-1])+1;
      |                                                                   ^~~
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
using namespace std;
typedef pair<int,int> p;
typedef pair<int,p> P;
typedef pair<p,p> p2;
#define pu push
#define pb push_back
#define mp make_pair
int num[100005];
int par[100005];
int ran[100005];
void init(int n){
	for(int i=0;i<n;i++){
		par[i]=i;
		ran[i]=0;
	}
}
int find(int x){
	if(par[x] == x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}
void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x == y) return ;
	if(ran[x]<=ran[y]){
		par[x]=par[y];
	}else{
		par[y]=par[x];
		if(ran[x] == ran[y]) ran[x]++;
	}
}
bool same(int x,int y){
	return find(x)==find(y);
}
int main(){
	while(1){
	int n;
	scanf("%d",&n);
	if(!n) break;
	for(int i=0;i<n;i++){
		scanf("%d",&num[i]);
	}
	init(n);
	int st=0;
	for(int i=0;i<n;i++){
		if(num[st]==num[i]){
			unite(st,i);
		}else{
			st=i;
		}
	}
	int st=0;
	st=0;
	for(int i=0;i<n;i++){
		if(!same(st,i)){
			if(i%2==1){
				unite(st,i);
			}else{
				st=i;
			}
		}
	}
	st=0;
	int ans=0;
	for(int i=0;i<n;i++){
		if(!same(st,i)){
			int ro=num[par[st]];
			if(!ro){
				ans+=(i-st);
			}
			st=i;
		}
	}
	if(!(num[par[st]])){
		ans+=(n-st);
	}
	printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:13: error: redeclaration of 'int st'
   66 |         int st=0;
      |             ^~
a.cc:58:13: note: 'int st' previously declared here
   58 |         int st=0;
      |             ^~
Language: C++

#include <vector>
#include <cstdio>
using namespace std;
typedef pair<int,int>pii;
main(){
	int n,x,i;
	for(;scanf("%d%d",&n,&x),n;printf("%d\n",x)){
		vector<pii>v;
		v.push_back(make_pair(x,1));
		for(i=1;i<n;i++){
			pii p=v.back();v.pop_back();
			scanf("%d",&x);
			if(i&1){
				if(x==p.first)
					v.push_back(make_pair(x,p.second+1));
				else{
					pii q=v.back(),v.pop_back();
					v.push_back(make_pair(x,q.second+p.second+1));
				}
			}else{
				if(x==p.first)v.push_back(make_pair(x,p.second+1));
				else v.push_back(p),v.push_back(make_pair(x,1));
			}
		}
		for(x=i=0;i<v.size();i++){
			if(!v[i].first)x+=v[i].second;
		}
	}
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:17:57: error: expected initializer before '.' token
   17 |                                         pii q=v.back(),v.pop_back();
      |                                                         ^
Language: C++

#include <vector>
#include <cstdio>
typedef std::pair<int,int>pii;
main(){
	int n,x,i,q;
	pii p;
	for(;scanf("%d%d",&n,&x),n;printf("%d\n",x)){
		std::vector<pii>v;
		v.push_back(make_pair(x,1));
		for(i=1;i<n;i++)
			if(p=v.back(),scanf("%d",&x),x==p.first)v.back().second++;
			else if(i&1){
				if(v.pop_back(),q=0,v.size())q=v.back().second,v.pop_back();
				v.push_back(make_pair(x,q+p.second+1));
			}else v.push_back(make_pair(x,1));
		for(x=i=0;i<v.size();i++)if(!v[i].first)x+=v[i].second;
	}
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:9:29: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
    9 |                 v.push_back(make_pair(x,1));
      |                             ^~~~~~~~~
      |                             std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
Language: C++

#include <cstdio>
#include <cstring>
bool stone[100000];
int main() {
	int n;
	while(scanf("%d",&n),n) {
		memset(stone,0,sizeof(stone));
		for(int i=0;i<n;i++) {
			scanf("%d",&stone[i]);
			if((i&1)&&(stone[i]^stone[i-1])) {
				for(int j=i-1;j>=0;j--) {
					if(stone[i]^stone[j]) stone[j^=1;
					else break;
				}
			}
		}
		int sum=0;
		for(int i=0;i<n;i++) sum+=!stone[i];
		printf("%d\n",sum);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:73: error: expected ']' before ';' token
   12 |                                         if(stone[i]^stone[j]) stone[j^=1;
      |                                                                         ^
      |                                                                         ]
Language: Java

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
for(;sc.hasNext();){
String s=sc.next();
String t=sc.next();
System.out.println(lcs(s,t));
}
}
	int lcs(String s, String t){
		int m=s.length(), n=t.length();
		int[][] d=new int[n+1][m+1];
		int[][] v=new int[n+1][m+1];
		for(int j=1; j<=n; j++){
			for(int i=1; i<=m; i++){
				if(s.charAt(i-1)==t.charAt(j-1))
					d[j][i]=d[j-1][i-1]+1;
				d[j][i]=Math.max(d[j][i-1], d[j-1][i]);
			}
		}
		return d[n][m];
	}

}

Compiler output:
Main.java:15: error: non-static method lcs(String,String) cannot be referenced from a static context
System.out.println(lcs(s,t));
                   ^
1 error
Language: Java

import java.util.Scanner;

public class A0528 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {
			String s1 = sc.next();
			String s2 = sc.next();
			int dp[][] = new int[s1.length()][s2.length()];
			int max = 0;

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

			System.out.println(max);
		}
	}
}

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


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main2 {

	/**
	 * @param args 
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String ss = br.readLine();
			if(ss.equals(""))break;
			String tt = br.readLine();
			int[]s = new int[ss.length()];
			int[]t = new int[tt.length()];
			for(int i=0;i<s.length;i++){
				s[i] = ss.charAt(i);
			}
			for(int i=0;i<t.length;i++){
				t[i] = tt.charAt(i);
			}
			SuffixArray sa = new SuffixArray(s);
			int left=-1,right=t.length+1;
			while(left<right-1){
				int len= (left+right)/2;
				boolean f = false;
				int[] sub = new int[len];
				for(int i=0;i<t.length;i++){
					if(i+len>t.length)break;
					for(int k=i;k<i+len;k++){
						sub[k-i]=t[k];
					}
					if(sa.contain(sub)){
						f=true;
						break;
					}
				}
				if(f){
					left=len;
				}
				else{
					right=len;
				}

			}
			System.out.println(left);
		}
	}

	static class SuffixArray {

		int n,k=1;
		Integer[] sa,rank,tmp;
		int[] s;

		SuffixArray(int[] _s) {
			s=_s;
			n = s.length;
			rank=new Integer[n+1];
			sa=new Integer[n+1];
			tmp=new Integer[n+1];
			for(int i=0;i<n;i++){
				sa[i]=i;
				rank[i]=s[i];
			}
			sa[n]=n;
			rank[n]=-1;

			for(k=1;k<=n;k<<=1){
				Arrays.sort(sa,new Comparator<Integer>(){
					@Override
					public int compare(Integer o1, Integer o2) {
						int r1=rank[o1];
						int r2=rank[o2];
						if(r1!=r2)return r1-r2;
						int r11=o1+k <= n ? rank[o1+k] : -1;
						int r22=o2+k <= n ? rank[o2+k] : -1;

						return r11-r22;
					}
				});
				tmp[sa[0]]=0;
				for(int i=1;i<=n;i++){
					tmp[sa[i]]=tmp[sa[i-1]]+ (compare(sa[i-1],sa[i])!=0?1:0);
				}
				for(int i=0;i<=n;i++){
					rank[i]=tmp[i];
				}
			}
		}

		/*
		 * s.contains(t)的な
		 */
		boolean contain(int[] t){
			return contain(s,sa,t);
		}

		private boolean contain(int[]s,Integer[] sa,int[] t){
			int a=0,b=s.length;
			while(b-a>1){
				int c = (a+b)/2;
				//			String sub = s.substring(sa[c], Math.min(sa[c]+t.length, s.length));
				if(compare(s,sa[c],Math.min(sa[c]+t.length, s.length),t)<0){
					a=c;
				}
				else{
					b=c;
				}
			}
			return compare(s,sa[b], Math.min(sa[b]+t.length, s.length),t)==0;
		}

		/*
		 * s.substring(i1,i2).compareTo(t) 的な
		 */
		private int compare(int[]s,int i1,int i2,int[] t){
			for(int i=i1;i<i2;i++){
				if(i-i1>=t.length){
					return 1;
				}
				if(s[i]!=t[i-i1]){
					return s[i]-t[i-i1];
				}
			}
			return (i2-i1)-t.length;
		}

		private int compare(Integer o1, Integer o2) {
			int r1=rank[o1];
			int r2=rank[o2];
			if(r1!=r2)return (r1-r2);
			int r11=o1+k <= n ? rank[o1+k] : -1;
			int r22=o2+k <= n ? rank[o2+k] : -1;

			return (r11-r22);
		}
	}
}

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

#include <stdio.h>
b=5e3,m,i,j,c;
char s[10000],t[10000];
main() {
    gets(s+b);
    gets(t+b);
    m=0;
    for(i=-b;i<b;i++) {
        c=0;
        for(j=b;s[j];j++) {
            if(s[j]!=t[i+j])
                c=0;
            else if(m<++c)m=c;
        }
    }
    printf("%d\n",m);
    return 0;
}

Compiler output:
main.c:2:1: warning: data definition has no type or storage class
    2 | b=5e3,m,i,j,c;
      | ^
main.c:2:1: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
main.c:2:7: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
    2 | b=5e3,m,i,j,c;
      |       ^
main.c:2:9: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
    2 | b=5e3,m,i,j,c;
      |         ^
main.c:2:11: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
    2 | b=5e3,m,i,j,c;
      |           ^
main.c:2:13: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
    2 | b=5e3,m,i,j,c;
      |             ^
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
    4 | main() {
      | ^~~~
main.c: In function 'main':
main.c:5:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    5 |     gets(s+b);
      |     ^~~~
      |     fgets
Language: C

main(){
short_coding_muzui_owata();
}

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){
      | ^~~~
main.c: In function 'main':
main.c:2:1: error: implicit declaration of function 'short_coding_muzui_owata' [-Wimplicit-function-declaration]
    2 | short_coding_muzui_owata();
      | ^~~~~~~~~~~~~~~~~~~~~~~~
Language: C

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

int main(void)
{
    static int dp[4001][4001];
    char str1[4001], str2[4001];
    int len1, len2;
    int i, j, ans;
    
    while (scanf("%s", str1) != EOF){
        getchar();
        scanf("%s", str2);
        getchar();
        
        len1 = strlen(str1);
        len2 = strlen(str2);
        memset(dp, 0, sizeof(dp));
        
        ans = 0;
        for (i = 0; i < len1; i++){
            for (j = 0; j < len2; j++){
                if (str1[i] == str2[j]){
                    dp[i + 1][j + 1] = dp[i][j] + 1;
                }
                else {
                    dp[i + 1][j + 1] = min(dp[i + 1][j], dp[i][j + 1]);
                }
                ans = max(dp[i][j], ans);
            }
        }
        
        printf("%d\n", ans);
    }
    
    return (0);
}

Compiler output:
main.c: In function 'main':
main.c:28:40: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
   28 |                     dp[i + 1][j + 1] = min(dp[i + 1][j], dp[i][j + 1]);
      |                                        ^~~
      |                                        main
main.c:30:23: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   30 |                 ans = max(dp[i][j], ans);
      |                       ^~~
Language: C

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string a,b;
int n,m;

int solve(int x, int y){
    int ret=0,cnt=0;
    while(x < n && y < m){
        if(a[x] == b[y]){
            cnt++;
        }else{
            ret = max(ret,cnt);
            cnt = 0;
        }
        x++;
        y++;
    }
    return max(ret,cnt);
}

int main(){
    while(cin >> a >> b){
        int x=0,y=0,t=1,tmp=0,ret=0;
        n=a.size();
        m=b.size();
        for(int i=0;i<n;i++){
            ret = max(ret,solve(i,0));
        }
        for(int i=0;i<m;i++){
            ret = max(ret,solve(0,i));
        }
        cout << ret << endl;
    }
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

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

int max(int,int);

int main(void){
  char str1[4001],str2[4001];
  int i,j,dp[4001][4001],count;

  while(~scanf("%[^\n]%*c",str1)){
    scanf("%[^\n]%*c",str2);

    for(i=0;i<=strlen(str1);i++)
      for(j=0;j<=strlen(str2);j++)
	dp[i][j]=0;

    count=0;
    for(i=0;i<strlen(str1);i++){
      for(j=0;j<strlen(str2);j++){
	if(str1[i]==str2[j]){
	  dp[i+1][j+1]=dp[i][j]+1;
	  count=max(count,dp[i+1][j+1]);
	}
	else dp[i+1][j+1]=0;
      }
    }
    printf("%d\n",count);
  }

  return 0;
}

Compiler output:
/usr/bin/ld: /tmp/cccIMsQy.o: in function `main':
main.c:(.text+0x146): undefined reference to `max'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>
#include<stdlib.h>
#define max(x, y) ((x) > (y) ? (x) : (y))
int main(){
  int dp[4001][4001];
  int i, j, k;
  while(scanf("%s %s", str1, str2) != EOF){
    int res = 0;
    for(i = 0;i < strlen(str1);i++){
      for(j = 0;j < strlen(str2);j++){
        int x = 0;
        for(k = 0;i + k < strlen(str1) && j + k < strlen(str2);k++){
          if(str1[i + k] == str2[j + k])x++;
          else x = 0;
          res = max(res, x);
        }
      }
    }
    printf("%d\n", res);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:24: error: 'str1' undeclared (first use in this function)
    7 |   while(scanf("%s %s", str1, str2) != EOF){
      |                        ^~~~
main.c:7:24: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:30: error: 'str2' undeclared (first use in this function)
    7 |   while(scanf("%s %s", str1, str2) != EOF){
      |                              ^~~~
main.c:9:19: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    9 |     for(i = 0;i < strlen(str1);i++){
      |                   ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | #define max(x, y) ((x) > (y) ? (x) : (y))
main.c:9:19: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    9 |     for(i = 0;i < strlen(str1);i++){
      |                   ^~~~~~
main.c:9:19: note: include '<string.h>' or provide a declaration of 'strlen'
Language: C

#include<stdio.h>#include <string.h>short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}

Compiler output:
main.c:1:18: warning: extra tokens at end of #include directive
    1 | #include<stdio.h>#include <string.h>short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
      |                  ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h> #include <string.h>short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}

Compiler output:
main.c:1:19: warning: extra tokens at end of #include directive
    1 | #include<stdio.h> #include <string.h>short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
      |                   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>#include <string.h>
short dp[4001][4001]={},ans=0;
char str1[2][4005];
int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){
if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}

Compiler output:
main.c:1:18: warning: extra tokens at end of #include directive
    1 | #include<stdio.h>#include <string.h>
      |                  ^
main.c: In function 'main':
main.c:4:70: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
    4 | int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){
      |                                                                      ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include<stdio.h>#include <string.h>
  +++ |+#include <string.h>
    2 | short dp[4001][4001]={},ans=0;
main.c:4:70: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    4 | int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){
      |                                                                      ^~~~~~
main.c:4:70: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:5:131: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
    5 | if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
      |                                                                                                                                   ^~~~~~
main.c:5:131: note: include '<string.h>' or provide a declaration of 'memset'
main.c:5:131: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
main.c:5:131: note: include '<string.h>' or provide a declaration of 'memset'
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
	char a[4000],b[4000];
	while(scanf("%s",a)!=EOF){
		scanf("%s",b);
	int t[4002][4002];
	for(int i=0;i<=strlen(a);i++){
		t[0][i]=0;
	}
	for(int j=0;j<=strlen(b);j++){
		t[j][0]=0;
	}
	for(int i=1;i<=strlen(a);i++){
		for(int j=1;j<=strlen(b);j++){
			if(a[i-1]==b[j-1])t[i][j]=t[i-1][j-1]+1;
			else t[i][j]=0;
		}
	}

	int ans=0;
	for(int i=1;i<=strlen(a);i++){
		for(int j=1;j<=strlen(b);j++){
			ans=max(ans,t[i][j]);
		}
	}
	cout << ans << "\n";
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:24: error: 'strlen' was not declared in this scope
   11 |         for(int i=0;i<=strlen(a);i++){
      |                        ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | #include<string>
a.cc:14:24: error: 'strlen' was not declared in this scope
   14 |         for(int j=0;j<=strlen(b);j++){
      |                        ^~~~~~
a.cc:14:24: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:17:24: error: 'strlen' was not declared in this scope
   17 |         for(int i=1;i<=strlen(a);i++){
      |                        ^~~~~~
a.cc:17:24: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:25:24: error: 'strlen' was not declared in this scope
   25 |         for(int i=1;i<=strlen(a);i++){
      |                        ^~~~~~
a.cc:25:24: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

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

int dp[4001][4001];

int main(){
	char str1[4001],str2[4001];
	while(cin>>str1>>str2){
		int ans=0;
		memset(dp,0,sizeof(dp));
		for(int i=0;str1[i]!='\0';i++){
			for(int j=0;str2[j]!='\0';j++){
				if(str1[i]==str2[j]){
					dp[i+1][j+1]=dp[i][j]+1;
				}
				if(ans<dp[i+1][j+1]){
					ans=dp[i+1][j+1];
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'memset' was not declared in this scope
   11 |                 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<cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>

#define REP(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
#define init(a,b) memset((a), (b), sizeof((a)))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double EPS=1e-9;
const long long INF = 100001000010000100ll;

template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
typedef pair<int,int> pii;


string L, R;

int dp[4000+10][4000+10];

int main(){
	while(cin >> L >> R, L){
		memset(dp, 0, sizeof(dp));
		int ans=0;
		rp(i, R){
			rp(j, L){
				if(R[i]==L[j]){
					dp[i][j] = dp[i-1][j-1] + 1;
				}else{
					dp[i][j]=0;
				}
				ans=max(ans, dp[i][j]);
			}
		}
		cout << ans << endl;

	}

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:28: error: could not convert '(((void)std::operator>><char, char_traits<char>, allocator<char> >((* & std::operator>><char, char_traits<char>, allocator<char> >(std::cin, L)), R)), L)' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   64 |         while(cin >> L >> R, L){
      |               ~~~~~~~~~~~~~^~~
      |                            |
      |                            std::string {aka std::__cxx11::basic_string<char>}
Language: C++

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

int dp[4001][4001];

int main(){
    
    string s, t;

    while(cin >> s >> t){
        memset(dp, -1, sizeof(dp));
        dp[0][0] = (s[0] == t[0]);
        for(int i = 1; i < s.size(); i++){
            for(int j = 1; j < t.size(); j++){
                if(s[i] == t[j]) dp[i][j] = dp[i - 1][j - 1] + 1;
                else dp[i][j]  = 0;
            }
        }
        int maxi = 0;
        for(int i = 0; i < s.size(); i++){
            maxi = max(maxi, *max_element(dp[i], dp[i] + t.size()));
        }
        cout << maxi << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
   13 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
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<cstdio>
#include<math.h>
#include<algorithm>


using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
char A[4002],B[4002];
int DP[4002][4002];


int main(){
	while(1){
		scanf("%s",A);
		scanf("%s",B);
		memset(DP,0,sizeof(DP));
		int ans=0;
		rep(i,strlen(A)){
			rep(j,strlen(B)){
				if(A[i]==B[j]){
					if(i!=0&&j!=0){
						DP[i][j]+=DP[i-1][j-1];
					}
					DP[i][j]++;
				}
				ans=max(ans,DP[i][j]);
			}
		}
	printf("%d\n",ans);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'memset' was not declared in this scope
   17 |                 memset(DP,0,sizeof(DP));
      |                 ^~~~~~
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 | 
a.cc:19:23: error: 'strlen' was not declared in this scope
   19 |                 rep(i,strlen(A)){
      |                       ^~~~~~
a.cc:7:32: note: in definition of macro 'rep'
    7 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:19:23: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   19 |                 rep(i,strlen(A)){
      |                       ^~~~~~
a.cc:7:32: note: in definition of macro 'rep'
    7 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                ^
Language: C++

//JOI 0528 Common Sub-String
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	string s, t; int roop1, roop2 = 0, save[10000], ans = 0;
	while(1){
        cin>>s>>t
	for (int i = 0; i<s.size(); i++){
		for (int j = 0; j<t.size(); j++){
			if (s[i] == t[j]){
				roop1 = 0;
				save[roop2] = 0;
				while (1){
					if (s[i + roop1] == 0 || t[j + roop1] == 0){
						break;
					}
					else{
						if (s[i + roop1] == t[j + roop1]){
							save[roop2] += 1;
							roop1++;
						}
						else if (s[i + roop1] != t[j + roop1]){
							roop2++;
							break;
						}
					}
				}
			}
		}
	}
	sort(save, save + roop2 + 1);
	ans = save[roop2];
	cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:18: error: expected ';' before 'for'
    9 |         cin>>s>>t
      |                  ^
      |                  ;
   10 |         for (int i = 0; i<s.size(); i++){
      |         ~~~       
a.cc:10:25: error: 'i' was not declared in this scope
   10 |         for (int i = 0; i<s.size(); i++){
      |                         ^
Language: C++

//JOI 0528 Common Sub-String
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	string s, t; int roop1, roop2 = 0, save[10000], ans = 0;
	while(cin>>s>>t&&){
	for (int i = 0; i<s.size(); i++){
		for (int j = 0; j<t.size(); j++){
			if (s[i] == t[j]){
				roop1 = 0;
				save[roop2] = 0;
				while (1){
					if (s[i + roop1] == 0 || t[j + roop1] == 0){
						break;
					}
					else{
						if (s[i + roop1] == t[j + roop1]){
							save[roop2] += 1;
							roop1++;
						}
						else if (s[i + roop1] != t[j + roop1]){
							roop2++;
							break;
						}
					}
				}
			}
		}
	}
	sort(save, save + roop2 + 1);
	ans = save[roop2];
	cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:26: error: expected primary-expression before ')' token
    8 |         while(cin>>s>>t&&){
      |                          ^
Language: C++

//JOI 0528 Common Sub-String
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	string s, t; int roop1, roop2 = 0, save[10000], ans = 0;
	while(cin){
             cin>>s>>t:
             if(cin.eof())
             break;
	for (int i = 0; i<s.size(); i++){
		for (int j = 0; j<t.size(); j++){
			if (s[i] == t[j]){
				roop1 = 0;
				save[roop2] = 0;
				while (1){
					if (s[i + roop1] == 0 || t[j + roop1] == 0){
						break;
					}
					else{
						if (s[i + roop1] == t[j + roop1]){
							save[roop2] += 1;
							roop1++;
						}
						else if (s[i + roop1] != t[j + roop1]){
							roop2++;
							break;
						}
					}
				}
			}
		}
	}
	sort(save, save + roop2 + 1);
	ans = save[roop2];
	cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: expected ';' before ':' token
    9 |              cin>>s>>t:
      |                       ^
      |                       ;
Language: C++

//JOI 0528 Common Sub-String
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	while(cin){
		string s, t; int roop1=0, save=0, ans = 0;
		cin>>s;
		cin>>t;
		if(s==/0){
		break;
		}
	for (int i = 0; i<s.size(); i++){
		for (int j = 0; j<t.size(); j++){
			if (s[i] == t[j]){
				roop1 = 0;
				save= 0;
				while (1){
					if (s[i + roop1] == 0 || t[j + roop1] == 0){
						break;
					}
					else{
						if (s[i + roop1] == t[j + roop1]){
							save += 1;
							roop1++;
						}
					else if (s[i + roop1] != t[j + roop1]){
							ans=max(ans,save);
							break;
						}
					}
				}
			}
		}
	}
	cout<<ans<<endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: expected primary-expression before '/' token
   11 |                 if(s==/0){
      |                       ^
Language: C++

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

int main() {
	while(true){
		string s,t;
		cin>>s>>t;
		if(s){
			break;
		}
	
		int ans=0;
		for(int i=0;i<s.size();i++){
			for(int j=0;j<t.size();j++){
				if(s[i]==t[j]){
					int sum=0;
					sum++;
					for(int k=1;k<min(s.size(),t.size());k++){
						if(s[i+k]==t[j+k]){
							sum++;
						} else{
							ans=max(ans,sum);
							break;
						}
					}
				}
			}
		}
	
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: could not convert 's' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   10 |                 if(s){
      |                    ^
      |                    |
      |                    std::string {aka std::__cxx11::basic_string<char>}
Language: C++

#include<bits/stdc++.h>
using namespace std;
short cnt[4100][4100];
int main(){
  string str1,str2;
  while(cin >> str1){
    cin >> str2;
    int len1 = str1.size();
    int len2 = str2.size();
    str1 = ' ' + str1;
    str2 = ' ' + str2;
    for(int i=1;i<=len1;i++){
      cnt[i][0] = 0;
    } 
    for(int i=1;i<=len2;i++){
      cnt[0][i] = 0;
    }
    int ret = 0;
    for(int i=1;i<=len1;i++){
      for(int j=1;j<=len2;j++){
	if(str1[i] == str2[j]){
	  cnt[i][j] = cnt[i-1][j-1] + 1;
	}
	else {
	  cnt[i][j] = 0;
	}
	ret = max(ret,cnt[i][j]);
      }
    }
    cout << ret << endl;
  }	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: no matching function for call to 'max(int&, short int&)'
   27 |         ret = max(ret,cnt[i][j]);
      |               ~~~^~~~~~~~~~~~~~~
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:27:18: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   27 |         ret = max(ret,cnt[i][j]);
      |               ~~~^~~~~~~~~~~~~~~
/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:27:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |         ret = max(ret,cnt[i][j]);
      |               ~~~^~~~~~~~~~~~~~~
Language: C++

#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

short dp[4000][4000];
char s[4001], t[4001];

int main() {
    while (cin >> s >> t) {
        for (int j = 0; j < 4000; ++j) {
            fill(dp[j], dp[j] + 4000, 0);
        }

        int sLen = strlen(s);
        int tLen = strlen(t);

        int ret = 0;

        for (int j = 0; j < sLen; ++j) {
            for (int k = 0; k < tLen; ++k) {
                if (s[j] != t[k]) {
                    dp[j][k] = 0;
                } else if (j == 0 || k == 0) {
                    dp[j][k] = 1;
                } else {
                    dp[j][k] = dp[j-1][k-1] + 1;
                }

                ret = max(ret, dp[j][k]);
            }
        }

        cout << ret << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:26: error: no matching function for call to 'max(int&, short int&)'
   45 |                 ret = max(ret, dp[j][k]);
      |                       ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 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:45:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   45 |                 ret = max(ret, dp[j][k]);
      |                       ~~~^~~~~~~~~~~~~~~
/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:45:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   45 |                 ret = max(ret, dp[j][k]);
      |                       ~~~^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define LL long long 
const int INF = 1145141919;

int dp[4002][4002];

int main(){
	string s1, s2;
	while (cin >> s1){
		cin >> s2;
		int ans = 0;
		memset (dp, 0, sizeof(dp));
		REP (i, s1.size()){
			REP (j, s2.size()){
				if (s1[i] == s2[j]){
					dp[i+1][j+1] = dp[i][j] + 1;
					ans = max (ans, dp[i+1][j+1]);
				}
			}
		}
		cout << ans << endl;
	}	
}

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

#include <iostream>
#include <cstdio>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define LL long long 
const int INF = 1145141919;

int dp[4002][4002];

int main(){
	string s1, s2;
	while (cin >> s1){
		cin >> s2;
		int ans = 0;
		memset (dp, 0, sizeof(dp));
		REP (i, s1.size()){
			REP (j, s2.size()){
				if (s1[i] == s2[j]){
					dp[i+1][j+1] = dp[i][j] + 1;
					ans = max (ans, dp[i+1][j+1]);
				}
			}
		}
		cout << ans << endl;
	}	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'memset' was not declared in this scope
   18 |                 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 <cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

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

using namespace std;

int dp[4001][4001];

void solve()
{
	string a, b;
	while (cin >> a)
	{
		cin >> b;
		memset(dp, 0, sizeof(dp));
		int ans = 0;
		for (int i = 0; i < a.size(); ++i)
		{
			for (int j = 0; j < b.size(); ++j)
			{
				if (a[i] == b[j])
				{
					dp[i + 1][j + 1] = dp[i][j] + 1;
					ans = max(ans, dp[i + 1][j + 1]);
				}
				else
				{
					dp[i + 1][j + 1] = 0;
				}
			}
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:15:17: error: 'memset' was not declared in this scope
   15 |                 memset(dp, 0, sizeof(dp));
      |                 ^~~~~~
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 |
Language: C++

#include <iostream>
#include <string>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int ans, dp[4001][4001];

int main() {
	while (true) {
		ans = 0;
		memset(dp, 0, sizeof(dp));
		string str[2];
		cin >> str[0];
		if (str[0].empty()) break;
		cin >> str[1];
		REP(i, (int)str[0].size()) {
			REP(j, (int)str[1].size()) {
				if (str[0][i] == str[1][j]) {
					dp[i + 1][j + 1] = dp[i][j] + 1;
					ans = ans < dp[i + 1][j + 1] ? dp[i + 1][j + 1] : ans;
				}
				else dp[i + 1][j + 1] = 0;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

#define rep(i, n)      for (int i=0; i<int(n); i++)
#define rep3(i, s, n)  for (int i=int(s); i<int(n); i++)
#define rev_rep(i, n)  for (int i=int(n)-1; i>=0; i-=1)

char s[4010];
char t[4010];
int dp[4010][4010];
int main() {
  while (cin >> s >> t) {
  int s_len = strlen(s), t_len = strlen(t);
  rep(i, s_len) {
    rep(j, t_len) {
      if (s[i] == t[j]) dp[i][j] = ((i>1&&j>1) ? dp[i-1][j-1] : 0) + 1;
      else              dp[i][j] = 0;
    }
  }
  int ans = 0;
  rep(i, s_len) {
    rep (j, t_len) {
      ans = max(ans, dp[i][j]);
    }
  }
  cout << ans << "\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: 'strlen' was not declared in this scope
   19 |   int s_len = strlen(s), t_len = strlen(t);
      |               ^~~~~~
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <cmath>
  +++ |+#include <cstring>
    7 | 
a.cc:21:12: error: 't_len' was not declared in this scope; did you mean 's_len'?
   21 |     rep(j, t_len) {
      |            ^~~~~
a.cc:10:44: note: in definition of macro 'rep'
   10 | #define rep(i, n)      for (int i=0; i<int(n); i++)
      |                                            ^
a.cc:28:13: error: 't_len' was not declared in this scope; did you mean 's_len'?
   28 |     rep (j, t_len) {
      |             ^~~~~
a.cc:10:44: note: in definition of macro 'rep'
   10 | #define rep(i, n)      for (int i=0; i<int(n); i++)
      |                                            ^
Language: C++

#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
#include <cstdlib>

using namespace std;

#define rep(i, n)      for (int i=0; i<int(n); i++)
#define rep3(i, s, n)  for (int i=int(s); i<int(n); i++)
#define rev_rep(i, n)  for (int i=int(n)-1; i>=0; i-=1)

char s[4010];
char t[4010];
int dp[4010][4010];
int main() {
  while (cin >> s >> t) {
  int s_len = strlen(s), t_len = strlen(t);
  rep(i, s_len) {
    rep(j, t_len) {
      if (s[i] == t[j]) dp[i][j] = ((i>1&&j>1) ? dp[i-1][j-1] : 0) + 1;
      else              dp[i][j] = 0;
    }
  }
  int ans = 0;
  rep(i, s_len) {
    rep (j, t_len) {
      ans = max(ans, dp[i][j]);
    }
  }
  cout << ans << "\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: 'strlen' was not declared in this scope
   20 |   int s_len = strlen(s), t_len = strlen(t);
      |               ^~~~~~
a.cc:8:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <cstdlib>
  +++ |+#include <cstring>
    8 | 
a.cc:22:12: error: 't_len' was not declared in this scope; did you mean 's_len'?
   22 |     rep(j, t_len) {
      |            ^~~~~
a.cc:11:44: note: in definition of macro 'rep'
   11 | #define rep(i, n)      for (int i=0; i<int(n); i++)
      |                                            ^
a.cc:29:13: error: 't_len' was not declared in this scope; did you mean 's_len'?
   29 |     rep (j, t_len) {
      |             ^~~~~
a.cc:11:44: note: in definition of macro 'rep'
   11 | #define rep(i, n)      for (int i=0; i<int(n); i++)
      |                                            ^
Language: C++

#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	string a, b;
	while (cin >> a >> b;) {
		int dp[4001][4001];
		for (int i = 0; i < 4001; ++i) {
			for (int j = 0; j < 4001; ++j) {
				dp[i][j] = -1e9;
			}
		}
		dp[0][0] = 0;
		int ans = 0;
		for (int i = 0; i < a.size(); ++i) {
			for (int j = 0; j < a.size(); ++j) {
				if (a[i] == b[j]) {
					if (i > 0 && j > 0) {
						dp[i][j] = dp[i - 1][j - 1] + 1;
					}
					else {
						dp[i][j] = 1;
					}

				}
				ans = max(ans, dp[i][j]);
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:29: error: expected ')' before ';' token
   14 |         while (cin >> a >> b;) {
      |               ~             ^
      |                             )
a.cc:14:30: error: expected primary-expression before ')' token
   14 |         while (cin >> a >> b;) {
      |                              ^