Language: C++

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

#define MAX_N 100000
#define INF 100000000000000
typedef __int64 Int;
int N;
Int A[MAX_N * 2 + 1];

bool CC(int a, int b, Int x){
	return A[b] - A[a] >= x;
}

bool C(Int x){
	int lb, ub, left;
	bool cut;
	for(int i = 0; i <= N; i++){
		left = i; lb = i; ub = 2 * N + 1;
		cut = false;
		while(ub - lb > 1){
			int mid = (lb + ub) / 2;
			if(CC(left, mid, x)){
				ub = mid;
				cut = true;
			}
			else lb = mid;
		}
		if(!cut) continue;
		left = ub; ub = 2 * N + 1;
		cut = false;
		while(ub - lb > 1){
			int mid = (lb + ub) / 2;
			if(CC(left, mid, x)){
				ub = mid;
				cut = true;
			}
			else lb = mid;
		}
		if(!cut) continue;
		left = ub; ub = 2 * N + 1;
		cut = false;
		while(ub - lb > 1){
			int mid = (lb + ub) / 2;
			if(CC(left, mid, x)){
				ub = mid;
				cut = true;
			}
			else lb = mid;
		}
		if(!cut) continue;
		if(ub - i < N + 1) return true;
	}
	return false;
}

int main(){
	scanf("%d", &N);
	A[0] = 0;
	scanf("%I64d", &A[1]);
	A[N + 1] = A[1];
	for(int i = 2; i <= N; i++){
		scanf("%I64d", &A[i]);
		A[i] += A[i - 1];
		A[i + N] = A[i];
	}
	for(int i = N + 1; i <= N * 2; i++){
		A[i] += A[N];
	}
	
	Int lb = 0, ub = INF;
	while(ub - lb > 1){
		Int mid = (lb + ub) / 2;
		if(C(mid)) lb = mid;
		else ub = mid;
	}
	
	printf("%I64d\n", lb);
	
	return 0;
}

Compiler output:
a.cc:7:9: error: '__int64' does not name a type; did you mean '__int64_t'?
    7 | typedef __int64 Int;
      |         ^~~~~~~
      |         __int64_t
a.cc:9:1: error: 'Int' does not name a type; did you mean 'int'?
    9 | Int A[MAX_N * 2 + 1];
      | ^~~
      | int
a.cc:11:23: error: 'Int' has not been declared
   11 | bool CC(int a, int b, Int x){
      |                       ^~~
a.cc: In function 'bool CC(int, int, int)':
a.cc:12:16: error: 'A' was not declared in this scope
   12 |         return A[b] - A[a] >= x;
      |                ^
a.cc: At global scope:
a.cc:15:8: error: 'Int' was not declared in this scope; did you mean 'int'?
   15 | bool C(Int x){
      |        ^~~
      |        int
a.cc: In function 'int main()':
a.cc:59:9: error: 'A' was not declared in this scope
   59 |         A[0] = 0;
      |         ^
a.cc:71:9: error: 'Int' was not declared in this scope; did you mean 'int'?
   71 |         Int lb = 0, ub = INF;
      |         ^~~
      |         int
a.cc:72:15: error: 'ub' was not declared in this scope
   72 |         while(ub - lb > 1){
      |               ^~
a.cc:72:20: error: 'lb' was not declared in this scope; did you mean 'labs'?
   72 |         while(ub - lb > 1){
      |                    ^~
      |                    labs
a.cc:73:20: error: expected ';' before 'mid'
   73 |                 Int mid = (lb + ub) / 2;
      |                    ^~~~
      |                    ;
a.cc:74:22: error: 'mid' was not declared in this scope
   74 |                 if(C(mid)) lb = mid;
      |                      ^~~
a.cc:74:25: error: 'C' cannot be used as a function
   74 |                 if(C(mid)) lb = mid;
      |                         ^
a.cc:78:27: error: 'lb' was not declared in this scope; did you mean 'labs'?
   78 |         printf("%I64d\n", lb);
      |                           ^~
      |                           labs