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

include<stdio.h>
#include<limits.h>


#define DEBUG 0


int buf [5001];

/*
  100kx5k= 500M
  2^20 = 1M
*/

int sum(int begin, int end){
  int i;
  int sum=0;
  for(i=begin; i<end; i++)
    sum +=buf[i];
  return sum;
}

int find_max_sum(int count){
  int i, j;
  int max, s;
  max = INT_MIN;

  for(i = 0; i < count; i++){
    for(j = i+1; j <= count; j++){
      s = sum(i,j);
      if(s>=max) max =s;
    }
  }
  return max;
}


int main(){
  int count;
  int i;
  while((scanf("%i", &count) == 1) && count){
    if(DEBUG)
      printf("count: %d\n", count);
    for(i=0; i<count;i++){
      scanf("%i", buf+i);
      if(DEBUG)
        printf("data: %d\n", *(buf+i));
    }
  return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'sum':
main.c:19:11: error: 'buf' undeclared (first use in this function)
   19 |     sum +=buf[i];
      |           ^~~
main.c:19:11: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:41:10: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   41 |   while((scanf("%i", &count) == 1) && count){
      |          ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include<limits.h>
  +++ |+#include <stdio.h>
    3 | 
main.c:41:10: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   41 |   while((scanf("%i", &count) == 1) && count){
      |          ^~~~~
main.c:41:10: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:43:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   43 |       printf("count: %d\n", count);
      |       ^~~~~~
main.c:43:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:43:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:43:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:45:19: error: 'buf' undeclared (first use in this function)
   45 |       scanf("%i", buf+i);
      |                   ^~~
main.c:47:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   47 |         printf("data: %d\n", *(buf+i));
      |         ^~~~~~
main.c:47:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:50:1: error: expected declaration or statement at end of input
   50 | }
      | ^
Language: C

      for(i=0;i<n;i++)
	if(b[0]<b[i])
	  b[0]=b[i];
      printf("%d\n",b[0]);
    } 
  return 0;
}

Compiler output:
main.c:1:7: error: expected identifier or '(' before 'for'
    1 |       for(i=0;i<n;i++)
      |       ^~~
main.c:1:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 |       for(i=0;i<n;i++)
      |                ^
main.c:1:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    1 |       for(i=0;i<n;i++)
      |                    ^~
main.c:4:14: error: expected declaration specifiers or '...' before string constant
    4 |       printf("%d\n",b[0]);
      |              ^~~~~~
main.c:4:21: error: unknown type name 'b'
    4 |       printf("%d\n",b[0]);
      |                     ^
main.c:5:5: error: expected identifier or '(' before '}' token
    5 |     }
      |     ^
main.c:6:3: error: expected identifier or '(' before 'return'
    6 |   return 0;
      |   ^~~~~~
main.c:7:1: error: expected identifier or '(' before '}' token
    7 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 5000
int sum(int s,int e,int *list){
	int ans=0;
	int i;
	for(i=s;i<=e;i++){
		ans+=list[i];
	}
	return ans;
}
int main(){
	int t[MAX];
	int n;
	int a[MAX];
	int i,j,k;
	int max=-200000000;
	while(scanf("%d",&n)){
		if(n==0){
			break;
		}
		max=-200000000;
		for(i=0;i<n;i++){
				t[i]=0;
		}
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
			for(j=i;j<n;j++){
				t[j]+=a[i];
			}
		}
		for(i=0;i<n;i++){
			for(j=0;j<i;j++){
				int S = sum(j,i,a);
				if(S)>t[i]){
					t[i]=S;
				}
			}
		}
		for(i=0;i<n;i++){
			if(max<t[i]){
				max=t[i];
			}
			
		}
		printf("%d\n",max);
	}	
	return 0;

}

Compiler output:
main.c: In function 'main':
main.c:34:38: error: expected expression before '>' token
   34 |                                 if(S)>t[i]){
      |                                      ^
main.c:34:43: error: expected statement before ')' token
   34 |                                 if(S)>t[i]){
      |                                           ^
Language: C

i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
      |   ^
main.c:1:5: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
      |     ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
      |       ^~~~
main.c: In function 'main':
main.c:1:7: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:24: error: lvalue required as left operand of assignment
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
      |                        ^
main.c:1:34: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
      |                                  ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
main.c:1:34: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
      |                                  ^~~~~
main.c:1:34: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:61: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | i,n,t;main(m){for(;n?:i=t=m=-9e5,scanf("%d",n--?&i:&n),n;n?:printf("%d\n",m))t*=t>0,t+=i,m=t>m?t:m;}
      |                                                             ^~~~~~
main.c:1:61: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:61: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:61: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
      |   ^
main.c:1:5: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
      |     ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
      |       ^~~~
main.c: In function 'main':
main.c:1:7: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:20: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
      |                    ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
main.c:1:20: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
      |                    ^~~~~
main.c:1:20: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:45: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
      |                                             ^~~~~~
main.c:1:45: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:45: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:45: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:89: error: lvalue required as left operand of assignment
    1 | i,n,t;main(m){for(;scanf("%d",n?&i:&n),n;n||printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:t=m=-9e5;}
      |                                                                                         ^
Language: C

#include <stdio.h>
void tansaku(int a);
int main(void)
{
	int array[1000];
	int n,i,sum=0,k=0;
	while(1)
	{
		sum = 0;
		for(i=0;i<1000;i++)
		{
			array[i] = 0;
		}
		scanf("%d",&n);
		if(n==0)break;
		for(i=0;i<n;i++)
		{
			scanf("%d",&array[i]);
		}
		for(i=0;i<n;i++)
		{
			tansaku(i);
			k = 0;
		}
		printf("%d\n",sum);
	}
	return 0;
}
void tansaku(int a)
{
	if(a>n)return;
	k += array[a];
	if(k > sum)
	{
		sum = k;
	}
	if(a == n)return;
	tansaku(a+1);
}

Compiler output:
main.c: In function 'tansaku':
main.c:31:14: error: 'n' undeclared (first use in this function)
   31 |         if(a>n)return;
      |              ^
main.c:31:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:32:9: error: 'k' undeclared (first use in this function)
   32 |         k += array[a];
      |         ^
main.c:32:14: error: 'array' undeclared (first use in this function)
   32 |         k += array[a];
      |              ^~~~~
main.c:33:16: error: 'sum' undeclared (first use in this function)
   33 |         if(k > sum)
      |                ^~~
Language: C

#include <stdio.h>
int main(void)
{
	int array[5000];
	int i,n,j,max,tmp=0;
	while(1)
	{
		scanf("%d",&n);
		if(n == 0)break;
		for(i=~;i<n;i++)
		{
			scanf("%d",&array[i]);
		}
		for(i=0;i<n;i++)
		{
			for(j=i;j<n;j++)
			{
				tmp += array[j];
				if(max < tmp)max = tmp;
			}
			tmp = 0;
		}
		printf("%d\n",max);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:24: error: expected expression before ';' token
   10 |                 for(i=~;i<n;i++)
      |                        ^
Language: C

#include<stdio.h>

int main(){

	int i,n,maxIdx,minIdx;
	long item[5000],sum,sumMax,sumMin;

	while(scanf("%d",&n)!=EOF){
		if(n==0) break;
		sumMin=0;
		sumMax=0;
		sum=0;

		for(i=0;i<n;i++){
			scanf("%ld",&item[i]);
			if(i==0){
				sum+=item[i];
				if(sumMax<item[i]) sumMax=item[i];
				else if(sumMin>item[i]) sumMin=item[i];
			}
			else{
				sum+=item[i];
				if(sumMax<sum){
					sumMax=sum;
					maxIdx=i;
				}
				else if(sumMin>sum){
					minIdx=i;
					if(maxIdx>minIdx){
						sumMin=sum;
					}
			}
					}
		
		printf("%ld\n",sumMax-sumMin);


	}



	return 0;
}

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

7
-5
-1
6
4
9
-6
-7
13
1
2
3
2
-2
-1
1
2
3
2
1
-2
1
3
1000
-200
201
0

Compiler output:
main.c:1:1: error: expected identifier or '(' before numeric constant
    1 | 7
      | ^
Language: C

#include <stdio.h>

int main(void)
{
	int n;
	int i, j, k;
	int a[5000];
	__int64 ans;
	__int64 buf;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			scanf("%d", &a[i]);
		}
		
		ans = -200000;
		for (i = 0; i < n - 1; i++){/*スタート*/
			for (j = i + 1; j < n; j++){/*ゴール*/
				buf = 0;
				for (k = i; k <= j; k++){/*項数*/
					buf += a[k];
				}
				if (ans < buf){
					ans = buf;
				}
			}
		}
		
		printf("%lld\n", ans);
	}
	
	return (0);
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    8 |         __int64 ans;
      |         ^~~~~~~
      |         __int64_t
main.c:9:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    9 |         __int64 buf;
      |         ^~~~~~~
      |         __int64_t
Language: C

#include <stdio.h>

int main(void)
{
	int n;
	int i, j, k;
	int a[5000];
	__int64 ans;
	__int64 buf;
	int start_max;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			scanf("%d", &a[i]);
		}
		
		ans = -2000000;
		start_max = -1000000;
		for (i = 0; i < n - 1; i++){/*スタート*/
			if (start_max < a[i]){
				start_max = a[i];
			}
			else {
				continue;
			}
			for (j = i + 1; j < n; j++){/*ゴール*/
				buf = 0;
				for (k = i; k <= j; k++){/*項数*/
					buf += a[k];
				}
				if (ans < buf){
					ans = buf;
				}
			}
		}
		
		
		printf("%lld\n", ans);
	}
	
	return (0);
}
/* 音ゲーの精度がよくなりますように。 */

Compiler output:
main.c: In function 'main':
main.c:8:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    8 |         __int64 ans;
      |         ^~~~~~~
      |         __int64_t
main.c:9:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    9 |         __int64 buf;
      |         ^~~~~~~
      |         __int64_t
Language: C

#include <stdio.h>

int main(void)
{
	int n;
	int i, j, k;
	int a[5000];
	__int64 ans;
	__int64 buf;
	int start_max;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			scanf("%d", &a[i]);
		}
		
		ans = -2000000;
		start_max = -1000000;
		for (i = 0; i < n - 1; i++){/*スタート*/
			/*if (a[i - 1] >= a[i] && i != 0){
				continue;
			}*/
			buf = a[i];
			for (j = i + 1; j < n; j++){/*ゴール*/
				/*for (k = i; k <= j; k++){/*項数*/
					/*printf("[%d]%d ", k, a[k]);
					buf += a[k];
				}*/
				buf += a[j];
				/*printf("%d\n", buf);*/
				if (ans < buf){
					ans = buf;
				}
			}
		}
		
		
		printf("%lld\n", ans);
	}
	
	return (0);
}
/* 音ゲーの精度がよくなりますように。 */

Compiler output:
main.c: In function 'main':
main.c:8:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    8 |         __int64 ans;
      |         ^~~~~~~
      |         __int64_t
main.c:9:9: error: unknown type name '__int64'; did you mean '__int64_t'?
    9 |         __int64 buf;
      |         ^~~~~~~
      |         __int64_t
Language: C

#include <stdio.h>

int main(void)
{
	int n;
	int i, j;
	int a[5000];
	long long ans;
	long long buf;
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			scanf("%d", &a[i]);
		}
		
		ans = -5000000000
		for (i = 0; i < n - 1; i++){/*スタート*/
			buf = a[i];
			for (j = i + 1; j < n; j++){/*ゴール*/
				buf += a[j];
				if (ans < buf){
					ans = buf;
				}
			}
		}
		
		
		printf("%lld\n", ans);
	}
	
	return (0);
}
/* 音ゲーの精度がよくなりますように。 */

Compiler output:
main.c: In function 'main':
main.c:21:34: error: expected ';' before 'for'
   21 |                 ans = -5000000000
      |                                  ^
      |                                  ;
   22 |                 for (i = 0; i < n - 1; i++){/*スタート*/
      |                 ~~~
Language: C

#include <stdio.h>

int main()
{
	int n;
	int a[5001];
	
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
			scanf("%d",a+i);
		}
		p=a[0];
		for(i=0;i<n;i++){
			t=m=a[i];
			for(j=i+1;j<n;j++){
				t+=a[j];
				if(t>m) m=t;
			}
			if(m>p) p=m;
		}
		printf("%d\n",p);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:21: error: 'i' undeclared (first use in this function)
   11 |                 for(i=0;i<n;i++){
      |                     ^
main.c:11:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:17: error: 'p' undeclared (first use in this function)
   14 |                 p=a[0];
      |                 ^
main.c:16:25: error: 't' undeclared (first use in this function)
   16 |                         t=m=a[i];
      |                         ^
main.c:16:27: error: 'm' undeclared (first use in this function)
   16 |                         t=m=a[i];
      |                           ^
main.c:17:29: error: 'j' undeclared (first use in this function)
   17 |                         for(j=i+1;j<n;j++){
      |                             ^
Language: C

#include<stdio.h>

int main(){
	int a[6000],n,i,j,total=0,amax=1E-10;
	while(1){
		scanf("%d",&n);
		if(!n) break;
		amax=0;
		for(i=0;i<n;i++) scanf("%d",&a[i]);
		for(i=0;i<n;i++){
			for(j=i;j<n;j++){
				total+=a[j];
				if(amax<total) amax=total;
			}
			total=0;
		}
		printf("%d\n",amax);
	}
	return 0;
}
		scanf("%d",&n);
		if(!n) break;
		amax=0;
		for(i=0;i<n;i++) scanf("%d",&a[i]);
		for(i=0,k=0;i<n;i++){
			for(j=i+1;j<=n;j++){
				for(l=i;l<j;l++) total+=a[l];
				if(amax<total) amax=total;
				total=0;
			}
		}
		printf("%d\n",amax);
	}
	return 0;
}

Compiler output:
main.c:21:23: error: expected declaration specifiers or '...' before string constant
   21 |                 scanf("%d",&n);
      |                       ^~~~
main.c:21:28: error: expected declaration specifiers or '...' before '&' token
   21 |                 scanf("%d",&n);
      |                            ^
main.c:22:17: error: expected identifier or '(' before 'if'
   22 |                 if(!n) break;
      |                 ^~
main.c:23:17: warning: data definition has no type or storage class
   23 |                 amax=0;
      |                 ^~~~
main.c:23:17: error: type defaults to 'int' in declaration of 'amax' [-Wimplicit-int]
main.c:24:17: error: expected identifier or '(' before 'for'
   24 |                 for(i=0;i<n;i++) scanf("%d",&a[i]);
      |                 ^~~
main.c:24:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   24 |                 for(i=0;i<n;i++) scanf("%d",&a[i]);
      |                          ^
main.c:24:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   24 |                 for(i=0;i<n;i++) scanf("%d",&a[i]);
      |                              ^~
main.c:25:17: error: expected identifier or '(' before 'for'
   25 |                 for(i=0,k=0;i<n;i++){
      |                 ^~~
main.c:25:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   25 |                 for(i=0,k=0;i<n;i++){
      |                              ^
main.c:25:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   25 |                 for(i=0,k=0;i<n;i++){
      |                                  ^~
main.c:32:24: error: expected declaration specifiers or '...' before string constant
   32 |                 printf("%d\n",amax);
      |                        ^~~~~~
main.c:32:31: error: expected declaration specifiers or '...' before 'amax'
   32 |                 printf("%d\n",amax);
      |                               ^~~~
main.c:33:9: error: expected identifier or '(' before '}' token
   33 |         }
      |         ^
main.c:34:9: error: expected identifier or '(' before 'return'
   34 |         return 0;
      |         ^~~~~~
main.c:35:1: error: expected identifier or '(' before '}' token
   35 | }
      | ^
Language: C

#include<stdio.h>

int main(){
	int a[6000],n,i,j,total=0,amax=-99999999;
	while(1){
		scanf("%d",&n);
		if(!n) break;
		amax=-99999999;
		for(i=0;i<n;i++) scanf("%d",&a[i]);
		for(i=0;i<n;i++){
			for(j=i;j<n;j++){
				total+=a[j];
				if(amax<total) amax=total;
			}
			total=0;
		}
		printf("%d\n",amax);
	}
	return 0;
}
		amax=0;
		for(i=0;i<n;i++) scanf("%d",&a[i]);
		for(i=0;i<n;i++){
			for(j=i;j<n;j++){
				total+=a[j];
				if(amax<total) amax=total;
			}
			total=0;
		}
		printf("%d\n",amax);
	}
	return 0;
}

Compiler output:
main.c:21:17: warning: data definition has no type or storage class
   21 |                 amax=0;
      |                 ^~~~
main.c:21:17: error: type defaults to 'int' in declaration of 'amax' [-Wimplicit-int]
main.c:22:17: error: expected identifier or '(' before 'for'
   22 |                 for(i=0;i<n;i++) scanf("%d",&a[i]);
      |                 ^~~
main.c:22:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   22 |                 for(i=0;i<n;i++) scanf("%d",&a[i]);
      |                          ^
main.c:22:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   22 |                 for(i=0;i<n;i++) scanf("%d",&a[i]);
      |                              ^~
main.c:23:17: error: expected identifier or '(' before 'for'
   23 |                 for(i=0;i<n;i++){
      |                 ^~~
main.c:23:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   23 |                 for(i=0;i<n;i++){
      |                          ^
main.c:23:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   23 |                 for(i=0;i<n;i++){
      |                              ^~
main.c:30:24: error: expected declaration specifiers or '...' before string constant
   30 |                 printf("%d\n",amax);
      |                        ^~~~~~
main.c:30:31: error: expected declaration specifiers or '...' before 'amax'
   30 |                 printf("%d\n",amax);
      |                               ^~~~
main.c:31:9: error: expected identifier or '(' before '}' token
   31 |         }
      |         ^
main.c:32:9: error: expected identifier or '(' before 'return'
   32 |         return 0;
      |         ^~~~~~
main.c:33:1: error: expected identifier or '(' before '}' token
   33 | }
      | ^
Language: C

n = int(raw_input())
while n > 0:
  a = []
  for i in range(n):
    a.append(int(raw_input()))
  print max(a)
  n = int(raw_input())

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n = int(raw_input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
    1 | n = int(raw_input())
      |     ^~~
Language: C

i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
      |   ^
main.c:1:5: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
      |     ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
      |       ^~~~
main.c: In function 'main':
main.c:1:7: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:20: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
      |                    ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
main.c:1:20: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
      |                    ^~~~~
main.c:1:20: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:42: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
      |                                          ^~~~~~
main.c:1:42: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:42: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:42: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:90: error: wrong type argument to unary minus
    1 | i,n,t;main(m){for(;scanf("%d",&i),n|i;n?:printf("%d\n",m))n--?t*=t>0,t+=i,m=t>m?t:m:(t=m=-"",n=i);}
      |                                                                                          ^
Language: C

#include <stdio.h>

int main(void)
{
	int number,value,i,sum = 0;

	while(1)
	{
		scanf_s("%d",&number);

		if(number == 0) break;

		for(i = 0; i < number ; i++)
		{
			scanf_s("%d",&value);
			sum += value;
		}
		printf("%d\n",sum);
		sum = 0;
	}
}

Compiler output:
main.c: In function 'main':
main.c:9:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    9 |                 scanf_s("%d",&number);
      |                 ^~~~~~~
      |                 scanf
Language: C

#include <stdio.h>

int main(void)
{
	int number,value,i,sum = 0;

	while(1)
	{
		scanf("%d",&number);

		if(number == 0) break;

		for(i = 0; i < number ; i++)
		{
			scanf_s("%d",&value);
			sum += value;
		}
		printf("%d\n",sum);
		sum = 0;
	}
}

Compiler output:
main.c: In function 'main':
main.c:15:25: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   15 |                         scanf_s("%d",&value);
      |                         ^~~~~~~
      |                         scanf
Language: C

#include <stdio.h>

int main(void)
{
	int number,value,i,sum = 0;

	while(1)
	{
		scanf("%d",&number);

		if(number == 0) break;

		for(i = 0; i < number ; i++)
		{
			scanf_s("%d",&value);
			sum += value;
		}
		printf("%d\n",sum);
		sum = 0;
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:25: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   15 |                         scanf_s("%d",&value);
      |                         ^~~~~~~
      |                         scanf
Language: C

#include<stdio.h>
main(){
	int i,j,n,a[5000];
	
	int sum = 0,max = 0;
	
	
	while(1){
		
		max = 0;
	
		scanf("%d",&n);
		
		if(n==0) break;
		
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		
		for(i = n - 1; (i >= 0)&&(a[i] <= 0); i--);
		
		n = i;
		
		for(i = 0; (i <= n)&&(a[i] <= 0); i++);

		
		for( ;i <= n; i++){
			
			sum = 0;
			
			for(j = i; j <= n; j++) sum += a[j];
			
			if(sum > max) max = sum;
			
			for(j = n; j >= i; j--){
				
				sum -= a[j];
				
				if(sum > max) max = sum;
				
			}
			
			if(max > ans ) ans = max;
		}

		printf("%d\n",max);
		
		
		sum = 0;
		max = 0;
		
	}

	return 0;
}

Compiler output:
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
    2 | main(){
      | ^~~~
main.c: In function 'main':
main.c:43:34: error: 'ans' undeclared (first use in this function)
   43 |                         if(max > ans ) ans = max;
      |                                  ^~~
main.c:43:34: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000
using namespace std;
int main() {
	int n;
	while (cin >> n,n) {
		int ans = -INF, cnt = 0;
		rep(i, n) {
			int a;
			cin >> a;
			if (cnt < 0) cnt = a;
			else cnt += a;
			ans = max(Max, cnt);
		}
		cout << ans << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:35: error: 'Max' was not declared in this scope
   14 |                         ans = max(Max, cnt);
      |                                   ^~~
Language: C++

#include <iostream>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000001

using namespace std;
#define ll long long
#define dbg if(0)



int main(){
    while(true){
        int n,t;
        ll ans= - INT_MAX;
        cin>>n;
        if (n==0)break;

        ll rui[n+1];
        rui[0]=0;
        for(int i=1;i<=n;i++){
            cin >>rui[i];
            rui[i]+=rui[i-1];
            dbg cout <<rui[i]<<" ";
        }
        //次を見る
        //今までの最小値を更新したか？
        //したなら暫定解を確定しansと比較。最大値=最小値=発見した最小値にする
        //してなければ最大値の更新をする
        //見る場所が一番後ろまで行ったら終了。
        ll nmin=MAX,nmax=0;
        for(int i=0;i<=n;i++){
            if (rui[i]<nmin){
                ans=max(nmax-nmin,ans);
                nmax=rui[i];
                nmin=rui[i];
            }else{
                if(rui[i]>nmax){
                    nmax=rui[i];
                }
            }
            dbg cout <<nmax<<" "<<nmin<<endl;
        }
        ans=max(nmax-nmin,ans);
        dbg cout << endl;
        cout<<ans<<endl;
    }

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: 'INT_MAX' was not declared in this scope
   17 |         ll ans= - INT_MAX;
      |                   ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <vector>
  +++ |+#include <climits>
    6 | #define MAX 1000000001
Language: C++

#include <iostream>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000001

using namespace std;
#define ll long long
#define dbg if(0)



int main(){
    while(true){
        int n;
        ll ans= LLONG_MIN;
        cin>>n;
        if (n==0)break;

        ll rui[n+1];
        rui[0]=0;
        for(int i=1;i<=n;i++){
            cin >>rui[i];
            rui[i]+=rui[i-1];
            dbg cout <<rui[i]<<" ";
        }
        dbg cout <<endl;
        //次を見る
        //今までの最小値を更新したか？
        //したなら暫定解を確定しansと比較。最大値=最小値=発見した最小値にする
        //してなければ最大値の更新をする
        //見る場所が一番後ろまで行ったら終了。
//        rui[0]=min(rui[0],rui[1]);
//        ll nmin=rui[0],nmax=rui[0];
//        bool nmflag=false;
        for(int i=1;i<=n;i++){
            for(int j=i;j<=n;j++){
                ans=max(rui[j]-rui[i-1],ans);
            }
        }
 /*       for(int i=0;i<=n;i++){
            if (rui[i]<nmin){
                ans=max(nmax-nmin,ans);
                nm=max(rui[i]-nmin,nm);
                nmax=rui[i];
                nmin=rui[i];
            }else{
                if(rui[i]>nmax){
                    nmax=rui[i];
                    nmflag=true;
                }
            }
            dbg cout <<nmax<<" "<<nmin<<" "<<nm<<endl;
        }
        ans=max(nmax-nmin,ans);
        dbg cout << endl;
        if(nmflag)cout<<ans<<endl;
        else cout<<nm<<endl;*/
        cout <<ans<<endl;
    }

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'LLONG_MIN' was not declared in this scope
   17 |         ll ans= LLONG_MIN;
      |                 ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <vector>
  +++ |+#include <climits>
    6 | #define MAX 1000000001
Language: C++

7
-5
-1
6
4
9
-6
-7
13
1
2
3
2
-2
-1
1
2
3
2
1
-2
1
3
1000
-200
201
0


Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 7
      | ^
Language: C++

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

int main() {
    int n,ans;
    cin >> n;
    while(n!=0){
        int a[5001];
        for(int i=0;i<n;++i){
            cin >> a[i];
        }
        ans=a[1]+a[0];
        for(int i=0;i<n-2;++i){
            ans=max(ans,a[i+2]+a[i+1]);
        }
        cout << ans << endl;
        cin >> n;
    }
}
7
-5
-1
6
4
9
-6
-7
13
1
2
3
2
-2
-1
1
2
3
2
1
-2
1
3
1000
-200
201
0


Compiler output:
a.cc:20:1: error: expected unqualified-id before numeric constant
   20 | 7
      | ^
Language: C++

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


using namespace std;

int main(){
	int n;
	int max1;
	int maxS;
	int sum=0;
	int sumS=0;
	int  raw[5000];
	int ans;
	while(cin>>n,n!=0){
		sum=0;
		maxS=0;
		sumS=0;
		cin >> raw[0];
		max1=raw[0];
		sum += raw[0];
		if(sum<0)sum=0;
		for(int i=1;i<n;i++){
			cin >> raw[i];
			if(max1<raw[i]) max1 = raw[i];
			if(raw[i]<0){
				if(sumS<sum) sumS=sum;
			}
			sum += raw[i];
			if(sum<0){
				if(maxS<sum)maxS=sum;
				sum=0;
			}
		}
		ans=max(sum,max(sumS,max1),maxS);
		cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:39:10:   required from here
   39 |                 ans=max(sum,max(sumS,max1),maxS);
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++


class Max
  def solve
    loop do
      n = get.chomp.to_i
      break if n == 0
      
      max = -100000
      sum = 0
      n.times do
        a = gets.chomp.to_i
        sum += a
        if max < sum
          max = sum
        end
        if sum < 0 then 
          sum = 0
        end
      end
      puts max
    end
  end
end
max.new.solve

Compiler output:
a.cc:3:7: error: expected initializer before 'solve'
    3 |   def solve
      |       ^~~~~
Language: C++


class Max
  def solve
    loop do
      n = gets.chomp.to_i
      break if n == 0
      
      max = -100000
      sum = 0
      n.times do
        a = gets.chomp.to_i
        sum += a
        if max < sum
          max = sum
        end
        if sum < 0 then 
          sum = 0
        end
      end
      puts max
    end
  end
end
Max.new.solve

Compiler output:
a.cc:3:7: error: expected initializer before 'solve'
    3 |   def solve
      |       ^~~~~
Language: C++

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

vector<int> num;

int main(void){
  while(true){
    int maximum = 0, n;
    cin >> n;
    if(!n)  break;
    num.clear();
    for(int i = 0; i < n; i++){
      int tmp;
      cin >> tmp;
      num.push_back(tmp);
    }
    for(int i = 0; i < num.size(); i++){
      int sum = num[i];
      for(int j = i + 1; j < num.size(); j++){
        sum += num[j];
        if(sum > maximum) maximuma = sum;
      }
    }
    cout << maximum << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:27: error: 'maximuma' was not declared in this scope; did you mean 'maximum'?
   22 |         if(sum > maximum) maximuma = sum;
      |                           ^~~~~~~~
      |                           maximum
Language: C++

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

int main()
{
	int N;
	while(cin>>N && N){
	
		vector<int> n(N), dp(N);
		for(int i=0;i<N;i++){
			cin>>n[i];
		}
		int ans = -1<<29;
		int dp[5000];
		for(int i=0;i<a;i++){
			if(i-1 >= 0 && dp[i-1]>0){
				dp[i] += dp[i-1] + n[i];
			}else{
				dp[i] = n[i];
			}
			ans = max(ans, dp[i]);
		}
		
		cout<<max_ret<<endl;
	}
	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: conflicting declaration 'int dp [5000]'
   16 |                 int dp[5000];
      |                     ^~
a.cc:11:35: note: previous declaration as 'std::vector<int> dp'
   11 |                 vector<int> n(N), dp(N);
      |                                   ^~
a.cc:17:31: error: 'a' was not declared in this scope
   17 |                 for(int i=0;i<a;i++){
      |                               ^
a.cc:26:23: error: 'max_ret' was not declared in this scope
   26 |                 cout<<max_ret<<endl;
      |                       ^~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
int main()
{
	int n, k, p, m;#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
int main()
{
	int n, k, p, m;
	bool isPlus = true;
	while (cin >> n){
		if (0 == n) break;
		vector<int> A(n, 0);
		m = INT_MIN;
		p = 0;
		for (int i = 0; i < n; ++i){
			cin >> k;
			if (m < k) m = k;
			if (0 == i){
				A[p] = k;
				isPlus = (k > 0);
			}
			else {
				if (isPlus == (k > 0)){
					A[p] += k;
				}else{
					++p;
					A[p] = k;
					isPlus = !isPlus;
				}
			}
		}
		int sum = 0;
		for (int i = 0; i <= p; ++i){
			sum += A[i];
			if (sum > m) m = sum;
			if (sum < 0) sum = 0;
		}
		cout << m << "\n";
	}
	return 0;
}
	bool isPlus = true;
	while (cin >> n){
		if (0 == n) break;
		vector<int> A(n, 0);
		m = INT_MIN;
		p = 0;
		for (int i = 0; i < n; ++i){
			cin >> k;
			if (m < k) m = k;
			if (0 == i){
				A[p] = k;
				isPlus = (k > 0);
			}
			else {
				if (isPlus == (k > 0)){
					A[p] += k;
				}else{
					++p;
					A[p] = k;
					isPlus = !isPlus;
				}
			}
		}
		int sum = 0;
		for (int i = 0; i <= p; ++i){
			sum += A[i];
			if (sum < 0) sum = 0;
			if (sum > m) m = sum;
		}
		cout << m << "\n";
	}
	return 0;
}

Compiler output:
a.cc:7:24: error: stray '#' in program
    7 |         int n, k, p, m;#include <iostream>
      |                        ^
a.cc: In function 'int main()':
a.cc:7:25: error: 'include' was not declared in this scope
    7 |         int n, k, p, m;#include <iostream>
      |                         ^~~~~~~
a.cc:7:42: error: expected primary-expression before '>' token
    7 |         int n, k, p, m;#include <iostream>
      |                                          ^
a.cc:10:1: error: expected primary-expression before 'using'
   10 | using namespace std;
      | ^~~~~
a.cc:11:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   11 | int main()
      |         ^~
a.cc:11:9: note: remove parentheses to default-initialize a variable
   11 | int main()
      |         ^~
      |         --
a.cc:11:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:12:1: error: a function-definition is not allowed here before '{' token
   12 | {
      | ^
Language: C++

7
-5
-1
6
4
9
-6
-7
13
1
2
3
2
-2
-1
1
2
3
2
1
-2
1
3
1000
-200
201
1
-1
0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 7
      | ^
Language: C++

# Kadane
module Kadane
  def self.max_subarray(a)
    max_so_far =  max_ending_here = 0
    a.each do |i|
      max_ending_here = [0, max_ending_here + i].max
      max_so_far = [max_so_far, max_ending_here].max
    end
    max_so_far
  end
end

answers = []

while n = gets.to_i
  break if n == 0
  a = []
  n.times { a << gets.to_i }
  answers << Kadane.max_subarray(a)
end

puts answers

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #Kadane
    1 | # Kadane
      |   ^~~~~~
a.cc:2:1: error: 'module' does not name a type
    2 | module Kadane
      | ^~~~~~
a.cc:2:1: note: C++20 'module' only available with '-fmodules-ts'
a.cc:19:3: error: 'answers' does not name a type
   19 |   answers << Kadane.max_subarray(a)
      |   ^~~~~~~
Language: C++

/*
 * AOJ-Volume0-0022
 */
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

/*
 * Find maximum sum.
 *   array: number list
 */
int findMaximumSum(vector<int> &array){
  int sumValue = array[0];
  int maxValue = INT_MIN;
  int length = array.size();

  for(int i = 1; i < length; i++){
    int value = array[i];

    if(sumValue < 0){
      sumValue = value;
    }else{
      sumValue += value;
    }

    if(maxValue < sumValue){
      maxValue = sumValue;
    }
  }

  return maxValue;
}

void solve(int n){
  vector<int> a(n);

  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

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

int main(){
  int n;

  while(cin >> n){
    if(n == 0) break;

    solve(n);
  }

  return 0;
}

Compiler output:
a.cc: In function 'int findMaximumSum(std::vector<int>&)':
a.cc:17:18: error: 'INT_MIN' was not declared in this scope
   17 |   int maxValue = INT_MIN;
      |                  ^~~~~~~
a.cc:6:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <vector>
  +++ |+#include <climits>
    6 |
Language: C++

/*
 * AOJ-Volume0-0022
 */
#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

typedef long long ll;

/*
 * Find maximum sum.
 *   array: number list
 */
int findMaximumSum(vector<int> &array){
  int sumValue = array[0];
  int maxValue = INT_MIN;
  int length = array.size();

  for(int i = 1; i < length; i++){
    int value = array[i];

    if(sumValue < 0){
      sumValue = value;
    }else{
      sumValue += value;
    }

    if(maxValue < sumValue){
      maxValue = sumValue;
    }
  }

  return maxValue;
}

void solve(int n){
  vector<int> a(n);

  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

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

int main(){
  int n;

  while(cin >> n){
    if(n == 0) break;

    solve(n);
  }

  return 0;
}

Compiler output:
a.cc: In function 'int findMaximumSum(std::vector<int>&)':
a.cc:18:18: error: 'INT_MIN' was not declared in this scope
   18 |   int maxValue = INT_MIN;
      |                  ^~~~~~~
a.cc:7:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cstdio>
  +++ |+#include <climits>
    7 |
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n, a;
  long long ing max_, tmp;
  while(cin >> n){
    max_=0; tmp=0; tmp=0;
    for(int i=0; i<n; i++){
      cin >> a;
      tmp = max(0,tmp+a);
      max_ = max(tmp,max_);
    }
    cout << max_ << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: expected initializer before 'max_'
    6 |   long long ing max_, tmp;
      |                 ^~~~
a.cc:8:5: error: 'max_' was not declared in this scope
    8 |     max_=0; tmp=0; tmp=0;
      |     ^~~~
a.cc:8:13: error: 'tmp' was not declared in this scope; did you mean 'tm'?
    8 |     max_=0; tmp=0; tmp=0;
      |             ^~~
      |             tm
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n, a;
  long long int max_, tmp;
  while(cin >> n){
    max_=0; tmp=0; tmp=0;
    for(int i=0; i<n; i++){
      cin >> a;
      tmp = max(0,tmp+a);
      max_ = max(tmp,max_);
    }
    cout << max_ << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: no matching function for call to 'max(int, long long int)'
   11 |       tmp = max(0,tmp+a);
      |             ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:11:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   11 |       tmp = max(0,tmp+a);
      |             ~~~^~~~~~~~~
/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
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
	long???long int n,ans = 0;
	while(cin >> n){
		if(n == 0)break;

		long int a[n];

		for(int i = 0;i < n;i++){
			cin >> a[i];
			ans += a[i];
		}
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: expected unqualified-id before '?' token
    7 |         long???long int n,ans = 0;
      |             ^
a.cc:8:22: error: 'n' was not declared in this scope
    8 |         while(cin >> n){
      |                      ^
a.cc:14:32: error: 'a' was not declared in this scope
   14 |                         cin >> a[i];
      |                                ^
a.cc:15:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |                         ans += a[i];
      |                         ^~~
      |                         abs
a.cc:17:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |                 cout << ans << endl;
      |                         ^~~
      |                         abs
Language: C++

#include <iostream>

#include <vector>

#include <algorithm>

#include <sstream>

#include <string>

#include <cmath>

#include <list>

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

int in() {int x; cin >> x; return x;}

template <typename T> class SegTree

{

public:

	int n;

	T T_max;

	vector<T> dat;

	SegTree(int n_, T t_max)

	{

		int n = 1;

		T_max = t_max;

		while (n < n_)n *= 2;

		for (int i = 0; i < 2 * n - 1; i++)dat.push_back(t_max);

	}

	void update(int k, T a)

	{

		k += n - 1;

		dat[k] = a;

		while (k > 0)

		{

			k = (k - 1) / 2;

			dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);

		}

	}



	//[a,b)

	T query(int a, int b)

	{

		return _query(a, b, 0, 0, n);

	}



private:

	T _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l)return T_max;

		if (a <= l && r <= b)return dat[k];

		else

		{

			T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);

			T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);

			return min(vr, vl);

		}

	}

};


int main()
{
	int n;
	while (cin >> n && n)
	{
		vector<int> a;
		int ans = -999999999;
		for (int i = 0; i < n; i++)
		{
			a.push_back(in());
		}
		for (int i = 1; i < n; i++)
		{
			a[i] += a[i - 1];
		}

		for (int l = 0; l < n; l++)
		{
			for (r = l; r < n; r++)
			{
				ans = max(ans, a[r] - a[l]);
			}
		}
		cout << ans << endl;


	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:126:30: error: 'r' was not declared in this scope
  126 |                         for (r = l; r < n; r++)
      |                              ^