malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma warning(disable : 4996)   using namespace std;   int T;   int main() {     cin >> T;     while (T--) {       int a, b, c;       cin >> c >> b >> a;       string s;       if (a > 0) {         s +=  1 ;         for (int i = 0; i < a; i++) s +=  1 ;         if (b > 0 && b % 2 == 1) {           for (int i = 0; i < b; i++) {             if (i % 2 == 0)               s +=  0 ;             else               s +=  1 ;           }           if (c > 0) {             if (s[s.length() - 1] !=  0 ) s +=  0 ;             for (int i = 0; i < c; i++) s +=  0 ;           }         } else if (b > 0 && b % 2 == 0) {           for (int i = 0; i < b - 1; i++) {             if (i % 2 == 0)               s +=  0 ;             else               s +=  1 ;           }           if (c > 0) {             if (s[s.length() - 1] !=  0 ) s +=  0 ;             for (int i = 0; i < c; i++) s +=  0 ;           }           cout <<  0 ;           cout << s << endl;           continue;         } else if (c > 0) {           if (s[s.length() - 1] !=  0 ) s +=  0 ;           for (int i = 0; i < c; i++) s +=  0 ;         }       } else if (b > 0) {         s +=  1 ;         if (b > 0 && b % 2 == 1) {           for (int i = 0; i < b; i++) {             if (i % 2 == 0)               s +=  0 ;             else               s +=  1 ;           }           if (c > 0) {             if (s[s.length() - 1] !=  0 ) s +=  0 ;             for (int i = 0; i < c; i++) s +=  0 ;           }         } else if (b > 0 && b % 2 == 0) {           for (int i = 0; i < b - 1; i++) {             if (i % 2 == 0)               s +=  0 ;             else               s +=  1 ;           }           if (c > 0) {             if (s[s.length() - 1] !=  0 ) s +=  0 ;             for (int i = 0; i < c; i++) s +=  0 ;           }           cout <<  0 ;           cout << s << endl;           continue;         } else if (c > 0) {           if (s[s.length() - 1] !=  0 ) s +=  0 ;           for (int i = 0; i < c; i++) s +=  0 ;         }       } else if (c > 0) {         s +=  0 ;         for (int i = 0; i < c; i++) s +=  0 ;       }       cout << s << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7;   const int MOD = 1e9 + 7;   const int di[4] = {1, 0, -1, 0};   const int dj[4] = {0, 1, 0, -1};   mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       long long a, b, x, y, n;       cin >> a >> b >> x >> y >> n;       long long a2, b2, x2, y2, n2;       a2 = a, b2 = b, x2 = x, y2 = y, n2 = n;       long long cnt_to_a = a - x;       long long cnt_to_a2 = cnt_to_a;       long long cnt_to_b = b - y;       long long cnt_to_b2 = cnt_to_b;       if (cnt_to_a < n) {         a = x;         n -= cnt_to_a;       } else {         a -= n;         n = 0;       }       if (cnt_to_b < n) {         b = y;         n -= cnt_to_b;       } else {         b -= n;         n = 0;       }       if (cnt_to_b2 < n2) {         b2 = y2;         n2 -= cnt_to_b2;       } else {         b2 -= n2;         n2 = 0;       }       if (cnt_to_a2 < n2) {         a2 = x2;         n2 -= cnt_to_a2;       } else {         a2 -= n2;         n2 = 0;       }       cout << min(a * b, a2 * b2) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   bool secdes(const pair<long long, long long>& a,               const pair<long long, long long>& b) {     if (a.second == b.second) {       return a.first > b.first;     } else {       return a.second > b.second;     }   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     string s;     cin >> s;     long long ind = -1;     long long l = s.length(), f = 0;     for (long long i = l - 1; i >= 0; i--) {       long long k = s[i] - 48;       if (k % 2 == 0) {         f += 1;         if (f == 1) {           ind = i;         }         if (s[l - 1] - 48 > k) {           ind = i;         }       }     }     if (f == 0)       cout << -1;     else {       swap(s[ind], s[l - 1]);       cout << s;     }   }
#include <bits/stdc++.h>   using namespace std;   int f[10000050], pre[10000050], used[10000050], edge[105];   vector<int> vec;   int main() {     int n, m, i, j, x, y, maxi, size, news;     scanf( %d%d , &n, &m);     for (i = 1; i <= m; i++) {       scanf( %d%d , &x, &y);       edge[x] |= 1 << y;       edge[y] |= 1 << x;     }     memset(f, 127, sizeof(f));     for (i = 1; i <= n; i++) f[1 << i] = 0;     maxi = 0;     for (i = 1; i <= n; i++) maxi |= 1 << i;     for (i = 0; i <= maxi; i++)       if (f[i] < 999999999) {         for (j = 1; j <= n; j++)           if ((1 << j) & i) {             news = i | edge[j];             if (f[i] + 1 < f[news]) {               f[news] = f[i] + 1;               used[news] = j;               pre[news] = i;             }           } else if ((i & edge[j]) == i) {             news = i | (1 << j);             if (f[i] < f[news]) {               f[news] = f[i];               used[news] = 0;               pre[news] = i;             }           }       }     vec.clear();     for (i = maxi; (i & -i) != i; i = pre[i])       if (used[i]) vec.push_back(used[i]);     size = vec.size();     printf( %d n , size);     for (i = size - 1; i >= 0; i--) printf( %d  , vec[i]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   const int maxn = 50;   using namespace std;   long long n, k, M;   int a[maxn + 5], b[maxn * maxn];   void ok() {     long long ans = 0, cot = 0, tot = 0, cnt = 0, sum = 0;     sort(a + 1, a + k + 1);     for (int i = 1; i <= k; i++) cot += a[i];     for (int i = 0; i <= n; i++) {       tot = cot * i;       if (tot > M) break;       sum = tot, cnt = (k + 1) * i;       for (int j = 1; j <= k; j++) {         for (int r = i + 1; r <= n; r++) {           sum += a[j];           cnt++;           if (sum > M) {             cnt--, j = k + 1;             break;           }         }       }       ans = max(ans, cnt);     }     printf( %I64d n , ans);   }   int main() {     while (~scanf( %I64d %I64d %I64d , &n, &k, &M)) {       for (int i = 1; i <= k; i++) scanf( %d , &a[i]);       ok();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 10;   int mx = 0;   vector<int> g[N];   int n;   int col[N];   int cnt[N][N];   void gen(int v) {     if (v == n) {       for (int i = 0; i < n; i++)         for (int u : g[i]) {           int t = col[i];           int z = col[u];           cnt[min(t, z)][max(t, z)] = 1;         }       int cur = 0;       for (int i = 0; i < 6; i++)         for (int j = 0; j < 6; j++) {           cur += cnt[i][j];           cnt[i][j] = 0;         }       mx = max(mx, cur);       return;     }     for (int i = 0; i < 6; i++) {       col[v] = i;       gen(v + 1);     }   }   int solve() {     if (!(cin >> n)) return 1;     int m;     cin >> m;     for (int i = 0; i < n; i++) g[i].clear();     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       x--;       y--;       g[x].push_back(y);       g[y].push_back(x);     }     mx = 0;     gen(0);     cout << mx << endl;     return 0;   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int TET = 1e9;     for (int i = 1; i <= TET; i++) {       if (solve()) break;       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   inline long long rd() {     long long x = 0;     bool f = 0;     char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) f = 1;       c = getchar();     }     while (isdigit(c)) {       x = (x << 1) + (x << 3) + (c ^ 48);       c = getchar();     }     return f ? -x : x;   }   long long n, m, l[1000010 << 1], f[1000010 << 1], hd[1000010];   int main() {     n = rd();     m = rd();     for (register long long i = 1; i <= n; ++i) l[i] = l[n + i] = rd();     for (register long long i = 1; i <= (n << 1); ++i) l[i] += l[i - 1];     while (m--) {       long long ptr = 0, len = rd();       for (register long long i = n + 1; i <= (n << 1); ++i) {         while (l[i] - l[ptr] > len) ++ptr;         f[i] = f[ptr] + 1;         hd[i - n] = (i == ptr ? i : (ptr <= n ? ptr : hd[ptr - n]));         if (i - hd[i - n] >= n) {           printf( %I64d n , f[i]);           break;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<long long, long long> > v, par;   long long QN, cmd, nums = 0;   map<long long, long long> ans;   long long solve(long long l, long long r, long long x) {     long long st = l, en = r;     while (st <= en) {       long long mid = (st + en) / 2;       if (x < v[mid].first) {         en = mid - 1;         continue;       }       if (x > v[mid].second) {         st = mid + 1;         continue;       }       if (v[mid].first == v[mid].second && par[mid].first == -1)         return ans[v[mid].first];       x = x - v[mid].first + 1;       x %= par[mid].first;       if (x == 0) x = par[mid].first;       return solve(l, mid, x);     }   }   long long x, l, r;   int main() {     cin >> QN;     while (QN--) {       cin >> cmd;       if (cmd == 1) {         cin >> x;         ans[++nums] = x;         v.push_back(make_pair(nums, nums));         par.push_back(make_pair(-1, -1));       } else {         cin >> l >> r;         nums++;         v.push_back(make_pair(nums, nums + l * r - 1));         nums = nums + l * r - 1;         par.push_back(make_pair(l, -1));       }     }     cin >> QN;     while (QN--) {       cin >> x;       cout << solve(0, v.size() - 1, x) <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   void imp() {     cout << -1;     exit(0);   }   double mn = 0, mx = 2e9;   void solve(int x, int vx, int x1, int x2) {     if (vx == 0) {       if (x1 < x && x < x2) return;       imp();     }     if (vx < 0) {       mn = std::max(mn, (x2 - x) / (double)vx);       mx = std::min(mx, (x1 - x) / (double)vx);     } else {       mn = std::max(mn, (x1 - x) / (double)vx);       mx = std::min(mx, (x2 - x) / (double)vx);     }     if (mn >= mx) imp();   }   int main() {     int n, x1, x2, y1, y2;     cin >> n >> x1 >> y1 >> x2 >> y2;     for (int i = 0; i < n; ++i) {       int x, y, vx, vy;       cin >> x >> y >> vx >> vy;       solve(x, vx, x1, x2);       solve(y, vy, y1, y2);     }     cout << setprecision(17) << mn;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     cin >> n;     vector<long long> arr(n + 1);     for (long long i = 0; i < n; i++) cin >> arr[i];     long long minute;     long long mn = 100000000000;     long long ans = 0;     long long x;     for (long long i = 0; i < n; i++) {       x = arr[i];       if ((x - i) <= 0)         minute = i;       else {         minute = n * ceil((x - i) / (long double)n);         minute += i;       }       if (minute < mn) {         mn = minute;         ans = i;       }     }     cout << ans + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int k1, k2, k3, count[6], min_elt = INT_MAX;     memset(count, 0, sizeof(count));     scanf( %d%d%d , &k1, &k2, &k3);     count[k1 >= 5 ? 5 : k1]++;     count[k2 >= 5 ? 5 : k2]++;     count[k3 >= 5 ? 5 : k3]++;     min_elt = min(k3, min(k1, k2));     if (min_elt >= 4)       printf( NO n );     else if (min_elt == 1)       printf( YES n );     else if (min_elt == 2) {       if (count[2] >= 2)         printf( YES n );       else if (count[4] == 2)         printf( YES n );       else         printf( NO n );     } else if (count[3] == 3)       printf( YES n );     else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long a, b, c, r, d, t, x1 = 0, x2 = 0;     cin >> t;     while (t--) {       cin >> a >> b >> c >> r;       d = 0;       if (a > b) {         swap(a, b);       }       x1 = c - r;       x2 = c + r;       if (x2 < a || x1 > b) {         d = b - a;       } else if (x1 <= a && x2 >= b) {         d = 0;       } else {         if (a <= x1) {           d += x1 - a;         }         if (b >= x2) {           d += b - x2;         }       }       cout << d << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005, M = 50 * N + 5;   int n, m, k, ans, X[N], Y[N];   int cnt = 0, hed[M], to[M], nxt[M];   bool vis[M];   char s[55];   int f[M];   int dfn[M], low[M], bl[M], lb = 0, sum[M];   int sta[M], top = 0, idx = 0;   inline int g(int u, int d) { return u + d * n; }   inline int Min(int x, int y) { return x < y ? x : y; }   inline int Max(int x, int y) { return x > y ? x : y; }   inline void add(int x, int y) {     to[++cnt] = y, nxt[cnt] = hed[x], hed[x] = cnt;   }   void tarjan(int u) {     dfn[u] = low[u] = ++idx, sta[++top] = u;     for (int i = hed[u]; i; i = nxt[i]) {       int v = to[i];       if (!dfn[v])         tarjan(v), low[u] = Min(low[u], low[v]);       else if (!bl[v])         low[u] = Min(low[u], dfn[v]);     }     if (dfn[u] == low[u]) {       for (bl[u] = ++lb, sum[lb] += vis[u]; sta[top] != u; --top)         bl[sta[top]] = lb, sum[lb] += vis[sta[top]];       --top;     }   }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = (1), ied = (m); i <= ied; i++) {       scanf( %d%d , &X[i], &Y[i]);       for (int j = (0), jed = (k - 2); j <= jed; j++)         add(g(X[i], j), g(Y[i], j + 1));       add(g(X[i], k - 1), g(Y[i], 0));     }     for (int i = (1), ied = (n); i <= ied; i++) {       scanf( %s , s);       for (int j = (0), jed = (k - 1); j <= jed; j++) vis[g(i, j)] = s[j] -  0 ;     }     for (int i = (1), ied = (n * k); i <= ied; i++)       if (!dfn[i]) tarjan(i);     for (int i = (1), ied = (n); i <= ied; i++)       for (int j = (0), jed = (k - 1); j <= jed; j++) {         if (!vis[g(i, j)]) continue;         for (int h = (j + 1), hed = (k - 1); h <= hed; h++)           if (vis[g(i, h)] && bl[g(i, h)] == bl[g(i, j)])             vis[g(i, h)] = 0, --sum[bl[g(i, j)]];       }     memset(hed, 0, sizeof(hed)), cnt = 0;     for (int i = (1), ied = (m); i <= ied; i++) {       for (int j = (0), jed = (k - 2); j <= jed; j++)         if (bl[g(X[i], j)] != bl[g(Y[i], j + 1)])           add(bl[g(X[i], j)], bl[g(Y[i], j + 1)]);       if (bl[g(X[i], k - 1)] != bl[g(Y[i], 0)])         add(bl[g(X[i], k - 1)], bl[g(Y[i], 0)]);     }     memset(f, -0x3f3f3f3f, sizeof(f)), f[bl[g(1, 0)]] = 0;     for (int i = (lb), ied = (1); i >= ied; i--) {       f[i] += sum[i];       ans = Max(ans, f[i]);       for (int j = hed[i]; j; j = nxt[j]) f[to[j]] = Max(f[to[j]], f[i]);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = 100000 + 5, inf = 2005120699;   const long long INF = 9200512069999999999ll;   int reads() {     int ans = 0;     bool fu = 0;     char ch = getchar();     while ((ch >  9  || ch <  0 ) && ch !=  - ) ch = getchar();     if (ch ==  - ) fu = 1, ch = getchar();     while (ch <=  9  && ch >=  0 )       ans = (ans << 3) + (ans << 1) + (ch ^ 48), ch = getchar();     if (fu) ans *= -1;     return ans;   }   long long a[maxN];   inline long long abss(long long x) { return x < 0 ? -x : x; }   int main() {     int n, c;     long long ans = INF, tem, o;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %lld , &a[i]);     }     sort(a + 1, a + 1 + n);     c = (int)pow((((1ll << 62) - 1) << 1) + 1, 1.0 / n);     for (long long i = 0ll; i <= c; ++i) {       tem = 0;       o = 1ll;       for (int j = 1; j <= n; ++j) {         tem += abss(a[j] - o);         o *= i;         if (o > (1ll << 50)) {           tem = INF;           break;         }       }       ans = min(ans, tem);     }     printf( %lld , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   int n;   int a[105];   int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     int mx = 0;     for (int i = 1; i <= n; i++) {       int tmp = 0;       for (int j = i; j <= n; j++) {         tmp ^= a[j];         mx = max(mx, tmp);       }     }     cout << mx << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Node {     Node *ch[26];     Node() {       for (int i = 0; i < 26; i++) ch[i] = NULL;     }   } * Root;   struct Trie {     void init() { Root = new Node(); }     void ins(Node *t, string s) {       for (int i = 0; i < s.size(); i++) {         int id = s[i] -  a ;         if (t->ch[id] == NULL) {           Node *p = new Node();           t->ch[id] = p;         }         t = t->ch[id];       }     }     void del(Node *t) {       for (int i = 0; i < 26; i++)         if (t->ch[i] != NULL) del(t->ch[i]);       free(t);     }     bool win(Node *t) {       for (int i = 0; i < 26; i++)         if (t->ch[i] != NULL)           if (!win(t->ch[i])) return true;       return false;     }     bool lose(Node *t) {       bool flag = 0;       for (int i = 0; i < 26; i++)         if (t->ch[i] != NULL) {           flag = true;           if (!lose(t->ch[i])) return true;         }       return false || !flag;     }   };   const int Maxn = 1e5 + 8;   char s[Maxn];   int main() {     Trie T;     T.init();     int n, k;     scanf( %d %d , &n, &k);     for (int i = 0; i < n; i++) {       scanf( %s , s);       T.ins(Root, s);     }     bool win = T.win(Root), lose = T.lose(Root);     if (win && lose)       puts( First );     else {       if (win) {         if (k & 1)           puts( First );         else           puts( Second );       } else         puts( Second );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 5555, Inf = 1e9;   int n, m;   vector<int> G[Maxn];   vector<pair<int, int> > V1[Maxn], V2[Maxn];   int d[Maxn][Maxn];   void bfs(int idx) {     for (int i = 1; i <= n; i++) d[idx][i] = i == idx ? 0 : Inf;     queue<int> q;     q.push(idx);     while (!q.empty()) {       int u = q.front();       q.pop();       for (int i = 0; i < G[u].size(); i++) {         int v = G[u][i];         if (d[idx][v] == Inf) {           d[idx][v] = d[idx][u] + 1;           q.push(v);         }       }     }     for (int i = 1; i <= n; i++) {       if (i != idx && d[idx][i] != Inf)         V1[idx].push_back(pair<int, int>(d[idx][i], i)),             V2[i].push_back(pair<int, int>(d[idx][i], idx));     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       int u, v;       scanf( %d%d , &u, &v);       G[u].push_back(v);     }     for (int i = 1; i <= n; i++) {       bfs(i);     }     for (int i = 1; i <= n; i++) {       sort(V1[i].begin(), V1[i].end(), greater<pair<int, int> >());       sort(V2[i].begin(), V2[i].end(), greater<pair<int, int> >());     }     int ans = -1;     vector<int> rep(4, 0);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         if (i == j || d[i][j] == Inf) continue;         for (int k1 = 0; k1 < 3 && k1 < V2[i].size(); k1++) {           for (int k2 = 0; k2 < 3 && k2 < V1[j].size(); k2++) {             if (V2[i][k1].second != j && V1[j][k2].second != i &&                 V2[i][k1].second != V1[j][k2].second) {               int tmp = V2[i][k1].first + V1[j][k2].first + d[i][j];               if (ans < tmp) {                 ans = tmp;                 rep[0] = V2[i][k1].second, rep[1] = i;                 rep[2] = j, rep[3] = V1[j][k2].second;               }             }           }         }       }     }     for (int i = 0; i < 4; i++) printf( %d  , rep[i]);   }
#include<bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using pint = pair<int, int>;   using pll = pair<ll, ll>;      int main(){       int t; cin >> t;       while(t--){           int k, n, m; cin >> k >> n >> m;           queue<int> a, b;           int size = k;           for(int i = 0; i < n; i++){               int x; cin >> x;               a.push(x);           }           for(int j = 0; j < m; j++){               int x; cin >> x;               b.push(x);           }           bool ok = true;           vector<int> ans;           while(!a.empty() && !b.empty()){               int op;               if(a.front() < b.front()){                   op = a.front();                   a.pop();               }               else{                   op = b.front();                   b.pop();               }               if(op == 0)size++;               else{                   if(op > size){                       ok = false;                       break;                   }               }               ans.push_back(op);           }           if(ok){               int op;               while(!a.empty()){                   op = a.front();                   a.pop();                   if(op == 0)size++;                   else{                       if(op > size){                           ok = false;                           break;                       }                   }                   ans.push_back(op);               }               while(!b.empty()){                   op = b.front();                   b.pop();                   if(op == 0)size++;                   else{                       if(op > size){                           ok = false;                           break;                       }                   }                   ans.push_back(op);               }           }           if(ok){               for(int i = 0; i < ans.size(); i++)cout << ans[i] <<    ;               cout << endl;           }           else{               cout << -1 << endl;           }       }   }
#include <bits/stdc++.h>   using namespace std;   using namespace std::chrono;   template <typename A>   ostream &operator<<(ostream &cout, vector<A> const &v);   template <typename A, typename B>   ostream &operator<<(ostream &cout, pair<A, B> const &p) {     return cout <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <typename A>   ostream &operator<<(ostream &cout, vector<A> const &v) {     cout <<  [ ;     for (int i = 0; i < v.size(); i++) {       if (i) cout <<  ,  ;       cout << v[i];     }     return cout <<  ] ;   }   template <typename A, typename B>   istream &operator>>(istream &cin, pair<A, B> &p) {     cin >> p.first;     return cin >> p.second;   }   mt19937 rng(steady_clock::now().time_since_epoch().count());   void usaco(string filename) {     freopen((filename +  .in ).c_str(),  r , stdin);     freopen((filename +  .out ).c_str(),  w , stdout);   }   const long double pi = 3.14159265358979323846;   long long n, m, k, q, l, r, x, y, z;   long long a[1000005];   long long b[1000005];   long long c[1000005];   string second, t;   long long ans = 0;   long long solve2() {     long long r = 0, best = 0;     for (long long i = 0; i < (n - 1); ++i) {       r += b[i];       best = max(best, r);       if (r < 0) r = 0;     }     return best;   }   void solve(int tc) {     cin >> n;     for (int ele = 0; ele < n; ele++) cin >> a[ele];     ;     for (long long i = 0; i < (n - 1); ++i) {       b[i] = abs(a[i] - a[i + 1]);       if (i % 2) b[i] = -b[i];     }     ans = 0;     ans = max(ans, solve2());     for (long long i = 0; i < (n - 1); ++i) b[i] = -b[i];     ans = max(ans, solve2());     cout << ans <<   n ;   }   int main() {     { ios_base::sync_with_stdio(false); }     {       cin.tie(NULL);       cout.tie(NULL);     }     int tc = 1;     for (int t = 0; t < tc; t++) solve(t);   }