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

#include<stdio.h>
const int MAX_X = 10000;
int prime[10000];

int main(){

	int i, k, n;

	int border[10];
	for( i = 2; i <= MAX_X; i++) {
		prime[i] = 1;
	}

	for(i = 2; i*i <= MAX_X; i++){
		if(prime[i]) {
			for(k = 2 * i; k <= MAX_X; k += i){
				prime[k] = 0;
			}
		}
	}

	while(1){
		scanf("%d", &n);
		if( n == 0) break;
		int max;
		for( i = n; i >= 2; i--){
			if( prime[i]){
				if( prime[i - 2]){
					max = i;
					break;
				}
			}
		}
		printf("%d %d\n", max -2, max);
	}

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

#include <bits/stdc++h>

using namespace std;

const int MAXN = 10100;
bool sieve[MAXN] = {true, true};

int main(){
  for (int i = 2; i * i < MAXN; i++){
    if (sieve[i]) continue;
.   for (int j = i * i; j < MAXN; j += i) sieve[j] = true;
. }
. int N;
. while (cin >> N, N){
    while (sieve[N] or sieve[N - 2]) N--;
.   cout << N - 2 << " " << N << endl;
  }
  return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

const int MAXN = 10100;
bool sieve[MAXN] = {true, true};

int main(){
  for (int i = 2; i * i < MAXN; i++){
    if (sieve[i]) continue;
.   for (int j = i * i; j < MAXN; j += i) sieve[j] = true;
. }
. int N;
. while (cin >> N, N){
    while (sieve[N] or sieve[N - 2]) N--;
.   cout << N - 2 << " " << N << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:1: error: expected primary-expression before '.' token
   11 | .   for (int j = i * i; j < MAXN; j += i) sieve[j] = true;
      | ^
a.cc:11:5: error: expected unqualified-id before 'for'
   11 | .   for (int j = i * i; j < MAXN; j += i) sieve[j] = true;
      |     ^~~
a.cc:11:25: error: 'j' was not declared in this scope
   11 | .   for (int j = i * i; j < MAXN; j += i) sieve[j] = true;
      |                         ^
a.cc:12:1: error: expected primary-expression before '.' token
   12 | . }
      | ^
a.cc:12:3: error: expected unqualified-id before '}' token
   12 | . }
      |   ^
a.cc:13:1: error: expected primary-expression before '.' token
   13 | . int N;
      | ^
a.cc:13:3: error: expected unqualified-id before 'int'
   13 | . int N;
      |   ^~~
a.cc:14:1: error: expected primary-expression before '.' token
   14 | . while (cin >> N, N){
      | ^
a.cc:14:3: error: expected unqualified-id before 'while'
   14 | . while (cin >> N, N){
      |   ^~~~~
Language: C++

#include <math.h>

int prime(int n)
{
	int i1, sw, m;

	m 	= (int)sqrt((double)n);
	sw  = (n <= 1) ? 0 : 1;

	for (i1 = 2; i1 <= m && sw > 0; i1++) {
		if (n%i1 == 0)
			sw = 0;
	}

	return sw;
}

Compiler output:
/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 <math.h>
int prime(int n)
{
	int i1, sw, m;
	m 	= (int)sqrt((double)n);
	sw  = (n <= 1) ? 0 : 1;
	for (i1 = 2; i1 <= m && sw > 0; i1++) {
		if (n%i1 == 0)
			sw = 0;
	}
	return sw;
}

Compiler output:
/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 <cstdio>
#include <vector>
using namespace std;
int main()
{
	int maxsize(0);
	vector<int> input;

	while (1)
	{
		int tmp;

		cin >> tmp;

		(maxsize < tmp) ? (maxsize = tmp) : (0);
	}

	vector<int> prime, ans;

	for (int i(1); i <= maxsize; ++i)
	{
		for (auto i2(prime.begin()), n2(prime.end()); i2 != n2; ++i2)
		{
			if (i % *i2 == 0)
			{
				prime.push_back(i);
				if (i2 != prime.begin())
				{
					if (*(--i2) == i)
					{
						ans.push_back(i);
					}
				}
				break;
			}
		}
	}

	for (auto i(input.begin()), n(input.end()); i != n; ++i)
	{
		int out(0);

		for (auto i2(ans.rbegin()), n2(ans.rend()); i2 != n2; ++i2)
		{
			if (*i2 <= *i)
			{
				cout << *i2 - 2 << ' ' << *i2 << endl;
			}
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'cin' was not declared in this scope
   13 |                 cin >> tmp;
      |                 ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <vector>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:47:33: error: 'cout' was not declared in this scope
   47 |                                 cout << *i2 - 2 << ' ' << *i2 << endl;
      |                                 ^~~~
a.cc:47:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:47:66: error: 'endl' was not declared in this scope
   47 |                                 cout << *i2 - 2 << ' ' << *i2 << endl;
      |                                                                  ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <vector>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

int main(void){
	int i,j;
	int isprime[1000];
 	//???????????????????????°????´???°?????¨??????
	for(i=0;i<=1000;i++){
 		isprime[i]=1;
	}
 //????????????????????????????????????
	isprime[0]=isprime[1]=0;
 //2??????????????????
	for(i=2;i<=1000;i++){
 		if(isprime[i]==1){
 			for(j=2*i;j<=1000;j+=i){
				isprime[j]=0;
			}
		}
	}

 //???????´???°?????????????????????
	for(i=2;i<=1000;i++){
		if(isprime[i-2]==1 && isprime[i]==1){
			print("(%d,%d)",i-2,i);
		}
	}
	return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: 'print' was not declared in this scope; did you mean 'int'?
   22 |                         print("(%d,%d)",i-2,i);
      |                         ^~~~~
      |                         int
Language: C++

int main(void){
	int i,j;
	int isprime[1000];
	for(i=0;i<=1000;i++){
 		isprime[i]=1;
	}
	isprime[0]=isprime[1]=0;
	for(i=2;i<=1000;i++){
 		if(isprime[i]==1){
 			for(j=2*i;j<=1000;j+=i){
				isprime[j]=0;
			}
		}
	}
	for(i=2;i<=1000;i++){
		if(isprime[i-2]==1 && isprime[i]==1){
			printf("(%d,%d)",i-2,i);
		}
	}
	return 0;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: 'printf' was not declared in this scope
   17 |                         printf("(%d,%d)",i-2,i);
      |                         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void){
Language: C++

#include <stdio.h>
int isprime(int n){
  for(int i = 2 ; i*i<=n ;i++){
    if(n%i==0)return 0;
}
 return 1;
}
int main(){
  int n ,i , fir ,sec;
  while(scanf("%d" ,&n)){
    if(n==0)break;
    fir = 0 ,sec = 0;
    for(i=n ;i>3 ;i--){
      if(number[i] && number[i-2]){
        fir = i-2;
        sec = i;
        break;
      }
    }
    printf("%d %d\n" ,fir ,sec);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: 'number' was not declared in this scope
   14 |       if(number[i] && number[i-2]){
      |          ^~~~~~
Language: C++

#import<algo.h>
int i,j,n,P[9999];
int main()
{
	for(i=2;i*i<9999;i++)for(j=i;j<9999;P[j+=i]=1);
	for(;std::cin>>n,n;printf("%d %d\n",i-2,i))
		for(i=n;P[i]||P[i-2];i--);
}

Compiler output:
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<algo.h>
      |  ^~~~~~
a.cc:1:8: fatal error: algo.h: No such file or directory
    1 | #import<algo.h>
      |        ^~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;

int dummy_prime(int n,int i){return i>1 ? n%i ? dummy_prime(n,i-1) : 0 : 1;}
int isprime(int n){return n>1 ? dummy_prime(n,(int)sqrt(n)) : 0;} 

int main(){
	int n;
	while(cin >> n && n){
		while(n>4){
			if(isprime(n) && isprime(n-2)){
				cout << n-2 << " " << n << endl;
				break;
			}
			n--;
		}
	}
}

Compiler output:
a.cc: In function 'int isprime(int)':
a.cc:5:52: error: 'sqrt' was not declared in this scope
    5 | int isprime(int n){return n>1 ? dummy_prime(n,(int)sqrt(n)) : 0;}
      |                                                    ^~~~
Language: C++

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

int dummy_prime(int n,int i){return i>1 ? n%i ? dummy_prime(n,i-1) : 0 : 1;}
int isprime(int n){return n>1 ? dummy_prime(n,(int)sqrt(n)) : 0;} 

int main(){
	int n;
	while(cin >> n && n){
		while(n>4){
			if(isprime(n) && isprime(n-2)){
				cout << n-2 << " " << n << endl;
				break;
			}
			n--;
		}
	}
}

Compiler output:
a.cc: In function 'int isprime(int)':
a.cc:6:52: error: 'sqrt' was not declared in this scope
    6 | int isprime(int n){return n>1 ? dummy_prime(n,(int)sqrt(n)) : 0;}
      |                                                    ^~~~
Language: C++

int i,j,k;char s[9];p(int n){if(n<2)return 0;else if(n==2)return 1;if(n%2==0)return 0;for(i=3;i*i<=n;i+=2)if(n%i==0)return 0;return 1;}main(){while(scanf("%d",&j)){if(!j)break;while(k++<j){if(p(k-1)&&p(k-3)){sprintf(s,"%d %d",k-3,k-1);}}puts(s);}}

Compiler output:
a.cc:1:21: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive]
    1 | int i,j,k;char s[9];p(int n){if(n<2)return 0;else if(n==2)return 1;if(n%2==0)return 0;for(i=3;i*i<=n;i+=2)if(n%i==0)return 0;return 1;}main(){while(scanf("%d",&j)){if(!j)break;while(k++<j){if(p(k-1)&&p(k-3)){sprintf(s,"%d %d",k-3,k-1);}}puts(s);}}
      |                     ^
a.cc:1:136: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | int i,j,k;char s[9];p(int n){if(n<2)return 0;else if(n==2)return 1;if(n%2==0)return 0;for(i=3;i*i<=n;i+=2)if(n%i==0)return 0;return 1;}main(){while(scanf("%d",&j)){if(!j)break;while(k++<j){if(p(k-1)&&p(k-3)){sprintf(s,"%d %d",k-3,k-1);}}puts(s);}}
      |                                                                                                                                        ^~~~
a.cc: In function 'int main()':
a.cc:1:149: error: 'scanf' was not declared in this scope
    1 | int i,j,k;char s[9];p(int n){if(n<2)return 0;else if(n==2)return 1;if(n%2==0)return 0;for(i=3;i*i<=n;i+=2)if(n%i==0)return 0;return 1;}main(){while(scanf("%d",&j)){if(!j)break;while(k++<j){if(p(k-1)&&p(k-3)){sprintf(s,"%d %d",k-3,k-1);}}puts(s);}}
      |                                                                                                                                                     ^~~~~
a.cc:1:209: error: 'sprintf' was not declared in this scope
    1 | int i,j,k;char s[9];p(int n){if(n<2)return 0;else if(n==2)return 1;if(n%2==0)return 0;for(i=3;i*i<=n;i+=2)if(n%i==0)return 0;return 1;}main(){while(scanf("%d",&j)){if(!j)break;while(k++<j){if(p(k-1)&&p(k-3)){sprintf(s,"%d %d",k-3,k-1);}}puts(s);}}
      |                                                                                                                                                                                                                 ^~~~~~~
a.cc:1:1: note: 'sprintf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int i,j,k;char s[9];p(int n){if(n<2)return 0;else if(n==2)return 1;if(n%2==0)return 0;for(i=3;i*i<=n;i+=2)if(n%i==0)return 0;return 1;}main(){while(scanf("%d",&j)){if(!j)break;while(k++<j){if(p(k-1)&&p(k-3)){sprintf(s,"%d %d",k-3,k-1);}}puts(s);}}
a.cc:1:238: error: 'puts' was not declared in this scope
    1 | int i,j,k;char s[9];p(int n){if(n<2)return 0;else if(n==2)return 1;if(n%2==0)return 0;for(i=3;i*i<=n;i+=2)if(n%i==0)return 0;return 1;}main(){while(scanf("%d",&j)){if(!j)break;while(k++<j){if(p(k-1)&&p(k-3)){sprintf(s,"%d %d",k-3,k-1);}}puts(s);}}
      |                                                                                                                                                                                                                                              ^~~~
Language: C++

#include <iostream>
using namespace std;
bool t[10000] = {false};
int main()
{
	int n, i;
	t[0] = true;
	for (i = 2; i * i <= 10000; i++)
	{
		if (!t[i-1])
		{
			for (j = i+i; j <= 10000; j+=i)
				t[j-1] = true;
		}
	}
	while (cin >> n, n)
	{
		for (i = n; i >= 5; i--)
		{
			if ((!t[i-1]) && (!t[i-3]))
			{
				cout << i-2 << " " << i << endl;
				break;
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: 'j' was not declared in this scope
   12 |                         for (j = i+i; j <= 10000; j+=i)
      |                              ^
Language: C++

#include <iostream>

using namespace std;

bool isPrime[10001];

void setPrime( bool *p, int size )
{
	memset(p, true, size);
	p[0] = p[1] = false;

	for(int i=2; i < size; ++i) {
		if(!p[i]) continue;
		for(int j=i+i; j < size; j+=i) {
			p[j] = false;
		}
	}
}

int main( void )
{
	setPrime(isPrime, 10001);
	int n;
	while(cin >> n, n) {
		bool hit = true;
		for(int i=n-2; i > 0 && hit; --i) {
			if(isPrime[i]) {
				if(isPrime[i+2]) {
					cout << i << ' ' << i+2 << endl;
					hit = false;
				}
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'void setPrime(bool*, int)':
a.cc:9:9: error: 'memset' was not declared in this scope
    9 |         memset(p, true, size);
      |         ^~~~~~
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 |
Language: C++

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

int p(int n){
	for(!n%2){
		return 0;
	}
	else{
		for(int i=0;i*i<n;i-=2){
			if(!n%1){
				return 0;
			}
		}
		return 1;
	}
}



int main(){

	cin >> n;

	for(int k=n;k>0;k--){
		if(p(n) && p(n-2)){
			cout << n-2 << n << endl;
			break;
		}
		
	}
}

Compiler output:
a.cc: In function 'int p(int)':
a.cc:7:17: error: expected ';' before ')' token
    7 |         for(!n%2){
      |                 ^
      |                 ;
a.cc:10:9: error: expected primary-expression before 'else'
   10 |         else{
      |         ^~~~
a.cc:9:10: error: expected ';' before 'else'
    9 |         }
      |          ^
      |          ;
   10 |         else{
      |         ~~~~
a.cc:10:9: error: expected primary-expression before 'else'
   10 |         else{
      |         ^~~~
a.cc:9:10: error: expected ')' before 'else'
    9 |         }
      |          ^
      |          )
   10 |         else{
      |         ~~~~
a.cc:7:12: note: to match this '('
    7 |         for(!n%2){
      |            ^
a.cc:10:9: error: expected primary-expression before 'else'
   10 |         else{
      |         ^~~~
a.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^
a.cc: In function 'int main()':
a.cc:24:16: error: 'n' was not declared in this scope
   24 |         cin >> n;
      |                ^
Language: C++

#include <iostream>

using namespace std;
bool isPrime[10002];

void PrimeCalc()
{
	memset(isPrime, 1, sizeof(isPrime));
	isPrime[0] = isPrime[1] = false;
	for(int i = 2; i < 10001; ++i)
	{
		if(isPrime[i])
		{
			for(int j = 2 * i; j < 10001; j += i)
			{
				isPrime[j] = false;
			}
		}
	}
}

void solve()
{
	PrimeCalc();
	int n;
	while(cin >> n, n)
	{
		for(int i = n; i >= 7; --i)
		{
			if(isPrime[i] && isPrime[i - 2])
			{
				cout << i - 2 << " " << i << endl;
				break;
			}
		}
	}
}

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

Compiler output:
a.cc: In function 'void PrimeCalc()':
a.cc:8:9: error: 'memset' was not declared in this scope
    8 |         memset(isPrime, 1, sizeof(isPrime));
      |         ^~~~~~
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 |
Language: C++

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


#define MAX_N 10000
int prime[MAX_N];
bool is_prime[MAX_N+1];
int sieve(int n){
	int p=0;
	memset(is_prime,true,sizeof(is_prime));
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<=n;i++){
		if(is_prime[i]){
			prime[p++]=i;
			for(int j=2*i;j<=n;j+=i)is_prime[j]=false;
		}
	}
	return p;
}

int main(){
	sieve(MAX_N);
	vector<int> p;
	for(int i=2;i<=MAX_N-2;i++)
		if(is_prime[i]&&is_prime[i+2])p.push_back(i+2);
	int n;
	while(cin>>n&&n){
		int a=upper_bound(p.begin(),p.end(),n)-p.begin();
		cout<<p[a-1]-2<<' '<<p[a-1]<<endl;
	}
	return 0;
}

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

/*Grid*/
#include<stdio.h>
void func(int,int);
int n;
int i,j;
char a[30][30];
int cnt,max;
int dx[8]={0,1,1,1,0,-1,-1,-1};
int dy[8]={1,1,0,-1,-1,-1,0,1};
int main(void)
{
	//int i,j;
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<n;i++) scanf("%s",a[i]);
		//for(i=1;i<n;i++) printf("%s\n",a[i]);
		max=0;
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				if(a[i][j]=='1'){
					cnt=1;
					func(i,j);
					//if(max<cnt) max=cnt;
				}
			}	
		}
		//printf("\n");
		//for(i=0;i<n;i++) printf("%s\n",a[i]);
		printf("%d\n",max);
	}
	return 0;
}
void func(int y,int x)
{
	int xx,yy,i1;
	a[y][x]='0';
	for(i1=0;i1<8;i1++){
		xx=x+dx[i1]; yy=y+dy[i1];
		if(xx>n||xx<=0||yy>n||yy<=0||a[yy][xx]=='0'){
			if(max<cnt) max=cnt,/*printf("%d\n",cnt)*/,cnt=0,
			func(i,j);
		}
		else if(xx<n&&xx>=0&&yy<n&&yy>=0&&a[yy][xx]=='1'){
			cnt++; func(yy,xx);
		}
		
	}	
}


Compiler output:
a.cc: In function 'void func(int, int)':
a.cc:41:67: error: expected primary-expression before ',' token
   41 |                         if(max<cnt) max=cnt,/*printf("%d\n",cnt)*/,cnt=0,
      |                                                                   ^
Language: C++

/*Grid*/
#include<stdio.h>
void func(int,int);
int n;
int i,j;
char a[255][255];
int cnt,max;
int dx[8]={0,1,1,1,0,-1,-1,-1};
int dy[8]={1,1,0,-1,-1,-1,0,1};
int main(void)
{
	//int i,j;
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<n;i++) scanf("%s",a[i]);
		//for(i=1;i<n;i++) printf("%s\n",a[i]);
		max=0;
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				if(a[i][j]=='1'){
					cnt=1;
					func(i,j);
					//if(max<cnt) max=cnt;
				}
			}	
		}
		//printf("\n");
		//for(i=0;i<n;i++) printf("%s\n",a[i]);
		printf("%d\n",max);
	}
	return 0;
}
void func(int y,int x)
{
	int xx,yy,i1;
	a[y][x]='0';
	for(i1=0;i1<8;i1++){
		xx=x+dx[i1]; yy=y+dy[i1];
		if(xx>n||xx<=0||yy>n||yy<=0||a[yy][xx]=='0'){
			if(max<cnt) max=cnt,/*printf("%d\n",cnt)*/,cnt=0,
			func(i,j);
		}
		else if(xx<n&&xx>=0&&yy<n&&yy>=0&&a[yy][xx]=='1'){
			cnt++; func(yy,xx);
		}
		
	}	
}


Compiler output:
a.cc: In function 'void func(int, int)':
a.cc:41:67: error: expected primary-expression before ',' token
   41 |                         if(max<cnt) max=cnt,/*printf("%d\n",cnt)*/,cnt=0,
      |                                                                   ^
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
int n, a[255][255];
int check(int x, int y, int dx, int dy) {
	int ret = 0;
	while(0 <= x && x < n && 0 <= y && y < n) {
		if(a[y][x] == 0) return ret;
		x += dx, y += dy, ret++;
	}
	return ret;
}
int main() {
	while(~scanf("%d", &n), n) {
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) scanf("%d", &a[i][j]);
		}
		int ret = 0;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				for(int k = -1; k <= 1; k++) {
					for(int l = -1; l <= 1; l++) {
						if(k != 0 || l != 0) {
							ret = max(ret, checK(j, i, l, k));
						}
					}
				}
			}
		}
		printf("%d\n", ret);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:72: error: 'checK' was not declared in this scope; did you mean 'check'?
   24 |                                                         ret = max(ret, checK(j, i, l, k));
      |                                                                        ^~~~~
      |                                                                        check
Language: C++

#include<cstdio.h>
#include<iostream.h>
using namespace std;
int main(void){
	int i,j,k,n,max,cnt,x,y;
	int dx[4]={1,1,0,-1},dy[4]={0,-1,-1,-1};
	char xy[225][225];
	while(1){
		max=0;
		cin>>n;
		if(n==0) break;
		for(i=0;i<n;i++) cin>>xy[i];
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				if(xy[i][j]=='1'){
					for(k=0;k<4;k++){
						cnt=1;
						y=i; x=j;
						while(1){
							y=y+dy[k]; x=x+dx[k];
							if(y>=n||x>=n||y<0||x<0||xy[y][x]!='1') break;
							cnt++;
						}
						if(max<cnt) max=cnt;
					}
				}
			}
		}
		cout<<max<<endl;
	}
	return 0;
}

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

#include<cstdio>
#include<iostream.h>
using namespace std;
int main(void){
	int i,j,k,n,max,cnt,x,y;
	int dx[4]={1,1,0,-1},dy[4]={0,-1,-1,-1};
	char xy[225][225];
	while(1){
		max=0;
		cin>>n;
		if(n==0) break;
		for(i=0;i<n;i++) cin>>xy[i];
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				if(xy[i][j]=='1'){
					for(k=0;k<4;k++){
						cnt=1;
						y=i; x=j;
						while(1){
							y=y+dy[k]; x=x+dx[k];
							if(y>=n||x>=n||y<0||x<0||xy[y][x]!='1') break;
							cnt++;
						}
						if(max<cnt) max=cnt;
					}
				}
			}
		}
		cout<<max<<endl;
	}
	return 0;
}

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

#include<cstdio.h>
#include<iostream>
using namespace std;
int main(void){
	int i,j,k,n,max,cnt,x,y;
	int dx[4]={1,1,0,-1},dy[4]={0,-1,-1,-1};
	char xy[225][225];
	while(1){
		max=0;
		cin>>n;
		if(n==0) break;
		for(i=0;i<n;i++) cin>>xy[i];
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				if(xy[i][j]=='1'){
					for(k=0;k<4;k++){
						cnt=1;
						y=i; x=j;
						while(1){
							y=y+dy[k]; x=x+dx[k];
							if(y>=n||x>=n||y<0||x<0||xy[y][x]!='1') break;
							cnt++;
						}
						if(max<cnt) max=cnt;
					}
				}
			}
		}
		cout<<max<<endl;
	}
	return 0;
}

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

#include<cstdio>
#include<iostream>
using namespace std;
int main(void){
	int i,j,k,n,max,cnt,x,y;
	int dx[]={1,1,0,-1},dy[]={0,1,1,1};
	char xy[225][226];
	while(1){
		max=0;
		cin>>n;
		if(n==0) break;
		for(i=0;i<n;i++) cin>>xy[i];
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				if(xy[i][j]=='1'){
					for(k=0;k<4;k++){
						cnt=1;
						y=i; x=j;
						while(1){
							y=y+dy[k]; x=x+dx[k];
							if(y>=n||x>=n||y<0||x<0) break;
							if(xy[y][x]!='1')break;
							cnt++;
						}
						if(max<cnt) max=cnt;
					}
				}
			}
		}
		cout<<max\n;
	}
	return 0;
}

Compiler output:
a.cc:30:26: error: stray '\' in program
   30 |                 cout<<max\n;
      |                          ^
a.cc: In function 'int main()':
a.cc:30:26: error: expected ';' before 'n'
   30 |                 cout<<max\n;
      |                          ^~
      |                          ;
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

const int MAX_N = 255;
int n;
char grid[MAX_N][MAX_N];
int dp[MAX_N][MAX_N][4];

int main()
{
    while(cin >> n && n) {
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                cin >> grid[i][j];
        
        memset(dp, 0, sizeof(dp));
        for(int j = 0; j < n; j++) 
            for(int k = 0; k < 4; k++) 
                dp[0][j][k] = grid[0][j] - '0';

        int ans = 0;
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                if(grid[i][j] == '0') {
                    for(int k = 0; k < 4; k++)
                        dp[i][j][k] = 0;
                } else {
                    dp[i][j][0] = (j) ? dp[i-1][j-1][0] + 1 : 1;
                    dp[i][j][1] = dp[i-1][j][1] + 1;
                    dp[i][j][2] = (j != n - 1) ? dp[i-1][j+1][2] + 1 : 1;
                    dp[i][j][3] = (j) ? dp[i][j-1][3] + 1 : 1;
                }
                for(int k = 0; k < 4; k++)
                    ans = max(ans, dp[i][j][k]);
            }
        }

        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: 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 <cmath>
  +++ |+#include <cstring>
    3 |
Language: C++

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

const int MAX_N = 255;
int n;
char grid[MAX_N][MAX_N];
int dp[MAX_N][MAX_N][4];

int main()
{
    while(cin >> n && n) {
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                cin >> grid[i][j];
        
        memset(dp, 0, sizeof(dp));
        for(int j = 0; j < n; j++) 
            for(int k = 0; k < 4; k++) 
                dp[0][j][k] = grid[0][j] - '0';

        int ans = 0;
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                if(grid[i][j] == '0') {
                    for(int k = 0; k < 4; k++)
                        dp[i][j][k] = 0;
                } else {
                    dp[i][j][0] = (j) ? dp[i-1][j-1][0] + 1 : 1;
                    dp[i][j][1] = dp[i-1][j][1] + 1;
                    dp[i][j][2] = (j != n - 1) ? dp[i-1][j+1][2] + 1 : 1;
                    dp[i][j][3] = (j) ? dp[i][j-1][3] + 1 : 1;
                }
                for(int k = 0; k < 4; k++)
                    ans = max(ans, dp[i][j][k]);
            }
        }

        cout << ans << endl;
    }
}

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

#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;

const int MAX_N = 255;
int n;
char grid[MAX_N][MAX_N];
int dp[MAX_N][MAX_N][4];

int main()
{
    while(cin >> n && n) {
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                cin >> grid[i][j];
        
        memset(dp, 0, sizeof(dp));
        for(int j = 0; j < n; j++) 
            for(int k = 0; k < 4; k++) 
                dp[0][j][k] = grid[0][j] - '0';

        int ans = 0;
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                if(grid[i][j] == '0') {
                    for(int k = 0; k < 4; k++)
                        dp[i][j][k] = 0;
                } else {
                    dp[i][j][0] = (j) ? dp[i-1][j-1][0] + 1 : 1;
                    dp[i][j][1] = dp[i-1][j][1] + 1;
                    dp[i][j][2] = (j != n - 1) ? dp[i-1][j+1][2] + 1 : 1;
                    dp[i][j][3] = (j) ? dp[i][j-1][3] + 1 : 1;
                }
                for(int k = 0; k < 4; k++)
                    ans = max(ans, dp[i][j][k]);
            }
        }

        cout << ans << endl;
    }
}

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

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int n;

const int MAX = 255;
int M[MAX][MAX];

int solve()
{
	int mval = 0;
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<n; j++)
		{
			if(M[i][j]==1)
			{
				c++;
			}
			else
			{
				if(c > mval) mval =c;
				c = 0;
			}
		}
		
		if(c > mval)
		{
			mval = c;
		}
	}
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<n; j++)
		{
			if(M[j][i]==1)
			{
				c++;
			}
			else
			{
				if(c > mval) mval =c;
				c = 0;
			}
		}
		
		if(c > mval)
		{
			mval = c;
		}
	}
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<=i; j++)
		{
			if(M[i-j][j]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<n-i; j++)
		{
			if(M[i+j][j]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<=i; j++)
		{
			if(M[i-j][n-j-1]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<n-i; j++)
		{
			if(M[i+j][n-j-1]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		
	}
	
	return mval;
}

int main(int argc, char** argv)
{
	string tmp;
	char c[1];
	
	while(cin >> n, n)
	{
		for(int i=0; i<n; i++)
		{
			cin >> tmp;
			for(int j=0; j<n; j++)
			{
				memcpy(c, &tmp[j], sizeof(char));
				M[i][j] = atoi(c);
			}
		}
		
		cout << solve() << endl;;
	}
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:128:33: error: 'memcpy' was not declared in this scope
  128 |                                 memcpy(c, &tmp[j], sizeof(char));
      |                                 ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cmath>
  +++ |+#include <cstring>
    4 |
Language: C++

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

using namespace std;

int n;

const int MAX = 255;
int M[MAX][MAX];

int solve()
{
	int mval = 0;
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<n; j++)
		{
			if(M[i][j]==1)
			{
				c++;
			}
			else
			{
				if(c > mval) mval =c;
				c = 0;
			}
		}
		
		if(c > mval)
		{
			mval = c;
		}
	}
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<n; j++)
		{
			if(M[j][i]==1)
			{
				c++;
			}
			else
			{
				if(c > mval) mval =c;
				c = 0;
			}
		}
		
		if(c > mval)
		{
			mval = c;
		}
	}
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<=i; j++)
		{
			if(M[i-j][j]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<n-i; j++)
		{
			if(M[i+j][j]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<=i; j++)
		{
			if(M[i-j][n-j-1]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<n-i; j++)
		{
			if(M[i+j][n-j-1]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		
	}
	
	return mval;
}

int main(int argc, char** argv)
{
	string tmp;
	char c[1];
	
	while(cin >> n, n)
	{
		for(int i=0; i<n; i++)
		{
			cin >> tmp;
			for(int j=0; j<n; j++)
			{
				memcpy(c, &tmp[j], sizeof(char));
				M[i][j] = atoi(c);
			}
		}
		
		cout << solve() << endl;;
	}
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:130:33: error: 'memcpy' was not declared in this scope
  130 |                                 memcpy(c, &tmp[j], sizeof(char));
      |                                 ^~~~~~
a.cc:6:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <vector>
  +++ |+#include <cstring>
    6 |
Language: C++

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

int n;

// arr[y][x]
int arr[260][260];

/*
0: ツ湘」
1: ツ債カ
2: ツ債カツ湘」
3: ツ右ツ湘」
*/
int dp[4][260][260];


int main() {
	for(;;) {
		scanf(" %d", &n);
		if(!n) break;
		for(int y = 0; y < n; y++) {
			char line[260];
			scanf(" %s", line);
			for(int x = 0; x < n; x++) {
				arr[y][x] = line[x] - '0';
			}
		}
		memset(dp, 0, sizeof dp);
		for(int y = 0; y < n; y++) {
			for(int x = 0; x < n; x++) {
				if(arr[y][x] == 1) {
					for(int i = 0; i < 4; i++) {
						dp[i][y][x] = 1;
					}
					if(y >= 1) {
						dp[0][y][x] += dp[0][y - 1][x];
					}
					if(x >= 1) {
						dp[1][y][x] += dp[1][y][x - 1];
					}
					if(x >= 1 && y >= 1) {
						dp[2][y][x] += dp[2][y - 1][x - 1];
					}
					if(y >= 1 && x < n - 1) {
						dp[3][y][x] += dp[3][y - 1][x + 1];
					}
				}
			}
		}
		int maxv = 0;
		for(int y = 0; y < n; y++) {
			for(int x = 0; x < n; x++) {
				for(int k = 0; k < 4; k++) {
					maxv = max(maxv, dp[k][y][x]);
				}
			}
		}
		printf("%d\n", maxv);
	}
	return 0;
}

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

#include<algorithm>
using namespace std;

int main(){
  int n;
  int field[255][255];
  int d;
  string tmp;

  while(1){
    cin >> n;
    if(!n)break;

    for(int i=0;i<n;i++){
      cin >> tmp;
      for(int j=0;j<n;j++)field[i][j] = tmp[j]-'0';
    }

    int ans = 0;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(field[i][j]){
	  d = 1;
	  while(i+d<n &&  j-d>=0 && field[i+d][j-d])d++;
	  ans = max(ans,d);

	  d = 1;
	  while(i+d<n && field[i+d][j])d++;
	  ans = max(ans,d);

	  d = 1;
	  while(i+d<n && j+d<n && field[i+d][j+d])d++;
	  ans = max(ans,d);

	  d = 1;
	  while(j+d<n && field[i][j+d])d++;
	  ans = max(ans,d);

	}
      }
    }

    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'string' was not declared in this scope
    8 |   string tmp;
      |   ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include<algorithm>
  +++ |+#include <string>
    2 | using namespace std;
a.cc:11:5: error: 'cin' was not declared in this scope
   11 |     cin >> n;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:15:14: error: 'tmp' was not declared in this scope
   15 |       cin >> tmp;
      |              ^~~
a.cc:43:5: error: 'cout' was not declared in this scope
   43 |     cout << ans << endl;
      |     ^~~~
a.cc:43:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:43:20: error: 'endl' was not declared in this scope
   43 |     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<algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C

#include <stdio.h>

int main(void){

int n, i, j;
int classnum[40];
int score[40][21];

scanf("%d", &n);

for(i=0; i<n; i++){
 scanf("%d", &classnum[i]);
 
 for(j=0;

Compiler output:
main.c: In function 'main':
main.c:14:2: error: expected expression at end of input
   14 |  for(j=0;
      |  ^~~
main.c:14:2: error: expected declaration or statement at end of input
main.c:14:2: error: expected declaration or statement at end of input
Language: C

#include <stdio.h>
int main (void)
{
int a,i,j=0;
int s[][22]={};
do{
scanf("%d",&a);
for(i=0;i<a;i++)
scnaf(s[j][]

Compiler output:
main.c: In function 'main':
main.c:9:1: error: implicit declaration of function 'scnaf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    9 | scnaf(s[j][]
      | ^~~~~
      | scanf
main.c:9:12: error: expected expression before ']' token
    9 | scnaf(s[j][]
      |            ^
main.c:9:12: error: expected declaration or statement at end of input
main.c:9:12: error: expected declaration or statement at end of input
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

bool exist[10000][301];

int main(){
	
	while(true){
		int n;
		cin >> n;
		if(n == 0){
			break;
		}
		
		for(int i = 0; i < 10000; i++){
			for(int j = 0; j < 301; j++){
				exist[i][j] = false;
			}
		}
		int id, score, round, round_small, dummy, rest;
		bool strike1, strike2, spare;
		bool last_throw;
		
		for(int loop = 0; loop < n; loop++){
			cin >> id;
			round = 1;
			round_small = 1;
			rest = 10;
			score = 0;
			strike1 = false;
			strike2 = false;
			spare = false;
			last_throw = false;
			
			while(true){
				if(round <= 9){
					cin >> dummy;
					score += dummy;
					if(strike1){
						score += dummy;
					}
					if(strike2){
						score += dummy;
					}
					if(spare){
						score += dummy;
						spare = false;
					}
					strike2 = strike1;
					strike1 = false;
					if(rest == dummy){
						if(dummy == 10){
							strike1 = true;
						}else{
							spare = true;
						}
						round++;
						round_small = 1;
						rest = 10;
					}else{
						round_small++;
						rest -= dummy;
						if(round_small >= 3){
							round_small = 1;
							round++;
							rest = 10;
						}
					}
				}else if(round == 10){
					cin >> dummy;
					score += dummy;
					if(strike1){
						score += dummy;
					}
					if(strike2){
						score += dummy;
					}
					if(spare){
						score += dummy;
						spare = false;
					}
					strike2 = strike1;
					strike1 = false;
					if(rest == dummy){
						last_throw = true;
						round_small++;
						rest = 10
					}else{
						round_small++;
						rest -= dummy;
					}
					if(round_small >= 3){
						if(last_throw){
							cin >> dummy;
							score += dummy;
						}
						break;
					}
				}
				//cout << "round_next = " << round << " : rest_next = " << rest << ", score = " << score << endl;
			}
			exist[id][score] = true;
		}
		for(int i = 300; i >= 0; i--){
			for(int j = 0; j < 10000; j++){
				if(exist[j][i]){
					cout << j << " " << i << endl;
				}
			}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:91:58: error: expected ';' before '}' token
   91 |                                                 rest = 10
      |                                                          ^
      |                                                          ;
   92 |                                         }else{
      |                                         ~
Language: C++


#if 1

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

void input(vector<vint>& v)
{
	rep(i, 10)
	{
		int f;
		cin >> f;
		  
		v[i][0] = f;
		
		// 2Úª éê
		if(f != 10 || i == 9)
		{
			int s;
			cin >> s;
			
			v[i][1] = s;
		}
	}
	
	// 10t[ÚÌÅãÌ
	if(v[9][0] + v[9][1] == 10 || v[9][1] == 10 || v[9][0] == 10)
	{
		int l;
		cin >> l;
		
		v[9][2] = l;
	}
}

int calc(vector<vint> v)
{
	// Åã©çßÄ¢­
	// 10t[ÚÌÝÊ

	int res = v[9][0] + v[9][1] + (v[9][2] != -1 ? v[9][2] : 0);
	
	rep(i, 9)
	{
		if(v[i][0] == 10)
		{
			res += 10 + v[i + 1][0] + (v[i + 1][1] != -1 ? v[i + 1][1] : (i < 8 ? v[i + 2][0] : v[i + 1][2]));
		}
		else if(v[i][0] + v[i][1] == 10)
		{
			res += 10 + v[i + 1][0];
		}
		else res += v[i][0] + v[i][1];
	}
	
	return res;
}

bool pred(pint a, pint b)
{
	return a.first > b.first || (a.first == b.first && a.second < b.second);
}

int main()
{
    int n;
	while(cin >> n && n)
	{
		vector<pint> pnt(n);
		
		rep(i, n)
		{
			cin >> pnt[i].second;

			vector<vint> v(10, vint(3, -1));
			
			// üÍðó¯æé
			input(v);
			
			// ¾_ðvZ·é
			pnt[i].first = calc(v);
		}
		
		// å«¢Å\[g
		sort(ALL(pnt), pred);
		
		rep(i, n)
			cout << pnt[i].second << " " << pnt[i].first << endl;
	}
}

Compiler output:
a.cc:2: error: unterminated #if
    2 | #if 1
Language: C++

#include<iostream>
#include<map>
#include<functional>
using namespace std;

int main(void){
	int n;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		multimap<int,int, greater<int> > s;
		for(int i=0;i<n;i++){
			int num,sc[10][3],sck[10],res=0;
			memset(sc,0,sizeof(sc));
			memset(sck,0,sizeof(sck));
			scanf("%d",&num);
			for(int j=0;j<10;j++){
				if(j<9)for(int k=0;k<2;k++){
					scanf("%d",&sc[j][k]);
					if(sc[j][k]==10)break;
				}
				if(j==9)for(int k=0;k<3;k++){
					scanf("%d",&sc[j][k]);
					if(k==1 && sc[j][0]+sc[j][1]<10)break;
				}
			}
			sck[9]=sc[9][0]+sc[9][1]+sc[9][2];
			for(int j=0;j<9;j++){
				if(sc[j][0]==10){
					sck[j]=10;
					if(sc[j+1][0]==10)sck[j]+=10+sc[j+2][0];
					else sck[j]+=sc[j+1][0]+sc[j+1][1];
				}else if(sc[j][0]+sc[j][1]==10){
					sck[j]=10+sc[j+1][0];
				}else sck[j]=sc[j][0]+sc[j][1];
			}
			for(int j=0;j<=9;j++)res+=sck[j];
			s.insert(make_pair(res,num));
		}
		multimap<int,int, greater<int> >::iterator it=s.begin();
		while(it!=s.end()){
			cout << (*it).second << " " << (*it).first << endl;
			it++;
		}
	}
    return 0;
}

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

#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
 
 int main() {
 int da[25],sc[41],i,j,k,n,fr;
 char ch[100];
 while(cin >> n) {
	 if (n==0) break;
	 cin.ignore();
	 for (j=0;j<n;j++) {
     gets(ch); k=fr=sc[j]=0; 
     for (i=0;i<25;i++) da[i]=0;
     for (i=0;ch[i]!='\0';i++) if (ch[i]>='0' && ch[i]<='9') da[k]=da[k]*10+ch[i]-'0'; else k++;
	 k++; i=fr=1; sc[j]=0;
	 for (fr=1;fr<10;fr++) {
		 if (da[i]==10) {sc[j]+=10+da[i+1]+da[i+2]; i++;} else {
		 if (da[i]+da[i+1]==10) sc[j]+=10+da[i+2]; else sc[j]+=da[i]+da[i+1];
		 i+=2;} }
	 sc[j]=(sc[j]+da[i]+da[i+1]+da[i+2])*10000+da[0];
	 }
     sort(sc,sc+n);
     for (i=n-1;i>=0;i--) cout << sc[i] % 10000 << ' ' << sc[i]/10000 << endl;
 }
 re

Compiler output:
a.cc: In function 'int main()':
a.cc:13:6: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |      gets(ch); k=fr=sc[j]=0;
      |      ^~~~
      |      getw
a.cc:26:2: error: 're' was not declared in this scope
   26 |  re
      |  ^~
a.cc:26:4: error: expected '}' at end of input
   26 |  re
      |    ^
a.cc:6:13: note: to match this '{'
    6 |  int main() {
      |             ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

typedef pair<int,int> P;

vector<int> Point(string s){
  stringstream ss(s);
  int num;
  vector<int> v;

  while(ss >> num){
    v.push_back(num);
  }

  return v;
}

int getScore(string s){
  vector<int> a = Point(s);
  int len = (int)a.size();
  int score = 0 , sum = 0;
  int plus[10] = {0};
  int p = 0,n = 0;

  for(int i = 0 ; i < len ; i++){
    if(p >= 9){
      p++;
      score += a[i];
    }else{
      if(a[i] == 10){
	score += a[i];
	plus[p++] = a[i+1] + a[i+2];
      }else{
	n++;
	sum += a[i];
	if(n == 2){
	  n = 0;
	  score += sum;
	  if(sum == 10){
	    plus[p++] = a[i+1];
	  }else{
	    p++;
	  }
	  sum = 0;
	}
      }
    }
  }

  for(int i = 0 ; i < 10 ; i++){
    score += plus[i];
  }

  return -score;
}

int main(){
  int m;
  while(cin >> m ,m){
    vector<P> v;
    string pin;
    for(int i = 0 ; i < m ; i++){
      int score = 0,num;
      cin >> num;
      getline(cin,pin);
      score = getScore(pin);
      v.push_back(P(score,num));
    }
    sort(v.begin(),v.end());
    for(int i = 0 ; i < m ; i++){
      cout << v[i].second << " " << -v[i].first << endl;
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   73 |     sort(v.begin(),v.end());
      |     ^~~~
      |     short
Language: Java


import java.util.Arrays;
import java.util.Scanner;

/**
 * AOJ id=0153
 * Triangle and Circle
 * @author scache
 *
 */
public class Main0153 {
	public static void main(String[] args) {
		Main0153 p = new Main0153();
	}

	public Main0153() {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int[] x = new int[3];
			int[] y = new int[3];
			for(int i=0;i<3;i++){
				x[i] = sc.nextInt();
				y[i] = sc.nextInt();
				if(i==0 && x[i]==0 && y[i]==0)
					return;
			}
			int rx = sc.nextInt();
			int ry = sc.nextInt();
			int r = sc.nextInt();
			
			System.out.println(solve(x, y, rx, ry, r));
		}
	}

	private String solve(int[] x, int[] y, int rx, int ry, int r) {
		int[] vx = new int[3];
		int[] vy = new int[3];
		
		
		for(int i=0;i<3;i++){
			vx[i] = x[(i+1)%3]-x[i];
			vy[i] = y[(i+1)%3]-y[i];
		}
		
		int inCircle = 0;
		for(int i=0;i<3;i++){
			int xd = (x[i]-rx)*(x[i]-rx);
			int yd = (y[i]-ry)*(y[i]-ry);
			if(r*r >= xd+yd)
				inCircle++;
		}
		if(inCircle==3)
			return "b";
//		else if(inCircle==1 || inCircle==2)
//			// 接している場合は三角形の中に円がはいっている可能性がある？
//			return "c";
		

		int l=0;
		for(int i=0;i<3;i++){
			if(vx[i]*(ry-y[i])-(rx-x[i])*vy[i]<0)
				l++;
		}
		if(l==3 || l==0)
			return "a";
		
		
		for(int i=0;i<3;i++){
			int vrx = rx-x[i];
			int vry = ry-y[i];
			
			int inp = vx[i]*vrx+vy[i]*vry;
			if(inp<0){
				if(vrx*vrx+vry*vry < r*r)
					return "c";
			}else{
				if(inp > vx[i]*vx[i]+vy[i]*vy[i]){
					if((rx-x[(i+1)%3])*(rx-x[(i+1)%3])+(ry-y[(i+1)%3])*(ry-y[(i+1)%3]) <r*r)
						return "c";
				}else{
					if(vrx*vrx+vry*vry-inp*inp < (long)(vx[i]*vx[i]+vy[i]*vy[i])*r*r){
						return "c";
					}
				}
			}
		}
		
		return "d";
		
		
	}
}

Compiler output:
Main.java:11: error: class Main0153 is public, should be declared in a file named Main0153.java
public class Main0153 {
       ^
1 error