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

import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		
		String str = br.readLine();
		int N = Integer.parseInt(str);
		long[] A = new int[N];
		long m = 1000000000000L, M = 0L;
		long tmp;
		long kei1 = 0L, kei2 = 0L, kei3 = 0L;//3つの切り分けた領域の合計を表す
		
		for(int i = 0; i < N; i++){
			str = br.readLine();
			A[i] = Integer.parseInt(str);
		}
		
		//主処理
		for(int n = 0; n < N; n++){
			for(int i = 1; i < N; i++){
				for(int j = i + 1; j < N + 1; j++){
						for(int i2 = 1; i2 <= i; i2++) kei1 = kei1 + A[i2 - 1];
						if(m > kei1) m = kei1;
						for(int j2 = i + 1; j2 <= j; j2++) kei2 = kei2 + A[j2 - 1];
						if(m > kei2) m = kei2;
						for(int k2 = j + 1; k2 <= N; k2++) kei3 = kei3 + A[k2 - 1];
						if(m > kei3) m = kei3;
						
						if(m > M) M = m;
						
						kei1 = 0;
						kei2 = 0;
						kei3 = 0;
						m = 2000000000000L;
				}
			}
			//1番目に切れ込みを入れるパターンしか計算されないので、バウムクーヘンを回す(配列を循環させる）
			tmp = A[0];
			for(int n2 = 0; n2 < N - 1; n2++) A[n2] = A[n2 + 1];
			A[N - 1] =tmp;
		}
		System.out.println(M);
	}
}


Compiler output:
Main.java:10: error: incompatible types: int[] cannot be converted to long[]
		long[] A = new int[N];
		           ^
1 error
Language: C++

#include<iostream>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int Num;

const int NMAX = 100010;
int N;
Num A[NMAX];
Num acc[NMAX];

void accumulate() {
  for (int i = 1; i <= N; i++) {
    acc[i] = acc[i - 1] + A[i];
  }
}

int increment(int i) {
  return (i + 1) % N + 1;
}

Num range(int l, int r) {
  if (l <= r) {
    return acc[r] - acc[l];
  } else {
    return range(0, r) + range(l, N);
  }
}


Num solve() {
  Num ans = 0;
  const Num Whole = acc[N];
  int left = 1, medium 

Compiler output:
a.cc: In function 'Num solve()':
a.cc:33:23: error: expected initializer at end of input
   33 |   int left = 1, medium
      |                       ^
a.cc:33:23: error: expected '}' at end of input
a.cc:30:13: note: to match this '{'
   30 | Num solve() {
      |             ^
a.cc:33:23: warning: no return statement in function returning non-void [-Wreturn-type]
   33 |   int left = 1, medium
      |                       ^
Language: C++

#include<iostream>
#include<algorithm>
#include<limits>

using namespace std;
typedef long long llong;

int N;
llong *v_list;
double tripartition;
	
llong BaumukuchenGetAnswer();
llong searchOne(int n0);
llong getMinV(int n0, int n1, int n2);
int findIndex(int from_n, int to_n, double target);

int main(){
	/*
	ifstream fin("input.txt");
	fin >> N;
	v_list = new llong[N+1];
	v_list[0] = 0;
	for(int n=1; n<N+1; n++){
		llong A;
		fin >> A;
		v_list[n] = v_list[n-1] + A;
	}
	fin.close();
	/*/
	cin >> N;
	v_list = new llong[N+1];
	v_list[0] = 0;
	for(int n=1; n<N+1; n++){
		llong A;
		cin >> A;
		v_list[n] = v_list[n-1] + A;
	}
	//*/
	cout << BaumukuchenGetAnswer() <<endl;
	delete[] v_list;
}


llong BaumukuchenGetAnswer(){
	tripartition = v_list[N] / 3.0;
	llong interm_maxV = -1;
	int n0_max = findIndex(0, N, tripartition);
	for (int n0 = 0; n0 <= n0_max; n0++){
		llong tmp = searchOne(n0);
		if (tmp > interm_maxV) interm_maxV = tmp;
	}
	return interm_maxV;
}

llong searchOne(int n0){
	int n1_left = findIndex(n0 + 1, N, tripartition + v_list[n0]);
	int n2_left = findIndex(n1_left+1, N, 2 * tripartition + v_list[n0]);
	llong V_ll = getMinV(n0, n1_left, n2_left);
	llong V_lr = getMinV(n0, n1_left, n2_left+1);
	llong V_rl = getMinV(n0, n1_left+1, n2_left);
	llong V_rr = getMinV(n0, n1_left+1, n2_left+1);
	return max( max(V_ll,V_lr), max(V_rl, V_rr));
}

llong getMinV(int n0, int n1, int n2){
	if (n1 == -1 || n2 == -1) return LLONG_MAX;
	else {
		llong V0 = v_list[n1] - v_list[n0];
		llong V1 = v_list[n2] - v_list[n1];
		llong V2 = v_list[n0] - v_list[n2] + v_list[N];
		return min(min(V0,V1),V2);
	}
}

int findIndex(int from_n, int to_n, double target){
	int n_left = from_n;
	int n_right = to_n;
	while (n_right - n_left != 1) {
		int n_mid = (n_right + n_left) / 2;
		if (v_list[n_mid] <= target) n_left = n_mid;
		else n_right = n_mid;
	}
	return n_left;
}

Compiler output:
a.cc: In function 'llong getMinV(int, int, int)':
a.cc:66:42: error: 'LLONG_MAX' was not declared in this scope
   66 |         if (n1 == -1 || n2 == -1) return LLONG_MAX;
      |                                          ^~~~~~~~~
a.cc:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include<limits>
  +++ |+#include <climits>
    4 |
Language: C++

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

int main(){
	int N;
	scanf("%d", &N);

	long long int whole = 0; //バームクーヘンの大きさ
	int* A = new int[N];
	for (int i = 0; i < N; i++){
		scanf("%d", &A[i]);
		whole += (long long int)A[i];
	}

	long long int one_third = whole / 3;

	int ini = 0;
	long long int piece1 = 0;
	while (piece1 + (long long int)A[ini] <= one_third){
		piece1 += (long long int)A[ini];
		ini++;
	}
	
	int piece2_i = ini;
	long long int piece2 = 0;
	while (1){
		piece2 += (long long int)A[ini];
		ini++;
		if (piece2 >= piece1) break;
	}
	
	int piece3_i = ini;
	long long int piece3 = whole - piece1 - piece2;
	long long int ans = min(piece1, piece3);

	for (int i = 1; i < N; i++){
		if (piece1 == 0){
			piece2 -= (long long int)A[piece2_i];
			piece2_i++;
		}
		else piece1 -= (long long int)A[i-1];

		while (piece1 + (long long int)A[piece2_i] <= one_third){
			piece1 += (long long int)A[piece2_i];
			piece2 -= (long long int)A[piece2_i];
			piece2_i++;
			if (piece2_i == N) piece2_i -= N; //周期的境界条件
		}

		while (piece2 < piece1){
			piece2 += (long long int)A[piece3_i];
			piece3_i++;
			if (piece3_i == N) piece3_i -= N; //周期的境界条件
		}

		piece3 = whole - piece1 - piece2;
		ans = max(ans, min(piece1, piece3));
	}

	cout << ans << endl;

	delete[] A;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:9: error: 'cout' was not declared in this scope
   61 |         cout << ans << endl;
      |         ^~~~
a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:61:24: error: 'endl' was not declared in this scope
   61 |         cout << ans << endl;
      |                        ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include<iostream>#include<vector>#include<algorithm>#include<string>#define rep(i,n) for(int i=0;i<(int)(n);i++)using namespace std;int n;vector<long long > rui;bool check(int i,long long m){    vector<long long >::iterator hoge=rui.end();    hoge = lower_bound(rui.begin() + i, rui.begin() +n-1+ i, m+rui[i]-1);    if (hoge == rui.end())return false;    vector<long long >::iterator hage = rui.end();    hage = lower_bound(hoge, rui.begin() + n - 1 + i, m + *hoge);    if (hage == rui.end())return false;    if (*(rui.begin() + n - 1 + i) - (*hage) >= m)return true;    return false;}int main(){    cin >> n;    rep(i, n)    {        long long int x;        cin >> x;        (i == 0) ? rui.push_back(x) : rui.push_back(rui[i - 1] + x);    }    rep(i, n)(i == 0) ? rui.push_back(rui[0] + rui[n - 1]) : rui.push_back(rui[n - 1 + i] + rui[i] - rui[i - 1]);    long long int ans = 0;    rep(i, n)    {        long long l = 0;        long long r = 500000000000000000;        while (r != l)        {            long long int m = (l + r) / 2;            if (check(i, m))            {                l = m+1;            }            else            {                r = m;            }        }        ans = max(ans, l);    }    cout << ans << endl;}

Compiler output:
a.cc:1:19: warning: extra tokens at end of #include directive
    1 | #include<iostream>#include<vector>#include<algorithm>#include<string>#define rep(i,n) for(int i=0;i<(int)(n);i++)using namespace std;int n;vector<long long > rui;bool check(int i,long long m){    vector<long long >::iterator hoge=rui.end();    hoge = lower_bound(rui.begin() + i, rui.begin() +n-1+ i, m+rui[i]-1);    if (hoge == rui.end())return false;    vector<long long >::iterator hage = rui.end();    hage = lower_bound(hoge, rui.begin() + n - 1 + i, m + *hoge);    if (hage == rui.end())return false;    if (*(rui.begin() + n - 1 + i) - (*hage) >= m)return true;    return false;}int main(){    cin >> n;    rep(i, n)    {        long long int x;        cin >> x;        (i == 0) ? rui.push_back(x) : rui.push_back(rui[i - 1] + x);    }    rep(i, n)(i == 0) ? rui.push_back(rui[0] + rui[n - 1]) : rui.push_back(rui[n - 1 + i] + rui[i] - rui[i - 1]);    long long int ans = 0;    rep(i, n)    {        long long l = 0;        long long r = 500000000000000000;        while (r != l)        {            long long int m = (l + r) / 2;            if (check(i, m))            {                l = m+1;            }            else            {                r = m;            }        }        ans = max(ans, l);    }    cout << ans << endl;}
      |                   ^
/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 "bits/stdc++.h"

#define int long long

using namespace std;
#define rep(i, n) for(int i = 0; i < signed(n); i++)
#define REP(i, s, n) for(int i = (s); i < signed(n); i++)
#define rrep(i, n) for(int i = signed(n) - 1; i >= 0; i--)
#define all(co) co.begin(), co.end()
typedef pair<int, int> P;
typedef long long LL;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
const int INF = 1 << 29;
const LL LINF = 1ll << 62ll;

struct edge{ int from, to, cost; };

int dr[] = { -1, 0, 1, 0 };
int dc[] = { 0, 1, 0, -1 };

template<typename T = int>
vector<vector<T>> vvector(int h, int w, T def = T()){ return move(vector<vector<T>>(h, vector<T>(w, def))); }
class range {
private: struct I{ int x; int operator*(){ return x; }bool operator!=(I& lhs){ return x < lhs.x; }void operator++(){ ++x; } }; I i, n;
public:range(int n) :i({ 0 }), n({ n }){}range(int i, int n) :i({ i }), n({ n }){}I& begin(){ return i; }I& end(){ return n; }
};

const int MOD = 10000;
signed main()
{
	int n;
	while (cin >> n && n)
	{
		vector<int> cuts(n + n + 2);
		rep(i, n) cin >> cuts[i + 1];
		int sum = accumulate(all(cuts), 0);
		rep(i, n + 1) cuts[i + n + 1] = cuts[i];
		rep(i, n + n + 1) cuts[i + 1] += cuts[i];
		int ideal = int(((double)sum / 3.0) + 0.5);

		int ans = 0;
		rep(i, n)
		{
			int idx = lower_bound(all(cuts), ideal + cuts[i]) - cuts.begin();
			int len = cuts[idx] - cuts[i];
			int rem = (sum - len) / 2;
			int remidx = lower_bound(all(cuts), rem + cuts[idx]) - cuts.begin();
			int remlen = cuts[remidx] - cuts[idx];
			ans = max(ans, sum - len - remlen);
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
a.cc:40:29: note: in expansion of macro 'int'
   40 |                 int ideal = int(((double)sum / 3.0) + 0.5);
      |                             ^~~
Language: C++

#include "bits/stdc++.h"

#define int long long

using namespace std;
#define rep(i, n) for(int i = 0; i < signed(n); i++)
#define REP(i, s, n) for(int i = (s); i < signed(n); i++)
#define rrep(i, n) for(int i = signed(n) - 1; i >= 0; i--)
#define all(co) co.begin(), co.end()
typedef pair<int, int> P;
typedef long long LL;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
const int INF = 1 << 29;
const LL LINF = 1ll << 62ll;

struct edge{ int from, to, cost; };

int dr[] = { -1, 0, 1, 0 };
int dc[] = { 0, 1, 0, -1 };

template<typename T = int>
vector<vector<T>> vvector(int h, int w, T def = T()){ return move(vector<vector<T>>(h, vector<T>(w, def))); }
class range {
private: struct I{ int x; int operator*(){ return x; }bool operator!=(I& lhs){ return x < lhs.x; }void operator++(){ ++x; } }; I i, n;
public:range(int n) :i({ 0 }), n({ n }){}range(int i, int n) :i({ i }), n({ n }){}I& begin(){ return i; }I& end(){ return n; }
};

const int MOD = 10000;
signed main()
{
	int n;
	while (cin >> n && n)
	{
		//brute-fource
		vector<int> cuts(n + n + 2);
		rep(i, n) cin >> cuts[i + 1];
		int sum = accumulate(all(cuts), 0);
		n++;
		rep(i, n) cuts[i + n] = cuts[i];
		rep(i, n + n - 1) cuts[i + 1] += cuts[i];

		int ans = 0;

		rep(i, n - 2) REP(j, i + 1, n - 1)
		{
			int size = cuts[j] - cuts[i];
			int rem = (sum - size) / 2;
			//int sep = upper_bound(all(cuts), cuts[j] + rem) - cuts.begin() - 1;
			//int k = max(j + 1, min(sep, n - 1));

			int sep = j + 1;
			REP(k, n) if (cuts[k] - cuts[j] >= rem)
			{
				sep = k;
				break;
			}

			int k = sep;
			int a = cuts[i + n] - cuts[k], b = cuts[j] - cuts[i], c = cuts[k] - cuts[j];
			ans = max(ans, min({ a, b, c }));
		}

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

Compiler output:
a.cc:53:33: error: macro "REP" requires 3 arguments, but only 2 given
   53 |                         REP(k, n) if (cuts[k] - cuts[j] >= rem)
      |                                 ^
a.cc:7:9: note: macro "REP" defined here
    7 | #define REP(i, s, n) for(int i = (s); i < signed(n); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:53:25: error: 'REP' was not declared in this scope
   53 |                         REP(k, n) if (cuts[k] - cuts[j] >= rem)
      |                         ^~~
Language: C++

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

const int INF=1001001001;
#define rep(i,n) for(int i=0;i<n;i++)
int N;
int A[200004];
long long int B[100002];


int main(){
	FILE *fp;
	fp=fopen("F:\\1JOI本選\\2014\\joi2014-ho-data\\joi2014-ho-data\\2014-ho-t3\\in\\03-06.txt","r");
	fscanf(fp,"%d",&N);
	long long int MAX = 0;
	rep(i,N){
		fscanf(fp,"%d",&A[i]);
		MAX+=A[i];
		B[i]=MAX;
	}
	memcpy(&A[N],A,sizeof(int)*N);
	
	long long int M=MAX/3;//全てのピースがM以上になる切り方は存在するか?
	long long int m=0;
	do{
		bool cann=false;//全てのピースがn以上になる切り方は存在するか?
		long long int n=(M+m)/2;
		rep(i,N-2){//どこで最初に切るか
			int a=i;//よりあとで切る
			int b=N-2;//以前で切る
			do{//次に切る場所を探す
				int c=(a+b)/2;
				long long int piece1=B[c]-B[i];
				if(piece1>=n){b=c;}//c以前で切れる
				else a=c;//cよりあとで切るべき
			}while(b>a+1);
			long long int p1=B[b]-B[i];
			if(p1<n)continue;//1個目がもうだめ
			int x=b;
			int y=N-1;
			do{//最後に切る場所を探す
				int z=(x+y)/2;
				long long int piece2=B[z]-B[b];
				if(piece2>=n){y=z;}
				else x=z;
			}while(y>x+1);
			long long int p2=B[y]-B[b];
			if(p2<n)continue;//2個目がもうだめ
			if(MAX-p1-p2>=n){cann=true;}
		}
		if(cann){m=n;}//すべて(３つ)のピースがn以上になりえる
		else{M=n;}
	}while(M>m+1);
	printf("%lld\n",m);
	return 1;
}

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

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

int b;
int c;
int d;
int e;
int f;
int main(){
  int n;
  cin>>n;
  int a[2n];
  int z[n]
  for(int i;i<n;i++){
    cin>>a[i];
    c=c+a{i}
    a[n+i]=a[i];}
  for(int j;j<n;j++){
    d=j-1;
    while(b<c/3){
      d++;
      b=b+a[d]; 
    }
    b=b-a[d]
    while(e<=c/3){
      d++;
      e=e+a[d];}
    f=c-b-e;
    if(f>b){
      z[j]=b;
    }else{
      z[j]=f;}     
  }
  sort(z,z+n);
  cout<<z[n]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: unable to find numeric literal operator 'operator""n'
   13 |   int a[2n];
      |         ^~
a.cc:15:3: error: expected initializer before 'for'
   15 |   for(int i;i<n;i++){
      |   ^~~
a.cc:15:13: error: 'i' was not declared in this scope
   15 |   for(int i;i<n;i++){
      |             ^
a.cc:23:11: error: 'a' was not declared in this scope
   23 |       b=b+a[d];
      |           ^
a.cc:25:9: error: 'a' was not declared in this scope
   25 |     b=b-a[d]
      |         ^
a.cc:31:7: error: 'z' was not declared in this scope
   31 |       z[j]=b;
      |       ^
a.cc:33:7: error: 'z' was not declared in this scope
   33 |       z[j]=f;}
      |       ^
a.cc:35:8: error: 'z' was not declared in this scope
   35 |   sort(z,z+n);
      |        ^
Language: C++

#include<iostream>
#include <algorithm>
using namespace std;
int n;
int b;
int c;
int d;
int e;
int f;
int main(){
  cin>>n;
  int a[2n];
  int z[n]
  for(int i;i<n;i++){
    cin>>a[i];
    c=c+a{i}
    a[n+i]=a[i];}
  for(int j;j<n;j++){
    d=j-1;
    while(b<c/3){
      d++;
      b=b+a[d]; 
    }
    b=b-a[d]
    while(e<=c/3){
      d++;
      e=e+a[d];}
    f=c-b-e;
    if(f>b){
      z[j]=b;
    }else{
      z[j]=f;}     
  }
  sort(z,z+n);
  cout<<z[n]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: unable to find numeric literal operator 'operator""n'
   12 |   int a[2n];
      |         ^~
a.cc:14:3: error: expected initializer before 'for'
   14 |   for(int i;i<n;i++){
      |   ^~~
a.cc:14:13: error: 'i' was not declared in this scope
   14 |   for(int i;i<n;i++){
      |             ^
a.cc:22:11: error: 'a' was not declared in this scope
   22 |       b=b+a[d];
      |           ^
a.cc:24:9: error: 'a' was not declared in this scope
   24 |     b=b-a[d]
      |         ^
a.cc:30:7: error: 'z' was not declared in this scope
   30 |       z[j]=b;
      |       ^
a.cc:32:7: error: 'z' was not declared in this scope
   32 |       z[j]=f;}
      |       ^
a.cc:34:8: error: 'z' was not declared in this scope
   34 |   sort(z,z+n);
      |        ^
Language: C++

#include<iostream>
#include <algorithm>
using namespace std;
int n;
int b;
int c;
int d;
int e;
int f;
int main(){
  cin>>n;
  int a[200000];
  int z[200000];
  for(int i;i<n;i++){
    cin>>a[i];
    c=c+a[i];
    a[n+i]=a[i];}
    for(int j;j<n;j++){
    d=j-1;
    while(b<=c/3){
      d++;
      b=b+a[d]; 
    }
    b=b-a[d];
    while(e<c/3){
      d++;
      e=e+a[d];}
    f=c-b-e;
    if(f>b){
      z[j]=b;
    }else{
      z[j]=f;}     
    }
    b=0;
    c=0;
    j=0;
    e=0;
    f=0;
    d=0;
    for(int j;j<n;j++){
    d=j-1;
    while(b<c/3){
      d++;
      b=b+a[d]; 
    };
    while(e<=c/3){
      d++;
      e=e+a[d];}
    e=e-a[d];
    f=c-b-e;
    if(f>b){
      z[j]=b;
    }else{
      z[j]=f;}     
  }
  sort(z,z+2n);
  cout<<z[2n-1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:5: error: 'j' was not declared in this scope
   36 |     j=0;
      |     ^
a.cc:56:12: error: unable to find numeric literal operator 'operator""n'
   56 |   sort(z,z+2n);
      |            ^~
a.cc:57:11: error: unable to find numeric literal operator 'operator""n'
   57 |   cout<<z[2n-1]<<endl;
      |           ^~
Language: C++

#include<iostream>
#include <algorithm>
using namespace std;
int n;
int b;
int c;
int d;
int e;
int f;
int main(){
  cin>>n;
  int a[200000];
  int z[200000];
  for(int i;i<n;i++){
    cin>>a[i];
    c=c+a[i];
    a[n+i]=a[i];}
  for(int j;j<n;j++){
    d=j-1;
    while(b<=c/3){
      d++;
      b=b+a[d]; 
    }
    b=b-a[d];
    d=d-1;
    while(e<c/3){
      d++;
      e=e+a[d];}
    f=c-b-e;
    if(f>b){
      z[j]=b;
    }else{
      z[j]=f;}
  }
  b=0;
  c=0;
  e=0;
  f=0;
  d=0;
  for(int m;m<n;m++){
    d=j-1;
    while(b<c/3){
      d++;
      b=b+a[d]; 
    };
    while(e<=c/3){
      d++;
      e=e+a[d];}
    e=e-a[d];
    f=c-b-e;
    if(f>b){
      z[m]=b;
    }else{
      z[m]=f;}     
  }
  sort(z,z+2n);
  cout<<z[2n-1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:7: error: 'j' was not declared in this scope
   41 |     d=j-1;
      |       ^
a.cc:56:12: error: unable to find numeric literal operator 'operator""n'
   56 |   sort(z,z+2n);
      |            ^~
a.cc:57:11: error: unable to find numeric literal operator 'operator""n'
   57 |   cout<<z[2n-1]<<endl;
      |           ^~
Language: C++

#include<iostream>
#include <algorithm>
using namespace std;
int n;
int b;
int c;
int d;
int e;
int f;
int ushi;
int uma;
int j;

int main(){
  cin>>n;
  int a[300000];
  int z[300000];
  for(int i;i<n;i++){
    cin>>a[i];
    c=c+a[i];
    a[n+i]=a[i];}
  for(int j;j<n;j++){
    d=j-1;
    while(b<=c/3){
      d++;
      b=b+a[d]; 
    }
    b=b-a[d];
    d=d-1;
    while(e<c/3){
      d++;
      e=e+a[d];}
    f=c-b-e;
    if(f>b){
      z[j]=b;
    }else{
      z[j]=f;}
  }
  b=0;
  c=0;
  e=0;
  f=0;
  d=0;
  for(int m;m<n;m++){
    d=j-1;
    while(b<c/3){
      d++;
      b=b+a[d]; 
    };
    while(e<=c/3){
      d++;
      e=e+a[d];}
    e=e-a[d];
    f=c-b-e;
    if(f>b){
      z[m]=b;
    }else{
      z[m]=f;}     
  }
  ushi=2*n-1;
  uma=z+2*n;
  sort(z,uma);
  cout<<z[ushi]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:8: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   61 |   uma=z+2*n;
      |       ~^~~~
      |        |
      |        int*
a.cc:62:7: error: no matching function for call to 'sort(int [300000], int&)'
   62 |   sort(z,uma);
      |   ~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   template argument deduction/substitution failed:
a.cc:62:7: note:   deduced conflicting types for parameter '_RAIter' ('int*' and 'int')
   62 |   sort(z,uma);
      |   ~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
#include    <iomanip>
using namespace std;

int main(){
    
    double a,b,c,d,e;
    int num;
    cin>>num;
    long int A[100001];
    for (int i=0; i<num; i++) {
        cin>>A[i];
    }
    int mi=0;
    for (int i=0; i<num-2; i++) {
        for (int j=i+1; j<num-1; j++) {
            for (int k=j+1; k<num; k++) {
                
                long int aa=0,bb=0,cc=0;
                for (int i2=i; i2< j; i2++) {
                    aa+=A[i2];
                }
                
                for (int i3=j; i3< k; i3++) {
                    bb+=A[i3];
                }
                
                for (int i4=k; i4< num; i4++) {
                    cc+=A[i4];
                }
                for (int i4=0; i4< i; i4++) {
                    cc+=A[i4];
                }
                mi=max(mi,min(aa,min(bb,cc)));
            }
        }
    }
    cout<<mi<<endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:23: error: no matching function for call to 'max(int&, const long int&)'
   36 |                 mi=max(mi,min(aa,min(bb,cc)));
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~
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:36:23: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
   36 |                 mi=max(mi,min(aa,min(bb,cc)));
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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<bits/stdc++.h>
using namespace std;

template <typename T>
T binary_search(function<bool(T)> func, T include, T exclude)
{
  while (abs(exclude - include) > 1)
  {
    auto middle = (include + exclude) / 2;
    (func(middle) ? include : exclude) = middle;
  }
  return include;
}

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 <vector>
using namespace std;


int main(){
	long long  num_cut = 0;
	long long  sum = 0L;
	long long  oneThird = 0L;
	int cuts[100000];

	long long min_piece=0L;
	int a=0;
	long long restCake=0L;

	cin >> num_cut;
	for(int i = 0; i < num_cut; i++){
		cin >> a;
		sum += a;
		cuts[i] = a;
	}	

	oneThird = (sum + 2) / 3;
	long long firstSize = 0L;
	long long secondSize = 0L;
	long long thirdSize = 0L;
	long long thirdSize_in1 = 0L;
	
	bool fi_se = false; // 1st >= 2nd
	bool se_th = false; // 2nd >= 3rd
	bool fi_th = false; // 1st >= 3rd
	// start
	for(int start=0; restCake < oneThird; start++){
		firstSize = 0L;
		// 1st
		for(int first=start+1; firstSize < oneThird; first++){
			firstSize += cuts[first];
			secondSize = 0L;
			thirdSize_in1 = sum-firstSize;
			// 2nd
			for(int second=first+1; secondSize < oneThird; second++){
				secondSize += cuts[second];
				// 3rd  
				thirdSize = thirdSize_in1 - secondSize;
				fi_se = (firstSize >= secondSize);
				se_th = (secondSize >= thirdSize);
				fi_th = (firstSize >= thirdSize);
				if(!fi_se && !fi_th){
					if(firstSize > min_piece) min_piece = firstSize;
				}else if(fi_se && !se_th){
					if(secondSize > min_piece) min_piece =secondSize;
				}else{
					if(thirdSize > min_piece) min_piece =thirdSize;
				}
			}
		}
		restCake += cuts[start];
	}

	cout << min_piece << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'cin' was not declared in this scope
   15 |         cin >> num_cut;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <vector>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:59:9: error: 'cout' was not declared in this scope
   59 |         cout << min_piece << endl;
      |         ^~~~
a.cc:59:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:59:30: error: 'endl' was not declared in this scope
   59 |         cout << min_piece << endl;
      |                              ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <vector>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const ll INF = LLONG_MAX / 3;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	ll n; cin >> n;
	vi a(n); REP(i, n) cin >> a[i];
	ll lb = 0, ub = INF;
	while (ub - lb > 1)
	{
		ll mid = (ub + lb) / 2;
		bool ok = false;
		int div0, div1, div2;
		div0 = 0;
		int p = 0;
		ll tmpa = 0;
		while (tmpa < mid)
		{
			tmpa += a[p];
			p++;
			if (p == n) goto end;
		}
		div1 = p;
		ll tmpb = 0;
		while (tmpb < mid)
		{
			tmpb += a[p];
			p++;
			if (p == n) goto end;
		}
		div2 = p;
		ll tmpc = 0;
		FOR(i, p, n) tmpc += a[i];
		while (1)
		{
			if (tmpa >= mid && tmpb >= mid && tmpc >= mid)
			{
				ok = true;
				break;
			}
			if (div2 == n) break;
			tmpa -= a[div0];
			tmpc += a[div0];
			div0++;
			while (tmpa < mid)
			{
				tmpa += a[div1];
				tmpb -= a[div1];
				div1++;
				if (div1 == div2) goto end;
			}
			while (tmpb < mid)
			{
				if (div2 == n) break;
				tmpb += a[div2];
				tmpc -= a[div2];
				div2++;
				if (div2 == div0) goto end;
			}
		}
	end:;
		if (ok) lb = mid;
		else ub = mid;
	}
	cout << lb << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:9: error: jump to label 'end'
   78 |         end:;
      |         ^~~
a.cc:46:42: note:   from here
   46 |                         if (p == n) goto end;
      |                                          ^~~
a.cc:49:20: note:   crosses initialization of 'll tmpc'
   49 |                 ll tmpc = 0;
      |                    ^~~~
a.cc:78:9: error: jump to label 'end'
   78 |         end:;
      |         ^~~
a.cc:38:42: note:   from here
   38 |                         if (p == n) goto end;
      |                                          ^~~
a.cc:49:20: note:   crosses initialization of 'll tmpc'
   49 |                 ll tmpc = 0;
      |                    ^~~~
a.cc:41:20: note:   crosses initialization of 'll tmpb'
   41 |                 ll tmpb = 0;
      |                    ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<functional>
#include<map>
#define int long long
using namespace std;

int a[200000];
signed main() {
	int b;
	cin >> b;
	int c = 0;
	for (int d = 0; d < b ; d++) {
		int e; scanf("%lld", &e);
		c += e;
		a[d + 1] = c;
	}
	for (int d = 1; d < b; d++) {
		a[b + d] = a[d] + c;
	}
	int MIN = LLONG_MAX / 3;
	int k = 0;
	for (int d = 0; d < b; d++) {
		int e = d + 1, f = d + b - 1;
		while (f - e >= 1) {
			int g = (e + f) / 2;
			auto h = lower_bound(a + d, a + d + b, a[d]+2*(a[g] - a[d]));
			if (h == a + d + b || a[d + b] - *h < a[g] - a[d]) {
				f = g;
			}
			else { e = g + 1; k = max(k, a[g] - a[d]);  }
		}
	}
	cout << k << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:19: error: 'LLONG_MAX' was not declared in this scope
   26 |         int MIN = LLONG_MAX / 3;
      |                   ^~~~~~~~~
a.cc:10:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    9 | #include<map>
  +++ |+#include <climits>
   10 | #define int long long
Language: C++

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

int n;
long long sum[110000];

bool Func(long long key){

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

		int f=lower_bound(sum+i,sum+n+1,key+sum[i-1]);
		int g=lower_bound(f,sum+n+1,key+*f);

		if(*g&&*g+key-sum[i-1]<=sum[n]){
			return true;
		}
	}
	return false;
}

int main(){

	cin>>n;
	sum[0]=0;

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

	long long left=0,right=sum[n]/3+1,mid;
	long long ans=0;

	while(left<right){

		mid=(left+right)/2;

		if(Func(mid)){
			left=mid+1;
			ans=max(ans,mid);
		}
		else right=mid;

	}

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

Compiler output:
a.cc: In function 'bool Func(long long int)':
a.cc:12:34: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
   12 |                 int f=lower_bound(sum+i,sum+n+1,key+sum[i-1]);
      |                       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                  |
      |                                  long long int*
a.cc:13:49: error: invalid type argument of unary '*' (have 'int')
   13 |                 int g=lower_bound(f,sum+n+1,key+*f);
      |                                                 ^~
a.cc:15:20: error: invalid type argument of unary '*' (have 'int')
   15 |                 if(*g&&*g+key-sum[i-1]<=sum[n]){
      |                    ^~
a.cc:15:24: error: invalid type argument of unary '*' (have 'int')
   15 |                 if(*g&&*g+key-sum[i-1]<=sum[n]){
      |                        ^~
Language: C++

#include<bits/stdc++.h>
#define N 100005
using namespace std;
typedef long long ll;
ll n,sum,a[N],A[2*N];

ll bynary_search(){
  
}

void solve(){
  ll ans=0;
  
  for(int cut1=0;cut1<n;cut1++){
    ll cut2=;
  }
  
}

int main(){
  cin>>n;
  
  for(int i=0;i<n;i++)cin>>a[i];
  A[0]=a[0];
  for(int i=1;i<2*n;i++)A[i]=a[i%n]+A[i-1];
  
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'll bynary_search()':
a.cc:9:1: warning: no return statement in function returning non-void [-Wreturn-type]
    9 | }
      | ^
a.cc: In function 'void solve()':
a.cc:15:13: error: expected primary-expression before ';' token
   15 |     ll cut2=;
      |             ^
Language: C++

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

long InArray[100000] = {0};
int N = 0;

long sumArray(int, int);
long getLocalMin(int, int, int);

int main()
{
	// initialize input
	if(1){
		FILE *inputFile = fopen("0600_in33.txt", "r");
		fscanf(inputFile, "%d", &N);
		for(int i = 0; i < N; i++){
			fscanf(inputFile, "%d", &InArray[i]);
		}
		fclose( inputFile);
	} else {
		cin >> N;
		for(int i = 0; i < N; i++){cin >> InArray[i];}
	}
	
	
	// Calculate sum and average
	long sum = sumArray(0, N);
	long average = sum / 3;
	
cout << "sum:\t" << sum << endl;
cout << "average:" << average << endl;
	
	long MaxMin = 0;
	long tempMin;
	long a3_sum, a1_sum, a2_sum;
	
	a3_sum = InArray[0];
	for(int a1 = 0; a3 < N-1; a1++){
		a1_sum = InArray[a1];
		for(int a2 = a1+1;;a2++){
			//if(sumArray(a1, a2+1) < average) continue;
			a1_sum += InArray[a2];
			if(a1_sum < average) continue;
			
			a2_sum = InArray[a2];
			for(int a3 = a2+1; a3 < N; a3++){
				//if(sumArray(a2, a3+1) < average) continue;
				a2_sum += InArray[a3];
				if(a2_sum < average) continue;
				
				tempMin = getLocalMin(a1, a2, a3);
				if(MaxMin < tempMin) MaxMin = tempMin;
				tempMin = getLocalMin(a1, a2, a3+1);
				if(MaxMin < tempMin) MaxMin = tempMin;
				break;
			}
			
			a2 = a2+1;
			a2_sum = InArray[a2];
			for(int a3 = a2+1; a3 < N; a3++){
				//if(sumArray(a2, a3+1) < average) continue;
				a2_sum += InArray[a3];
				if(a2_sum < average) continue;
				
				tempMin = getLocalMin(a1, a2, a3);
				if(MaxMin < tempMin) MaxMin = tempMin;
				tempMin = getLocalMin(a1, a2, a3+1);
				if(MaxMin < tempMin) MaxMin = tempMin;
				break;
			}
			break;
		}
		//if(sumArray(0, a1+1) > average) break;
		a3_sum += InArray[a1];
		if(a3_sum > average) break;
	}
	
	cout << MaxMin << endl;
	
	return 0;
}

long sumArray(int start, int end)
{
	long sum = 0;
	for(int i = start; i < end; i++){
		sum += InArray[i];
	}
	return sum;
}

long getLocalMin(int p1, int p2, int p3)
{
	long LocalMin = sumArray(p1, p2);
	long tempSum  = sumArray(p2, p3);
	if(LocalMin > tempSum){
		LocalMin = tempSum;
	}
	tempSum = sumArray(0, p1) + sumArray(p3, N);
	if(LocalMin > tempSum){
		LocalMin = tempSum;
	}
//cout << "getLocalMin(a1, a2, a3)\t" << LocalMin << "\t" << p1 << "\t" << p2 << "\t" << p3 << endl;
	return LocalMin;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: 'a3' was not declared in this scope; did you mean 'a1'?
   39 |         for(int a1 = 0; a3 < N-1; a1++){
      |                         ^~
      |                         a1
Language: C++

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

long InArray[100000] = {0};
int N = 0;

long sumArray(int, int);
long getLocalMin(int, int, int);

int main()
{
	// initialize input
	if(0){
		FILE *inputFile = fopen("0600_in33.txt", "r");
		fscanf(inputFile, "%d", &N);
		for(int i = 0; i < N; i++){
			fscanf(inputFile, "%d", &InArray[i]);
		}
		fclose( inputFile);
	} else {
		cin >> N;
		for(int i = 0; i < N; i++){cin >> InArray[i];}
	}
	
	
	// Calculate sum and average
	long sum = sumArray(0, N);
	long average = sum / 3;
	
cout << "sum:\t" << sum << endl;
cout << "average:" << average << endl;
	
	long MaxMin = 0;
	long tempMin;
	long a3_sum, a1_sum, a2_sum;
	
	a3_sum = InArray[0];
	for(int a1 = 0; a3 < N-1; a1++){
		a1_sum = InArray[a1];
		for(int a2 = a1+1;;a2++){
			//if(sumArray(a1, a2+1) < average) continue;
			a1_sum += InArray[a2];
			if(a1_sum < average) continue;
			
			a2_sum = InArray[a2];
			for(int a3 = a2+1; a3 < N; a3++){
				//if(sumArray(a2, a3+1) < average) continue;
				a2_sum += InArray[a3];
				if(a2_sum < average) continue;
				
				tempMin = getLocalMin(a1, a2, a3);
				if(MaxMin < tempMin) MaxMin = tempMin;
				tempMin = getLocalMin(a1, a2, a3+1);
				if(MaxMin < tempMin) MaxMin = tempMin;
				break;
			}
			
			a2 = a2+1;
			a2_sum = InArray[a2];
			for(int a3 = a2+1; a3 < N; a3++){
				//if(sumArray(a2, a3+1) < average) continue;
				a2_sum += InArray[a3];
				if(a2_sum < average) continue;
				
				tempMin = getLocalMin(a1, a2, a3);
				if(MaxMin < tempMin) MaxMin = tempMin;
				tempMin = getLocalMin(a1, a2, a3+1);
				if(MaxMin < tempMin) MaxMin = tempMin;
				break;
			}
			break;
		}
		//if(sumArray(0, a1+1) > average) break;
		a3_sum += InArray[a1];
		if(a3_sum > average) break;
	}
	
	cout << MaxMin << endl;
	
	return 0;
}

long sumArray(int start, int end)
{
	long sum = 0;
	for(int i = start; i < end; i++){
		sum += InArray[i];
	}
	return sum;
}

long getLocalMin(int p1, int p2, int p3)
{
	long LocalMin = sumArray(p1, p2);
	long tempSum  = sumArray(p2, p3);
	if(LocalMin > tempSum){
		LocalMin = tempSum;
	}
	tempSum = sumArray(0, p1) + sumArray(p3, N);
	if(LocalMin > tempSum){
		LocalMin = tempSum;
	}
//cout << "getLocalMin(a1, a2, a3)\t" << LocalMin << "\t" << p1 << "\t" << p2 << "\t" << p3 << endl;
	return LocalMin;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: 'a3' was not declared in this scope; did you mean 'a1'?
   39 |         for(int a1 = 0; a3 < N-1; a1++){
      |                         ^~
      |                         a1
Language: C++

/* 2017/09/17
data will be seperated to 3 groups, a b c
the bigest(a) should >= sum / 3
then the second should >= (sum - a) / 3
loop to find the just data that comply with the previous conditions
*/
#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
	// end link to head
	int InArray[200000] = {0};
	int N = 0;
	
	// initialize input
	int temp;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> temp;
		InArray[i] = temp;
		InArray[i + N] = temp;
	
	// Calculate sum and average
	long long sum = 0;
	for(int i = start; i < end; i++){
		sum += InArray[i];
	}
	long long average;
	if(sum % 3 == 0){
		average = sum / 3;
	}else{
		average = sum / 3 + 1;
	}
	
	long long MaxMin = 0;
	long long tempMin;
	long long a1_sum, a2_sum;
	long long average2;
	
	for(int a1 = 0; a1 < N; a1++){
		a1_sum = 0;
		for(int a2 = a1 + 1; a2 < (a1 + N); a2++){
			a1_sum += InArray[a2 - 1];
			if(a1_sum < average) continue;
			
			if((sum - a1_sum) % 2 == 0){
				average2 = (sum - a1_sum) / 2;
			}else{
				average2 = (sum - a1_sum + 1) / 2;
			}
			
			a2_sum = 0;
			for(int a3 = a2 + 1; a3 < (a1 + N); a3++){	// left 1 for a3_sum
				a2_sum += InArray[a3 -1];
				if(a2_sum < average2) continue;
								
				if(a2_sum - InArray[a3 -1] > MaxMin){
					MaxMin = a2_sum - InArray[a3 -1];
				}
				if(sum - a1_sum - a2_sum   > MaxMin){
					MaxMin = sum - a1_sum - a2_sum;
				}
				break;
			}
			break;
		}
	}
	
	cout << MaxMin << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: 'start' was not declared in this scope
   27 |         for(int i = start; i < end; i++){
      |                     ^~~~~
a.cc:27:30: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   27 |         for(int i = start; i < end; i++){
      |                            ~~^~~~~
a.cc:74:2: error: expected '}' at end of input
   74 | }
      |  ^
a.cc:12:1: note: to match this '{'
   12 | {
      | ^
Language: C++

/* 2017/09/17
data will be seperated to 3 groups, a b c
the bigest(a) should >= sum / 3
then the second should >= (sum - a) / 3
loop to find the just data that comply with the previous conditions
*/
#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
	// end link to head
	int InArray[200000] = {0};
	int N = 0;
	
	// initialize input
	int temp;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> temp;
		InArray[i] = temp;
		InArray[i + N] = temp;
	
	// Calculate sum and average
	long long sum = 0;
	for(int i = 0; i < N; i++){
		sum += InArray[i];
	}
	long long average;
	if(sum % 3 == 0){
		average = sum / 3;
	}else{
		average = sum / 3 + 1;
	}
	
	long long MaxMin = 0;
	long long tempMin;
	long long a1_sum, a2_sum;
	long long average2;
	
	for(int a1 = 0; a1 < N; a1++){
		a1_sum = 0;
		for(int a2 = a1 + 1; a2 < (a1 + N); a2++){
			a1_sum += InArray[a2 - 1];
			if(a1_sum < average) continue;
			
			if((sum - a1_sum) % 2 == 0){
				average2 = (sum - a1_sum) / 2;
			}else{
				average2 = (sum - a1_sum + 1) / 2;
			}
			
			a2_sum = 0;
			for(int a3 = a2 + 1; a3 < (a1 + N); a3++){	// left 1 for a3_sum
				a2_sum += InArray[a3 -1];
				if(a2_sum < average2) continue;
								
				if(a2_sum - InArray[a3 -1] > MaxMin){
					MaxMin = a2_sum - InArray[a3 -1];
				}
				if(sum - a1_sum - a2_sum   > MaxMin){
					MaxMin = sum - a1_sum - a2_sum;
				}
				break;
			}
			break;
		}
	}
	
	cout << MaxMin << endl;
	
	return 0;
}

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

#include <stdio.h>

int main()
{
	int InArray[200000] = {0};		// end is linked to start (Baumkuchen is round)
	int N;							// total data input
	int i;							// for counter
	int inputBuffer;				// buffer for input data
	int a1, a2, a3;					// the start index of each region
	long long sum;					// buffer for sum
	long long average, average2;	// sum / 3, (sum - region1) / 2
	long long a1_sum, a2_sum;		// sum of region1, region2
	long long MaxMin;				// final result
	
	scanf("%d", &N);
	for(i = 0; i < N; i++){
		scanf("%d", &inputBuffer);
		InArray[i] = inputBuffer;
		InArray[i + N] = inputBuffer;

	
	// Calculate sum and average
	sum = 0;
	for(i = 0; i < N; i++){
		sum += InArray[i];
	}
	if(sum % 3 == 0){
		average = sum / 3;
	}else{
		average = sum / 3 + 1;
	}
	
	MaxMin = 0;
	for(a1 = 0; a1 < N; a1++){
		a1_sum = 0;
		for(a2 = a1 + 1; a2 < (a1 + N); a2++){
			a1_sum += InArray[a2 - 1];
			if(a1_sum < average) continue;
			
			if((sum - a1_sum) % 2 == 0){
				average2 = (sum - a1_sum) / 2;
			}else{
				average2 = (sum - a1_sum + 1) / 2;
			}
			
			a2_sum = 0;
			for(a3 = a2 + 1; a3 < (a1 + N); a3++){	// left 1 for a3_sum
				a2_sum += InArray[a3 -1];
				if(a2_sum < average2) continue;
								
				if(a2_sum - InArray[a3 -1] > MaxMin){
					MaxMin = a2_sum - InArray[a3 -1];
				}
				if(sum - a1_sum - a2_sum   > MaxMin){
					MaxMin = sum - a1_sum - a2_sum;
				}
				break;
			}
			break;
		}
	}
	
	printf("%lld", MaxMin);
	
	return 0;
}

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

#include <cstdio>
#include <iostream>

int main()
{
	int InArray[200000] = {0};		// end is linked to start (Baumkuchen is round)
	int N;							// total data input
	int i;							// for counter
	int inputBuffer;				// buffer for input data
	int a1, a2, a3;					// the start index of each region
	long long sum;					// buffer for sum
	long long average, average2;	// sum / 3, (sum - region1) / 2
	long long a1_sum, a2_sum;		// sum of region1, region2
	long long MaxMin;				// final result
	
	scanf("%d", &N);
	for(i = 0; i < N; i++){
		cin >> inputBuffer;
		InArray[i] = inputBuffer;
		InArray[i + N] = inputBuffer;
	}

	
	// Calculate sum and average
	sum = 0;
	for(i = 0; i < N; i++){
		sum += InArray[i];
	}
	if(sum % 3 == 0){
		average = sum / 3;
	}else{
		average = sum / 3 + 1;
	}
	
	MaxMin = 0;
	for(a1 = 0; a1 < N; a1++){
		a1_sum = 0;
		for(a2 = a1 + 1; a2 < (a1 + N); a2++){
			a1_sum += InArray[a2 - 1];
			if(a1_sum < average) continue;
			
			if((sum - a1_sum) % 2 == 0){
				average2 = (sum - a1_sum) / 2;
			}else{
				average2 = (sum - a1_sum + 1) / 2;
			}
			
			a2_sum = 0;
			for(a3 = a2 + 1; a3 < (a1 + N); a3++){	// left 1 for a3_sum
				a2_sum += InArray[a3 -1];
				if(a2_sum < average2) continue;
								
				if(a2_sum - InArray[a3 -1] > MaxMin){
					MaxMin = a2_sum - InArray[a3 -1];
				}
				if(sum - a1_sum - a2_sum   > MaxMin){
					MaxMin = sum - a1_sum - a2_sum;
				}
				break;
			}
			break;
		}
	}
	
	printf("%lld", MaxMin);
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   18 |                 cin >> inputBuffer;
      |                 ^~~
      |                 std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
bool func(long long mid, vector<long long>&line) {
	int lp = 0, hp = 1;
	while (true) {
		if (line[hp] - line[lp] >= mid) {/*
			int fp = hp + 1;
			int bp = lp + N;
			while (fp < bp) {
				int mp = (fp + bp) >> 1;
				if (line[mp] - line[hp+1] >= mid) {
					if (line[lp + N] - line[mp] >= mid) {
						return true;
					}
					bp = mp;
				}
				else {
					fp = mp + 1;
				}
			}*/
			int it = lower_bound(line.begin() + hp + 1, line.begin() + lp + N, mid + line[hp])-line.begin();
			if (line[lp + N] - line[it] >= mid) {
				return true;
			}
			++lp;
		}
		else {
			++hp;
			if (hp == N - 1) {
				break;
			}
		}
	}
	return false;
}
int main() {
	cin >> N;
	vector<long long> line(N+1);
	for (int i = 1; i <= N; ++i) {
		cin >> line[i];
		line.push_back(line[i]);
	}
	line[0] = 0;
	for (int i = 1; i < line.size(); ++i) {
		line[i] = line[i] + line[i - 1];
	}
	long long lp = 0, hp = INT64_MAX;
	while (lp < hp) {
		long long mid = (lp + hp) >> 1;
		if (func(mid, line)) {
			lp = mid+1;
		}
		else {
			hp = mid;
		}
	}
	cout << lp - 1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:32: error: 'INT64_MAX' was not declared in this scope
   50 |         long long lp = 0, hp = INT64_MAX;
      |                                ^~~~~~~~~
a.cc:4:1: note: 'INT64_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    3 | #include<algorithm>
  +++ |+#include <cstdint>
    4 | using namespace std;