malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n;     cin >> n;     long long int a[n][2];     for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1];     long long int l[n][2], r[n][2];     long long int mi = a[0][0];     long long int mx = a[0][1];     l[0][0] = mi;     l[0][1] = mx;     if (n == 1) {       cout << a[0][1] - a[0][0];       return 0;     }     for (int i = 1; i < n; i++) {       if (l[i - 1][0] == -1) {         l[i][0] = -1;         l[i][1] = -1;         continue;       }       long long int x, y;       x = max(a[i][0], l[i - 1][0]);       y = min(a[i][1], l[i - 1][1]);       if (y - x < 0) {         l[i][0] = -1;         l[i][1] = -1;       } else {         l[i][0] = x;         l[i][1] = y;       }     }     mx = a[n - 1][1];     mi = a[n - 1][0];     r[n - 1][0] = mi;     r[n - 1][1] = mx;     for (int i = n - 2; i >= 0; i--) {       if (r[i + 1][0] == -1) {         r[i][0] = -1;         r[i][1] = -1;         continue;       }       long long int x, y;       x = max(a[i][0], r[i + 1][0]);       y = min(a[i][1], r[i + 1][1]);       if (y - x < 0) {         r[i][0] = -1;         r[i][1] = -1;       } else {         r[i][0] = x;         r[i][1] = y;       }     }     long long int ans = 0;     if (l[n - 2][0] != -1) ans = l[n - 2][1] - l[n - 2][0];     if (r[1][0] != -1) ans = max(ans, r[1][1] - r[1][0]);     for (int i = 1; i < n - 1; i++) {       long long int x, y;       if (l[i - 1][0] == -1 || r[i + 1][0] == -1) continue;       x = max(l[i - 1][0], r[i + 1][0]);       y = min(l[i - 1][1], r[i + 1][1]);       ans = max(ans, max((long long int)0, y - x));     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << setprecision(10);     ;     int n;     cin >> n;     vector<int> deg(n);     int ones = 0;     vector<int> others, ops;     long long total = 0;     for (int i = 0; i < (int)n; i++) {       cin >> deg[i];       if (deg[i] == 1) {         ones++;         ops.push_back(i);       } else {         total += deg[i];         others.push_back(i);       }     }     if (total - (n - ones - 1) * 2 < ones) return cout <<  NO n , 0;     vector<pair<int, int>> edges;     if (others.size() == 0 && ops.size() == 2) {       cout <<  YES 1 n ;       cout <<  1 n ;       cout << ops[0] + 1 <<     << ops[1] + 1 <<   n ;       return 0;     }     for (int i = 1; i < (int)others.size(); i++) {       edges.push_back({others[i - 1], others[i]});     }     int opptr = 0;     if (others.size() == 1) {       for (int i = 0; i < (int)ops.size(); i++)         edges.push_back({ops[i], others[0]});     } else {       if (opptr < (int)ops.size()) edges.push_back({ops[opptr++], others[0]});       if (opptr < (int)ops.size()) edges.push_back({ops[opptr++], others.back()});       for (int i = 0; i < (int)deg[others[0]] - 2; i++) {         if (opptr >= (int)ops.size()) break;         edges.push_back({ops[opptr++], others[0]});       }       for (int i = 0; i < (int)deg[others.back()] - 2; i++) {         if (opptr >= (int)ops.size()) break;         edges.push_back({ops[opptr++], others.back()});       }     }     for (int i = 1; i < (int)others.size() - 1; i++) {       int av = deg[others[i]] - 2;       while (opptr < (int)ops.size() && av > 0) {         edges.push_back({others[i], ops[opptr++]});         av--;       }     }     cout <<  YES   << (others.size() - 1 + (ops.size() > 0) + (ops.size() > 1))          <<   n ;     cout << edges.size() <<   n ;     for (int i = 0; i < (int)edges.size(); i++)       cout << (edges[i].first + 1) <<     << edges[i].second + 1 <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};   int dy[] = {0, 0, 1, -1, -1, -1, 1, 1};   void file() {}   int main() {     cout << setprecision(20) << fixed;     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int k;     cin >> k;     int x = 0;     for (int i = 2; i <= 2000; i++) {       long long s = k + i;       if (ceil(s / (double(i - 1))) <= 1e6) {         x = i;         break;       }     }     if (!x) return cout << -1 <<   n , 0;     cout << x <<   n ;     cout <<  -1  ;     long long s = k + x;     long long rem = s % (x - 1);     long long num = s / (x - 1);     for (int i = 0; i < x - 1; i++)       if (rem)         cout << num + 1 <<    , rem--;       else         cout << num <<    ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline void read(T &x) {     x = 0;     bool w = 1;     char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) w = 0;       c = getchar();     }     while (isdigit(c)) {       x = x * 10 + c -  0 ;       c = getchar();     }     x = w ? x : -x;   }   const long long N = 1e5 + 10, Mod = 1e9 + 7;   long long n, m, a[N], lg[N], b[N], f[N], c[N], sum[N], d[N], ans[N];   struct en {     long long l, r, id;     bool operator<(const en &x) const { return r < x.r; }   } q[N];   inline long long Get(long long x) { return f[x] ? f[x] = Get(f[x]) : x; }   inline long long ji(long long x, long long y) {     return (b[x] - b[y + 1] * lg[y - x + 1] % Mod + Mod) % Mod;   }   inline void add(long long x, long long y) {     f[x] = y;     c[y] = c[x];     if ((x - c[x] > 30 && sum[y] > 9) || (sum[x] + (sum[y] << x - c[x])) > Mod)       sum[y] = Mod;     else       sum[y] = sum[x] + (sum[y] << x - c[x]);   }   signed main() {     read(n), read(m);     lg[0] = 1;     for (long long i = 1; i <= n; i++)       read(a[i]), sum[i] = a[i], lg[i] = (lg[i - 1] << 1) % Mod, c[i] = i - 1;     for (long long i = 1; i <= m; i++) read(q[i].l), read(q[i].r), q[i].id = i;     for (long long i = n; i >= 1; i--)       b[i] = ((b[i + 1] << 1) + a[i] + Mod) % Mod;     sort(q + 1, q + m + 1);     long long k = 1;     for (long long i = 1; i <= n; i++) {       while (sum[i] >= 0 && c[i]) add(c[i], i);       d[i] = (d[c[i]] + (ji(c[i] + 1, i) << 1) % Mod + Mod) % Mod;       while (q[k].r == i) {         long long x = Get(q[k].l);         ans[q[k].id] = (d[i] - d[x] + ji(q[k].l, x) + Mod) % Mod;         k++;       }     }     for (long long i = 1; i <= m; i++) printf( %lld n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long read() {     char ch = getchar();     long long x = 0, ff = 1;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) ff = -ff;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) x = x * 10 + ch -  0 , ch = getchar();     return x * ff;   }   void write(long long aa) {     if (aa < 0) putchar( - ), aa = -aa;     if (aa > 9) write(aa / 10);     putchar(aa % 10 +  0 );     return;   }   long long n;   long long a[200005];   long long tt[800005], tts[800005], lz[800005];   void up(long long rt) {     tt[rt] = min(tt[rt << 1], tt[rt << 1 | 1]);     if (tt[rt << 1] >= tt[rt << 1 | 1])       tts[rt] = tts[rt << 1 | 1];     else       tts[rt] = tts[rt << 1];     return;   }   void bt(long long rt, long long ll, long long rr) {     if (ll == rr) {       tt[rt] = read(), tts[rt] = ll;       return;     }     long long mid = (ll + rr) >> 1;     bt(rt << 1, ll, mid);     bt(rt << 1 | 1, mid + 1, rr);     up(rt);     return;   }   void push(long long rt) {     if (!lz[rt]) return;     tt[rt << 1] += lz[rt];     tt[rt << 1 | 1] += lz[rt];     lz[rt << 1] += lz[rt];     lz[rt << 1 | 1] += lz[rt];     lz[rt] = 0;     return;   }   void update(long long rt, long long ll, long long rr, long long L, long long R,               long long kk) {     if (ll == L && rr == R) {       tt[rt] += kk;       lz[rt] += kk;       return;     }     long long mid = (ll + rr) >> 1;     push(rt);     if (R <= mid)       update(rt << 1, ll, mid, L, R, kk);     else if (L > mid)       update(rt << 1 | 1, mid + 1, rr, L, R, kk);     else       update(rt << 1, ll, mid, L, mid, kk),           update(rt << 1 | 1, mid + 1, rr, mid + 1, R, kk);     up(rt);     return;   }   int main() {     n = read();     bt(1, 1, n);     for (long long i = 1; i <= n; ++i) {       long long now = tts[1];       a[now] = i;       update(1, 1, n, now, now, n * n);       if (now < n) update(1, 1, n, now + 1, n, -i);     }     for (long long i = 1; i <= n; ++i, putchar(   )) write(a[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int k;     scanf( %d , &k);     if (k % 2 == 1) {       printf( -1 n );       return 0;     }     char a[k][k];     memset(a, 0, sizeof(a));     for (int layer = 0; layer < k / 2; layer++) {       char c;       if (layer % 2)         c =  w ;       else         c =  b ;       for (int runner = layer; runner < k - layer; runner++)         a[runner][layer] = a[layer][runner] = a[runner][k - layer - 1] =             a[k - layer - 1][runner] = c;     }     for (int i = 0; i < k; i++)       for (int j = 0; j < k; j++) {         for (int l = 0; l < k; l++)           if (i % 2)             if (a[j][l] ==  w )               printf( b );             else               printf( w );           else             printf( %c , a[j][l]);         printf(  n );       }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string a, s;     cin >> a;     cin >> s;     long la = 0, ls = 0, i = 0, ps = 0, pv = 0;     la = a.length();     ls = s.length();     vector<int> v;     for (i = 0; i < ls; i++) v.push_back(s[i]);     sort(v.rbegin(), v.rend());     while (ps < la && pv < ls) {       if (a[ps] < v[pv]) {         a[ps] = v[pv];         ps++;         pv++;       } else if (a[ps] >= v[pv])         ps++;     }     cout << a;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int n1;   vector<long long> v;   int c[20];   int a[20];   bool viz[20];   int f[20];   inline void get(int i) {     int cif = 0;     long long zece = 1;     long long r = 0;     for (zece = 1; i > 0; i >>= 1, zece *= 10LL) {       ++cif;       if ((i & 1) != 0)         r += 7LL * zece;       else         r += 4LL * zece;     }     if (r != 0LL) v.push_back(r);     for (++cif; cif < 11; ++cif, zece *= 10LL) {       r += 4LL * zece;       v.push_back(r);     }   }   void back(int k1) {     if (k1 == n1 + 1) return;     for (int i = 1; i <= n1; ++i) {       if (viz[i]) continue;       if (k > f[n1 - k1])         k -= f[n1 - k1];       else {         viz[i] = true;         a[k1] = i;         back(k1 + 1);         return;       }     }     printf( -1 n );     exit(0);   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 0; i < 1024; ++i) {       get(i);     }     sort(v.begin(), v.end());     int start = max(1, n - 12);     f[0] = f[1] = 1;     for (int i = 2; i < 13; ++i) f[i] = f[i - 1] * i;     n1 = n - start + 1;     back(1);     int rez = 0;     long long start1 = (long long)start;     for (size_t i = 0, lim = v.size(); i < lim && v[i] < start1; ++i) {       ++rez;     }     int x = start;     for (int i = 1; i <= n1; ++i, ++x) {       c[i] = x;     }     for (int i = 1; i <= n1; ++i) {       if (find(v.begin(), v.end(), (long long)(i - 1) + start1) != v.end() &&           find(v.begin(), v.end(), (long long)c[a[i]]) != v.end())         ++rez;     }     printf( %d n , rez);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c, d, i, j, e, ar[105];     scanf( %d , &a);     while (a--) {       scanf( %d , &b);       if (b == 1) {         scanf( %d , &c);         if (c % 2 == 0)           printf( 1 n1 n );         else           printf( -1 n );       } else {         e = -1;         for (i = 1; i <= b; i++) {           scanf( %d , &ar[i]);         }         for (i = 1; i <= b; i++) {           if (ar[i] % 2 == 0) {             d = 1;             break;           }           if (e != -1) {             d = 2;             break;           }           if (e == -1) e = i;         }         printf( %d n , d);         if (d == 1)           printf( %d n , i);         else           printf( %d %d n , e, i);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double mn = 1e20, mx, t;   int n, low, high;   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> t;       mn = min(mn, (t + 1 - 1e-8) / i);       mx = max(mx, t / i);     }     n++;     low = (int)(n * mx + 1e-9), high = (int)(n * mn + 1 - 1e-9);     if (low + 1 == high)       cout <<  unique n  << low;     else       cout <<  not unique ;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     string s;     cin >> s;     int arr[26] = {};     int n = s.length();     int count = 0;     for (int i = 0; i < n; i++) {       arr[s[i] -  a ]++;       if (arr[s[i] -  a ] == 2) {         arr[s[i] -  a ] = 0;         count--;       } else         count++;     }     if (count == 0 || count == 1) {       cout <<  First             <<   n ;     } else {       if (count % 2 == 0) {         cout <<  Second               <<   n ;       } else         cout <<  First               <<   n ;     }   }   int main() {     long long t = 1;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 400100;   vector<int> grafo[MAXN];   int a[MAXN], b[MAXN];   pair<int, int> p[MAXN];   int q[MAXN];   bool vis[MAXN];   int n;   vector<int> vec;   void dfs(int x) {     vis[x] = true;     vec.push_back(x);     if (x > n)       vis[x - n] = true;     else       vis[x + n] = true;     for (int i = 0; i < grafo[x].size(); i++) {       int at = grafo[x][i];       if (vis[at] == true) continue;       dfs(at);     }   }   int main() {     int t;     cin >> t;     while (t--) {       cin >> n;       vec.clear();       for (int i = 1; i <= 2 * n; i++) {         p[i] = {0, 0};         grafo[i].clear();         q[i] = 0;         vis[i] = false;         a[i] = b[i] = 0;       }       for (int i = 1; i <= n; i++) {         int x;         cin >> x;         a[x] = i;         q[x]++;         if (p[x].first == 0)           p[x].first = i;         else           p[x].second = i;       }       for (int i = 1; i <= n; i++) {         int x;         cin >> x;         b[x] = i;         q[x]++;         if (p[x].first == 0)           p[x].first = i;         else           p[x].second = i;       }       bool f = true;       for (int i = 1; i <= n; i++)         if (q[i] != 2) f = false;       if (f == false) {         cout << -1 << endl;         continue;       }       for (int i = 1; i <= n; i++) {         int p1 = p[i].first, p2 = p[i].second;         if (a[i] > 0 && b[i] > 0) {           grafo[p1].push_back(p2);           grafo[p2].push_back(p1);           grafo[p1 + n].push_back(p2 + n);           grafo[p2 + n].push_back(p1 + n);         } else {           grafo[p1].push_back(p2 + n);           grafo[p2].push_back(p1 + n);           grafo[p2 + n].push_back(p1);           grafo[p1 + n].push_back(p2);         }       }       vector<int> resp;       for (int i = 1; i <= n; i++) {         if (vis[i] == true) continue;         vec.clear();         dfs(i);         int h = vec.size();         int cnt = 0;         for (int j = 0; j < vec.size(); j++) {           int at = vec[j];           if (at > n) cnt++;         }         if (cnt < h - cnt) {           for (int j = 0; j < vec.size(); j++)             if (vec[j] > n) resp.push_back(vec[j] - n);         } else {           for (int j = 0; j < vec.size(); j++)             if (vec[j] <= n) resp.push_back(vec[j]);         }       }       cout << resp.size() << endl;       for (int i = 0; i < resp.size(); i++) cout << resp[i] <<    ;       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int read() {     int s = 0;     char c = getchar(), lc =  + ;     while (c <  0  ||  9  < c) lc = c, c = getchar();     while ( 0  <= c && c <=  9 ) s = s * 10 + c -  0 , c = getchar();     return lc ==  -  ? -s : s;   }   void write(int x) {     if (x < 0) {       putchar( - );       x = -x;     }     if (x < 10)       putchar(x +  0 );     else {       write(x / 10);       putchar(x % 10 +  0 );     }   }   void print(int x, char c =   n ) {     write(x);     putchar(c);   }   void L(int x) {     putchar( L );     putchar(   );     print(x);   }   void R(int x) {     putchar( R );     putchar(   );     print(x);   }   char a[N];   signed main() {     scanf( %s , a + 1);     int n = strlen(a + 1);     print(4);     L(2);     L(2);     R(2);     R(n + 2 + n - 1);     return 0;   }
#include <bits/stdc++.h>   int n, m, k, s, a[1000000], b[1000000];   int amin[1000000];   int bmin[1000000];   struct Gadget {     long long cost;     int id;     Gadget(long long cost, int id) : cost(cost), id(id) {}     bool operator<(const Gadget &other) const { return cost < other.cost; }   };   int main() {     scanf( %d %d %d %d , &n, &m, &k, &s);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);       amin[i] = i;       if (i > 0 && a[amin[i - 1]] < a[i]) amin[i] = amin[i - 1];     }     for (int i = 0; i < n; i++) {       scanf( %d , &b[i]);       bmin[i] = i;       if (i > 0 && b[bmin[i - 1]] < b[i]) bmin[i] = bmin[i - 1];     }     long long asum, bsum;     std::vector<Gadget> d, p;     for (int i = 0; i < m; i++) {       int t, c;       scanf( %d %d , &t, &c);       if (t == 1)         d.push_back(Gadget(c, i + 1));       else         p.push_back(Gadget(c, i + 1));     }     d.push_back(Gadget(0, 0));     p.push_back(Gadget(0, 0));     std::sort(d.begin(), d.end());     std::sort(p.begin(), p.end());     for (int i = 1; i < d.size(); i++) d[i].cost += d[i - 1].cost;     for (int i = 1; i < p.size(); i++) p[i].cost += p[i - 1].cost;     int day_ans = n;     int d_ans = 0, p_ans = 0;     for (int i = 0; i <= std::min(k, (int)d.size() - 1); i++) {       int j = k - i;       if (j >= p.size()) continue;       int left = 0, right = day_ans - 1;       while (left <= right) {         int mid = (left + right) >> 1;         long long cost = d[i].cost * a[amin[mid]] + p[j].cost * b[bmin[mid]];         if (cost <= s) {           if (mid < day_ans) {             day_ans = mid;             d_ans = i;             p_ans = j;           }           right = mid - 1;         } else {           left = mid + 1;         }       }     }     if (day_ans == n) {       puts( -1 );       return 0;     }     printf( %d n , day_ans + 1);     for (int i = 1; i <= d_ans; i++) {       printf( %d %d n , d[i].id, amin[day_ans] + 1);     }     for (int i = 1; i <= p_ans; i++) {       printf( %d %d n , p[i].id, bmin[day_ans] + 1);     }   }
#include <bits/stdc++.h>   using namespace std;   int to1[1000010], w[1000010], begin1[1000010], next1[1000010], v[1000010],       p[1000010], d[1000010], e;   void add(int x, int y, int z) {     to1[++e] = y;     next1[e] = begin1[x];     begin1[x] = e;     w[e] = z;   }   void ins(int x) {     int i;     for (i = 30; i >= 0; i--)       if ((x >> i) & 1) {         if (!p[i]) {           p[i] = x;           break;         }         x ^= p[i];       }   }   void dfs(int x, int now) {     int i;     d[x] = now;     v[x] = 1;     for (i = begin1[x]; i; i = next1[i]) {       if (!v[to1[i]])         dfs(to1[i], now ^ w[i]);       else         ins(now ^ w[i] ^ d[to1[i]]);     }   }   int find(int x) {     int i;     for (i = 30; i >= 0; i--)       if ((p[i] ^ x) < x) x = p[i] ^ x;     return x;   }   int main() {     int i, u, v, w, n, m;     scanf( %d%d , &n, &m);     for (i = 1; i <= m; i++) {       scanf( %d%d%d , &u, &v, &w);       add(u, v, w);       add(v, u, w);     }     dfs(1, 0);     printf( %d n , find(d[n]));   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1000000000;   const long long INF = 1LL * inf * inf;   const double eps = 1e-9;   const int md = (int)1e9 + 7;   const double EPS = 1e-7;   const long long maxll = numeric_limits<long long>::max();   const double PI = acos(-1.0);   template <typename name>   inline name sqr(name x) {     return x * x;   }   inline long long multmod(long long a, long long b, long long md) {     if (!a) return 0;     if (a % 2 == 1)       return (multmod(a - 1, b, md) + b) % md;     else       return sqr<long long>(multmod(a / 2, b, md)) % md;   }   template <typename name>   inline name bpow(name base, long long exp) {     name res = base;     while (exp) {       if (exp % 2 == 1) {         res = res * base;       }       base = base * base;       exp /= 2;     }     return res;   }   int n, x, m;   double p[2000];   struct matr {     double a[1 << 7][1 << 7];   } mat, qq;   const matr& operator*(const matr& x, const matr& y) {     for (int i = 0; i < (1 << 7); i++)       for (int j = 0; j < (1 << 7); j++) qq.a[i][j] = 0;     for (int i = 0; i < (1 << 7); i++)       for (int j = 0; j < (1 << 7); j++)         for (int k = 0; k < (1 << 7); k++) qq.a[i][j] += x.a[i][k] * y.a[k][j];     return qq;   }   int main() {     ios_base ::sync_with_stdio(0);     cin >> n >> x;     for (int i = 0; i <= x; i++) cin >> p[i];     for (int mask1 = 0; mask1 < (1 << 7); mask1++)       for (int mask2 = 0; mask2 < (1 << 7); mask2++)         mat.a[mask1][mask2] = p[mask1 ^ mask2];     mat = bpow(mat, n - 1);     cout << fixed << setprecision(10) << 1 - mat.a[0][0];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n, k;     cin >> n >> k;     string ans =   ;     for (long long i = 0; i < n; i++) {       ans.push_back( a );     }     for (long long i = n - 2; i >= 0; i--) {       if (k <= n - i - 1) {         ans[i] =  b ;         ans[n - k] =  b ;         break;       }       k -= (n - i - 1);     }     cout << ans << endl;   }   int main() {     int t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, a, b, c, d, x, y, x1, x2, y1, y2;     scanf( %d , &t);     while (t--) {       scanf( %d%d%d%d , &a, &b, &c, &d);       int t1 = a - b;       int t2 = c - d;       scanf( %d%d%d%d%d%d , &x, &y, &x1, &y1, &x2, &y2);       if (x - t1 >= x1 && x - t1 <= x2 && y - t2 >= y1 && y - t2 <= y2) {         if ((a > 0 || b > 0) && x1 == x2)           printf( NO n );         else if ((c > 0 || d > 0) && y1 == y2)           printf( NO n );         else           printf( YES n );       } else         printf( 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);     cin.tie(0), cout.tie(0);     ;     long long int a, b, t, n, m, k, i, j, l, sum = 0, sum1 = 0, ans = 0;     vector<long long int> v;     cin >> n;     for (i = 0; i < n; i++) {       cin >> a;       v.push_back(a);       if (i & 1) {         sum1 += a;       } else         sum += a;     }     ans = max(sum1, sum);     for (i = 0; i < n; i++) {       if (i & 1) {         sum1 -= v[i];         sum += v[i];       } else {         sum -= v[i];         sum1 += v[i];       }       ans = max(ans, max(sum, sum1));     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a, b, c;     cin >> a;     b = a - 1;     c = a - 2;     if (a >= 3) {       if (b % 2 != 0) {         if (a % 3 == 0) {           long long e = a * b * c / 2;           long long r = a * b * (c - 1) / 3;           long long t = a * b * (c - 2) / 2;           long long y = a * b * (c - 3);           long long h = (a - 1) * (b - 1) * (c - 1);           cout << max(max(max(e, r), max(t, y)), h);         } else {           c--;           cout << a * b * c;         }       } else {         cout << a * b * c;       }     } else {       b = 1;       c = 1;       cout << a * b * c;     }     return 0;   }