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

#include <iostream>

using namespace std;

template <typename Type>
long long Maximum_Sum_Sequence(Type N[], int size)
{
	long long max = LLONG_MIN;

	for (int i = 0; i < size; i++)
	{
		long long sum = 0;

		for (int j = i; j < size; j++)
		{
			sum += N[j];

			if (sum > max) { max = sum; }
		}
	}

	return max;
}

int main()
{
	const int DATASETS = 10;

	int n[DATASETS], a[DATASETS][5000], c = 0;

	while (true)
	{
		cin >> n[c];

		if (n[c] == 0) { break; }

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

		c++;
	}

	for (int i = 0; i < c; i++)
	{
		cout << Maximum_Sum_Sequence(a[i], n[i]) << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'long long int Maximum_Sum_Sequence(Type*, int)':
a.cc:8:25: error: 'LLONG_MIN' was not declared in this scope
    8 |         long long max = LLONG_MIN;
      |                         ^~~~~~~~~
a.cc:2:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

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

int main(){
	long long a, maximum;
	int n;
	S[0] = 0;
	while (cin >> n, n){
		maximum=-1000000
		long long S[5010] = {};
		for (int i = 1; i <= n; i++){
			cin >> a;
			S[i] = S[i - 1] + a;
		}

		for (int i = 0; i <= n; i++)
			for (int j = i + 1; j <= n; j++){
				maximum = max(maximum, S[j] - S[i]);
			}
		cout << maximum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'S' was not declared in this scope
    8 |         S[0] = 0;
      |         ^
a.cc:10:33: error: expected ';' before 'long'
   10 |                 maximum=-1000000
      |                                 ^
      |                                 ;
   11 |                 long long S[5010] = {};
      |                 ~~~~
Language: C++

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

int main(){
	int n, max1, max2, a[5001];

	while( cin >> n , n ){
		for(int i=0 ; i<n ; i++){
			cin >> a[i] ;
		}
		max1 = a[0];

		for(int i=0 ; i<n ; i++){
			int sum = 0;
			for(int j=i ; j<n ; j++){
				sum += a[j];
				max1 = max( max1 , sum );
			}
		}
		cout << max1 << endl;
	}

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

#include<iostream>
#include<algortihm>
using namespace std;
int main(){
	long int n, m[5001] = { 0 }, max = -2147483647, temp = 0, k;
	while (cin>> n && n!=0){
		for (int i = 0; i < n; i++){
			cin >> m[i];
		}
		for (int i = 0; i < n; i++){
			temp = m[i];
			for (int l = i + 1; l < n; l++){
				temp += m[l];
				if (temp > m[i]) if (max < temp) max = temp;
				else if (max < m[i]) max = m[i];
			}temp = 0;
		}
		cout << max << endl;
		max = -2147483647;
	}
	return 0;
}

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

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

int main()
{

	int n, num;
	vector< long int > a;
	vector< long int > res;

	while( 1 ) {

		int Max = -INT_MAX;

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

		for( int i = 0; i < n; i++ ) {
		
			cin >> num;
			a.push_back( num );
			
		}

		//?????§???
		for( int i = 1; i < n; i++ ) {
		
			a[i - 1] + a[i] > a[i] ? a[i] = a[i - 1] + a[i] : a[i] = a[i];

			if ( a[i] > Max ) {
				Max = a[i];
			}
		
		}

		res.push_back( Max );
		a.clear();
	
	}

	for( vector< long int > :: iterator mIt = res.begin(); mIt != res.end(); ++mIt ) {
		cout << *mIt << endl;
	}

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:28: error: 'INT_MAX' was not declared in this scope
   14 |                 int Max = -INT_MAX;
      |                            ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

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

int main()
{

	int n, num;
	vector< long int > a;
	vector< long int > res;

	while( 1 ) {

		int Max = INT_MAX * -1;

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

		for( int i = 0; i < n; i++ ) {
		
			cin >> num;
			a.push_back( num );
			
		}

		//?????§???
		for( int i = 1; i < n; i++ ) {
		
			a[i - 1] + a[i] > a[i] ? a[i] = a[i - 1] + a[i] : a[i] = a[i];

			if ( a[i] > Max ) {
				Max = a[i];
			}
		
		}

		res.push_back( Max );
		a.clear();
	
	}

	for( vector< long int > :: iterator mIt = res.begin(); mIt != res.end(); ++mIt ) {
		cout << *mIt << endl;
	}

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: 'INT_MAX' was not declared in this scope
   14 |                 int Max = INT_MAX * -1;
      |                           ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int nn[5001] = { 0 }, temp, n, max = -110000;
	while (cin >> n && (n != 0)){
		for (int i = 0; i < n; i++){
			cin >> nn[i];
		}
		temp = nn[0];
		for (int i = 1; i < n; i++){
			temp += nn[i];
			if (temp < nn[i]) temp = nn[i];
			if (max < temp) max = temp;
		}if (max < nn[0]) cout << nn[0] << endl;
		else cout << max << endl;
		max = -110000;
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: expected '}' at end of input
   19 |         return 0;
      |                  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;
int main(void){

	int n, max=0;
	int *a;
	int sum;

	do{
		max = -1000000;
		//cout << endl;
		cin >> n;

		if (n == 0) break;

		a = new long[n + 1];

		sum = 0;

		for (int i = 0; i < n; i++){

			sum = 0;

			cin >> a[i];

			for (int j = i; j >= 0; j--){

				sum += a[j];
				if (max < sum) max = sum;
			}
		}

		cout << max << endl;
	} while (1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:21: error: cannot convert 'long int*' to 'int*' in assignment
   16 |                 a = new long[n + 1];
      |                     ^~~~~~~~~~~~~~~
      |                     |
      |                     long int*
Language: C++

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

using namespace std;

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

int main(void){
	int Max, Num = -1, In, N = 0;
	vector<int>	Dat;
	while (Num != 0){
		Max = -100000;
		cin >> Num;
		Dat.push_back(-100000);
		FOR(Num){
			cin >> In;
			Dat.push_back(In);
		}
		FORR(1, Num + 1){
			Dat[i] = max(Dat[i], Dat[i - 1] + Dat[i]);
			Max = max(Max, Dat[i]);
		}
		N = Dat.max_size;
		FOR(N){
			Dat.pop_back();
		}
		cout << Max << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: cannot convert 'std::vector<int>::max_size' from type 'std::vector<int>::size_type (std::vector<int>::)() const noexcept' {aka 'long unsigned int (std::vector<int>::)() const noexcept'} to type 'int'
   25 |                 N = Dat.max_size;
      |                         ^~~~~~~~
Language: C++

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

int main(){
	int n;
	cin >> n;
	while(n != 0){
		int a[n];
		for(int i = 0; i < n; i++){
			cin >> a[i];
		}

		sort(a.begin(), a.end());
		int sum = 0;
		for(int i = 0; i < n; i++){
			if(a[n-1-i] > 0){
				sum += a[n-1-i];
			}else{
				cout << sum << endl;
				break;
			}
		}
		cin >> n;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   14 |                 sort(a.begin(), a.end());
      |                        ^~~~~
a.cc:14:35: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   14 |                 sort(a.begin(), a.end());
      |                                   ^~~
Language: C++

#include<iostream>
using namesapce std;

int main()
{
    while(1){
        int n,sum=0;
        cin>>n;
        int a[n];
        for(i=0;i<n;i++){
            cin>>a[i];
            sum+=a[i];
        }
        cout<<sum<<endl;
    }
    return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |         cin>>n;
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:13: error: 'i' was not declared in this scope
   10 |         for(i=0;i<n;i++){
      |             ^
a.cc:14:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |         cout<<sum<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:14:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   14 |         cout<<sum<<endl;
      |                    ^~~~
      |                    std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++


#include<iostream>
using namespace std;

int main()
{
    while(1){
        int n,sum=0;
        cin>>n;
        int a[n];
        for(i=0;i<n;i++){
            cin>>a[i];
            sum+=a[i];
        }
        cout<<sum<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'i' was not declared in this scope
   11 |         for(i=0;i<n;i++){
      |             ^
Language: C++


#include<iostream>
using namespace std;

int main()
{
    while(1){
        int n,sum=0;
        cin>>n;
        if(n==0)
            break;
        int a[n];
        for(i=0;i<n;i++){
            cin>>a[i];
            sum+=a[i];
        }
        cout<<sum<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'i' was not declared in this scope
   13 |         for(i=0;i<n;i++){
      |             ^
Language: C++

#include<iostream>
using namespace std;

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

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

#include<iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: invalid types 'int[int]' for array subscript
   13 |          maxsum+=a[i];
      |                   ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
int n;
while(true){
cin>>n;
if(n==0)
break;
int best=0;
for(int i=0;i<n;i++)
 cin>>a[i];
 
for(int start=0;start<n;start++){
 int count=0;
 for(int len=start;len<n;len++){
  count+=a[len];
  best=max(best,count);
 }
}

cout<<best<<endl;
}
return 0;   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'a' was not declared in this scope
   12 |  cin>>a[i];
      |       ^
a.cc:17:10: error: 'a' was not declared in this scope
   17 |   count+=a[len];
      |          ^
Language: C++

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

int main() {
	int n, a;
	vector<int> an;
	vector<vector<int>> AN;
	while (cin >> n) {
		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> a;
			an.push_back(a);
		}
		AN.push_back(an); an.clear();
	}

	for (int i = 0; i < AN.size(); i++) {
		long long int max = 0, min = INT_MAX, MAX = 0, MIN = 0 , counter = 0, negative = 0;
		for (int j = 0; j < AN[i].size(); j++) {
			if (AN[i][j] >= 0) {
				max += AN[i][j];
				if (MAX < max)MAX = max;
				counter = 1;
				negative = 1;
			}
			
			else {
				if (negative == 0) {
						if(min > abs(AN[i][j]))min=abs(AN[i][j]);
					}
				else if (counter==1){
					if (AN[i][j] + max >= 0)max += AN[i][j];
					else {
						max = 0;
						counter = 0;
					}
				}
			}
		}
		if (negative == 0)cout << -1*min << endl;
		else cout << MAX << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:46: error: 'INT_MAX' was not declared in this scope
   20 |                 long long int max = 0, min = INT_MAX, MAX = 0, MIN = 0 , counter = 0, negative = 0;
      |                                              ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<vector>
  +++ |+#include <climits>
    4 | using namespace std;
a.cc:24:37: error: 'MAX' was not declared in this scope
   24 |                                 if (MAX < max)MAX = max;
      |                                     ^~~
a.cc:25:33: error: 'counter' was not declared in this scope
   25 |                                 counter = 1;
      |                                 ^~~~~~~
a.cc:26:33: error: 'negative' was not declared in this scope
   26 |                                 negative = 1;
      |                                 ^~~~~~~~
a.cc:30:37: error: 'negative' was not declared in this scope
   30 |                                 if (negative == 0) {
      |                                     ^~~~~~~~
a.cc:33:42: error: 'counter' was not declared in this scope
   33 |                                 else if (counter==1){
      |                                          ^~~~~~~
a.cc:42:21: error: 'negative' was not declared in this scope
   42 |                 if (negative == 0)cout << -1*min << endl;
      |                     ^~~~~~~~
a.cc:43:30: error: 'MAX' was not declared in this scope
   43 |                 else cout << MAX << endl;
      |                              ^~~
Language: C++

#include <stdio.h>
int arr[] = int[5000];
int sub[] = int[5001];
int main() {
  while(1) {
    int n;
    scanf("%d", &n);
    if (n == 0) {
      return 0;
    }
    for(int i = 0; i < n; ++i) {
      scanf("%d", &arr[i]);
    }
    sub[0] = 0;
    for(int i = 1; i < n+1; ++i) {
      sub[i] = sub[i-1] + arr[i-1];
    }
    for(int i = 0; i < n; ++i) { 
        for(int j = i + 1; j < n + 1; ++j) {
          m = max(m, sub[j] - arr[i]);
        }
    }
    printf("%d", m);
  }
}

Compiler output:
a.cc:2:13: error: expected primary-expression before 'int'
    2 | int arr[] = int[5000];
      |             ^~~
a.cc:3:13: error: expected primary-expression before 'int'
    3 | int sub[] = int[5001];
      |             ^~~
a.cc: In function 'int main()':
a.cc:20:11: error: 'm' was not declared in this scope
   20 |           m = max(m, sub[j] - arr[i]);
      |           ^
a.cc:20:15: error: 'max' was not declared in this scope
   20 |           m = max(m, sub[j] - arr[i]);
      |               ^~~
a.cc:23:18: error: 'm' was not declared in this scope
   23 |     printf("%d", m);
      |                  ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int n,ans;
vi dp,num;

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		ans=-1
		dp=vi(n);
		num=vi(n);
		for(int i=0;i<n;i++) cin>>num[i];
		dp[0]=num[0];
		for(int i=0;i<n-1;i++) dp[i+1]=max(num[i+1],num[i+1]+dp[i]);
		for(int i=0;i<n;i++) ans=max(ans,dp[i]);
		cout<<ans<<endl;
		for(int i=0;i<n;i++) cout<<dp[i]<<' ';
		cout<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: expected ';' before 'dp'
   29 |                 ans=-1
      |                       ^
      |                       ;
   30 |                 dp=vi(n);
      |                 ~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int n,ans;
vi dp,num;

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		ans=-1
		dp=vi(n);
		num=vi(n);
		for(int i=0;i<n;i++) cin>>num[i];
		dp[0]=num[0];
		for(int i=0;i<n-1;i++) dp[i+1]=max(num[i+1],num[i+1]+dp[i]);
		for(int i=0;i<n;i++) ans=max(ans,dp[i]);
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: expected ';' before 'dp'
   29 |                 ans=-1
      |                       ^
      |                       ;
   30 |                 dp=vi(n);
      |                 ~~
Language: C++

#include"bits/stdc++.h"
#define INF LLONG_MAX-1
using namespace std;
typedef long long ll;
??
ll a[100001];
int main(){
	ll n;
	ll cnt = 0;
	scanf("%lld", &n);
	for (ll i = 0; i < n; i++){
		scanf("%lld", &a[i]);
		cnt += a[i];
	}
	ll Max = cnt;
	ll w = 0;
	for (ll i = 0; i < n; i++){
		cnt -= a[i];
		if (Max < cnt) {
			w = i;
			Max = cnt;
		}
	}
	cnt = Max;
	for (ll i = n - 1; i > w; i--){
		cnt -= a[i];
		Max = max(Max, cnt);
	}
	printf("%lld\n", Max);
	return 0;
}

Compiler output:
a.cc:5:1: error: expected unqualified-id before '?' token
    5 | ??
      | ^
a.cc: In function 'int main()':
a.cc:12:32: error: 'a' was not declared in this scope
   12 |                 scanf("%lld", &a[i]);
      |                                ^
a.cc:18:24: error: 'a' was not declared in this scope
   18 |                 cnt -= a[i];
      |                        ^
a.cc:26:24: error: 'a' was not declared in this scope
   26 |                 cnt -= a[i];
      |                        ^
Language: C++

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

void main() {
	int n;

	while (cin >> n) {
		if (n == 0) break;
		vector<int> array(n);
		for (int i = 0; i < n; i++) {
			cin >> array.at(i);
		}

		long max = array.at(0);
		for (int j = 0; j < n; j++) {
			long total = 0;
			for (int k = 0; k < n - j; k++) {
				total += array.at(j + k);
				if (total > max) max = total;
			}
		}

		cout << max << endl;
	}
	return;
}

Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | void main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:26:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   26 |         return;
      |         ^~~~~~
Language: C++

#include <iostrem>
using namespace std;
int main(){
while(true)
{
int n;
cin >> n;
if(n == 0)return 0;
int numbers[n];
for(int i = 0;i < n;i++)
cin >> numbers[i];
int max = 0;
for ( int i = 0; i < n; i++){
int sum = 0;
for ( int j = i; j < n; j++){
sum += a[j];
if(max < sum)max = sum;
}
}
cout >> max >> endl;
}
}

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

//
#include <iostream>
using namespace std;
int main()
{
  int n;
  while(true){
    int a[5000] = {0};
  cin >> n;
  if (n == 0 ) break;
  for (int i = 0; i < n;i++)
    cin >> a[i];
  int sum_max = a[0];
  int sum = 0;
  for (int i = 0; i <n;i++){
    for (int j = i; j < n; j++){
      sum += a[j];    if(sum > sum_max) sum_max = sum;
    }
    int sum = 0;
  }

  }
  cout << sum_max;
    

  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:11: error: 'sum_max' was not declared in this scope
   23 |   cout << sum_max;
      |           ^~~~~~~
a.cc: At global scope:
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

#include <iostream>
typedef long long ll;
using namespace std;
 
int main(){
    int n,a[5001];
    ll ans;
    a[0]=0;
    while(cin>>n&&n){
        ans = INT_MIN;
        for(int i=1;i<=n;i++){
            cin>>a[i];
            a[i] += a[i-1];
        }
        for(int i=1;i<=n;i++){
            for(int j=i;j<=n;j++){
                ans = max(ans,a[j]-a[i-1]);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'INT_MIN' was not declared in this scope
   10 |         ans = INT_MIN;
      |               ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | typedef long long ll;
a.cc:17:26: error: no matching function for call to 'max(ll&, int)'
   17 |                 ans = max(ans,a[j]-a[i-1]);
      |                       ~~~^~~~~~~~~~~~~~~~~
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:17:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   17 |                 ans = max(ans,a[j]-a[i-1]);
      |                       ~~~^~~~~~~~~~~~~~~~~
/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 <climits>
typedef long long ll;
using namespace std;
 
int main(){
    int n,a[5001];
    ll ans;
    a[0]=0;
    while(cin>>n&&n){
        ans = INT_MIN;
        for(int i=1;i<=n;i++){
            cin>>a[i];
            a[i] += a[i-1];
        }
        for(int i=1;i<=n;i++){
            for(int j=i;j<=n;j++){
                ans = max(ans,a[j]-a[i-1]);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: no matching function for call to 'max(ll&, int)'
   18 |                 ans = max(ans,a[j]-a[i-1]);
      |                       ~~~^~~~~~~~~~~~~~~~~
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:18:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |                 ans = max(ans,a[j]-a[i-1]);
      |                       ~~~^~~~~~~~~~~~~~~~~
/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 <climits>
typedef long long ll;
using namespace std;
 
int main(){
    int n,a[5001];
    long long ans;
    a[0]=0;
    while(cin>>n&&n){
        ans = INT_MIN;
        for(int i=1;i<=n;i++){
            cin>>a[i];
            a[i] += a[i-1];
        }
        for(int i=1;i<=n;i++){
            for(int j=i;j<=n;j++){
                ans = max(ans,a[j]-a[i-1]);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: no matching function for call to 'max(long long int&, int)'
   18 |                 ans = max(ans,a[j]-a[i-1]);
      |                       ~~~^~~~~~~~~~~~~~~~~
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:18:26: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |                 ans = max(ans,a[j]-a[i-1]);
      |                       ~~~^~~~~~~~~~~~~~~~~
/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 <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;
int sum[5001];
int main(){
	int N;
	int ans = 0;
	while(cin>>N&&N){
		int index=0;
		ans = INT_MIN
		FOR(i,1,N+1){
			cin>>sum[i];
			sum[i] += sum[i-1];
		}
		FOR(i,1,N+1){
			FOR(j,i,N+1){
				ans = max(ans,sum[j]-sum[i-1]);
			}
		}
		cout<< ans <<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:20: error: expected ';' before 'for'
   29 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
      |                    ^~~
a.cc:48:17: note: in expansion of macro 'FOR'
   48 |                 FOR(i,1,N+1){
      |                 ^~~
a.cc:48:21: error: 'i' was not declared in this scope
   48 |                 FOR(i,1,N+1){
      |                     ^
a.cc:29:34: note: in definition of macro 'FOR'
   29 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
      |                                  ^
Language: C++

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

int main(){
    int n;
    while(scanf("%d",&n) && n != 0){
        int arr[n];
        for(int i = 0; i < n; i++){
            scanf("%d",arr[i]);
        }
        int max_c = 0, max_s = 0;
        for(int cur = 0; cur < n; cur++){
            max_e = max(a[cur], max_e + a[cur]);    //max_e????????????????????´??????a[cur]???max_e?????£??\?????????
            max_s = max(max_s, max_e);              //
        }
        printf("%d\n",max_s);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'max_e' was not declared in this scope; did you mean 'max_s'?
   14 |             max_e = max(a[cur], max_e + a[cur]);    //max_e????????????????????´??????a[cur]???max_e?????£??\?????????
      |             ^~~~~
      |             max_s
a.cc:14:25: error: 'a' was not declared in this scope
   14 |             max_e = max(a[cur], max_e + a[cur]);    //max_e????????????????????´??????a[cur]???max_e?????£??\?????????
      |                         ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
	int n;
	while(cin>>n){
		if(n==0) break;
		int a[n], S[n], sum=0;
		for(int i=0;i<n;++i){
			cin>>a[i];
			sum+=a[i];
			S[i]=sum;
		}

		long max=S[0];
		for(int i=0;i<n;++i){
			if(S[i]>max) max=S[i];
			for(int j=0;j<i+1;++j){
				if(S[i]-S[j]>max) max=S[i]-S[j];
			}
		}

		cout<<max<<endl;
	}

	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: expected '}' at end of input
   27 |         return 0;
      |                  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <iostream>
using namespace std;

int a[5001] = {0};
int S[5001] = {0};

int main() {
  int n;
  while(cin >> n) {
  if(n == 0) break;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }

  S[0] = 0;
  for(int i = 1; i <= n; i++) {
    S[i] = S[i-1] + a[i-1];
  }
  

  int maxsum = INT_MIN;
  int sum;
  for(int i = 0; i <= n-1; i++){
    for(int j = i + 1; j <= n;j++) {
      sum = S[j] - S[i];
      if(sum > maxsum)
	maxsum = sum;
    }
  }
  cout << maxsum << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:16: error: 'INT_MIN' was not declared in this scope
   21 |   int maxsum = INT_MIN;
      |                ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include <iostream>
using namespace std;



int main()
{
	int n;
	while (cin >> n && n > 0)
	{
		vector<int> a = vector<int>(n);
		for (int i = 0; i < n; i++)
			cin >> a[i];

		vector<int> s = vector<int>(1, 0);
		bool f = true;
		for (int i = 0; i < n; i++)
		{
			if (a[i] >= 0)
			{
				if (!f)
					f = true;
				s[0] += a[i];
			}
			else if(s[0] > a[i])
			{
				if (f)
				{
					s.push_back(s[0]);
					f = false;
				}
				s[0] += a[i];
			}
			else
			{
				s[0] = 0;
			}

		}
		for (int i = 1; i < s.size(); i++)
		{
			if (s[i] > s[0])
				s[0] = s[i];
		}
		cout << s[0] << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'vector' was not declared in this scope
   11 |                 vector<int> a = vector<int>(n);
      |                 ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:11:24: error: expected primary-expression before 'int'
   11 |                 vector<int> a = vector<int>(n);
      |                        ^~~
a.cc:13:32: error: 'a' was not declared in this scope
   13 |                         cin >> a[i];
      |                                ^
a.cc:15:24: error: expected primary-expression before 'int'
   15 |                 vector<int> s = vector<int>(1, 0);
      |                        ^~~
a.cc:19:29: error: 'a' was not declared in this scope
   19 |                         if (a[i] >= 0)
      |                             ^
a.cc:23:33: error: 's' was not declared in this scope
   23 |                                 s[0] += a[i];
      |                                 ^
a.cc:25:33: error: 's' was not declared in this scope
   25 |                         else if(s[0] > a[i])
      |                                 ^
a.cc:40:37: error: 's' was not declared in this scope
   40 |                 for (int i = 1; i < s.size(); i++)
      |                                     ^
a.cc:45:25: error: 's' was not declared in this scope
   45 |                 cout << s[0] << endl;
      |                         ^
Language: C++

loop do
  n = gets.to_i
  break if n == 0

  max = -1_000_000
  sum = 0
  n.times do
    m = gets.to_i
    sum += m
    max = sum if max < sum
    sum = 0 if sum < 0
  end
  puts max
end

Compiler output:
a.cc:1:1: error: 'loop' does not name a type
    1 | loop do
      | ^~~~
Language: C++

#include<iostream>  
#include<algorithm>  
#include<cstdio>  
#include<cstring>  
#include <deque> 
using namespace std;  

//bool state = false ;

int main()
{
	int n ;
	while(1)
	{
		cin >> n ;
		if( ! n ) return 0 ;
		
		int p[5005];
		
		for(int i = 0 ; i < n ; i ++)
		{
			cin >> p[i] ;
		}
		
		int max , contain ;
		max = contain = 0 ;
		
		for(int i = 0 ; i < n ; i ++)
		{
			if(contain < 0) contain = 0 ;
			 
			contain += p[i] ;
			
			if(contain > max) max = contain ;
		}
		
		if(state) cout << endl ;
		
		state = true ;
	
		cout << max ;
		
	} 
	return 0 ;
 } 

Compiler output:
a.cc: In function 'int main()':
a.cc:37:20: error: 'state' was not declared in this scope; did you mean 'static'?
   37 |                 if(state) cout << endl ;
      |                    ^~~~~
      |                    static
a.cc:39:17: error: 'state' was not declared in this scope; did you mean 'static'?
   39 |                 state = true ;
      |                 ^~~~~
      |                 static
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n;
  int a[5000];
  while(cin >> n && n>0){
    for(int i=0;i>n;i++)
      cin >> a[i];
    int sum=0,tmp=0,max=-100000;
    bool flg=true;
    for(int i=0;i<n;i++){
      if(flg) max=max(max,a[i]);
      if(a[i]>0){
	flg=false;
	sum+=a[i];
	continue;
      }
      for(tmp=sum;a[i]<=0;i++){
	tmp+=a[i];
      }i--;
      if(tmp>0)
	sum=tmp;
      else
	sum=0;
    }

    cout << sum;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: 'max' cannot be used as a function
   13 |       if(flg) max=max(max,a[i]);
      |                   ~~~^~~~~~~~~~
Language: C++

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

int main(){
  int n;
  int a[5000];
  while(cin >> n && n>0){
    for(int i=0;i>n;i++)
      cin >> a[i];
    int sum=0,tmp=0,max=-100000;
    bool flg=true;
    for(int i=0;i<n;i++){
      if(flg) max=max(max,a[i]);
      if(a[i]>0){
	flg=false;
	sum+=a[i];
	continue;
      }
      for(tmp=sum;a[i]<=0;i++){
	tmp+=a[i];
      }i--;
      if(tmp>0)
	sum=tmp;
      else
	sum=0;
    }

    cout << sum;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: 'max' cannot be used as a function
   14 |       if(flg) max=max(max,a[i]);
      |                   ~~~^~~~~~~~~~
Language: C++

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

int main(){
    int n;
    while(cin >> n, n){
        vector<int> a(n,0);
        for(i=0; i<n; ++i){
            cin >> a[n];
        }
        // ????????£?¶??????????????????§??£?¶???????dp??¨?????????
        vector<int> dp(n,0);
        dp[0] = a[0];
        int max = 0;
        for(i=0; i<n; ++i){
            if(dp[i-1]>0){
                dp[i] = dp[i-1] + n[i];
            } else {
                dp[i] = n[i];
            }
            if(max<dp[i]){
                max = dp[i];
            }
        }
        cout << max << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'i' was not declared in this scope
    9 |         for(i=0; i<n; ++i){
      |             ^
a.cc:16:13: error: 'i' was not declared in this scope
   16 |         for(i=0; i<n; ++i){
      |             ^
Language: C++

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

int main(){
	int n;
	while(cin >> n, n){
		//n++;
		vector<int> dp(n), vec(n);
		//t[0] = 0;
		/*for(int i = 1;i < n;i++){
			cin >> v[i];
			t[i] = max(t[i-1]+v[i], v[i]);
		}*/
		for(int i=0;i<N;i++)cin >> vec[i];
		dp[0]=vec[0];
		for(int i=1;i<N;i++)dp[i]=max(dp[i-1]+vec[i],vec[i]);
		cout << *max_element(t.begin(), t.end()) << endl;
	}
	return 0; 
}

/*
7
-5
-1
6
4
9
-6
-7
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:17:31: error: 'N' was not declared in this scope
   17 |                 for(int i=0;i<N;i++)cin >> vec[i];
      |                               ^
a.cc:19:31: error: 'N' was not declared in this scope
   19 |                 for(int i=1;i<N;i++)dp[i]=max(dp[i-1]+vec[i],vec[i]);
      |                               ^
a.cc:20:38: error: 't' was not declared in this scope
   20 |                 cout << *max_element(t.begin(), t.end()) << endl;
      |                                      ^
Language: C++

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

int main(){
	int n, a;
	while(cin >> n, n){
		n++;
		vector<int> t(n);
		t[0] = 0;
		for(int i = 1;i < n;i++){
			cin >> a;
			t[i] = max(t[i-1]+a, a);
		}
		cout << *max_element(t.begin()+1, t.end()) << endl;
	}
	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: 'max_element' was not declared in this scope
   15 |                 cout << *max_element(t.begin()+1, t.end()) << endl;
      |                          ^~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
if(n==0)
{
	break;
}
else
{
int a[n];
int A=0;
int R=-100000;
for(h=0;h<n;h++)
{
	cin>>a[h];
}
for(int i=0;i<n;i++)
{
	for(int j=0;j<n-i;j++)
	{
	for(int k=i;k<=j;k++)
	{
		A=A+a[k]
		
	}	
	if(R<A)
	{
		R=A;
	}
	A=0
	}
}
cout<<R<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'h' was not declared in this scope
   16 | for(h=0;h<n;h++)
      |     ^
a.cc:26:25: error: expected ';' before '}' token
   26 |                 A=A+a[k]
      |                         ^
      |                         ;
   27 | 
   28 |         }
      |         ~                
a.cc:33:12: error: expected ';' before '}' token
   33 |         A=0
      |            ^
      |            ;
   34 |         }
      |         ~
Language: C++

#include<iostream>
using namespace std;
int main()
{
int n;
while(cin>>n&&n!=0)
else
{
int a[n];
int A=0;
int R=-100000;
for(int h=0;h<n;h++)
{
	cin>>a[h];
}
for(int i=0;i<n;i++)
{
	for(int j=0;j<n-i;j++)
	{
	for(int k=i;k<=j;k++)
	{
		A=A+a[k];
		
	}	
	if(R<A)
	{
		R=A;
	}
	A=0;
	}
}
cout<<R<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: expected primary-expression before 'else'
    7 | else
      | ^~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
    int n=0,a[5000],saidai=-100000;
    while(cin>>n&&n!=0){
saidai=-100000
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        for(int i=0;n>i;i++){
            int kazu=0;
            for(int x=i;x<n;x++){
                kazu=kazu+a[x];
                cout<<kazu<<endl;
                if(saidai<kazu){
                   
                }
            }
        }
        cout<<saidai<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:15: error: expected ';' before 'for'
    6 | saidai=-100000
      |               ^
      |               ;
    7 |         for(int i=0;i<n;i++){
      |         ~~~    
a.cc:7:21: error: 'i' was not declared in this scope
    7 |         for(int i=0;i<n;i++){
      |                     ^
Language: C++

#include<stdio.h>
int main(void){
   int n, a, i, max = 0, sum[100][100];
   scanf("%d", &n);
   for ( i = 0; i < n; i++ ) {
       scanf("%d", &a);
       if ( i == 0 )sum[0][0] = a;
       else sum[0][i] = sum[0][i - 1] + a;
       if ( max < sum[0][i]) max = sum[0][i];
       printf("sum:%d max:%d\n", sum[0][i], max);
   }
   printf("%d", max[0]);
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: invalid types 'int[int]' for array subscript
   12 |    printf("%d", max[0]);
      |                    ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main_(void)
{
	int n, a[5001];
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	int goukei = 0, ryuta = -10000000;
	for (int i = 1; i <= n; i++)
	{
		goukei = 0;
		for (int j = 1; j <= n; j++)
		{
			goukei = goukei+a[j];
			ryuta = max(goukei, ryuta);
		}
	}
	cout << ryuta << endl;
	return 0;
}

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 <iostream>
#include <cstdio.h>>
using namespace std;
int main (){
while (1){
long n,dset[5000],max=-99999,temp=0;
cin>>n;
if (n==0)break;
for (int i=0;i<n;i++){
        cin>>dset[i];
}
for (int i=0;i<n;i++){
        for (int j=i;j<n;j++){
                temp=temp+dset[j];
                if (max<temp){
                        max=temp;
                }
        }
temp=0;
}
printf ("%d\n",max);
}
return 0;
}

Compiler output:
a.cc:2:20: warning: extra tokens at end of #include directive
    2 | #include <cstdio.h>>
      |                    ^
a.cc:2:10: fatal error: cstdio.h: No such file or directory
    2 | #include <cstdio.h>>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio.h>
using namespace std;
int main (){
while (1){
long n,dset[5000],max=-99999,temp=0;
cin>>n;
if (n==0)break;
for (int i=0;i<n;i++){
        cin>>dset[i];
}
for (int i=0;i<n;i++){
        for (int j=i;j<n;j++){
                temp=temp+dset[j];
                if (max<temp){
                        max=temp;
                }
        }
temp=0;
}
printf ("%d\n",max);
}
return 0;
}

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

#include <iostream>

using namespace std;

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

int seq(){
    int a;
    while(cin >> a,a){
        int b[a];
        for(int i = 0; i < a; i++){
            cin >> b[i];
        }
        cout << max() << endl;
    }
}

int max(){
    int max = -10000000;
    int sum = 0;
    for(int len = 1; len <= a ; len++){
        for(int i = 0; i < a-len; i++){
            for(int j = 0, sum = 0; j < len; j++){
                sum += b[i+j];
            }
            if (sum > max) max = sum;
        }
    }
    return max
}




Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'seq' was not declared in this scope
    6 |     seq();
      |     ^~~
a.cc: In function 'int seq()':
a.cc:17:20: error: no matching function for call to 'max()'
   17 |         cout << max() << endl;
      |                 ~~~^~
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:   candidate expects 2 arguments, 0 provided
/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, 0 provided
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
a.cc: In function 'int max()':
a.cc:24:29: error: 'a' was not declared in this scope
   24 |     for(int len = 1; len <= a ; len++){
      |                             ^
a.cc:27:24: error: 'b' was not declared in this scope
   27 |                 sum += b[i+j];
      |                        ^
a.cc:32:15: error: expected ';' before '}' token
   32 |     return max
      |               ^
      |               ;
   33 | }
      | ~
Language: C++

#include <stdio.h>

int main(void) {
  while( 1 ) {
  long long n, ans = 0, now = 0;
  scanf("%lld", &n);
  if(!n) break;
  int a[n];
  for(i = 0; i < n; ++i) scanf("%d", &a[i]);
  for(i = 0; i < n; ++i) {
    now += a[i];
    if(now > ans) ans -= now;
    if(now < 0) now = 0;
  }
  if(!ans) {
    int max = -1000000;
    for(i = 0; i < n; ++i) if(max < a[i]) max = a[i];
    ans = max;
  }
  printf("%lld\n", ans);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'i' was not declared in this scope
    9 |   for(i = 0; i < n; ++i) scanf("%d", &a[i]);
      |       ^
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   for(i = 0; i < n; ++i) {
      |       ^
a.cc:17:9: error: 'i' was not declared in this scope
   17 |     for(i = 0; i < n; ++i) if(max < a[i]) max = a[i];
      |         ^
Language: C++

// 0022.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++) 
ll main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	while (cin >> n) {
		ll sum[5001];
		ll ans = -9000000000;
		roop(i, n) {
			cin >> sum[i];
			if (i != 0) { sum[i] += sum[i - 1]; }
			ans = max(ans, sum[i]);
		}
		for (ll i = 0; i < n - 1; i++) {

			ll	sumi = sum[i];

			for (ll j = i + 1; j < n; j++) {

				ll sumj = sum[j];
				ans = max(ans, sumj - sumi);
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#define INF=-10000000000000000000
int main(void){
    int n,a,max=INF;
    while(std::cin>>n){
        if(n==0) break;
        std::vector<int> dp(n+1);
        dp[0]=INF;
        for(int i=0;i<n;i++){
            std::cin>>a;
            dp[i+1]=(a>0?dp[i]+a:a);
            max=std::max(max,dp[i+1]);
        }
        std::cout<<max;
    
    }
    retrn 0;
}


Compiler output:
a.cc:4:9: warning: ISO C++11 requires whitespace after the macro name
    4 | #define INF=-10000000000000000000
      |         ^~~
a.cc:6:17: warning: integer constant is so large that it is unsigned
    6 |     int n,a,max=INF;
      |                 ^~~
a.cc:10:15: warning: integer constant is so large that it is unsigned
   10 |         dp[0]=INF;
      |               ^~~
a.cc: In function 'int main()':
a.cc:4:12: error: expected primary-expression before '=' token
    4 | #define INF=-10000000000000000000
      |            ^
a.cc:6:17: note: in expansion of macro 'INF'
    6 |     int n,a,max=INF;
      |                 ^~~
a.cc:4:12: error: expected primary-expression before '=' token
    4 | #define INF=-10000000000000000000
      |            ^
a.cc:10:15: note: in expansion of macro 'INF'
   10 |         dp[0]=INF;
      |               ^~~
a.cc:19:5: error: 'retrn' was not declared in this scope
   19 |     retrn 0;
      |     ^~~~~