malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   int main() {     long int n, k, i, *a, *b, t, max, j;     scanf( %ld , &t);     while (t--) {       scanf( %ld , &n);       a = (long int *)malloc(n * sizeof(long int));       b = (long int *)malloc(n * sizeof(long int));       for (i = 0; i < n; i++) {         scanf( %ld , &a[i]);         b[a[i] - 1] = i;       }       max = n - 1;       if (b[0] != 0) k = b[0] - 1;       for (j = 0, i = 0; j < n - 1; j++) {         if (b[i] == max) {           max = k;           k = b[i + 1] - 1;           i++;         } else {           if (b[i + 1] != b[i] + 1)             break;           else             i++;         }       }       if (j == n - 1)         printf( Yes n );       else         printf( No n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 300010;   const int INF = 1e9 + 7;   struct node {     int x, y;   } p[maxn];   int s[maxn];   int dis(int i, int j) { return abs(p[i].x - p[j].x) + abs(p[i].y - p[j].y); }   int main() {     int n, top, i, num, ans, maxx, maxy, minx, miny, tmp, j, pos1, pos2, k;     scanf( %d , &n);     maxx = -INF;     maxy = -INF;     minx = INF;     miny = INF;     for (i = 1; i <= n; i++) {       scanf( %d%d , &p[i].x, &p[i].y);       maxx = max(maxx, p[i].x);       maxy = max(maxy, p[i].y);       minx = min(minx, p[i].x);       miny = min(miny, p[i].y);     }     top = 0;     for (i = 1; i <= n; i++) {       if (p[i].x == minx || p[i].x == maxx || p[i].y == miny || p[i].y == maxy)         s[++top] = i;     }     ans = 0;     num = unique(s + 1, s + top + 1) - s - 1;     for (i = 1; i <= num; i++) {       for (j = i + 1; j <= num; j++) {         pos1 = s[i];         pos2 = s[j];         for (k = 1; k <= n; k++) {           if (k == pos1 || k == pos2) continue;           tmp = dis(pos1, pos2) + dis(pos1, k) + dis(k, pos2);           ans = max(ans, tmp);         }       }     }     for (i = 3; i <= n; i++) {       if (i == 3) {         printf( %d  , ans);         continue;       }       printf( %d  , 2 * (maxx - minx + maxy - miny));     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, k;     cin >> n >> k;     vector<int> arr(k);     for (int i = 0; i < k; i++) {       arr[i] = i + 1;     }     vector<string> allPos;     do {       string s =   ;       for (int x : arr) {         s += (x +  0 );       }       allPos.emplace_back(s);     } while (next_permutation((arr).begin(), (arr).end()));     vector<string> v(n), tempV(n);     for (int i = 0; i < n; i++) {       cin >> v[i];       tempV[i] = v[i];     }     int ans = INT_MAX;     for (string current : allPos) {       vector<int> temp(n);       int index = 0;       for (char ch : current) {         for (int i = 0; i < n; i++) {           tempV[i][index] = v[i][ch -  0  - 1];         }         index++;       }       for (int i = 0; i < n; i++) {         temp[i] = stoi(tempV[i]);       }       ans = min(ans, *max_element((temp).begin(), (temp).end()) -                          *min_element((temp).begin(), (temp).end()));     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int q;   char s[5050];   bool f[5000][5000];   int g[5000][5000];   int main() {     scanf( %s , s);     int n = strlen(s);     for (int i = 0; i < n; i++) {       for (int j = i; j >= 0; j--) {         if (i - j == 0)           f[j][i] = 1;         else if (i - j == 1 && s[i] == s[j])           f[j][i] = 1;         else if (f[j + 1][i - 1] && s[i] == s[j])           f[j][i] = 1;       }     }     for (int i = 0; i < n; i++) {       for (int j = i; j >= 0; j--) {         if (i - j == 0)           g[j][i] = 1;         else {           g[j][i] = g[j + 1][i] + g[j][i - 1];           if (i - j != 1) g[j][i] -= g[j + 1][i - 1];           if (f[j][i]) g[j][i]++;         }       }     }     scanf( %d , &q);     for (int i = 1; i <= q; i++) {       int l, r;       scanf( %d%d , &l, &r);       printf( %d n , g[l - 1][r - 1]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   long long dp[200100][2];   long long ans[200100];   int main(int argc, char const *argv[]) {     int T, k;     cin >> T >> k;     dp[k][1] = 1;     dp[1][0] = 1;     for (int i = 2; i <= 100000; i++) {       if (i - k <= 0) {         dp[i][0] += dp[i - 1][0] + dp[i - 1][1];         dp[i][0] %= mod;       } else {         dp[i][0] += dp[i - 1][0] + dp[i - 1][1];         dp[i][0] %= mod;         dp[i][1] += dp[i - k][0] + dp[i - k][1];         dp[i][1] %= mod;       }     }     int a, b;     for (int i = 1; i <= 100000; i++) {       ans[i] = ans[i - 1] + dp[i][1] + dp[i][0];       ans[i] %= mod;     }     while (T--) {       scanf( %d%d , &a, &b);       cout << (mod + ans[b] - ans[a - 1]) % mod << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, fl = 0, a[200005], c[200005] = {0}, ans, i, j;     cin >> n >> m;     for (i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     for (i = 0; i < n; i++) {       a[i] = a[i] % m;       c[a[i]]++;       if (c[a[i]] > 1) fl = 1;     }     if (fl == 1) cout <<  0  << endl;     if (fl == 0) {       ans = 1;       for (i = 0; i < n; i++) {         for (j = i + 1; j < n; j++) {           ans = (ans % m * ((a[j] - a[i] + m) % m)) % m;         }       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 4e5 + 5;   int vis[MAX];   vector<int> adj[MAX];   vector<vector<int> > trip;   void dfs(int x) {     vis[x] = 1;     for (auto u : adj[x]) {       if (!vis[u]) {         for (auto v1 : adj[x]) {           for (auto v2 : adj[u]) {             if (!vis[v1] && !vis[v2] && v1 == v2) {               vector<int> triplet;               triplet.push_back(x);               triplet.push_back(u);               triplet.push_back(v1);               trip.push_back(triplet);             }           }         }       }     }   }   int main() {     int n, m, x, y, minm = 1e9 + 9;     cin >> n >> m;     memset(vis, 0, sizeof(vis));     for (int i = 0; i < m; i++) {       cin >> x >> y;       adj[x].push_back(y);       adj[y].push_back(x);     }     for (int i = 0; i < n; i++) {       if (!vis[i]) dfs(i);     }     for (auto v : trip) {       minm = min(minm, (int)(adj[v[0]].size() + adj[v[1]].size() +                              adj[v[2]].size() - 6));     }     if (!trip.empty())       cout << minm << endl;     else       cout << -1 << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 5;   int v1[10], v2[10];   int main() {     memset(v1, 0, sizeof(v1));     memset(v2, 0, sizeof(v2));     int n;     scanf( %d , &n);     for (int i = 0, a; i < n; i++) {       scanf( %d , &a);       v1[a]++;     }     for (int i = 0, a; i < n; i++) {       scanf( %d , &a);       v2[a]++;     }     int ans = 0;     bool flag = true;     for (int i = 1; i <= 5 && flag; i++) {       if ((v1[i] + v2[i]) & 1) {         flag = false;       }       ans += abs(v1[i] - v2[i]) / 2;     }     if (flag)       printf( %d n , ans / 2);     else {       printf( -1 n );     }     return 0;   }
#include <bits/stdc++.h>   const long long MAXN = 80000 + 5;   std::vector<long long> G[MAXN];   long long n;   long long sz[MAXN], fa[MAXN];   inline void dfs1(long long v, long long faa = 0) {     sz[v] = 1;     fa[v] = faa;     for (auto x : G[v]) {       if (x == faa) continue;       dfs1(x, v);       sz[v] += sz[x];     }   }   long long ans = 0ll;   inline long long C(long long x) { return 1ll * x * (x - 1) / 2; }   signed main() {     scanf( %lld , &n);     for (register long long i = 1; i <= n - 1; ++i) {       long long u, v;       scanf( %lld%lld , &u, &v);       G[u].push_back(v);       G[v].push_back(u);     }     dfs1(1);     ans = C(n) * C(n);     for (register long long i = 1; i <= n; ++i) {       long long num2 = C(sz[i]), num1 = C(n);       for (auto x : G[i]) {         if (x == fa[i]) {           num1 -= C(n - sz[i]);           continue;         }         num2 -= C(sz[x]);         num1 -= C(sz[x]);       }       ans -= (2ll * num1 * num2 - num2 * num2);     }     std::cout << ans << std::endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int a[N], n;   int dp[N];   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> a[i];     }     for (int i = 1; i <= n; ++i) {       dp[i] = dp[i - 1] + 20;       for (int j = i - 1; j > 0; j--) {         if (a[i] - a[j] < 90)           dp[i] = min(dp[i], dp[j - 1] + 50);         else if (a[i] - a[j] < 1440)           dp[i] = min(dp[i], dp[j - 1] + 120);         else           break;       }       cout << dp[i] - dp[i - 1] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   const int N = 1000000 + 5;   const int K = 26 + 5;   char s[N], t[N];   int ns[K], nt[K], ans[K];   int main() {     scanf( %s %s , s, t);     for (int i = 0; t[i]; ++i) {       nt[t[i] -  a ]++;     }     int cnt = 0;     for (int i = 0; s[i]; ++i) {       if (s[i] !=  ? )         ns[s[i] -  a ]++;       else         cnt++;     }     while (1) {       int c = 0;       for (int i = 0; i < 26; ++i) {         if (nt[i]) c += max(0, nt[i] - ns[i]);       }       if (cnt < c) break;       for (int i = 0; i < 26; ++i) {         if (nt[i]) {           ans[i] += max(0, nt[i] - ns[i]);           ns[i] = max(0, ns[i] - nt[i]);         }       }       cnt -= c;     }     int k = 0;     for (int i = 0; s[i]; ++i) {       if (s[i] ==  ? ) {         while (k < 26 && ans[k] <= 0) k++;         if (k < 26) ans[k]--;         printf( %c ,  a  + (k < 26 ? k : 0));       } else {         printf( %c , s[i]);       }     }     printf(  n );   }
#include <bits/stdc++.h>   const long long INF = 0x3f3f3f3f3f3f3f3fLL;   const int inf = 0x3f3f3f3f;   const int mod = 1e9 + 7;   const double eps = 1e-6;   template <class T>   inline void read(T& x) {     int sign = 1;     char c = getchar();     x = 0;     while (c >  9  || c <  0 ) {       if (c ==  - ) sign = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = x * 10 + c -  0 ;       c = getchar();     }     x *= sign;   }   using namespace std;   const int maxn = 5e6 + 10;   unsigned long long ji = 1;   long long dp[maxn];   unsigned long long prehash[maxn], sufhash[maxn];   char s[maxn];   inline int val(char x) {     if (x >=  0  && x <=  9 ) return x -  0 ;     if (x >=  a  && x <=  z ) return x -  a  + 10;     if (x >=  A  && x <=  Z ) return x -  Z  + 36;   }   int main() {     scanf( %s , s + 1);     int len = 0;     for (int i = 1; s[i]; ++i) s[i] = val(s[i]);     for (int i = 1; s[i]; ++i) prehash[i] = prehash[i - 1] * 131 + 1ll * s[i];     for (int i = 1; s[i]; ++i) {       sufhash[i] = sufhash[i - 1] + 1ll * s[i] * ji;       ji *= 131;     }     long long res = 0;     for (int i = 1; s[i]; ++i) {       if (prehash[i] == sufhash[i]) {         dp[i] = dp[i >> 1] + 1;       }       res += dp[i];     }     printf( %lld n , res);   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-10;   pair<double, double> za, zb, zc, zd;   pair<double, double> a, b, c, d, e;   pair<double, double> A, B, C, D;   double cha(pair<double, double> a, pair<double, double> b,              pair<double, double> c) {     return (b.first - a.first) * (c.second - a.second) -            (b.second - a.second) * (c.first - a.first);   }   pair<double, double> jiao(pair<double, double> a, pair<double, double> b,                             pair<double, double> c, pair<double, double> d) {     double t1 = cha(a, c, b), t2 = cha(a, b, d), t3 = cha(c, a, d),            t4 = cha(c, d, b);     return make_pair((c.first * t2 + d.first * t1) / (t1 + t2),                      (c.second * t2 + d.second * t1) / (t1 + t2));   }   void work(pair<double, double> a, pair<double, double> b,             pair<double, double> &c, pair<double, double> &d) {     c = make_pair((a.first + b.first) / 2, (a.second + b.second) / 2);     d = make_pair(c.first + b.second - a.second, c.second + a.first - b.first);   }   bool get(pair<double, double> a, pair<double, double> b,            pair<double, double> c) {     work(a, b, za, zb), work(b, c, zc, zd);     d = make_pair(b.first + zd.first - zc.first,                   b.second + zd.second - zc.second);     d = jiao(b, d, za, zb);     e = jiao(za, zb, zc, zd);     A = make_pair(2 * d.first - e.first, 2 * d.second - e.second);     B = make_pair(2 * b.first - A.first, 2 * b.second - A.second);     C = make_pair(2 * c.first - B.first, 2 * c.second - B.second);     D = make_pair(2 * a.first - A.first, 2 * a.second - A.second);     return cha(A, B, C) * cha(B, C, D) - eps > 0 &&            cha(B, C, D) * cha(C, D, A) - eps > 0 &&            cha(C, D, A) * cha(D, A, B) - eps > 0;   }   int main() {     int t;     for (scanf( %d , &t); t--;) {       scanf( %lf%lf%lf%lf%lf%lf , &a.first, &a.second, &b.first, &b.second,             &c.first, &c.second);       if (fabs(cha(a, b, c)) - eps < 0) {         printf( NO n );         continue;       }       if (get(a, b, c) || get(a, c, b) || get(b, a, c)) {         printf( YES n );         printf( %.9f %.9f  , A.first, A.second);         printf( %.9f %.9f  , B.first, B.second);         printf( %.9f %.9f  , C.first, C.second);         printf( %.9f %.9f n , D.first, D.second);       } else         printf( NO n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 200009;   long long N, M;   long long Max[MAXN], A[MAXN];   long long maxLL(long long num1, long long num2) {     return (num1 > num2 ? num1 : num2);   }   void Update(int x, long long nh) {     for (int i = x; i <= N; i += (i & (-i))) Max[i] = maxLL(Max[i], nh);   }   long long Find(int x) {     long long ret = 0;     for (int i = x; i >= 1; i -= (i & (-i))) ret = maxLL(ret, Max[i]);     return ret;   }   int main() {     cin >> N;     for (int i = 1; i <= N; i++) Max[i] = 0;     for (int i = 1; i <= N; i++) {       cin >> A[i];       Update(i, A[i]);     }     cin >> M;     for (int i = 1; i <= M; i++) {       long long Xx, Yy;       cin >> Xx >> Yy;       long long Ans = Find(Xx);       Update(1, Ans + Yy);       cout << Ans <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<long double, int> > v;   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       long double x, y;       cin >> x >> y;       v.push_back(make_pair(atan2(y, x), i));     }     sort(v.begin(), v.end());     v.push_back(v[0]);     if (v.back().first < 0.0)       v.back().first = (2 * acos(0.0) + v.back().first + 2 * acos(0.0));     long double ans = 1e18;     int id1, id2;     for (int i = 1; i < (int)v.size(); i++) {       long double x = fabs(v[i].first - v[i - 1].first);       if (x < ans) {         ans = x;         id1 = v[i].second;         id2 = v[i - 1].second;       }     }     cout << id1 <<     << id2 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9 + 10;   int main() {     int n;     cin >> n;     int an[n];     vector<int> p;     vector<pair<int, int> > st;     int i = 0;     for (int a = 0; a < n * 2; a++) {       char sy;       cin >> sy;       if (sy ==  + ) {         p.push_back(i++);         st.push_back({0, 1});       } else {         int x;         scanf( %d , &x);         if (st.size() and x > st.back().first) {           int su = 0;           while (st.size() and st.back().first < x) {             su += st.back().second;             st.pop_back();           }           su--;           if (su) st.push_back({x, su});           an[p.back()] = x;           p.pop_back();         } else {           cout <<  NO ;           return 0;         }       }     }     cout <<  YES n ;     for (int a = 0; a < n; a++) printf( %d  , an[a]);   }
#include <bits/stdc++.h>   using namespace std;   int arr[2010], money, mn, mx, ans;   vector<pair<int, int> > tmp;   int main() {     int n, b;     cin >> n >> b;     for (int i = 0; i < n; i++) {       cin >> arr[i];       tmp.push_back(make_pair(arr[i], i));     }     sort(tmp.rbegin(), tmp.rend());     for (int i = 0; i < n; i++) {       mx = tmp[i].first, mn = 1e8;       for (int j = 0; j < tmp[i].second; j++) {         mn = min(mn, arr[j]);       }       money = b / mn;       money *= mx;       money += (b % mn);       ans = max(ans, money);     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   bool comp(string s, string t, vector<int> rows) {     int i = 0;     int m = s.size();     while (i < m &&            (s[i] == t[i] || (find(rows.begin(), rows.end(), i) != rows.end())))       i++;     if (i == m) return false;     return s[i] < t[i];   }   int main() {     int n, m;     cin >> n >> m;     vector<string> table(n);     for (int i = 0; i < n; i++) cin >> table[i];     vector<int> rows;     for (int j = 0; j < m; j++) {       for (int i = 1; i < n; i++) {         int k = i - 1;         if (comp(table[i], table[k], rows)) {           for (int l = 0; l < m; l++) {             if (find(rows.begin(), rows.end(), l) != rows.end()) continue;             if (table[i][l] < table[k][l]) {               rows.push_back(l);               break;             }           }         }       }     }     cout << rows.size() << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int o[101];   int main() {     int t;     cin >> t;     for (int i = 0; i < t; i++) {       int e;       cin >> e;       if (e % 7 == 0) {         o[i] = e / 7;       } else {         o[i] = e / 7 + 1;       }     }     for (int i = 0; i < t; i++) {       cout << o[i] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 5;   int n, m, col[maxn];   set<int> s;   set<int>::iterator t[maxn];   int main() {     while (~scanf( %d %d , &n, &m)) {       s.clear();       for (int i = 1; i <= n; i++) s.insert(i);       int cnt = 0;       while (m--) {         int l, r, c;         scanf( %d %d %d , &l, &r, &c);         cnt = 0;         for (auto it = s.lower_bound(l); *it <= r && it != s.end(); it++) {           if (*it != c) {             col[*it] = c;             t[cnt++] = it;           }         }         for (int i = 0; i < cnt; i++) {           s.erase(t[i]);         }       }       for (int i = 1; i <= n; i++) {         printf( %d  , col[i]);       }       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     scanf( %d%d , &n, &m);     vector<int> mp(32);     vector<int> A(m);     for (int i = 0; i < n; i++) {       int no;       scanf( %d , &no);       for (int ii = 0; ii < 31; ii++)         if (no & (1 << ii)) mp[ii]++;     }     for (int i = 0; i < m; i++) scanf( %d , &A[i]);     sort(A.begin(), A.end());     int res = 0;     for (int i = 0; i < A.size(); i++) {       for (int ii = A[i]; ii < 31; ii++)         if (mp[ii] > 0) {           res++;           mp[ii]--;           for (int iii = A[i]; ii != A[i] && iii < ii; iii++) mp[iii]++;           break;         }     }     printf( %d n , res);   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e2 + 7;   const long long nol = 0;   long long n;   string g, s;   void vkoshp() {     cin >> n;     while (n >= 2) {       g +=  1 ;       n -= 2;     }     if (n == 1) {       s +=  7 ;       g.erase(g.begin());       s += g;       g = s;     }     cout << g;   }   int main() {     cout.tie(NULL);     cin.tie(NULL);     ios_base::sync_with_stdio(0);     long long t = 1;     while (t--) vkoshp();   }
#include <bits/stdc++.h>   using namespace std;   const long long int mod = 1e9 + 7;   const long long int N = 1e5 + 5;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int i, j, tc;     cin >> tc;     while (tc--) {       long long int n, w;       cin >> n >> w;       long long int a[n];       for (i = 0; i < n; i++) {         cin >> a[i];       }       vector<long long int> v;       for (i = 0; i < n; i++) {         if (a[i] <= w && a[i] >= (w + 1) / 2) {           v.push_back(i + 1);           break;         }       }       if (v.size() == 1) {         cout << 1 <<   n ;         cout << v[0] <<   n ;         continue;       }       long long int sum = 0;       for (i = 0; i < n; i++) {         if (a[i] <= w) {           sum += a[i];           v.push_back(i + 1);           if (sum >= (w + 1) / 2) break;         }       }       if (sum >= (w + 1) / 2 && sum <= w) {         cout << v.size() <<   n ;         for (i = 0; i < v.size(); i++) cout << v[i] <<    ;         cout <<   n ;       } else         cout << -1 <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   constexpr long long N = 600500;   constexpr long long D = 2000010;   constexpr long double EPS = 1e-8;   ofstream fout;   ifstream fin;   int flag = -1;   long long n, m, k;   vector<vector<int> > v;   vector<int> h;   vector<int> was;   bool comp(int a, int b) { return h[a] > h[b]; }   multiset<int, bool (*)(int, int)> s(comp);   void dfs(int x) {     int o = 0;     was[x] = 1;     for (auto &y : (v[x])) {       if (!was[y]) {         dfs(y);         o = max(o, h[y]);       }     }     h[x] = o + 1;   }   void dfs1(int x) {     was[x] = 1;     int u, m = -1;     for (auto &y : (v[x])) {       if (!was[y]) {         if (h[y] > m) {           m = h[y];           u = y;         }       }     }     if (m == -1) return;     for (auto &y : (v[x])) {       if (!was[y]) {         if (y == u) {           dfs1(y);         } else {           s.insert(y);         }       }     }   }   void solve() {     long long a, b;     cin >> n >> k;     s.clear();     v.clear();     h.clear();     was.clear();     v.resize(n);     h.resize(n);     was.resize(n);     for (long long i = 0; i < (n - 1); i++) {       cin >> a >> b;       a--;       b--;       v[a].push_back(b);       v[b].push_back(a);     }     dfs(0);     s.insert(0);     fill(was.begin(), was.end(), 0);     a = k;     k = 0;     while (k < a && !s.empty()) {       k++;       int x = *s.begin();       s.erase(s.begin());       dfs1(x);     }     long long mx = -((long long)1e15);     long long e = count(was.begin(), was.end(), 1);     if (k < a) {       for (long long i = (k); i < (a + 1); i++) {         mx = max(mx, (e - i) * (i));       }     } else {       mx = ((long long)1e15);       long long p = count(was.begin(), was.end(), 0);       for (long long i = (0); i < (p + 1); i++) {         mx = min(mx, (e - a + (p - i)) * (a - i));       }     }     cout << mx <<   n ;   }   signed main(signed argc, char *argv[]) {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout.precision(14);     cout.fixed;     srand(time(0));     fout.precision(14);     fout.fixed;     int tt = 1;     while (tt--) {       solve();     }     fout.close();     fin.close();   }