Language: C++

/* - - - - - - - - - - - - - - -
	User : 		VanishD
	problem :
	Points : 	
- - - - - - - - - - - - - - - */
# include <bits/stdc++.h>
# define 	ll 		long long
# define 	N 		200010
using namespace std;
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
int read(){
	int tmp = 0, fh = 1; char ch = getchar();
	while (ch < '0' || ch > '9'){ if (ch == '-') fh = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9'){ tmp = tmp * 10 + ch - '0'; ch = getchar(); }
	return tmp * fh;
}
int n;
ll num[N], sum[N];
bool check(int l, int mid, int r){
	if (mid == r) return false;
	ll now1 = max(sum[mid] - sum[l - 1], sum[r] - sum[mid]) - min(sum[mid] - sum[l - 1], sum[r] - sum[mid]);
	ll now2 = max(sum[mid + 1] - sum[l - 1], sum[r] - sum[mid + 1]) - min(sum[mid + 1] - sum[l - 1], sum[r] - sum[mid + 1]);
	return now2 <= now1; 
}
int main(){
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read();
	for (int i = 1; i <= n; i++) num[i] = read();
	for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + num[i];
	int cntl = 1, cntr = 3;
	ll ans = infll;
	for (int i = 2; i <= n - 2; i++){
		while (check(1, cntl, i) == true) cntl++;
		while (check(i + 1, cntr, n) == true) cntr++;
		ll mn = min(sum[cntl], min(sum[i] - sum[cntl], min(sum[cntr] - sum[i], sum[n] - sum[cntr])));
		ll mx = max(sum[cntl], max(sum[i] - sum[cntl], max(sum[cntr] - sum[i], sum[n] - sum[cntr])));
		ans = min(ans, mx - mn);
	}
	printf("%lld\n", ans);
	return 0;
}
/* - - - - - - - - - - - - - - -
	User : 		VanishD
	problem :
	Points : 	
- - - - - - - - - - - - - - - */
# include <bits/stdc++.h>
# define 	ll 		long long
# define 	N 		200010
using namespace std;
const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
int read(){
	int tmp = 0, fh = 1; char ch = getchar();
	while (ch < '0' || ch > '9'){ if (ch == '-') fh = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9'){ tmp = tmp * 10 + ch - '0'; ch = getchar(); }
	return tmp * fh;
}
int n;
ll num[N], sum[N];
bool check(int l, int mid, int r){
	if (mid == r) return false;
	ll now1 = max(sum[mid] - sum[l - 1], sum[r] - sum[mid]) - min(sum[mid] - sum[l - 1], sum[r] - sum[mid]);
	ll now2 = max(sum[mid + 1] - sum[l - 1], sum[r] - sum[mid + 1]) - min(sum[mid + 1] - sum[l - 1], sum[r] - sum[mid + 1]);
	return now2 <= now1; 
}
int main(){
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read();
	for (int i = 1; i <= n; i++) num[i] = read();
	for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + num[i];
	int cntl = 1, cntr = 3;
	ll ans = infll;
	for (int i = 2; i <= n - 2; i++){
		while (check(1, cntl, i) == true) cntl++;
		while (check(i + 1, cntr, n) == true) cntr++;
		ll mn = min(sum[cntl], min(sum[i] - sum[cntl], min(sum[cntr] - sum[i], sum[n] - sum[cntr])));
		ll mx = max(sum[cntl], max(sum[i] - sum[cntl], max(sum[cntr] - sum[i], sum[n] - sum[cntr])));
		ans = min(ans, mx - mn);
	}
	printf("%lld\n", ans);
	return 0;
}

Compiler output:
a.cc:53:11: error: redefinition of 'const int inf'
   53 | const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
      |           ^~~
a.cc:10:11: note: 'const int inf' previously defined here
   10 | const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
      |           ^~~
a.cc:53:29: error: redefinition of 'const int INF'
   53 | const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
      |                             ^~~
a.cc:10:29: note: 'const int INF' previously defined here
   10 | const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
      |                             ^~~
a.cc:54:11: error: redefinition of 'const long long int infll'
   54 | const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
      |           ^~~~~
a.cc:11:11: note: 'const long long int infll' previously defined here
   11 | const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
      |           ^~~~~
a.cc:54:41: error: redefinition of 'const long long int INFll'
   54 | const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
      |                                         ^~~~~
a.cc:11:41: note: 'const long long int INFll' previously defined here
   11 | const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
      |                                         ^~~~~
a.cc:55:5: error: redefinition of 'int read()'
   55 | int read(){
      |     ^~~~
a.cc:12:5: note: 'int read()' previously defined here
   12 | int read(){
      |     ^~~~
a.cc:61:5: error: redefinition of 'int n'
   61 | int n;
      |     ^
a.cc:18:5: note: 'int n' previously declared here
   18 | int n;
      |     ^
a.cc:62:4: error: redefinition of 'long long int num [200010]'
   62 | ll num[N], sum[N];
      |    ^~~
a.cc:19:4: note: 'long long int num [200010]' previously declared here
   19 | ll num[N], sum[N];
      |    ^~~
a.cc:62:12: error: redefinition of 'long long int sum [200010]'
   62 | ll num[N], sum[N];
      |            ^~~
a.cc:19:12: note: 'long long int sum [200010]' previously declared here
   19 | ll num[N], sum[N];
      |            ^~~
a.cc:63:6: error: redefinition of 'bool check(int, int, int)'
   63 | bool check(int l, int mid, int r){
      |      ^~~~~
a.cc:20:6: note: 'bool check(int, int, int)' previously defined here
   20 | bool check(int l, int mid, int r){
      |      ^~~~~
a.cc:69:5: error: redefinition of 'int main()'
   69 | int main(){
      |     ^~~~
a.cc:26:5: note: 'int main()' previously defined here
   26 | int main(){
      |     ^~~~