malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long x = 0, f = 1;     char c = getchar();     while ((c <  0  || c >  9 ) && (c !=  - )) c = getchar();     if (c ==  - ) f = -1, c = getchar();     while (c >=  0  && c <=  9 ) x = x * 10 + c -  0 , c = getchar();     return x * f;   }   const int N = 1e6 + 10;   int n, a[N][2], dp[N][2][2], ans[N];   pair<int, int> pre[N][2][2];   inline void solve() {     n = read();     for (int i = (1); i <= (n); i++) a[i][0] = read(), a[i][1] = -a[i][0];     if (n == 1) return puts( YES n1 n ), void(0);     for (int i = (1); i <= (n); i++)       for (int j = (0); j <= (1); j++)         for (int k = (0); k <= (1); k++)           dp[i][j][k] = n + 1, pre[i][j][k] = make_pair(-1, -1);     for (int j = (0); j <= (1); j++) dp[1][j][0] = -n - 1;     for (int i = (1); i < (n); i++)       for (int j = (0); j <= (1); j++)         for (int k = (0); k <= (1); k++)           if (dp[i][j][k] < n + 1) {             for (int l = (0); l <= (1); l++) {               int x = 0, y = 0;               if (k == 0)                 x = a[i][j], y = dp[i][j][k];               else                 y = a[i][j], x = dp[i][j][k];               int z = a[i + 1][l];               if (z < y) continue;               if (z > x) {                 if (y < dp[i + 1][l][0])                   dp[i + 1][l][0] = y, pre[i + 1][l][0] = make_pair(j, k);               } else {                 if (x < dp[i + 1][l][1])                   dp[i + 1][l][1] = x, pre[i + 1][l][1] = make_pair(j, k);               }             }           }     int x = -1, y = -1;     for (int j = (0); j <= (1); j++)       for (int k = (0); k <= (1); k++)         if (pre[n][j][k].first != -1) x = j, y = k;     if (x == -1) return puts( NO ), void(0);     for (int i = (n); i >= (1); i--) {       ans[i] = a[i][x];       auto tmp = pre[i][x][y];       x = tmp.first, y = tmp.second;     }     puts( YES );     for (int i = (1); i <= (n); i++) printf( %d  , ans[i]);     puts(  );   }   int main() {     int T = read();     while (T--) solve();   }
#include <bits/stdc++.h>   using namespace std;   map<long long, long long> m1;   long long query(long long a, long long b) {     long long ans = 0;     while (a != b) {       if (a > b) {         ans += m1[a];         a = a / 2;       } else {         ans += m1[b];         b = b / 2;       }     }     return ans;   }   void update(long long a, long long b, long long m) {     while (a != b) {       if (a > b) {         m1[a] += m;         a = a / 2;       } else {         m1[b] += m;         b = b / 2;       }     }     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long q;     cin >> q;     while (q--) {       long long ch;       cin >> ch;       if (ch == 2) {         long long a, b;         cin >> a >> b;         cout << query(a, b) << endl;       } else {         long long a, b, m;         cin >> a >> b >> m;         update(a, b, m);       }     }     return 0;   }
#include<bits/stdc++.h>      using namespace std;    typedef long long ll;      const int N = 400 + 5;   int n = 0, m = 0;   int dp[N][N] = {};   int c[N][N] = {}, smc[N] = {};   int ans = 0;      int main(){    cin >> n >> m;    dp[0][0] = 1;    for(int i = 0 ; i <= n + 1 ; i ++) for(int j = 0 ; j <= i ; j ++){     if(j == 0) c[j][i] = 1;     else c[j][i] = (c[j - 1][i - 1] + c[j][i - 1]) % m;         }    for(int i = 0 ; i <= n + 1 ; i ++){     if(i == 0) smc[i] = 1;     else smc[i] = (smc[i - 1] * 2) % m;    }    for(int i = 1 ; i <= n + 1; i ++)     for(int j = ceil(i / 2.0) ; j < i ; j ++){      for(int k = i - j - 1 ; k < i - 1 ; k ++) dp[i][j] = (dp[i][j] + (((1ll * dp[k][j - i + k + 1] * c[i - k - 1][j]) % m) * smc[i - k - 2]) % m) % m;      if(i == n + 1) ans = (ans + dp[i][j]) % m;        }    cout << ans;    return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100003;   int l[maxn], r[maxn], L, R, K, n, cnt[maxn][30], sum[30], A[30], B[30];   char c[maxn], s[maxn];   int List[30][maxn], a[maxn], len[maxn], tot = 0;   inline int get() {     int f = 0, v = 0;     char ch;     while (!isdigit(ch = getchar()))       if (ch ==  - ) break;     if (ch ==  - )       f = 1;     else       v = ch - 48;     while (isdigit(ch = getchar())) v = v * 10 + ch - 48;     if (f == 1)       return -v;     else       return v;   }   int check(int st, int ed) {     bool f = 0, g = 0;     for (int i = 0; i < 26; i++) {       int tp = cnt[ed][i] - cnt[st - 1][i];       if (tp > B[i]) g = 1;       if (tp < A[i]) f = 1;     }     if (f && g) return 2;     if (f) return -1;     if (g) return 1;     return 0;   }   void add(int st, int ed, int v) {     for (int i = st; i <= ed; i++) {       if (L <= a[i] && a[i] <= R) tot--;       a[i] += v;       if (L <= a[i] && a[i] <= R) tot++;     }   }   int main() {     scanf( %s , s + 1);     n = strlen(s + 1);     K = get();     L = get(), R = get();     for (int i = 1; i <= K; i++) scanf(  %c , &c[i]), l[i] = get(), r[i] = get();     for (int i = 1; i <= n; i++) {       for (int j = 0; j < 26; j++) cnt[i][j] = cnt[i - 1][j];       cnt[i][s[i] -  a ]++;     }     if (L == K && R == K) {       long long ans = 0;       for (int i = 0; i < 26; i++) A[i] = 0, B[i] = n + 1;       for (int i = 1; i <= K; i++) {         A[c[i] -  a ] = max(A[c[i] -  a ], l[i]);         B[c[i] -  a ] = min(B[c[i] -  a ], r[i]);         if (A[c[i] -  a ] > B[c[i] -  a ]) return puts( 0 ), 0;       }       for (int i = 1; i <= n; i++) {         bool flag = 1;         L = i, R = n;         int Left, Right;         while (L <= R) {           int mid = (L + R) / 2, t = check(i, mid);           if (t == 2) {             flag = 0;             break;           }           if (t == 1)             R = mid - 1;           else             L = mid + 1;         }         Right = R;         L = i, R = n;         while (L <= R) {           int mid = (L + R) / 2, t = check(i, mid);           if (t == 2) {             flag = 0;             break;           }           if (t == -1)             L = mid + 1;           else             R = mid - 1;         }         Left = L;         if (flag && Right >= Left) ans += Right - Left + 1;       }       cout << ans << endl;       return 0;     }     long long ans = 0;     for (int i = 1; i <= n; i++) {       if (L == 0) tot++;       int tp = s[i] -  a ;       List[tp][++len[tp]] = i;       for (int j = 1; j <= K; j++) {         if (l[j] == 0) add(i, i, 1);         if (c[j] != s[i]) continue;         if (len[tp] >= l[j] && l[j] != 0)           add(List[tp][len[tp] - l[j]] + 1, List[tp][len[tp] - l[j] + 1], 1);         if (len[tp] > r[j])           add(List[tp][len[tp] - r[j] - 1] + 1, List[tp][len[tp] - r[j]], -1);       }       ans += tot;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int m;   struct Edge {     int x;     int y;     int t;     Edge(int x, int y, int t) : x(x), y(y), t(t) {}     void print() { cout << x <<     << y <<     << t << endl; }   };   vector<Edge> edges;   vector<int> edge_idx[200005];   int in_digree[200005];   queue<int> Q;   int order[200005];   int main() {     int i, j, k;     int x, y, z;     int t;     cin >> t;     while (0 < t--) {       edges.clear();       while (!Q.empty()) Q.pop();       for (i = 0; i < n; i++) edge_idx[i].clear();       memset(in_digree, 0, sizeof(in_digree));       cin >> n >> m;       for (i = 0; i < m; i++) {         cin >> z >> x >> y;         x--;         y--;         Edge e(x, y, z);         if (e.x != x || e.y != y || e.t != z) return -1;         edge_idx[x].push_back(edges.size());         edge_idx[y].push_back(edges.size());         edges.push_back(e);         if (z) {           in_digree[y] += 1;         }       }       for (i = 0; i < n; i++) {         if (in_digree[i] == 0) {           Q.push(i);         }       }       int cnt = 0;       k = 0;       while (!Q.empty()) {         x = Q.front();         Q.pop();         order[x] = k++;         cnt++;         for (i = 0; i < edge_idx[x].size(); i++) {           Edge e = edges[edge_idx[x][i]];           z = -1;           if (e.t == 1 && e.x == x) {             y = e.y;             if (--in_digree[y] == 0) Q.push(y);           }         }       }       if (cnt != n) {         cout <<  NO n ;       } else {         cout <<  YES n ;         for (i = 0; i < edges.size(); i++) {           Edge e = edges[i];           if (order[e.x] < order[e.y]) {             cout << e.x + 1 <<     << e.y + 1 << endl;           } else {             cout << e.y + 1 <<     << e.x + 1 << endl;           }         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   constexpr long long MOD = 1e9 + 7;   constexpr long double EPS = 0.0 + 1e-6;   void YES() {     cout <<  YES           <<   n ;   }   void NO() {     cout <<  NO           <<   n ;   }   bool search(const string& s, long long i, const string& t, long long j,               bool going_left, bool going_right, bool can_turn_left) {     if (j >= t.size()) return false;     if (i < 0 or i >= s.size()) return false;     if (s[i] != t[j]) return false;     if (s[i] == t[j] and j + 1 == t.size()) return true;     if (going_right and search(s, i + 1, t, j + 1, false, true, true))       return true;     if (going_right and can_turn_left and         search(s, i - 1, t, j + 1, true, false, false))       return true;     if (going_left and search(s, i - 1, t, j + 1, true, false, false))       return true;     return false;   }   void solve() {     string s;     cin >> s;     string t;     cin >> t;     for (long long i = 0; i < s.size(); ++i) {       if (search(s, i, t, 0, false, true, true)) return YES();     }     NO();   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     long long t;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   int counter = 0;   int ans = 0;   vector<int> L[500000];   bool visited[500000];   bool cat[500000];   int main() {     int a, b, k1, k2;     deque<int> q1, q2, t1, t2;     set<pair<deque<int>, deque<int> > > st;     scanf( %d , &n);     scanf( %d , &k1);     for (int i = 1; i <= k1; i++) {       cin >> a;       q1.push_back(a);     }     scanf( %d , &k2);     for (int i = 1; i <= k2; i++) {       cin >> a;       q2.push_back(a);     }     int fight = 0;     int x, y;     t1 = q1;     t2 = q2;     bool loop = false;     int winner = 0;     st.insert(make_pair(q1, q2));     while (true) {       if (q1.empty()) {         winner = 2;         break;       }       if (q2.empty()) {         winner = 1;         break;       }       x = q1.front();       y = q2.front();       q1.pop_front();       q2.pop_front();       if (x > y)         q1.push_back(y), q1.push_back(x);       else         q2.push_back(x), q2.push_back(y);       fight++;       st.insert(make_pair(q1, q2));       if (t1 == q1 and t2 == q2 or (t2 == q1 and t1 == q2)) {         loop = true;         break;       }       if (st.size() != fight + 1) {         loop = true;         break;       }     }     if (!loop)       cout << fight <<     << winner << endl;     else       cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void start() {}   vector<long int> g[200007];   map<long int, bool> vis;   long int siz = 0;   void dfs(long int x) {     vis[x] = 1;     siz++;     for (auto i : g[x]) {       if (!vis[i]) {         dfs(i);       }     }     return;   }   double dist(long int x, long int y, long int a, long int b) {     double ans = sqrt((a - x) * (a - x) + (b - y) * (b - y));     return ans;   }   void sober() {     double r, x, y, x1, y1;     cin >> r >> x >> y >> x1 >> y1;     double ans = sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));     ans = ans / (2 * r);     cout << ceil(ans) <<   n ;   }   signed main() {     start();     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long int t = 1;     while (t--) {       sober();     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 3e5 + 5;   vector<int> G[1000010];   int a[MAXN], s[MAXN], L[MAXN], R[MAXN];   int n, k;   long long ans;   int query(int k, int l, int r) {     return upper_bound(G[k].begin(), G[k].end(), r) -            lower_bound(G[k].begin(), G[k].end(), l);   }   int main() {     scanf( %d%d , &n, &k);     G[0].push_back(0);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       s[i] = (s[i - 1] + a[i]) % k;       G[s[i]].push_back(i);     }     for (int i = 1; i <= n; i++) {       L[i] = i - 1;       while (L[i] && a[L[i]] < a[i]) L[i] = L[L[i]];     }     for (int i = n; i >= 1; i--) {       R[i] = i + 1;       while (R[i] <= n && a[R[i]] <= a[i]) R[i] = R[R[i]];     }     for (int i = 1; i <= n; i++) a[i] %= k;     for (int i = 1; i <= n; i++) {       if (i - L[i] < R[i] - i) {         for (int j = L[i] + 1; j <= i; j++)           ans += query((s[j - 1] + a[i]) % k, i, R[i] - 1);       } else {         for (int j = i; j < R[i]; j++)           ans += query((s[j] - a[i] + k) % k, L[i], i - 1);       }     }     printf( %lld n , ans - n);     return 0;   }
#include <bits/stdc++.h>   char s[200010];   int tree[26][200010 << 2];   bool vis[200010];   inline void PushUp(int t, int rt) {     tree[t][rt] = tree[t][rt << 1] + tree[t][rt << 1 | 1];   }   void Update(int t, int x, int L, int R, int rt) {     if (L == R)       tree[t][rt] = 1;     else {       int mid = (L + R) >> 1;       if (mid >= x)         Update(t, x, L, mid, rt << 1);       else         Update(t, x, mid + 1, R, rt << 1 | 1);       PushUp(t, rt);     }   }   int Find(int t, int x, int L, int R, int rt) {     if (L == R) {       tree[t][rt] = 0;       return L;     }     int ans, mid = (L + R) >> 1;     if (tree[t][rt << 1] >= x)       ans = Find(t, x, L, mid, rt << 1);     else {       x -= tree[t][rt << 1];       ans = Find(t, x, mid + 1, R, rt << 1 | 1);     }     PushUp(t, rt);     return ans;   }   int main() {     char ch;     int k, i, j, q, len, n;     while (~scanf( %d %s%d , &k, s + 1, &q)) {       memset(vis, false, sizeof(vis));       memset(tree, 0, sizeof(tree));       len = strlen(s + 1);       n = len * k;       for (j = len + 1; --k;) {         for (i = 1; i <= len; i++) s[j++] = s[i];       }       s[j] = 0;       for (i = 1; s[i]; i++) Update(s[i] -  a , i, 1, n, 1);       while (q--) {         scanf( %d %c , &i, &ch);         k = Find(ch -  a , i, 1, n, 1);         vis[k] = true;       }       for (i = 1; s[i]; i++) {         if (!vis[i]) putchar(s[i]);       }       putchar(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1005;   int numb[MAXN], numw[MAXN];   int dp[MAXN][2];   string s[MAXN];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     for (int i = 0; i < MAXN; i++) dp[i][0] = dp[i][1] = -1;     int n, m, x, y;     cin >> n >> m >> x >> y;     for (int i = 0; i < n; i++) cin >> s[i];     for (int t = 0; t < m; t++) {       int num = 0;       for (int i = 0; i < n; i++)         if (s[i][t] ==  # ) num++;       numb[t] = num;       numw[t] = n - num;     }     for (int t = 1; t < m; t++) numb[t] += numb[t - 1], numw[t] += numw[t - 1];     for (int t = x - 1; t < m; t++) {       for (int j = x; j <= y && t - j + 1 >= 0; j++) {         if (t - j + 1 == 0) {           if (dp[t][0] == -1) dp[t][0] = 1e9;           if (dp[t][1] == -1) dp[t][1] = 1e9;           dp[t][0] = min(dp[t][0], numb[t]);           dp[t][1] = min(dp[t][1], numw[t]);           continue;         }         if (dp[t - j][0] != -1) {           if (dp[t][1] == -1) dp[t][1] = 1e9;           dp[t][1] = min(dp[t][1], dp[t - j][0] + (numw[t] - numw[t - j]));         }         if (dp[t - j][1] != -1) {           if (dp[t][0] == -1) dp[t][0] = 1e9;           dp[t][0] = min(dp[t][0], dp[t - j][1] + (numb[t] - numb[t - j]));         }       }     }     cout << min(dp[m - 1][0], dp[m - 1][1]) <<   n ;   }
#include<bits/stdc++.h>   using namespace std;   #define forg(i,x) for(register int i=fir[x];i;i=nxt[i])   #define uu unsigned   #define scanf a14=scanf   #define rint register int   #define fre(x) freopen(#x .in , r ,stdin),freopen(#x .out , w ,stdout)   typedef long long ll;   typedef uu long long ull;   typedef pair<int,int>pii;   int a14;   inline int rd(int l,int r){return rand()%(r-l+1)+l;}      const int mxn=1e5+3,sq=200,qs=320;   int n,b[mxn],lp[mxn],rp[mxn],kn,be[mxn],po[mxn],qn;   int ju[mxn/sq+2][mxn],ad[mxn/sq+2][mxn/qs+1];   int TG;   struct shu{       int a[mxn],tg[mxn];       void add(int x){for(;x<=n;x+=x&-x){if(tg[x]!=TG)tg[x]=TG,a[x]=0;++a[x];}}       int ask(int x){           int su=0,p=0;           for(int i=1<<16;i;i>>=1){               if(p+i>=n)continue;               p+=i;if(tg[p]!=TG)tg[p]=TG,a[p]=0;               if(p+a[p]+su>=x)p-=i;else su+=a[p];           }           return p+1;       }       void gb(int t){for(int i=1;i<=n;++i){if(tg[i]!=TG)a[i]=0;ju[t][i]=ju[t][i-(i&-i)]+a[i];}for(int i=1;i<=n;++i)ju[t][i]+=i;}   }ar;   void add2(int t,int x,int y){       int k=(x-1)/qs;       for(int i=x;i<=(k+1)*qs;++i)ju[t][i]+=y;       for(++k;k*qs+1<=n;++k)ad[t][k]+=y;   }   int main(){   //cout<<(sizeof(ju)>>20)<<endl;       scanf( %d ,&n);for(int i=1;i<=n;++i)scanf( %d ,b+i),b[i]=i-b[i];scanf( %d ,&qn);       for(int l=1,r;r!=n;l=r+1){r=min(l+sq-1,n);lp[++kn]=l,rp[kn]=r;for(int i=l;i<=r;++i)be[i]=kn;}       for(int t=1;t<=kn;++t){           ++TG; for(int i=lp[t];i<=rp[t];++i)po[i]=ar.ask(b[i]),ar.add(po[i]);           ar.gb(t);       }       while(qn--){           int o,x,y;scanf( %d%d ,&o,&x);if(o==1){               scanf( %d ,&y);b[x]=x-y;int k=be[x],ls;               ++TG;for(int i=lp[k];i<=rp[k];++i){                   if(i<x)ar.add(po[i]);else{                       ls=po[i],po[i]=ar.ask(b[i]),ar.add(po[i]);                       if(ls==po[i])continue;                       if(ls==po[i]-1){--ju[k][ls];continue;}                       if(ls==po[i]+1){++ju[k][po[i]];continue;}                       assert(i==x);                       add2(k,ls,-1),add2(k,po[i],1);                   }               }           }else{               int t=be[x],re=b[x];for(int i=x+1;i<=rp[t];++i)re+=b[i]<=re;               for(++t;t<=kn;++t)re=ju[t][re]+ad[t][(re-1)/qs];               printf( %d n ,re);           }       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const int MOD = 1e9 + 7;   vector<int> prefix_function(vector<int> s) {     int n = s.size();     vector<int> pi(n);     pi[0] = 0;     for (int i = 1; i < n; ++i) {       int j = pi[i - 1];       while (j > 0 && s[i] != s[j]) {         j = pi[j - 1];       }       if (s[i] == s[j]) {         ++j;       }       pi[i] = j;     }     return pi;   }   vector<int> res_vector(vector<int> s, vector<int> t) {     vector<int> res = s;     res.push_back(2 * INF);     for (int i = 0; i < t.size(); ++i) {       res.push_back(t[i]);     }     return res;   }   vector<int> process(vector<int> res, vector<int> pi, int n) {     vector<int> ans(res.size());     for (int i = n + 1; i < res.size(); ++i) {       ++ans[pi[i]];     }     for (int i = res.size() - 1; i >= n + 1; --i) {       ans[pi[i - 1]] += ans[i];     }     return ans;   }   int main() {     ios::sync_with_stdio(0);     int n, w;     cin >> n >> w;     if (w == 1) {       cout << n << endl;       return 0;     }     vector<int> a(n - 1);     int last;     cin >> last;     for (int i = 0; i < n - 1; ++i) {       int temp;       cin >> temp;       a[i] = temp - last;       last = temp;     }     cin >> last;     vector<int> b(w - 1);     for (int i = 0; i < w - 1; ++i) {       int temp;       cin >> temp;       b[i] = temp - last;       last = temp;     }     vector<int> res = res_vector(b, a);     vector<int> pi = prefix_function(res);     vector<int> ans = process(res, pi, b.size());     cout << ans[w - 1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     if (n == 1)       cout << 0;     else if (k >= n / 2) {       long long int ans = 0;       for (int i = 0; i < n; i++) ans += n - i - 1;       cout << ans << endl;     } else {       long long int ans = 0;       for (int i = 0; i < k; i++) {         ans += n - i - 1;         ans += k - i - 1;       }       for (int i = k; i < n - k; i++) {         ans += k;       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s;     cin >> s;     vector<char> v;     int i = 0;     int j = 1;     int sum = -1;     while (sum < n - 1) {       sum = sum + j;       v.push_back(s[sum]);       j++;     }     for (auto it = v.begin(); it != v.end(); it++) {       cout << *it;     }   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   T prod(const T &a, const T &b, const T &mod) {     return ((a % mod) * (b % mod)) % mod;   }   template <typename T>   T pow_(const T &a, const T &b) {     if (!b) return 1;     T p = pow_(a, b / 2);     p *= p;     return (b % 2) ? (p * a) : p;   }   template <typename T>   T modpow(const T &a, const T &b, const T &mod) {     if (!b) return 1;     T p = modpow(a, b / 2);     p = prod(p, p);     return (b % 2) ? (prod(p, a)) : p;   }   template <typename T>   T max(const T &a, const T &b, const T &c) {     return max(a, max(b, c));   }   template <typename T>   T min(const T &a, const T &b, const T &c) {     return min(a, min(b, c));   }   template <typename T>   void dbg(const vector<T> &a, int l, int r) {     for (long long int i = l; i <= r; i++) cout << a[i] <<    ;     cout << endl;   }   template <typename T>   void dbg(const vector<T> &a) {     for (long long int i = 0; i <= a.size() - 1; i++) cout << a[i] <<    ;     cout << endl;   }   void main_() {     long long int n;     cin >> n;     vector<long long int> a(n + 1, 0);     for (long long int i = 1; i <= n; i++) {       cin >> a[i];       a[i] += a[i - 1];     }     long long int x, y, z;     long long int res = -LLONG_MAX;     for (long long int i = 0; i <= n; i++) {       long long int m1 = -LLONG_MAX, m2 = -LLONG_MAX;       long long int y_, x_, z_;       y_ = i;       for (long long int j = 0; j <= i; j++) {         if (m1 < a[j]) {           m1 = a[j];           x_ = j;         }       }       for (long long int j = i; j <= n; j++) {         if (m2 < a[j]) {           m2 = a[j];           z_ = j;         }       }       long long int sum = 2 * (a[x_] + a[z_] - a[y_]) - a[n];       if (res < sum) {         res = sum;         x = x_;         y = y_;         z = z_;       }     }     cout << x <<     << y <<     << z << endl;   }   int main() {     { main_(); }     return 0;   }