malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 123456;   char buffer[N];   string solve(string s, int k) {     const int n = s.size();     sort(s.begin(), s.end());     string res;     int ptr = 0;     while (ptr < n) {       int p = ptr;       char mini =  ~ ;       char maxi =   0 ;       assert(mini >  z  && maxi <  a );       for (int i = 0; i < k && ptr < n; i++) {         mini = min(mini, s[ptr]);         maxi = max(maxi, s[ptr]);         ptr++;       }       if (!res.empty()) {         if (mini == s.back()) {           res += mini;         } else {           res += s.substr(p);           break;         }       } else {         if (mini == maxi) {           res += mini;         } else {           res += maxi;           break;         }       }     }     return res;   }   string brute_force(string s, int k) {     assert(k == 2);     int n = s.size();     string res =  ~~~ ;     sort(s.begin(), s.end());     for (int i = 0; i < (1 << n); i++) {       string left, right;       for (int j = 0; j < n; j++) {         if (i & (1 << j)) {           left += s[j];         } else {           right += s[j];         }       }       if (left.empty() || right.empty()) {         continue;       }       res = min(res, max(left, right));     }     return res;   }   void test() {     assert(solve( ccbbb , 2) ==  bbcc );     assert(solve( bbabc , 2) ==  b );     assert(solve( bababc , 2) ==  abbbc );     assert(solve( babab , 2) ==  abb );     assert(solve( baba , 2) ==  ab );     assert(solve( baacb , 2) ==  abbc );     assert(solve( baacb , 3) ==  b );     assert(solve( aaaaa , 3) ==  aa );     assert(solve( aaxxzz , 4) ==  x );     assert(solve( phoenix , 1) ==  ehinopx );     assert(solve( phoenix , 2) ==  h );     for (int i = 0; i < 100; i++) {       int n = 10;       string s;       for (int j = 0; j < n; j++) {         s += rand() % 5 +  a ;       }       assert(brute_force(s, 2) == solve(s, 2));     }   }   int main() {     int T;     cin >> T;     int n, k;     while (T--) {       scanf( %d%d , &n, &k);       scanf( %s , buffer);       puts(solve(buffer, k).c_str());     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, fl;     cin >> t;     while (t--) {       fl = 1;       int a, b, c, d, x, y, x1, y1, x2, y2;       cin >> a >> b >> c >> d >> x >> y >> x1 >> y1 >> x2 >> y2;       int p = x - a + b, q = y - c + d;       if ((p >= x1 && p <= x2) && (x1 < x2 || a + b == 0))         ;       else         fl = 0;       if ((q >= y1 && q <= y2) && (y1 < y2 || c + d == 0))         ;       else         fl = 0;       if (fl)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int N;     cin >> N;     string s;     cin >> s;     int current = N;     int count = 0;     while (true) {       if (current >= s.size()) break;       set<char> vs;       vs.insert(s[current - 1]);       vs.insert(s[current - 2]);       vs.insert(s[current - 3]);       if (vs.size() == 1) count++;       current += N;     }     cout << count;   }
#include <bits/stdc++.h>   using namespace std;   int x[] = {-1, -1, 1, 1};   int y[] = {-1, 1, -1, 1};   int main() {     int i, j, k, l, m = 0, n, cnt = 0;     cin >> n;     char a[n + 10][n + 10];     for (i = 0; i < n; i++)       for (j = 0; j < n; j++) cin >> a[i][j];     for (i = 1; i < n - 1; i++)       for (j = 1; j < n - 1; j++) {         if (a[i][j] ==  X ) {           m = 0;           for (k = 0; k < 4; k++) {             if (a[i + x[k]][j + y[k]] ==  X ) m++;           }           if (m == 4) cnt++;         }       }     cout << cnt << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long int n, h, A, B, k, S, T, ta, tb, fa, fb;     cin >> n >> h >> A >> B >> k;     for (long int i = 0; i < k; i++) {       S = 0;       cin >> ta >> fa >> tb >> fb;       if (ta == tb) {         S = abs(fa - fb);       } else {         if (fa < A) {           S += abs(A - fa);           T = A;         } else if (fa > B) {           S += abs(fa - B);           T = B;         } else {           S += 0;           T = fa;         }         S += abs(ta - tb);         S += abs(fb - T);       }       cout << S << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long power(long long a, long long b, long long p) {     if (a == 0) return 0;     long long res = 1;     a %= p;     while (b > 0) {       if (b & 1) res = (res * a) % p;       b >>= 1;       a = (a * a) % p;     }     return res;   }   int32_t main() {     std::ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       long long ar[n];       for (long long i = 0; i < n; i++) cin >> ar[i];       sort(ar, ar + n);       for (long long i = n - 1; i >= 0; i--) cout << ar[i] <<    ;       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 10;   const int INF = 1.01e9;   const long long INF18 = 1.01e18;   int main() {     int n;     long long C;     scanf( %d%lld , &n, &C);     vector<long long> a(n);     vector<long long> b(n - 1);     for (int i = 0; i < (n); i++) {       scanf( %lld , &a[i]);       if (i + 1 != n) {         scanf( %lld , &b[i]);       }     }     b.push_back(0);     vector<long long> c(n);     set<pair<long long, int>> q;     long long shift = 0;     vector<long long> hist(n);     int cur = 0;     vector<long long> prefB;     prefB.push_back(0);     for (int i = 0; i < n; i++) {       prefB.push_back(prefB.back() + a[i] + b[i]);     }     vector<long long> prefC;     prefC.push_back(0);     for (int i = 0; i < n; i++) {       if (i > 0) {         long long diff = b[i - 1] - c[i - 1];         shift += diff;         q.insert({-shift, i});         hist[i] = -shift;       }       if (i == 0) {         q.insert({0, i});         hist[i] = 0;       }       for (; cur < i && (prefB[i] - prefB[cur]) + a[i] > C;) {         assert(q.erase({hist[cur], cur}));         cur++;       }       long long val = 0;       if (!q.empty()) {         val = max(q.rbegin()->first + shift, val);       }       val = max(           min(prefB[i] + a[i], C) - ((prefC[i] - prefC[max(0, cur - 1)]) + a[i]),           val);       c[i] = val;       prefC.push_back(prefC.back() + a[i] + c[i]);     }     long long answer = 0;     for (auto x : c) {       answer += x;     }     for (auto x : a) {       answer += min(x, C);     }     cout << answer << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int x[1000 + 1], y[1000 + 1];   void solve() {     int n;     cin >> n;     for (int i = 0; i < n + 1; i++) cin >> x[i] >> y[i];     int res = 0;     for (int i = 1; i < n; i++) {       double X = x[i], Y = y[i];       int cnt = 0;       if (x[i - 1] == x[i]) {         if (y[i] > y[i - 1])           Y += 0.2;         else           Y -= 0.2;         for (int j = 0; j < n; j++)           if (x[j] == x[j + 1] && x[j] < x[i] && min(y[j], y[j + 1]) < Y &&               Y < max(y[j], y[j + 1]))             cnt++;         if (cnt % 2 == 1) res++;       } else {         if (x[i] > x[i - 1])           X += 0.2;         else           X -= 0.2;         for (int j = 0; j < n; j++)           if (y[j] == y[j + 1] && y[j] < y[i] && min(x[j], x[j + 1]) < X &&               X < max(x[j], x[j + 1]))             cnt++;         if (cnt % 2 == 1) res++;       }     }     cout << res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     int fac[4];     fac[0] = 1;     fac[1] = 1;     fac[2] = 1;     for (int i = 3; i < 10; i++) {       int y1213 = 100;       int n1113;       vector<int> ans112;       int tempor = 100;     }     while (t--) {       int n;       cin >> n;       long long res = 1;       for (int i = 0; i < 10; i++) {         int j661;         int k771;         string k772;       }       int y1213 = 100;       int n1113;       long long modu = 1e9 + 7;       for (int i = 2 * n; i >= 3; i--) {         res = (res * i) % modu;       }       vector<int> ans1222;       int tem33por = 100;       for (int i = 0; i < 10; i++) {         int j12;         int k15;         string k277;       }       res = res % modu;       cout << res <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> v;     for (int i = 1; i * i <= n; i++) {       if (n % i == 0) {         v.push_back(i);         if (i != n / i) {           v.push_back(n / i);         }       }     }     sort(v.begin(), v.end());     int ans = 0;     for (int i = v.size() - 1; i > -1; i--) {       int p = v[i];       int q = 0;       while (p % 2 == 0) {         q++;         p /= 2;       }       int r = pow(2, q + 1) + 0.5;       r--;       if (p == r) {         ans = v[i];         break;       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 20;   long long int c[15][maxn];   int lowbit(int x) { return x & (-x); }   void upDate(int pos, long long int val, int which) {     while (pos <= maxn - 20) {       c[which][pos] += val;       pos += lowbit(pos);     }   }   long long int ask(int pos, int which) {     long long int ans = 0;     while (pos) {       ans += c[which][pos];       pos -= lowbit(pos);     }     return ans;   }   long long int dp[maxn][15];   void work() {     int n, k;     cin >> n >> k;     for (int i = 1; i <= n; ++i) {       int x;       cin >> x;       dp[i][1] = 1;       for (int j = 2; j <= k + 1; ++j) {         dp[i][j] += ask(x - 1, j - 1);       }       for (int j = 1; j <= k + 1; ++j) {         upDate(x, dp[i][j], j);       }     }     long long int ans = 0;     for (int i = 1; i <= n; ++i) ans += dp[i][k + 1];     cout << ans << endl;   }   int main() {     ios::sync_with_stdio(false);     work();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, v, a, b, x;     cin >> n >> v;     int mp[3002] = {0};     for (int i = 0; i < n; i++) {       cin >> a >> b;       mp[a] += b;     }     int prev = 0, ans = 0;     for (int i = 1; i <= 3001; i++) {       int now = mp[i];       if (now + prev <= v) {         ans += (now + prev);         prev = 0;       } else {         ans += v;         prev = now - max(v - prev, 0);       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     node *c[3];     bool flag;   };   node *root;   void insert(string a) {     node *cur = root;     for (int i = 0; i < a.size(); i++) {       if (!(cur->c[a[i] -  a ])) cur->c[a[i] -  a ] = new node();       cur = cur->c[a[i] -  a ];     }     cur->flag = 1;   }   string s;   bool solve(node *root, int pos, int diff) {     if (!root) return 0;     if (diff > 1) return 0;     if (pos == s.size()) return diff == 1 && root->flag;     int ret = 0;     for (int i = 0; i < 3; i++)       ret = ret || solve(root->c[i], pos + 1, (s[pos] -  a  != i) + diff);     return ret;   }   int main() {     int n, m;     cin >> n >> m;     root = new node();     for (int i = 0; i < n; i++) {       string s;       cin >> s;       insert(s);     }     for (int i = 0; i < m; i++) {       cin >> s;       if (solve(root, 0, 0))         cout <<  YES n ;       else         cout <<  NO n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int INF = int(1e9);   const int MAX = 200;   int num[MAX], mixt[MAX];   int n;   bool substring(string &a, string &b) {     for (int i = 0; i < n; i++) {       bool found = true;       for (int j = 0; j < 3; j++) {         if (a[i + j] != b[j]) {           found = false;         }       }       if (found) {         return true;       }     }     return false;   }   int main() {     ios_base::sync_with_stdio(false);     string s;     cin >> s;     n = s.size();     string t =  ABC ;     do {       if (substring(s, t)) {         cout <<  Yes n ;         return 0;       }     } while (next_permutation(t.begin(), t.end()));     cout <<  No n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long mod(long long a, long long b) {     if (a % b < 0) {       return a % b + b;     }     return a % b;   }   long long mod_exp(long long a, long long b, long long c) {     long long res = 1;     a = a % c;     while (b > 0) {       if (b % 2 == 1) {         res = (res * a) % c;       }       b /= 2;       a = (a * a) % c;     }     return res;   }   long long mymod(long long a, long long b) { return ((a % b) + b) % b; }   bool prime[200001];   void SieveOfEratosthenes() {     memset(prime, true, sizeof(prime));     prime[1] = false;     for (int p = 2; p * p <= 200000; p++) {       if (prime[p] == true) {         for (int i = p * p; i <= 200000; i += p) prime[i] = false;       }     }     return;   }   long long powe[200005];   void power() {     powe[0] = 1;     for (long long i = 1; i < 200005; i++) {       powe[i] = mymod(2 * powe[i - 1], 1000000007);     }   }   long long gcdExtended(long long, long long, long long *, long long *);   long long modInverse(long long a, long long m) {     long long x, y;     long long g = gcdExtended(a, m, &x, &y);     long long res = (x % m + m) % m;     return res;   }   long long gcdExtended(long long a, long long b, long long *x, long long *y) {     if (a == 0) {       *x = 0, *y = 1;       return b;     }     long long x1, y1;     long long gcd = gcdExtended(b % a, a, &x1, &y1);     *x = y1 - (b / a) * x1;     *y = x1;     return gcd;   }   long long n;   struct node {     vector<long long> adj;     long long colour;   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n;     cin >> n;     string second;     cin >> second;     long long count[36001] = {0};     for (long long i = 0; i < second.size(); i++) {       long long sum = 0;       for (long long j = i; j < second.size(); j++) {         sum += (second[j] - 48);         if (sum <= 36000) {           count[sum]++;         } else           break;       }     }     vector<long long> factors;     for (long long i = 1; i < sqrt(n); i++) {       if (n % i == 0) {         factors.push_back(i);         factors.push_back(n / i);       }     }     if ((long long)(sqrt(n)) * (long long)(sqrt(n)) == n)       factors.push_back((long long)(sqrt(n)));     long long ans = 0;     if (n == 0) {       long long p = second.size();       long long ways0 = count[0];       long long waysn0 = (p * (p + 1)) / 2 - count[0];       ans = 2 * ways0 * waysn0 + ways0 * ways0;       cout << ans << endl;       exit(0);     }     for (auto x : factors) {       if (x <= 36000 && (n / x) <= 36000) ans += (count[x] * count[n / x]);     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double h, luas, top;   int n;   double f(double x) { return ((x / h + top / h) * (x - top)) / 2; }   double binser(double l, double r) {     double ret = 0;     for (int i = 1; i <= 100; i++) {       double mid = (l + r) / 2;       if (f(mid) >= luas) {         ret = mid;         r = mid;       } else         l = mid;     }     return ret;   }   int main() {     cin >> n >> h;     luas = h / (2 * n);     for (int i = 1; i <= n - 1; i++) {       top = binser(0, h);       cout << fixed << setprecision(6) << top;       if (i < n - 1) cout <<    ;     }     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long n, H;   unsigned long long bound[60];   unsigned long long cnt(unsigned long long p, unsigned long long h,                          unsigned long long n) {     if (h == 1) {       if (p == 0 && n == 1) return 1;       if (p == 1 && n == 2) return 1;       return 2;     }     unsigned long long res = 1;     if (n > bound[h - 1] && p == 0 || n <= bound[h - 1] && p == 1)       res += 2 * bound[h - 1] - 1;     if (n > bound[h - 1])       res += cnt(0, h - 1, n - bound[h - 1]);     else       res += cnt(1, h - 1, n);     return res;   }   int main() {     cin >> H >> n;     bound[0] = 1;     for (unsigned long long i = 0; i < H; ++i) bound[i + 1] = 2 * bound[i];     cout << cnt(0, H, n);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   std::pair<T, U> operator+(const std::pair<T, U> &l, const std::pair<T, U> &r) {     return {l.first + r.first, l.second + r.second};   }   typedef void (*callback_function)(void);   const long long INF64 = 1e18;   const long long INF32 = 1e9;   long long dist(pair<long long, long long> &a, pair<long long, long long> &b) {     return abs(a.first - b.first) + abs(a.second - b.second);   }   long long dist(pair<long long, long long> &a) {     return abs(a.first) + abs(a.second);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie();     {       long long n;       string s;       cin >> n >> s;       long long res = 1;       bool first[2] = {true, true};       char hv[2];       string HV[2] = { LR ,  DU };       for (long long i = (0); i < (s.length()); i++) {         for (long long j = (0); j < (2); j++) {           if (HV[j].find(s[i]) != string::npos) {             if (first[j]) {               first[j] = false;               hv[j] = s[i];             } else if (hv[j] != s[i]) {               first[1 - j] = true;               res++;               hv[j] = s[i];             }             break;           }         }       }       cout << res << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int gcd(long long int a, long long int b) {     if (a < b) swap(a, b);     if (b == 0)       return a;     else       gcd(b, a % b);   }   int main() {     long long int ncr[62][62];     for (long long int i = 0; i < 62; i++) {       ncr[i][0] = 1;       ncr[i][i] = 1;     }     for (long long int i = 1; i < 62; i++) {       for (long long int j = 1; j <= i; j++) {         ncr[i][j] = ncr[i - 1][j - 1] + ncr[i - 1][j];       }     }     long long int n, m, t, ans = 0;     cin >> n >> m >> t;     for (long long int i = 4; i <= t - 1; i++) {       ans += (ncr[n][i] * ncr[m][t - i]);     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long n, q;     cin >> n >> q;     long i, j;     int** a = new int*[2];     for (i = 0; i < 2; ++i) {       a[i] = new int[n + 2];       for (j = 0; j < n + 2; j++) {         a[i][j] = 0;       }     }     long res = 0;     long x, y;     while (q--) {       cin >> x >> y;       if (a[x - 1][y] == 0) {         a[x - 1][y] = 1;         for (i = -1; i <= 1; i++) {           if (a[2 - x][y + i] == 1) res++;         }       } else {         a[x - 1][y] = 0;         for (i = -1; i <= 1; i++) {           if (a[2 - x][y + i] == 1) {             res--;           }         }       }       if (res == 0)         cout <<  Yes  << endl;       else         cout <<  No  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define ll long long int   #define mp make_pair   //ll const MAX_N=100000;   ll const MAX_A = (ll)1e9 + 1;   const ll MOD = 1e9 + 7;               void solve()   {    ll n, l,u,v,w,n1,n2,n3,h,sum=0,suma=0,sumb=0,sumc=0,minia=MAX_A,minib=MAX_A,minic=MAX_A, ansa,ansb,ansc;    cin>>n1>>n2>>n3;    ll a[n1],b[n2],c[n3];    vector<ll> pos;    for(auto & i: a)    {     cin>>i;     minia=min(i,minia);     suma+=i;     }    for(auto & i: b)    {     cin>>i;     minib=min(i,minib);     sumb+=i;     }    for(auto & i: c)    {     cin>>i;     minic=min(i,minic);     sumc+=i;    }    sum=suma+sumb+sumc;    sort(a,a+n1);    sort(b,b+n2);    sort(c,c+n3);    ansa=sum-2*minia-2*min(min(minib,minic),suma-minia);    ansb=sum-2*minib-2*min(min(minia,minic),sumb-minib);    ansc=sum-2*minic-2*min(min(minib,minia),sumc-minic);           cout<<max(ansa,max(ansb,ansc))<<endl;   }      int main()   {    //freopen( luka.in , r , stdin);    ios_base::sync_with_stdio(false);       cin.tie(NULL);    ll t = 1;    //cin >> t;    for (ll i = 1; i <= t; i++)    {     solve();    }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   priority_queue<int, vector<int>, greater<int> > q;   int main() {     int n, m;     while (cin >> n) {       long long sum = 0;       if (!q.empty()) {         q.pop();       }       while (n--) {         scanf( %d , &m);         if (!q.empty() && m > q.top()) {           sum += m - q.top();           q.pop();           q.push(m);           q.push(m);         } else {           q.push(m);         }       }       cout << sum << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     char str[100];     int n, z;     cin >> z;     while (z--) {       cin >> str;       n = strlen(str);       if (n > 10) {         cout << str[0] << n - 2 << str[n - 1] << endl;       } else         cout << str << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long v1, v2, v3, vm;     long long u1, u2, u3;     cin >> v1 >> v2 >> v3 >> vm;     for (u1 = v1; u1 <= 2 * v1; u1++) {       for (u2 = v2; u2 <= 2 * v2; u2++) {         for (u3 = v3; u3 <= 2 * v3; u3++) {           if (vm <= u3 && vm <= u2 && vm <= u1 && 2 * vm >= u3 && 2 * vm < u2 &&               2 * vm < u1 && u1 > u2 && u2 > u3 && u1 > u3) {             cout << u1 <<   n  << u2 <<   n  << u3;             return 0;           }         }       }     }     cout <<  -1 ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     double l, r, x, y, k, i, f = 0;     cin >> l >> r >> x >> y >> k;     for (i = x; i <= y; i++) {       if ((i * k) >= l && (i * k) <= r) {         f = 1;         break;       } else         continue;     }     if (f == 1)       cout <<  YES n ;     else       cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, m, x;     cin >> n >> m;     vector<long long> vPref(n), vSuf(n), vTot(n), vCen(n);     for (int i(0), ThkMk(n); i < ThkMk; ++i) {       cin >> x;       vector<long long> v(x);       vector<long long> prefix(x);       vector<long long> suffix(x);       vector<long long> dp(x);       long long curMx, curSuf, curPref;       for (int i(0), ThkMk(x); i < ThkMk; ++i) {         cin >> v[i];         dp[i] = prefix[i] = v[i];         if (i > 0) {           prefix[i] += prefix[i - 1];           dp[i] += max(0LL, dp[i - 1]);           curMx = max(curMx, dp[i]);         } else           curMx = v[0];       }       suffix[x - 1] = v[x - 1];       curSuf = suffix[0];       curPref = prefix[0];       for (int i = x - 2; i >= 0; --i) suffix[i] += suffix[i + 1] + v[i];       for (int i(0), ThkMk(x); i < ThkMk; ++i) {         curSuf = max(curSuf, suffix[i]);         curPref = max(curPref, prefix[i]);       }       vPref[i] = curPref;       vSuf[i] = curSuf;       vTot[i] = suffix[0];       vCen[i] = curMx;     }     long long ans = -1e18;     long long prev = 0;     for (int i(0), ThkMk(m); i < ThkMk; ++i) {       cin >> x;       --x;       ans = max(ans, vCen[x]);       ans = max(ans, prev + vPref[x]);       prev = max({0LL, prev + vTot[x], vSuf[x]});     }     cout << ans <<   n ;     return 0;   }