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

/*
AizuOnline A0571
JJOOII
*/
#include <stdio.h>
#include <string.h>

char buffer[100001];


char * find_chr_run(char * s,char c,int * ret)
{
  int i;
  char *p;

  if(NULL==(p=strchr(s,c)))
    return(NULL);
  i=0;
  while(p[i]==c)
    i++;
  *ret = i;

  return(p);
}

// do not search before start !
char * chr_run_back(char * s,char c,char * start,int * ret)
{
  int i;
  i=0;
  
  while(*s==c  && s >= start )
    {
      printf("CRB:%s\n",s);      
      i++;s--;
    }
  *ret=i;
  return(s);
}

int findJOI()
{
  char *p,*p1,*p0;
  int maxlen;
  int run_i,run_o,run_j;

  maxlen=0;
  p=buffer+2;

  while(*p && p<buffer+strlen(buffer))
    { p0=p;
      p=find_chr_run(p,'I',&run_i);
      //printf("r_i:%d\n",run_i);
      p1=p;
      if(p==NULL)
	return(maxlen);
      p=chr_run_back(p-1,'O',p0,&run_o);
      //printf("r_o:%d\n",run_o);
      if(run_o == 0 || run_o > run_i)
	{
	  p=p1+run_i;
	  continue;
	}
      p=chr_run_back(p,'J',p0,&run_j);
      //printf("r_j:%d\n",run_j);
      if(run_o == 0 || run_o > run_j)
	{
	  p=p1+run_i;
	  //printf("*\n");
	  continue;
	}
      if(maxlen < run_o)
	{
	  maxlen = run_o;
	  p=p1+run_i+2*maxlen;
	  //printf("**\n");
	}
      else
	{
	  p=p1+run_i;
	  //printf("*\n");
	}
	
    }
  return(maxlen);
} 
main()
{
  int ret;

  buffer=buffer0+1;
  gets(buffer);

  //  printf("%s\n",buffer);
  ret = findJOI();

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

Compiler output:
main.c:87:1: error: return type defaults to 'int' [-Wimplicit-int]
   87 | main()
      | ^~~~
main.c: In function 'main':
main.c:91:10: error: 'buffer0' undeclared (first use in this function); did you mean 'buffer'?
   91 |   buffer=buffer0+1;
      |          ^~~~~~~
      |          buffer
main.c:91:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:92:3: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   92 |   gets(buffer);
      |   ^~~~
      |   fgets
Language: C++

#include <cstdio>
using namespace std;

typedef struct {
	char c;
	int num;
} C_NUM

int main()
{
	char str[2048];
	C_NUM c_num[2048];
	
	scanf("%s", str);
	int len = strlen(str);
	
	int j = 0;
	for (int i = 0; i < len; i++){
		if (j == 0 || str[i] != c_num[j - 1].c){
			c_num[j].c = str[i];
			c_num[j].num = 1;
		}
		else if (str[i] == c_num[j - 1]){
			c_num[j].num++;
		}
	}
	
	int max_k = 0;
	for (int i = 0; i < j; i++){
		if (c_num[i].c == 'O'){
			if (
			(c_num[i - 1].c == 'J' && c_num[i - 1].num >= c_num[i].num) &&
			(c_num[i + 1].c == 'I' && c_num[i + 1].num >= c_num[i].num) &&
			(max_k < c_num[i])
			){
				max_k = c_num[i];
			}
		}
	}
	
	printf("%d\n", max_k);
}

Compiler output:
a.cc:9:1: error: expected initializer before 'int'
    9 | int main()
      | ^~~
Language: C++

#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>




#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
using namespace std;
char T[1000002];
pair<int,int> W[1000002];

int charid(char a){
	if(a=='J')return 0;
	if(a=='O')return 1;
	if(a=='I')return 2;
}
int main(){
	//FILE *fp;
	//fp=fopen("D:\\1JOI本選\\2012\\2012-ho-data\\2012-ho-t1\\in\\10-02.txt","r");
	scanf("%s",T);
	int pairnum=0;
	int pairtype=0;
	int pairsum=0;
	rep(i,(int)(strlen(T))){
		if(i==0){pairtype=charid(T[i]);continue;}
		if(T[i]==T[i-1])pairsum++;
		else{
			W[pairnum]=make_pair(pairtype,pairsum+1);
			pairnum++;
			pairtype=charid(T[i]);
			pairsum=0;
		}
		if(i==(int)(strlen(T))-1){
			W[pairnum]=make_pair(pairtype,pairsum+1);
			pairnum++;
		}
	}
	int ans=0;
	rep(i,pairnum){
		if(W[i].first==1){
			if(W[i-1].first==0&&W[i-1].second>=W[i].second&&W[i+1].first==2&&W[i+1].second>=W[i].second){
				ans=max(ans,W[i].second);
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:21: error: 'strlen' was not declared in this scope
   28 |         rep(i,(int)(strlen(T))){
      |                     ^~~~~~
a.cc:10:32: note: in definition of macro 'rep'
   10 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<queue>
  +++ |+#include <cstring>
    6 | 
a.cc: In function 'int charid(char)':
a.cc:20:1: warning: control reaches end of non-void function [-Wreturn-type]
   20 | }
      | ^
Language: C++

#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<stdlib.h>


#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
using namespace std;
char T[1000002];
pair<int,int> W[1000002];

int charid(char a){
	if(a=='J')return 0;
	if(a=='O')return 1;
	if(a=='I')return 2;
}
int main(){
	//FILE *fp;
	//fp=fopen("D:\\1JOI本選\\2012\\2012-ho-data\\2012-ho-t1\\in\\10-02.txt","r");
	scanf("%s",T);
	int pairnum=0;
	int pairtype=0;
	int pairsum=0;
	rep(i,(int)(strlen(T))){
		if(i==0){pairtype=charid(T[i]);continue;}
		if(T[i]==T[i-1])pairsum++;
		else{
			W[pairnum]=make_pair(pairtype,pairsum+1);
			pairnum++;
			pairtype=charid(T[i]);
			pairsum=0;
		}
		if(i==(int)(strlen(T))-1){
			W[pairnum]=make_pair(pairtype,pairsum+1);
			pairnum++;
		}
	}
	int ans=0;
	rep(i,pairnum){
		if(W[i].first==1){
			if(W[i-1].first==0&&W[i-1].second>=W[i].second&&W[i+1].first==2&&W[i+1].second>=W[i].second){
				ans=max(ans,W[i].second);
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: 'strlen' was not declared in this scope
   27 |         rep(i,(int)(strlen(T))){
      |                     ^~~~~~
a.cc:9:32: note: in definition of macro 'rep'
    9 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include<stdlib.h>
  +++ |+#include <cstring>
    7 | 
a.cc: In function 'int charid(char)':
a.cc:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
Language: C++

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

using namespace std;

int main()
{
    string S; cin >> S;
    
    vector<char> v1;
    
    vector<int> v2; int c = 1;
    
    for(int i = 1; i < S.size(); i++)
    {
        if(S[i - 1] != S[i])
        {
            v1.push_back(S[i - 1]);
            v2.push_back(c);
        }
        
        c++;
    }
    
    v1.push_back(S[S.size() - 1]);
    v2.push_back(c);
    
    int ret = -1;
    
    for(int j = 1; j < S.size() -1; j++)
    {
        if(v1[i - 1] == 'J' && v1[i] == 'O' && v1[i + 1] == 'I')
        {
            ret = max(ret, min( { v2[i - 1], v2[i], v2[i + 1] } ));
        }
    }
    
    printf("%d\n", ret);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:15: error: 'i' was not declared in this scope
   34 |         if(v1[i - 1] == 'J' && v1[i] == 'O' && v1[i + 1] == 'I')
      |               ^
a.cc:36:31: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   36 |             ret = max(ret, min( { v2[i - 1], v2[i], v2[i + 1] } ));
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
double V = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string str;
string sA, strB;
vector<vector<char>> map;
vector<double> num;
vector<string> str;

int sum = 0;

vector<int> value;
vector<int> weight;

int dp[110][10010];

int data_[210][2] = { -2 };

void input(void) {
	CI str;
	return;
}


int main(void) {
	input();
	int f_j = 0;
	int f_o = 0;
	int f_i = 0;

	int max_k;

	for (int i = 0; i < str.size(); i++) {
		if (f_j == 0 && str[i] == 'J') {
			f_j++;
		}
		else {
			if (f_j > 0 && f_o != f_j && str[i] == 'O') {
				f_o++;
			}
			else {
				if (f_o > 0 && f_i != f_o && str[i] == 'I') {
					f_i++;
				}
				else {
					if (f_j == f_o && f_o == f_i) {
						if (f_i > max_k) {
							max_k = f_i;
						}
					}
					else {
						f_j = 0;
						f_o = 0;
						f_i = 0;
					}
				}
			}
		}
	}

	CO max_k E


	return 0;
}

Compiler output:
a.cc:46:16: error: conflicting declaration 'std::vector<std::__cxx11::basic_string<char> > str'
   46 | vector<string> str;
      |                ^~~
a.cc:42:8: note: previous declaration as 'std::string str'
   42 | string str;
      |        ^~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
double V = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;


string sA, strB;
vector<vector<char>> map;
vector<double> num;
//vector<string> str;

int sum = 0;

vector<int> value;
vector<int> weight;

int dp[110][10010];

int data_[210][2] = { -2 };

const long long int III = 1000010;

char str[III];

void input(void) {
	scanf_s("%s",str,III);
	return;
}


int main(void) {
	input();
	long long int f_j = 0;
	long long int f_o = 0;
	long long int f_i = 0;

	long long int max_k = 0;

	for (int i = 0; i < 1000005; i++) {
		if (str[i] == 'J') {
			if (f_o == 0 && f_i == 0) {
				f_j++;
			}
			if (f_o != 0 || f_i != 0) {
				f_j = 1;
				f_o = 0;
				f_i = 0;
			}
		}
		else {
			if (f_j > 0 && f_o != f_j && str[i] == 'O') {
				f_o++;
			}
			else {
				if (f_o > 0 && f_i != f_o && str[i] == 'I') {
					f_i++;
					if (f_j >= f_o && f_o == f_i) {
						if (f_o > max_k) {
							max_k = f_o;
						}
						f_j = 0;
						f_o = 0;
						f_i = 0;
					}
				}
				else {
					
					f_j = 0;
					f_o = 0;
					f_i = 0;
					
				}
			}
		}
	}

	CO max_k E


	return 0;
}

/*#include<stdio.h>
#include<string.h>
int n, m;
int k;
int len;
int flgj = 0, flgo = 0, flg;
int j = 0, o = 0, i = 0;
int max = 0;
int temp;
char s[1000010];
int main(void) {
	scanf_s("%s", s, 1000010);
	len = strlen(s);
	for (k = 0; k<len; k++) {
		flg = 0;
		if (s[k] == 'J' && flgo == 0) {
			j++;
			flgj = 1;
			if (s[k + 1] == 'I') {
				flg = 1;
			}
		}
		else if (s[k] == 'O' && flgj == 1) {
			o++;
			flgo = 1;
			if (s[k + 1] == 'J') {
				flg = 1;
			}
		}
		else if (s[k] == 'I' && flgo == 1) {
			i++;
			if (s[k + 1] != 'I') {
				flg = 2;
			}
			if (k == len - 1) {
				flg = 2;
			}
		}
		if (flg == 1) {
			j = 0;
			o = 0;
			flgj = 0;
			flgo = 0;
		}
		if (flg == 2) {
			//printf("%d %d %d\n",j,o,i);
			if (j<o || i<o) {
			}
			else {
				temp = j;
				if (temp>o) {
					temp = o;
				}
				if (temp>i) {
					temp = i;
				}
			}
			if (max<temp) {
				max = temp;
			}
			j = 0;
			o = 0;
			i = 0;
			flgj = 0;
			flgo = 0;
		}
	}
	printf("%d\n", max);
	return 0;
}
*/

Compiler output:
a.cc: In function 'void input()':
a.cc:62:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   62 |         scanf_s("%s",str,III);
      |         ^~~~~~~
      |         scanf
Language: C++

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

char a[1000000];
int b;
int g=0;
struct JOI
{
	int J, O, I;
};
JOI c(int d) {
	JOI e;
	e.J = e.O = e.I = 0;
	int f;
	for (f = d; f < b; f++) {
		if (a[f] != 'J')break;
	}
	e.J = f - d;
	d = f;
	for (f = d; f < b; f++) {
		if (a[f] != 'O')break;
	}
	e.O = f - d;
	d = f;
	for (f = d; f < b; f++) {
		if (a[f] != 'I')break;
	}
	e.I = f - d;
	return e;
}
int main() {
	scanf("%s", a);
    b = strlen(a);
	int MAX = 0;
	for (;g < b;g++) {
		if (a[g] == 'J') {
			JOI s = c(g);
			if (s.O <= s.I&&s.O <= s.J)MAX = max(MAX, s.O);
		}
	}
	cout << MAX << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'strlen' was not declared in this scope
   37 |     b = strlen(a);
      |         ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<algorithm>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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

int main() {

	char s[1000000];
	cin>>s;
	int N;
	N=strlen(s);
	int ans=0;
	int a0,a1,a2,a3;

	for(a0=0; a0<N; a0=a3){
		for(a1=a0; s[a1]=='J'; a1++);
		for(a2=a1; s[a2]=='O'; a2++);
		for(a3=a2; s[a3]=='I'; a3++);
		if(a1-a0>=a2-a1 && a2-a1<=a3-a2){
			if(ans<a2-a1){
				ans=a2-a1;
			}
		}
	}






	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: 'strlen' was not declared in this scope
   20 |         N=strlen(s);
      |           ^~~~~~
a.cc:13:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include <cctype>
  +++ |+#include <cstring>
   13 | using namespace std;
Language: C++

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

#define loop(i,n) for(int i=1;i<=n;i++)
typedef P pair<char,int>;
vector<P> v;

int main(){
  char c;
  while(cin>>c){
    if(!v.empty()&&v.back().first==c){
      v.back().second++;
    }else{
      v.push_back(P(c,1));
    }
  }
  int m=0;
  loop(p,v.size()-2){
    if(v[p-1].first=='J'&&v[p].first=='O'&&v[p+1].first=='I'){
      int j=v[p-1].second;
      int o=v[p].second;
      int i=v[p+1].second;
      if(j<=o&&o>=i){
        m=max(m,o);
      }
    }
    cout<<m<<endl;
  }
  return 0;
}

Compiler output:
a.cc:5:9: error: 'P' does not name a type
    5 | typedef P pair<char,int>;
      |         ^
a.cc:6:8: error: 'P' was not declared in this scope
    6 | vector<P> v;
      |        ^
a.cc:6:9: error: template argument 1 is invalid
    6 | vector<P> v;
      |         ^
a.cc:6:9: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:11:11: error: request for member 'empty' in 'v', which is of non-class type 'int'
   11 |     if(!v.empty()&&v.back().first==c){
      |           ^~~~~
a.cc:11:22: error: request for member 'back' in 'v', which is of non-class type 'int'
   11 |     if(!v.empty()&&v.back().first==c){
      |                      ^~~~
a.cc:12:9: error: request for member 'back' in 'v', which is of non-class type 'int'
   12 |       v.back().second++;
      |         ^~~~
a.cc:14:9: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   14 |       v.push_back(P(c,1));
      |         ^~~~~~~~~
a.cc:14:19: error: 'P' was not declared in this scope
   14 |       v.push_back(P(c,1));
      |                   ^
a.cc:18:12: error: request for member 'size' in 'v', which is of non-class type 'int'
   18 |   loop(p,v.size()-2){
      |            ^~~~
a.cc:4:34: note: in definition of macro 'loop'
    4 | #define loop(i,n) for(int i=1;i<=n;i++)
      |                                  ^
a.cc:19:9: error: invalid types 'int[int]' for array subscript
   19 |     if(v[p-1].first=='J'&&v[p].first=='O'&&v[p+1].first=='I'){
      |         ^
a.cc:19:28: error: invalid types 'int[int]' for array subscript
   19 |     if(v[p-1].first=='J'&&v[p].first=='O'&&v[p+1].first=='I'){
      |                            ^
a.cc:19:45: error: invalid types 'int[int]' for array subscript
   19 |     if(v[p-1].first=='J'&&v[p].first=='O'&&v[p+1].first=='I'){
      |                                             ^
a.cc:20:14: error: invalid types 'int[int]' for array subscript
   20 |       int j=v[p-1].second;
      |              ^
a.cc:21:14: error: invalid types 'int[int]' for array subscript
   21 |       int o=v[p].second;
      |              ^
a.cc:22:14: error: invalid types 'int[int]' for array subscript
   22 |       int i=v[p+1].second;
      |              ^
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
#define FOR(i,a) for(int i=0;i<a;i++)
 char joi[1000000];
 int retu[1000000];
int main(){
	int ans;
	int rennsa[4];
	rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;
	int i=0;
	while(cin>>joi[i];){
		if(cin.eof()==true){break;}
		if(joi[i]=='J'){
			if(rennsa[0]==1){rennsa[1]++;}
			else{rennsa[0]=1;rennsa[1]=1;rennsa[2]=0;rennsa[3]=0;}
		}
		else if(joi[i]=='O'){
			if(rennsa[0]==2 or rennsa[0]==1){
				rennsa[0]=2;
				if(rennsa[2]<rennsa[1]){rennsa[2]++;}
				else{rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;}
			}
			else{rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;}
		}
		else if(joi[i]=='I'){
			if(rennsa[0]==2 or rennsa[0]==3){
				rennsa[0]=3;
				if(rennsa[3]<rennsa[2]){
					rennsa[3]++;
					ans=max(ans,rennsa[3]);
				}
				else{rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;}
			}
			else{rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;}
		}
		cout<<rennsa[0]<<" "<<rennsa[1]<<" "<<rennsa[2]<<" "<<rennsa[3]<<endl;
		i++;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: expected ')' before ';' token
   12 |         while(cin>>joi[i];){
      |              ~           ^
      |                          )
a.cc:12:27: error: expected primary-expression before ')' token
   12 |         while(cin>>joi[i];){
      |                           ^
Language: C++

int main (int argc, char *argv[]) {
    string str;
    int ans = 0;
    int n1, n2, n3;
    cin>>str;

    for (int i = 0; i < str.length(); ++i) {
        n1 = n2 = n3 = 0;
        while (str[i] == 'J') {
            n1++;
            i++;
        }
        while (str[i] == 'O') {
            n2++;
            i++;
        }
        while (str[i] == 'I') {
            n3++;
            i++;
        }
        if(n2 <= n1 && n2 <= n3) ans = max(ans, n2);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:2:5: error: 'string' was not declared in this scope
    2 |     string str;
      |     ^~~~~~
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin>>str;
      |     ^~~
a.cc:5:10: error: 'str' was not declared in this scope; did you mean 'std'?
    5 |     cin>>str;
      |          ^~~
      |          std
a.cc:21:40: error: 'max' was not declared in this scope
   21 |         if(n2 <= n1 && n2 <= n3) ans = max(ans, n2);
      |                                        ^~~
a.cc:23:5: error: 'cout' was not declared in this scope
   23 |     cout<<ans<<endl;
      |     ^~~~
a.cc:23:16: error: 'endl' was not declared in this scope
   23 |     cout<<ans<<endl;
      |                ^~~~
Language: C++

#include <cstdio>
#include <cstring>
using namespace std;
char s[1000001];
int main(){
scanf("%

Compiler output:
a.cc:6:7: warning: missing terminating " character
    6 | scanf("%
      |       ^
a.cc:6:7: error: missing terminating " character
    6 | scanf("%
      |       ^~
a.cc: In function 'int main()':
a.cc:6:7: error: expected primary-expression at end of input
    6 | scanf("%
      |       ^
a.cc:6:7: error: expected '}' at end of input
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <cstdio>
#include <string> 
#include <cstring> 
using namespace std; 
    string s; 
        string a="j",b="o",c="i";
int main(){ 
    scanf("%s",s);
        int leng=s.size();
            for(int i=leng/3;i>=0;i++){
                stirng x="j";
                    for(int j=1;j<i;j++){
                        x+=a;
                    }
                    for(int j=0;j<i;j++){
                        x+=b;
                    }
                    for(int j=1;j<i;j++){
                        x+=c;
                    }
                if(strstr(s,x)!=NULL){
                    printf("%d\n",i);
                }
            }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'stirng' was not declared in this scope
   11 |                 stirng x="j";
      |                 ^~~~~~
a.cc:13:25: error: 'x' was not declared in this scope
   13 |                         x+=a;
      |                         ^
a.cc:16:25: error: 'x' was not declared in this scope
   16 |                         x+=b;
      |                         ^
a.cc:19:25: error: 'x' was not declared in this scope
   19 |                         x+=c;
      |                         ^
a.cc:21:29: error: 'x' was not declared in this scope
   21 |                 if(strstr(s,x)!=NULL){
      |                             ^
Language: C++

#include <cstdio>
#include <string> 
#include <cstring> 
using namespace std; 
    string s; 
        string a="j",b="o",c="i";
int main(){ 
    scanf("%s",s);
        int leng=s.size();
            for(int i=leng/3;i>=0;i++){
                string x="j";
                    for(int j=1;j<i;j++){
                        x+=a;
                    }
                    for(int j=0;j<i;j++){
                        x+=b;
                    }
                    for(int j=1;j<i;j++){
                        x+=c;
                    }
                if(strstr(s,x)!=NULL){
                    printf("%d\n",i);
                }
            }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: no matching function for call to 'strstr(std::string&, std::string&)'
   21 |                 if(strstr(s,x)!=NULL){
      |                    ~~~~~~^~~~~
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:3:
/usr/include/string.h:330:14: note: candidate: 'char* strstr(char*, const char*)'
  330 | extern char *strstr (char *__haystack, const char *__needle)
      |              ^~~~~~
/usr/include/string.h:330:28: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char*'
  330 | extern char *strstr (char *__haystack, const char *__needle)
      |                      ~~~~~~^~~~~~~~~~
/usr/include/string.h:332:20: note: candidate: 'const char* strstr(const char*, const char*)'
  332 | extern const char *strstr (const char *__haystack, const char *__needle)
      |                    ^~~~~~
/usr/include/string.h:332:40: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
  332 | extern const char *strstr (const char *__haystack, const char *__needle)
      |                            ~~~~~~~~~~~~^~~~~~~~~~
Language: C++

#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
static char str[1200000];
int len;
vector<pair<char, int> > x;
scanf("%s", str);
len = strlen(str);
for(int i = 0; i < len; ++i) {
int it = i;
while(it < len && str[it] == str[i]) ++it;
x.push_back(make_pair(str[i], it - i));
i = it - 1;
}
int ans = 0;
for(int i = 0; i < x.size() - 2; ++i) {
pair<char, int> jjj = x[i], ooo = x[i + 1], iii = x[i + 2];
if(jjj.first != 'J' || ooo.first != 'O' || iii.first != 'I')
continue;
if(ooo.second > jjj.second || ooo.second > iii.second)
continue;
ans = max(ans, min(jjj.second, ooo.second, iii.second));
}

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

Compiler output:
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:27:19:   required from here
   27 | ans = max(ans, min(jjj.second, ooo.second, iii.second));
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
static char str[1200000];
int len;
vector<pair<char, int> > x;
scanf("%s", str);
len = strlen(str);
for(int i = 0; i < len; ++i) {
int it = i;
while(it < len && str[it] == str[i]) ++it;
x.push_back(make_pair(str[i], it - i));
i = it - 1;
}
int ans = 0;
for(int i = 0; i < x.size() - 2; ++i) {
pair<char, int> jjj = x[i], ooo = x[i + 1], iii = x[i + 2];
if(jjj.first != 'J' || ooo.first != 'O' || iii.first != 'I')
continue;
if(ooo.second > jjj.second || ooo.second > iii.second)
continue;
ans = max(ans, min(min(jjj.second, ooo.second), iii.second)));
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:27:61: error: expected ';' before ')' token
   27 | ans = max(ans, min(min(jjj.second, ooo.second), iii.second)));
      |                                                             ^
      |                                                             ;
Language: C++

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

int main(){

	int K,cnt;
	char *in;
	char *joi;
	char JOI[4] = {"JOI"};

	in = new char [1000001];
	joi = new char [1000001];

	cin >> in;

	K = strlen(in) / 3;

	for(int i = K; i > 0; i--){
		cnt = 0;
		for(int c = 0; c < 3; c++){
			for(int j = 0; j < i; j++){
				joi[cnt] = JOI[c];
				cnt++;
			}
		}
		joi[cnt] = '\0';
		if(strstr(in,joi) != NULL){
			cout << i << endl;
			break;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'strlen' was not declared in this scope
   17 |         K = strlen(in) / 3;
      |             ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
a.cc:28:20: error: 'strstr' was not declared in this scope
   28 |                 if(strstr(in,joi) != NULL){
      |                    ^~~~~~
a.cc:28:20: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <cstdio>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for(int i = x; i < n; i++)

int main()
{
  const string joi = "JOI";
  
  string str;
  cin >> str;

  int ans = 0;
  rep(i, str.size())
    {
      int cs[3] = {0};

      rep(j, 3) while(str[i] == joi[j]) cs[j]++;

      if(cs[0] >= cs[1] && cs[2] >= cs[1]) ans = max(ans, cs[1]);
    }

  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'string' does not name a type; did you mean 'stdin'?
    8 |   const string joi = "JOI";
      |         ^~~~~~
      |         stdin
a.cc:10:3: error: 'string' was not declared in this scope
   10 |   string str;
      |   ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include <cstdio>
  +++ |+#include <string>
    2 | using namespace std;
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> str;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <cstdio>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:11:10: error: 'str' was not declared in this scope; did you mean 'std'?
   11 |   cin >> str;
      |          ^~~
      |          std
a.cc:18:33: error: 'joi' was not declared in this scope
   18 |       rep(j, 3) while(str[i] == joi[j]) cs[j]++;
      |                                 ^~~
a.cc:20:50: error: 'max' was not declared in this scope
   20 |       if(cs[0] >= cs[1] && cs[2] >= cs[1]) ans = max(ans, cs[1]);
      |                                                  ^~~
a.cc:23:3: error: 'cout' was not declared in this scope
   23 |   cout << ans << endl;
      |   ^~~~
a.cc:23:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:18: error: 'endl' was not declared in this scope
   23 |   cout << ans << endl;
      |                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <cstdio>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#define mem(x,y)		(x*)malloc(sizeof(x)*(y))

int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	int* an = mem(int,a);
	int* bu = mem(int,b);
	int i,j;
	int max = 0;
	for(i = 0;i < a;i++)
	{
		scanf("%d",an+i);
	}
	for(i = 0;i < b;i++)
	{
		scanf("%d",bu+i);
	}
	for(i = 0;i < b;i++)
	{
		int pt = i;
		for(j = 0;j < a;j++)
		{
			if(an[j] == bn[pt])
			{
				pt++;
			}
			if(pt == b)
				break;
		}
		if((pt-i)>max)
		{
			max = pt-i;
		}
	}
	printf("%d\n",max);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:27:37: error: 'bn' undeclared (first use in this function); did you mean 'bu'?
   27 |                         if(an[j] == bn[pt])
      |                                     ^~
      |                                     bu
main.c:27:37: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int n,m,ans,a[5000],b[5000];

int main(){
	scanf("%d%d", &n, &m);
	rep(i,n) scanf("%d",&a[i]);
	rep(i,m) scanf("%d",&b[i]);
	rep(i,m){
		if(ans>=m.size()-i)break;
		int cnt=0;
		rep(j,n){
			if(i+cnt>=m)break;
			if(a[j]==b[i+cnt])cnt++;			
		}
		if(cnt>ans)ans=cnt;
	}
	printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:27: error: request for member 'size' in 'm', which is of non-class type 'int'
   11 |                 if(ans>=m.size()-i)break;
      |                           ^~~~
Language: C++

#include<iosteream>
#include<algorithm>
#include<vector>
using namespace std;

int main(void){
  int na,nb;
  cin>>na>>nb;
  vector<int> a(na);
  vector<int> b(nb);
  for(int i = 0 ; i < na ; i ++){
    cin>>a[i];
  }
  for(int i = 0 ; i < nb ; i ++){
    cin>>b[i];
  }
  int dp[2][5001]={{}};
  int m = 0;
  
  for(int i = 1 ; i <= nb ; i ++){
    for(int j = 1 ; j <= na ; j ++){
      if(a[j-1]==b[i-1]){
	dp[i&1][j] = max(dp[i&1][j-1],dp[i-1&1][j-1] + (a[j-1]==b[i-1]));
      }else{
	dp[i&1][j] = dp[i&1][j-1];
      }
      m = max(m,dp[i&1][j]);
    }
  }
  cout<<m<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

static int dp[ 5000 ][ 5000 ][ 2 ];

static int a, b;

static int cards_1[ 5000 ]
static int cards_2[ 5000 ];
static int solve( int now_a, int now_b, bool g ) {
	if ( now_a == a || now_b == b ) {
		return 0;
	}
	if ( dp[ now_a ][ now_b ][ g ] >= 0 ) {
		return dp[ now_a ][ now_b ][ g ];
	}
	static int res;
	res = 0;
	if ( cards_1[ now_a ] == cards_2[ now_b ] ) {
		res = solve( now_a + 1, now_b + 1, true ) + 1;
	}
	res = max( res, max( solve( now_a + 1, now_b, g ), g ? 0 : solve( now_a, now_b + 1, g ) ) );
	return dp[ now_a ][ now_b ][ g ] = res;
}

int main() {
	scanf( "%d %d", &a, &b );
	for ( int i = 0; i < a; i++ ) {
		scanf( "%d", &cards_1[ i ] );
	}
	for ( int i = 0; i < b; i++ ) {
		scanf( "%d", &cards_2[ i ] );
	}
	NCLR( dp );
	int ans = solve( 0, 0, false );
	printf( "%d\n", ans );
	return 0;
}

Compiler output:
a.cc:45:1: error: expected initializer before 'static'
   45 | static int cards_2[ 5000 ];
      | ^~~~~~
a.cc: In function 'int solve(int, int, bool)':
a.cc:55:14: error: 'cards_1' was not declared in this scope
   55 |         if ( cards_1[ now_a ] == cards_2[ now_b ] ) {
      |              ^~~~~~~
a.cc:55:34: error: 'cards_2' was not declared in this scope
   55 |         if ( cards_1[ now_a ] == cards_2[ now_b ] ) {
      |                                  ^~~~~~~
a.cc: In function 'int main()':
a.cc:65:31: error: 'cards_1' was not declared in this scope
   65 |                 scanf( "%d", &cards_1[ i ] );
      |                               ^~~~~~~
a.cc:68:31: error: 'cards_2' was not declared in this scope
   68 |                 scanf( "%d", &cards_2[ i ] );
      |                               ^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define INF(a) memset(a,1000000000,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 5010
using namespace std;

int n,m,a[MAX],b[MAX],pos[1010];

void solve(){
 cin>>n>>m;
 FOR(i,n) cin>>a[i];
 FOR(i,m) cin>>b[i];
 INF(pos);
 FOR(i,n) pos[a[i]]=min(i,pos[a[i]]);
 FOR(i,1001) if(pos[i]==1000000000) pos[i]=-1;
 int ma=0;
 FOR(i,m){
  int now=-1;
  FOR(j,i,m){
   if(pos[j]>now) now=pos[j];
   else{
    ma=max(ma,j-i);
    break;
   }
   if(i==m-1) ma=max(ma,m-i);
  }
 }
 cout<<ma<<endl;
}

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

Compiler output:
a.cc:12:9: warning: "INF" redefined
   12 | #define INF 1<<29
      |         ^~~
a.cc:8:9: note: this is the location of the previous definition
    8 | #define INF(a) memset(a,1000000000,sizeof(a))
      |         ^~~
a.cc:28:12: error: macro "FOR" passed 3 arguments, but takes just 2
   28 |   FOR(j,i,m){
      |            ^
a.cc:2:9: note: macro "FOR" defined here
    2 | #define FOR(i,n) for(int i=0;i<(int)(n);i++)
      |         ^~~
a.cc: In function 'void solve()':
a.cc:22:5: error: expression cannot be used as a function
   22 |  INF(pos);
      |     ^
a.cc:28:3: error: 'FOR' was not declared in this scope
   28 |   FOR(j,i,m){
      |   ^~~
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;

int A,B,a[5000],b[5000];
int dp[5001];

int main(){
	scanf("%d%d",&A,&B);
	for(int i=0;i<A;i++) scanf("%d",&a[i]);
	for(int i=0;i<B;i++) scanf("%d",&b[i]);
	int res=0;
	for(int i=1;i<=A;i++) for(int j=1;j<=B;j++){
		dp[j]=dp[j];
		if(a[i-1]==b[j-1]) dp[j]=max(dp[j-1]+1,dp[i][j]);
		res=max(res,dp[j]);
	}
	printf("%d\n",res);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:61: error: invalid types 'int[int]' for array subscript
   18 |                 if(a[i-1]==b[j-1]) dp[j]=max(dp[j-1]+1,dp[i][j]);
      |                                                             ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

short dp[5001][5001];
int main(){
    int a,b;
    cin >> a >> b;
    memset(dp,0,sizeof(dp));
    vector<int> c1(a);
    vector<int> c2(b);
    REP(i,a){
	cin >> c1[i];
    }
    REP(i,b){
	cin >> c2[i];
    }
    REP(i,a){
	dp[i+1][0] = dp[i][b];
	REP(j,b){
	    if(c1[i] == c2[j]){
		dp[i+1][j+1] = dp[i][j] + 1;
	    }else dp[i+1][j+1] = dp[i][j];
	}
    }
    int ans = 0;
    FOR(i,1,b+1) ans = max(dp[a][i],ans);
    cout << ans << endl;
    return 0;
}

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

#include <stdio.h>
#include <algorithm>
using namespace std;
int A, B, a[1000], b[1000];
int main() {
	scanf("%d%d", &A, &B);
	for(int i = 0; i < A; i++) scanf("%d", &a[i]);
	for(int i = 0; i < B; i++) scanf("%d", &b[i]);
	int ret = 0;
	for(int i = 0; i < B; i++) {
		int pos = i;
		for(int j = 0; j < A; j++) {
			if(pos == B) break;
			if(b[pos] == A[j]) pos++;
		}
		ret = max(ret, pos - i);
	}
	printf("%d\n", ret);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:39: error: invalid types 'int[int]' for array subscript
   14 |                         if(b[pos] == A[j]) pos++;
      |                                       ^
Language: C++

#include<cstdio>
#include<cstdlib>
#include<vector>
using name space std;
int main(void){
int a[5000];
int b[5001];
int aa;
int bb;
int n;
int max;
int s;
int c;
max=0;
scanf("%d %d",&aa,&bb);
for(int i=0;i<aa;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<bb;i++){
scanf("%d",&b[i]);
}
b[bb]=10000000;
for(int i=0;i<bb;i++){
s=0;
c=i;
for(int j=0;j<aa;j++){
if(a[j]==b[c]){
c++;
s++;
}
}
if(s>max)max=s;
}
printf("%d\n",max);

return 0;
}

Compiler output:
a.cc:4:7: error: expected nested-name-specifier before 'name'
    4 | using name space std;
      |       ^~~~
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
int a[5001],b[5001];
int c,d,i,j,s=0;
void main(){
scanf("%d%d",&c,&d);
for(i=0;i<c;i++){
scanf("%d",&a[i]);
}
for(j=0;j<d;j++){
scanf("%d",&b[j]);
}
for(int now=0;now<d;now++){
int r=now;
for(i=0;i<c;i++){
if(a[i]==b[r]){
r++;
if(r==d){
break;
}
}
}
s=std::max(r-now,s);
}
printf("%d\n",s);
}

Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | void main(){
      | ^~~~
Language: C++

#include<algorithm>
int a[5001],b[5001];
int c,d,i,j,s=0;
int main(){
scanf("%d%d",&c,&d);
for(i=0;i<c;i++){
scanf("%d",&a[i]);
}
for(j=0;j<d;j++){
scanf("%d",&b[j]);
}
for(int now=0;now<d;now++){
int r=now;
for(i=0;i<c;i++){
if(a[i]==b[r]){
r++;
if(r==d){
break;
}
}
}
s=std::max(r-now,s);
}
printf("%d\n",s);return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:1: error: 'scanf' was not declared in this scope
    5 | scanf("%d%d",&c,&d);
      | ^~~~~
a.cc:24:1: error: 'printf' was not declared in this scope
   24 | printf("%d\n",s);return 0;
      | ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include<algorithm>
  +++ |+#include <cstdio>
    2 | int a[5001],b[5001];
Language: C++

#include <cstdio>
#include <algorithm>
using namespace std;
int n;
int m;
int be[5005],en[5005];
int main()
{
  scanf("%d %d",&n,&m);
  for(int i=1;i<=n;i++)
    {
      scanf("%d",&be[i]);
    }
  for(int i=1;i<=m;i++)
    {
      scanf("%d",&en[i]);
    }
  int ans=0;
  for(int i=1;i<=m;i++)
    {
        int last=i;
	for(int i=1;i<=n;i++)
	  {
	    if(en[last]==st[i])
	      {
		last++;
		if(last==m+1) break;
	      }
	  }
	ans=max(ans,last-i);
    }
  printf("%d\n",ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:26: error: 'st' was not declared in this scope; did you mean 'std'?
   24 |             if(en[last]==st[i])
      |                          ^~
      |                          std
Language: C++

line = gets
A = gets.split
B = gets.split

ans = 0
A.each.with_index do |a, i|
    count = 0
    B.each do |b|
        if A[i] == b
            count += 1
            i += 1
        end
    end
    ans = [ans, count].max
end
puts ans

Compiler output:
a.cc:1:1: error: 'line' does not name a type
    1 | line = gets
      | ^~~~
Language: C

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int a[3000],b[3000];
ll dp1[3000][3000],dp2[3000][3000];

int main() {
	int n,t,s;scanf("%d%d%d",&n,&t,&s);
	rep(i,n)scanf("%d%d",&a[i],&b[i]);
	int Max=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=s;j++){
			if(b[i]>j)dp1[i+1][j]=dp1[i][j];
			else{
				if(dp1[i][j]<dp1[i][j-b[i]]+a[i]){
					Max=i;
					dp1[i+1][j]=dp1[i][j-b[i]]+a[i];
				}
				else dp1[i+1][j]=dp1[i][j];
			}
		}
	}
	for(int i=Max;i<n;i++){
		for(int j=0;j<=t-s;j++){
			if(b[i]>j)dp2[i+1][j]=dp2[i][j];
			else dp2[i+1][j]=max(dp2[i][j],dp2[i][j-b[i]]+a[i]);
		}
	}
	printf("%lld\n",(ll)dp1[n][s]+dp2[n][t-s]);
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<cstdio>
using namespace std;
int main(){
	int N, T, S, M[3001]={}, maxM=0;
	scanf("%d%d%d", &N, &T, &S);
	if(S==0){
		for(int n=0; n<N; n++){
			scanf("%d%d", &mise_fun, &mise_time);
			cin >> mise_fun >> mise_time;
			for(int t=T; t>=mise_time; t--)
				int newM = M[t-mise_time] + mise_fun;
				if(M[t] > newM){
					M[t] = newM;
					maxM = newM;
				}
		}
	}
	else{
		for(int n=0; n<N; n++){
			int mise_fun, mise_time;
			scanf("%d%d", &mise_fun, &mise_time);
			for(int t=T; t>=mise_time; t--)
				if(t<=S || t >= S  + mise_time){
					int newM = M[t-mise_time] + mise_fun;
					if(M[t] > newM){
						M[t] = newM;
						maxM = newM;
					}
				}
		}
	}
	cout << maxM << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:40: error: 'mise_fun' was not declared in this scope
    8 |                         scanf("%d%d", &mise_fun, &mise_time);
      |                                        ^~~~~~~~
a.cc:8:51: error: 'mise_time' was not declared in this scope
    8 |                         scanf("%d%d", &mise_fun, &mise_time);
      |                                                   ^~~~~~~~~
a.cc:9:25: error: 'cin' was not declared in this scope
    9 |                         cin >> mise_fun >> mise_time;
      |                         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cstdio>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:12:38: error: 't' was not declared in this scope
   12 |                                 if(M[t] > newM){
      |                                      ^
a.cc:12:43: error: 'newM' was not declared in this scope
   12 |                                 if(M[t] > newM){
      |                                           ^~~~
a.cc:32:9: error: 'cout' was not declared in this scope
   32 |         cout << maxM << endl;
      |         ^~~~
a.cc:32:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:25: error: 'endl' was not declared in this scope
   32 |         cout << maxM << endl;
      |                         ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cstdio>
  +++ |+#include <ostream>
    2 | using namespace std;