malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 300001;   set<pair<long long int, long long int> >* T[N];   int A[N];   int S[N];   char s[N];   vector<int> adj[N];   long long int MOD1 = 1000000007LL;   long long int MOD2 = 1000000009LL;   void dfs(int st, int p = -1, long long int hash1 = 0LL,            long long int hash2 = 0LL) {     hash1 = (hash1 * 257LL + s[st] -  a  + 1) % MOD1;     hash2 = (hash2 * 43LL + s[st] -  a  + 1) % MOD2;     S[st] = 1;     int mx = -1;     for (auto c : adj[st]) {       if (c != p) {         dfs(c, st, hash1, hash2);         S[st] += S[c];         if (mx == -1 || S[mx] < S[c]) mx = c;       }     }     set<pair<long long int, long long int> >* root;     if (mx == -1)       root = new set<pair<long long int, long long int> >;     else {       root = T[mx];       for (auto c : adj[st]) {         if (c != p && c != mx) root->insert(T[c]->begin(), T[c]->end());       }     }     root->insert({hash1, hash2});     T[st] = root;     A[st] += T[st]->size();   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , A + i);     }     scanf( %s , s + 1);     for (int i = 1; i <= n - 1; i++) {       int u, v;       scanf( %d%d , &u, &v);       adj[u].push_back(v);       adj[v].push_back(u);     }     dfs(1);     int mxc = 0, mx = 1;     for (int i = 1; i <= n; i++) {       if (mx == A[i])         mxc++;       else if (mx < A[i])         mx = A[i], mxc = 1;     }     printf( %d n%d n , mx, mxc);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int solve(string &s, vector<vector<long long int> > &pre,                       vector<vector<long long int> > &dp, long long int st,                       long long int en, long long int a, long long int b) {     if (st > en) {       return 0;     }     if (dp[st][en] != -1) {       return dp[st][en];     }     long long int val = solve(s, pre, dp, st + 1, en, a, b) + a;     for (long long int i = st; i < pre[st][0] + st; i++) {       val = min(val, solve(s, pre, dp, i + 1, en, a, b) + b);     }     dp[st][en] = val;     return val;   }   void getZarr(string str, int Z[]);   long long int get_len(string &text, string &pattern) {     string concat = pattern +  $  + text;     int l = concat.length();     int Z[l];     getZarr(concat, Z);     long long int ans = 0;     for (int i = pattern.length() + 1; i < l; ++i) {       ans = max(ans, (long long int)Z[i]);     }     return ans;   }   void getZarr(string str, int Z[]) {     int n = str.length();     int L, R, k;     L = R = 0;     for (int i = 1; i < n; ++i) {       if (i > R) {         L = R = i;         while (R < n && str[R - L] == str[R]) R++;         Z[i] = R - L;         R--;       } else {         k = i - L;         if (Z[k] < R - i + 1)           Z[i] = Z[k];         else {           L = i;           while (R < n && str[R - L] == str[R]) R++;           Z[i] = R - L;           R--;         }       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n, a, b;     cin >> n >> a >> b;     string s;     cin >> s;     vector<vector<long long int> > pre(n + 1, vector<long long int>(1, -1)),         dp(n + 1, vector<long long int>(n + 1, -1));     string s1 =   ;     for (long long int l = 1; l < n; l++) {       long long int min1 = min(l, n - l);       s1 += s[l - 1];       string s2 =   ;       for (long long int idx = l; idx < (l + min1); idx++) {         s2 += s[idx];       }       long long int len = get_len(s1, s2);       pre[l][0] = len;     }     cout << solve(s, pre, dp, 0, n - 1, a, b) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAXN = 1e5 + 1;   const long long INF = 1e9 + 1;   const long long MOD = 1e9;   const long long BITS = 64;   const long double EPS = 1e-12;   void bye() {     cout <<   n ;     exit(0);   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, k;     cin >> n >> k;     string s;     cin >> s;     vector<int> cnt(k);     for (int i = 0; i < (long long)(s).size(); i++) {       cnt[s[i] -  A ]++;     }     cout << *min_element((cnt).begin(), cnt.end()) * k;     bye();   }
#include <bits/stdc++.h>   using namespace std;   const int nmax = 110;   int x[nmax];   char g[nmax][nmax];   int pos[nmax * nmax][2];   int main() {     int a, b, c, d;     scanf( %d%d%d%d , &a, &b, &c, &d);     int q;     scanf( %d , &q);     for (int i = 0; i < q; ++i) {       scanf( %d , &x[i]);     }     bool swapped = false;     if (b < d) {       swap(b, d);       swap(a, c);       swapped = true;     }     int n = b;     int m = a + c;     memset(g,  . , sizeof(g));     int k = 0;     for (int j = 0; j < m; ++j) {       if (((j ^ a) & 1) == 0) {         for (int i = 0; i < (j < a ? b : d); ++i) {           pos[k][0] = i;           pos[k][1] = j;           ++k;         }       } else {         for (int i = (j < a ? b : d) - 1; i >= 0; --i) {           pos[k][0] = i;           pos[k][1] = j;           ++k;         }       }     }     int cnt = 0;     for (int i = 0; i < q; ++i) {       for (int j = 0; j < x[i]; ++j) {         g[pos[cnt][0]][pos[cnt][1]] =  a  + (char)i;         ++cnt;       }     }     if (swapped) {       for (int i = 0; i < n; ++i) {         reverse(g[i], g[i] + m);       }     }     puts( YES );     for (int i = 0; i < n; ++i) {       g[i][m] = 0;       puts(g[i]);     }     return 0;   }
#include <bits/stdc++.h>   const int INF = 0x3f3f3f3f;   const long long int INFLL = 0x3f3f3f3f3f3f3f3fll;   long long int getint() {     long long int ret = 0;     bool f = 0;     char c;     while ((c = getchar()) <  0  || c >  9 )       if (c ==  - ) f ^= 1;     while (c >=  0  && c <=  9 ) {       ret = ret * 10 + c -  0 ;       c = getchar();     }     return f ? -ret : ret;   }   using namespace std;   const int MAXN = 100;   long long int f[MAXN + 10][2];   char s[MAXN + 10];   int main() {     scanf( %s , s + 1);     int n = strlen(s + 1);     f[1][0] = 1;     for (int i = 2; i <= n; ++i) {       if (s[i - 1] ==  A ) f[i][0] += f[i - 1][0];       if (s[i - 1] ==  B  && s[i] ==  A ) f[i][1] += f[i - 1][0];       if (s[i] ==  B ) f[i][1] += f[i - 1][1];       f[i][0] += f[i - 1][1];     }     long long int ans = f[n][1];     if (s[n] ==  A ) ans += f[n][0];     memset(f, 0, sizeof f);     f[1][1] = 1;     for (int i = 2; i <= n; ++i) {       if (s[i - 1] ==  A ) f[i][0] += f[i - 1][0];       if (s[i - 1] ==  B  && s[i] ==  A ) f[i][1] += f[i - 1][0];       if (s[i] ==  B ) f[i][1] += f[i - 1][1];       f[i][0] += f[i - 1][1];     }     if (s[1] ==  B )       ans += f[n][1];     else if (s[n] ==  B )       ans += f[n][0];     printf( %I64d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 109;   const int INF = 1e9;   char zbs[5] = { R ,  G ,  B ,  Y ,  W };   pair<int, int> a[N];   int main() {     int n, ans = 11;     cin >> n;     for (int i = 0; i < int(n); ++i) {       char t1, t2;       cin >> t1 >> t2;       a[i].second = int(t2 -  1 );       for (int j = 0; j < int(5); ++j)         if (zbs[j] == t1) a[i].first = j;     }     for (int mask1 = 0; mask1 < int(1 << 5); ++mask1) {       for (int mask2 = 0; mask2 < int(1 << 5); ++mask2) {         int m[5][5], na = 0, ok = 1;         memset(m, 0, sizeof(m));         for (int i = 0; i < int(5); ++i) {           if (mask1 & (1 << i)) ++na;           if (mask2 & (1 << i)) ++na;         }         for (int i = 0; i < int(n); ++i) m[a[i].first][a[i].second] = 1;         for (int i1 = 0; i1 < int(5); ++i1)           for (int j1 = 0; j1 < int(5); ++j1)             for (int i2 = 0; i2 < int(5); ++i2)               for (int j2 = 0; j2 < int(5); ++j2) {                 bool ok1 = 0;                 if (m[i1][j1] * m[i2][j2] == 0) continue;                 if (i1 == i2 && j1 == j2) continue;                 if (i1 != i2 && ((mask1 & (1 << i1)) || (mask1 & (1 << i2))))                   ok1 = 1;                 if (j1 != j2 && ((mask2 & (1 << j1)) || (mask2 & (1 << j2))))                   ok1 = 1;                 if (ok) ok = ok1;               }         if (ok) ans = min(na, ans);       }     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   vector<int> g[100001];   bool is_centroid[100001];   int centroid_parent[100001];   int mn[100001];   int sz[100001];   int level[100001];   int centroid_root;   map<pair<int, int>, int> dist;   void dfs(int nd, int p, int c) {     sz[nd] = 1;     if (p == c) {       level[nd] = 0;     } else {       level[nd] = level[p] + 1;     }     dist[make_pair(nd, c)] = level[nd] + 1;     for (int i = 0; i < g[nd].size(); i++) {       int z = g[nd][i];       if (z != p && !is_centroid[z]) {         dfs(z, nd, c);         sz[nd] += sz[z];       }     }   }   int pd;   int find_centroid(int u, int ts) {     for (int i = 0; i < g[u].size(); i++) {       int z = g[u][i];       if (is_centroid[z] || sz[z] > sz[u]) continue;       if (sz[z] > ts / 2) return find_centroid(z, ts);     }     return u;   }   int get_centroid(int nd, int p) {     dfs(nd, p, p);     int u = find_centroid(nd, sz[nd]);     is_centroid[u] = true;     centroid_parent[u] = p;     for (int i = 0; i < g[u].size(); i++) {       int z = g[u][i];       if (!is_centroid[z]) {         get_centroid(z, u);       }     }     return u;   }   void centroid_decompose() {     fill(is_centroid, is_centroid + 100001, false);     centroid_root = get_centroid(1, -1);   }   void debug() {     for (int i = 1; i <= n; i++) {       cout << i <<     << centroid_parent[i] <<     << mn[i] << endl;     }   }   void redify(int u) {     int x = u;     while (u != -1) {       mn[u] = min(dist[make_pair(x, u)], mn[u]);       u = centroid_parent[u];     }   }   int solve(int u) {     int res = INT_MAX / 3;     int x = u;     while (u != -1) {       res = min(res, dist[make_pair(x, u)] + mn[u]);       u = centroid_parent[u];     }     return res;   }   int main() {     int u, v;     scanf( %d %d , &n, &m);     for (int i = 0; i < n - 1; i++) {       scanf( %d %d , &u, &v);       g[u].push_back(v);       g[v].push_back(u);     }     fill(mn, mn + 100001, INT_MAX / 3);     centroid_decompose();     redify(1);     while (m--) {       scanf( %d %d , &u, &v);       if (u == 1) {         redify(v);       } else {         printf( %d n , solve(v));       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100010;   vector<int> v[5 * maxn];   int t[5 * maxn];   int comp[5 * maxn];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n = 0, m = 0, x = 0, y = 0;     cin >> n >> m;     for (int i = 0; i < m; ++i) {       cin >> x >> y;       --x;       --y;       v[x].push_back(y);       v[y].push_back(x);     }     vector<int> aux;     for (int i = 0; i < n; ++i) {       cin >> t[i];       comp[i] = 1;       if (t[i] == comp[i]) aux.push_back(i);     }     bool flag = false;     for (int i = 0; i < (int)aux.size(); ++i) {       int node = aux[i];       if (comp[node] != t[node]) flag = true;       for (auto j : v[node]) {         if (comp[j] == t[node]) {           ++comp[j];           if (comp[j] == t[j]) aux.push_back(j);         }       }     }     if ((int)aux.size() < n) flag = true;     if (flag)       cout <<  -1 ;     else {       for (auto i : aux) {         cout << (i + 1) <<    ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int dp[513];   int n, m;   int main() {     scanf( %d %d , &n, &m);     for (int i = 0; i < n; ++i) {       scanf( %d , &dp[i + 1]);     }     double best = 0;     for (int i = 0; i < m; ++i) {       int x, y, z;       scanf( %d %d %d , &x, &y, &z);       best = max(best, ((double)dp[x] + dp[y]) / z);     }     printf( %.9lf , best);     return 0;   }
#include <bits/stdc++.h>   const int N = int(1e5 + 3);   using namespace std;   bool is_prime(int n) {     if (n == 2) return true;     if (n % 2 == 0) return false;     for (int i = 2; i * i <= n; ++i)       if (n % i == 0) return false;     return true;   }   void solve() {     long long n;     cin >> n;     long long t = n / 3;     long long t1 = (t - 1) + t * 2;     long long t2 = (t) + (t + 1) * 2;     long long t3 = (t) + t * 2;     if (t1 == n) {       cout << (t - 1) <<     << t <<   n ;       ;     } else if (t2 == n) {       cout << t <<     << t + 1 <<   n ;       ;     } else if (t3 == n) {       cout << t <<     << t <<   n ;       ;     } else {       cout << t + 1 <<     << t <<   n ;       ;     }     return;   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> adj[1005];   int w[1005];   int main() {     int n, k;     cin >> n >> k;     if (n - k - 1 < k) return cout << -1, 0;     cout << n * k << endl;     for (int i = 1; i <= n; i++) {       int t = w[i];       for (int j = i + 1; j <= n; j++) {         if (w[i] < k)           printf( %d %d n , i, j), w[i]++;         else if (w[j] < k)           printf( %d %d n , j, i), w[j]++;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)1e9;   int main() {     int n, d, l;     vector<int> a;     cin >> n >> d >> l;     int a1 = 0;     for (int i = 0; i < n - 1; i++) {       if (d < 1)         a1 = 1;       else if (d >= l)         a1 = l;       else         a1 = d + 1;       a.push_back(a1);       d = a1 - d;     }     a.push_back(d);     if (a.back() < 1 || a.back() > l) {       cout << -1;       return 0;     }     for (int i = 0; i < n; i++) cout << a[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       vector<int> v(n), rank(n + 1), v1(m);       for (int i = 0; i < n; i++) {         cin >> v[i];         rank[v[i]] = i + 1;       }       for (int i = 0; i < m; i++) cin >> v1[i];       long long cnt = 0;       long long pre = 0;       for (int i = 0; i < m; i++) {         if (rank[v1[i]] < pre) {           cnt += 1;         } else {           int k = rank[v1[i]] - 1;           k -= i;           cnt += (2 * k + 1);           pre = rank[v1[i]];         }       }       cout << cnt << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int maxi = 0;   long long int nc2(long long int n) { return (n * (n - 1)) / 2; }   int m[367];   int f[367];   int main() {     int n, g;     cin >> n;     while (n--) {       char c;       int l, r;       cin >> c >> l >> r;       if (c ==  M ) {         for (int i = l; i <= r; i++) {           m[i]++;         }       } else {         for (int i = l; i <= r; i++) {           f[i]++;         }       }     }     for (int i = 1; i < 367; i++) {       g = min(m[i], f[i]);       if (maxi < g) {         maxi = g;       }     }     cout << 2 * maxi << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int a[n + 1];     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     long long int f[n + 1];     f[0] = 0;     for (int i = 1; i < n; i++) {       f[i] = f[i - 1] ^ i;     }     long long sum = 0;     for (int i = 1; i <= n; i++) {       if ((n / (i)) % 2 == 1) {         sum = sum ^ (a[i] ^ f[i - 1]) ^ (f[n % i]);       } else {         sum = sum ^ a[i] ^ f[n % i];       }     }     cout << sum;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     long long res = 0;     for (size_t i = 0; i < s.size(); ++i) {       int c = s[i] -  0 ;       int pc = (i > 0 ? s[i - 1] -  0  : 0);       if (c % 4 == 0) {         ++res;       }       if ((pc * 10 + c) % 4 == 0) {         res += i;       }     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int nxt() {     int res;     scanf( %d , &res);     return res;   }   inline void solve() {     int n = nxt();     int k = nxt();     int d = nxt();     vector<vector<int> > ans;     ans.push_back(vector<int>(d, 0));     while (int(ans.size()) < n) {       vector<int> q = ans.back();       int add = 1;       for (int i = 0; i < d && add; ++i) {         q[i] += add;         add = 0;         if (q[i] >= k) {           q[i] -= k;           add = 1;         }       }       if (add) {         break;       }       ans.push_back(q);     }     if (int(ans.size()) != n) {       cout <<  -1 n ;       return;     }     for (int i = 0; i < d; ++i) {       for (int j = 0; j < n; ++j) {         cout << ans[j][i] + 1 <<    ;       }       cout <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long dp[5005][5005];   long long solve(long long x, long long y) {     if (x == 0 || y == 0) return 1;     if (dp[x][y] == 0)       dp[x][y] = (solve(x - 1, y - 1) * y + solve(x - 1, y)) % 998244353;     return dp[x][y];   }   int main() {     long long n, m, k;     while (scanf( %lld%lld%lld , &n, &m, &k) != EOF) {       memset(dp, 0, sizeof(0));       printf( %lld n ,              (solve(n, m) * solve(m, k) % 998244353) * solve(k, n) % 998244353);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const double PI = 3.141592653528;   const long long INF = 10000000000000000;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<pair<pair<int, int>, int> > v;       long long sum = 0;       for (int i = 0; i < 2 * n - 1; ++i) {         int a, b;         cin >> a >> b;         v.push_back(make_pair(make_pair(a, b), i));         sum += b;       }       cout <<  YES n ;       sort(v.rbegin(), v.rend());       long long sum1 = v[0].first.second;       int k = 1;       for (int i = 0; i < n - 1; ++i) sum1 += v[k + 2 * i].first.second;       if (2 * sum1 < sum) ++k;       cout << v[0].second + 1 <<    ;       for (int i = 0; i < n - 1; ++i) cout << v[k + 2 * i].second + 1 <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, x1, y1, x2, y2, x, y;     scanf( %d%d%d%d%d%d , &n, &m, &x1, &y1, &x2, &y2);     x = abs(x1 - x2);     y = abs(y1 - y2);     if (x + y >= 7 || y >= 5 || x >= 5)       printf( Second n );     else       printf( First n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> num;     int n;     cin >> n;     int k = -1, tmp;     while (n > 0) {       tmp = n % 10;       num.push_back(tmp);       if (tmp > k) k = tmp;       n /= 10;     }     cout << k << endl;     bool flag = true;     bool main = true;     while (true) {       flag = false;       main = false;       for (int i = num.size() - 1; i > -1; i--) {         if (num[i] > 0) {           cout << 1;           flag = true;           main = true;           num[i]--;         } else if ((num[i] == 0) && (main))           cout << 0;       }       if (flag == false) break;       cout <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const double eps = 1e-6;   const double pi = acos(-1.0);   int T[100005 << 2];   void update(int n, int L, int R, int p, int a) {     if (L == R) {       T[n] = a;       return;     }     if (p > (L + R) / 2)       update(n * 2 + 1, (L + R) / 2 + 1, R, p, a);     else       update(n * 2, L, (L + R) / 2, p, a);     T[n] = max(T[n * 2], T[n * 2 + 1]);   }   int query(int n, int L, int R, int l, int r) {     if (L == l && R == r) return T[n];     int M = (L + R) / 2;     if (l > M)       return query(n * 2 + 1, M + 1, R, l, r);     else if (r <= M)       return query(n * 2, L, M, l, r);     else       return max(query(n * 2, L, M, l, M), query(n * 2 + 1, M + 1, R, M + 1, r));   }   struct node {     node(){};     node(int L, int R, int M, double P) : l(L), r(R), mx(M), p(P){};     int l, r, mx;     double p;     vector<int> c;     bool operator<(const node& n) const { return l == n.l ? r > n.r : l < n.l; };   } N[5005];   int q;   double dp[5005][5005];   double dfs(int n) {     for (auto i : N[n].c) dfs(i);     double a, b;     dp[n][0] = 1.0 - N[n].p;     for (auto i : N[n].c)       if (N[n].mx - N[i].mx <= q) dp[n][0] *= dp[i][N[n].mx - N[i].mx];     for (int j = 1; j <= q; ++j) {       a = b = 1;       for (auto i : N[n].c) {         if (N[n].mx - N[i].mx + j - 1 <= q) a *= dp[i][N[n].mx - N[i].mx + j - 1];         if (N[n].mx - N[i].mx + j <= q) b *= dp[i][N[n].mx - N[i].mx + j];       }       dp[n][j] = a * N[n].p + b * (1.0 - N[n].p);     }     if (n == 0) {       double ans = dp[n][0] * N[n].mx;       for (int j = 1; j <= q; ++j)         if (dp[n][j] > dp[n][j - 1])           ans += (dp[n][j] - dp[n][j - 1]) * (N[n].mx + j);       return ans;     } else       return 0;   }   int main() {     int n, a, l, r;     double p;     stack<int> s;     cin >> n >> q;     for (int i = 1; i <= n; ++i) {       cin >> a;       update(1, 1, n, i, a);     }     for (int i = 1; i <= q; ++i) {       cin >> l >> r >> p;       N[i] = node(l, r, query(1, 1, n, l, r), p);     }     N[0] = node(1, n, T[1], 0);     sort(N + 1, N + 1 + q);     s.push(0);     for (int i = 1; i <= q; ++i) {       while (!s.empty()) {         l = N[s.top()].l;         r = N[s.top()].r;         if (l <= N[i].l && N[i].r <= r) {           N[s.top()].c.push_back(i);           s.push(i);           break;         } else           s.pop();       }     }     memset(dp, 0, sizeof(dp));     printf( %.8lf n , dfs(0));   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100005;   int arr[2 * MAXN];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= 2 * n; i++) scanf( %d , arr + i);     sort(arr + 1, arr + 2 * n + 1);     long long best = LONG_LONG_MAX;     for (int start_x = 1; start_x <= n + 1; start_x++) {       int r_x = arr[start_x + n - 1] - arr[start_x];       int y_max = ((start_x == n + 1) ? arr[n] : arr[2 * n]);       int y_min = ((start_x == 1) ? arr[n + 1] : arr[1]);       int r_y = y_max - y_min;       best = min(best, 1ll * r_x * r_y);     }     printf( %lld n , best);     return 0;   }