Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  vi A(N);
  rep(i,0,N) cin>>A[i];
  vi dp(N+1);
  rep(i,0,N) dp[i+1]=dp[i]+A[i];
  vi B(3);
  int B[0]=disup(dp,dp[N]/2),B[1]=dislow(dp,dp[N]/2),B[2]=B[1]-1;
  int ans=INF;
  rep(i,0,3){
    vi C(3),D(3);
    int C[0]=disup(dp,dp[B[i]]/2),C[1]=dislow(dp,dp[B[i]]/2),C[2]=C[1]-1;
    int D[0]=disup(dp,(dp[B[i]]+dp[N])/2),D[1]=dislow(dp,(dp[B[i]]+dp[N])/2),D[2]=C[1]-1;
    rep(j,0,3){
      rep(k,0,3){
        if(0<C[j]&&C[j]<B[i]&&B[i]<D[k]&&D[k]<N){
          int E=dp[C[j]];
          int F=dp[B[i]]-E;
          int G=dp[D[k]]-dp[B[i]];
          int H=dp[N]-dp[D[k]];
          int I=max({E,F,G,H})-min({E,F,G,H});
          ans=min(I,ans);
        }
      }
    }
  }
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:26:7: error: conflicting declaration 'long long int B [0]'
   26 |   int B[0]=disup(dp,dp[N]/2),B[1]=dislow(dp,dp[N]/2),B[2]=B[1]-1;
      |       ^
a.cc:25:6: note: previous declaration as 'std::vector<long long int> B'
   25 |   vi B(3);
      |      ^
a.cc:26:30: error: conflicting declaration 'long long int B [1]'
   26 |   int B[0]=disup(dp,dp[N]/2),B[1]=dislow(dp,dp[N]/2),B[2]=B[1]-1;
      |                              ^
a.cc:25:6: note: previous declaration as 'std::vector<long long int> B'
   25 |   vi B(3);
      |      ^
a.cc:26:54: error: conflicting declaration 'long long int B [2]'
   26 |   int B[0]=disup(dp,dp[N]/2),B[1]=dislow(dp,dp[N]/2),B[2]=B[1]-1;
      |                                                      ^
a.cc:25:6: note: previous declaration as 'std::vector<long long int> B'
   25 |   vi B(3);
      |      ^
a.cc:30:9: error: conflicting declaration 'long long int C [0]'
   30 |     int C[0]=disup(dp,dp[B[i]]/2),C[1]=dislow(dp,dp[B[i]]/2),C[2]=C[1]-1;
      |         ^
a.cc:29:8: note: previous declaration as 'std::vector<long long int> C'
   29 |     vi C(3),D(3);
      |        ^
a.cc:30:35: error: conflicting declaration 'long long int C [1]'
   30 |     int C[0]=disup(dp,dp[B[i]]/2),C[1]=dislow(dp,dp[B[i]]/2),C[2]=C[1]-1;
      |                                   ^
a.cc:29:8: note: previous declaration as 'std::vector<long long int> C'
   29 |     vi C(3),D(3);
      |        ^
a.cc:30:62: error: conflicting declaration 'long long int C [2]'
   30 |     int C[0]=disup(dp,dp[B[i]]/2),C[1]=dislow(dp,dp[B[i]]/2),C[2]=C[1]-1;
      |                                                              ^
a.cc:29:8: note: previous declaration as 'std::vector<long long int> C'
   29 |     vi C(3),D(3);
      |        ^
a.cc:31:9: error: conflicting declaration 'long long int D [0]'
   31 |     int D[0]=disup(dp,(dp[B[i]]+dp[N])/2),D[1]=dislow(dp,(dp[B[i]]+dp[N])/2),D[2]=C[1]-1;
      |         ^
a.cc:29:13: note: previous declaration as 'std::vector<long long int> D'
   29 |     vi C(3),D(3);
      |             ^
a.cc:31:43: error: conflicting declaration 'long long int D [1]'
   31 |     int D[0]=disup(dp,(dp[B[i]]+dp[N])/2),D[1]=dislow(dp,(dp[B[i]]+dp[N])/2),D[2]=C[1]-1;
      |                                           ^
a.cc:29:13: note: previous declaration as 'std::vector<long long int> D'
   29 |     vi C(3),D(3);
      |             ^
a.cc:31:78: error: conflicting declaration 'long long int D [2]'
   31 |     int D[0]=disup(dp,(dp[B[i]]+dp[N])/2),D[1]=dislow(dp,(dp[B[i]]+dp[N])/2),D[2]=C[1]-1;
      |                                                                              ^
a.cc:29:13: note: previous declaration as 'std::vector<long long int> D'
   29 |     vi C(3),D(3);
      |             ^