malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   long double PI = acosl(-1);   const long long infl = 1e18;   const int nmax = 1e6 + 5;   const int MAXLG = log2(nmax) + 1;   const int N = 2e4 + 5;   struct Hopcroft_Karp {     int NIL = 0, INF = (1 << 28), match[N], dist[N], n, m;     vector<int> G[N];     void init(int lft, int rgt) {       n = lft, rgt = m;       for (int i = 0; i <= n + m + 1; i++) G[i].clear();     }     void addEdge(int u, int v) { G[u].push_back(v + n); }     bool bfs() {       queue<int> Q;       for (int i = 1; i <= n; i++) {         if (match[i] == NIL)           dist[i] = 0, Q.push(i);         else           dist[i] = INF;       }       dist[NIL] = INF;       while (!Q.empty()) {         int u = Q.front();         Q.pop();         if (u != NIL) {           for (int i = 0; i < G[u].size(); i++) {             int v = G[u][i];             if (dist[match[v]] == INF) {               dist[match[v]] = dist[u] + 1;               Q.push(match[v]);             }           }         }       }       return (dist[NIL] != INF);     }     bool dfs(int u) {       if (u != NIL) {         for (int i = 0; i < G[u].size(); i++) {           int v = G[u][i];           if (dist[match[v]] == dist[u] + 1) {             if (dfs(match[v])) {               match[v] = u;               match[u] = v;               return true;             }           }         }         dist[u] = INF;         return false;       }       return true;     }     int hopcroft_karp() {       memset(dist, 0, sizeof dist);       memset(match, 0, sizeof match);       int matching = 0;       while (bfs()) {         for (int i = 1; i <= n; i++) {           if (match[i] == NIL && dfs(i)) {             matching++;           }         }       }       return matching;     }   };   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     Hopcroft_Karp carp;     int n, m;     cin >> n >> m;     vector<pair<int, pair<int, int> > > ejes;     for (int i = 0; i < m; i++) {       int u, v, d;       cin >> u >> v >> d;       ejes.push_back({d, {u, v}});     }     carp.init(n, n);     for (pair<int, pair<int, int> > pp : ejes) {       carp.addEdge(pp.second.first, pp.second.second);     }     int z = carp.hopcroft_karp();     if (z != n) cout <<  -1 n , exit(0);     sort(ejes.begin(), ejes.end());     int lo = 1, hi = 1000000000;     while (hi > lo) {       int mid = (hi + lo) / 2;       carp.init(n, n);       for (auto pp : ejes) {         if (pp.first > mid) break;         carp.addEdge(pp.second.first, pp.second.second);       }       if (carp.hopcroft_karp() == n)         hi = mid;       else         lo = mid + 1;     }     cout << lo << endl;   }
#include <bits/stdc++.h>   using namespace std;   double max(double a, double b) { return (a > b ? a : b); }   int main() {     std::ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     double A[n][n];     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         cin >> A[i][j];       }     }     vector<vector<double> > DP(n, vector<double>(1 << n, 0));     DP[0][0] = 1;     for (int i = 1; i < n; ++i) {       DP[i][1 << (n - 1)] = A[0][i];     }     double mom = 0;     for (int k = 1; k < n; ++k) {       for (int i = 0; i < (1 << n); ++i) {         if (__builtin_popcount(i) != k) {           continue;         }         for (int player = 0; player < n; ++player) {           if (i & (1 << player)) {             continue;           }           double mx = 0;           DP[player][i] = 0;           for (int enemy = 0; enemy < n; ++enemy) {             mx = 0;             if (i & (1 << enemy)) {               mx += A[player][enemy] * DP[player][i - (1 << enemy)];               mx += A[enemy][player] * DP[enemy][i - (1 << enemy)];             }             DP[player][i] = max(mx, DP[player][i]);           }           if (k == n - 1) {             mom = max(DP[player][i], mom);           }         }       }     }     cout << (n == 1 ? 1 : mom) <<   n ;   }
#include <bits/stdc++.h>   int MakeTB(unsigned int *A, unsigned int *B, unsigned int *T, unsigned int N,              unsigned int StartBit) {     for (unsigned int i = 0; i < N - 1; i++)       if (A[i] == 0)         if (B[i] == 0) {           if (i > 0 && T[i] != 0) return 0;           T[i] = 0;           T[i + 1] = 0;         } else           return 0;       else if (B[i] == 0) {         if (i == 0) T[i] = StartBit;         T[i + 1] = !T[i];       } else {         if (i > 0 && T[i] != 1) return 0;         T[i] = 1;         T[i + 1] = 1;       }     return 1;   }   int MakeTWB(unsigned int *A, unsigned int *B, unsigned int *T, unsigned int N) {     unsigned int *a, *b, *t1, *t2;     a = new unsigned int[N - 1];     b = new unsigned int[N - 1];     t1 = new unsigned int[N];     t2 = new unsigned int[N];     for (unsigned int i = 0; i < N - 1; i++) {       a[i] = A[i] & 1;       b[i] = B[i] & 1;     }     if (!(MakeTB(a, b, t1, N, 0) || MakeTB(a, b, t1, N, 1))) return 0;     for (unsigned int i = 0; i < N - 1; i++) {       a[i] = A[i] >> 1;       b[i] = B[i] >> 1;     }     if (!(MakeTB(a, b, t2, N, 0) || MakeTB(a, b, t2, N, 1))) return 0;     for (unsigned int i = 0; i < N; i++) T[i] = t1[i] | (t2[i] << 1);     return 1;   }   int main(void) {     unsigned int N;     unsigned int *a, *b, *t;     scanf( %d , &N);     a = new unsigned int[N - 1];     b = new unsigned int[N - 1];     t = new unsigned int[N];     for (unsigned int i = 0; i < N - 1; i++) scanf( %d , &a[i]);     for (unsigned int i = 0; i < N - 1; i++) scanf( %d , &b[i]);     if (MakeTWB(a, b, t, N)) {       printf( YES n );       for (unsigned int i = 0; i < N; i++) printf( %i  , t[i]);     } else       printf( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<int, int> mp, x[1000005];   int main() {     int t1;     cin >> t1;     while (t1--) {       string s, t;       cin >> s >> t;       mp.clear();       for (int i = 0; i < s.size(); i++) mp[s[i]]++;       bool q = true;       for (int i = 0; i < t.size(); i++) {         if (mp[t[i]] == 0) {           q = false;           break;         }       }       if (q == false) {         cout << -1 << endl;         continue;       }       for (int j = 100005; j >= 1; j--) x[j].clear();       for (int i = s.size() - 1; i >= 0; i--) {         for (int j = 1; j <= 26; j++) x[i + 1][j] = x[i + 2][j];         x[i + 1][s[i] -  a  + 1] = i + 1;       }       int in = 0, ans = 0;       while (in < t.size()) {         ans++;         int ind = 0;         while (true) {           if (x[ind + 1][t[in] -  a  + 1] == 0) break;           ind = x[ind + 1][t[in] -  a  + 1];           in++;           if (in >= t.size()) break;         }         if (in >= t.size()) break;       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int a[10001];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m, k;     cin >> n >> m >> k;     long long int x1 = 1, x2 = 1;     int p = k;     if (k % 2 == 0) {       k -= 1;     }     int x = 1, y = 1, res = 0;     for (int j = 1; j <= m; j++) {       for (int i = 1; i <= n; i++) {         a[i] = x;         if (a[i] == k) {           cout << i <<     << j <<    ;           p % 2 == 0 ? cout <<  R  : cout <<  L ;           return 0;         }         x += m * 2;       }       x = y + 2 * j;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e6 + 10;   int n, a[MAXN], d[MAXN];   bool pic[MAXN];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       int temp;       scanf( %d , &temp);       pic[temp] = 1;     }     fill(d, d + MAXN, 1);     int ans = 0;     for (int i = 1; i < MAXN; i++) {       if (pic[i]) ans = max(ans, d[i]);       if (pic[i])         for (int j = i + i; j < MAXN; j += i) d[j] = max(d[j], d[i] + 1);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   struct BIT {     int n;     vector<int> bit;     BIT(int _n = 0) {       n = _n;       bit.assign(n + 5, 0);     }     void update(int pos, int val) {       for (; pos <= n; pos += pos & -pos) bit[pos] += val;     }     int getsum(int pos) {       int res = 0;       for (; pos; pos -= pos & -pos) res += bit[pos];       return res;     }   };   BIT bit[3];   set<int> pos[3];   int a[N];   int n, q;   int fix(char c) {     if (c ==  R ) return 0;     if (c ==  S ) return 1;     return 2;   }   int getans() {     int res = 0;     for (int x = 0; x < 3; x++)       if (pos[x].size()) {         int y = (x + 1) % 3;         int z = (x + 2) % 3;         if (!pos[y].size())           res += n * (!pos[z].size());         else {           res += pos[x].size();           if (pos[z].size()) {             int l = *pos[y].begin();             int r = *prev(pos[y].end());             int u = *pos[z].begin();             int v = *prev(pos[z].end());             if (r < v) res -= bit[x].getsum(v) - bit[x].getsum(r - 1);             if (u < l) res -= bit[x].getsum(l) - bit[x].getsum(u - 1);           }         }       }     return res;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> q;     for (int i = 0; i < 3; i++) bit[i] = BIT(n);     for (int i = 1; i <= n; i++) {       char c;       cin >> c;       a[i] = fix(c);       pos[a[i]].insert(i);       bit[a[i]].update(i, 1);     }     cout << getans() <<   n ;     while (q--) {       int i;       char c;       cin >> i >> c;       pos[a[i]].erase(i);       bit[a[i]].update(i, -1);       a[i] = fix(c);       pos[a[i]].insert(i);       bit[a[i]].update(i, 1);       cout << getans() <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct ss {     long long sur, x, y, z;     ss() {}     ss(long long a, long long b, long long c, long long d) {       sur = a;       x = b;       y = c;       z = d;     }   } ans;   int n, tot, a[100], b[100];   long long x, uu, p[100], u[200000];   long long calc(long long a, long long b, long long c) {     return a * b + a * c + b * c;   }   long long getsqr(long long a) {     long long b = (long long)sqrt(a) + 1;     while (b * b > a) --b;     return b;   }   long long gettri(long long a) {     long long b = (long long)pow(a, 1.0 / 3) + 1;     while (b * b * b > a) --b;     return b;   }   void dfs(int now, long long lim, long long xx) {     if (!now) {       u[++tot] = xx;       return;     }     dfs(now - 1, lim, xx);     for (int i = 1; i <= a[now]; ++i) {       xx *= p[now];       if (xx > lim) break;       dfs(now - 1, lim, xx);     }   }   void dfs2(int now, long long lim, long long xx) {     if (!now) {       if (calc(uu, xx, x / xx / uu) < ans.sur)         ans = ss(calc(uu, xx, x / xx / uu), uu, xx, x / xx / uu);       return;     }     dfs2(now - 1, lim, xx);     for (int i = 1; i <= a[now]; ++i) {       xx *= p[now];       if (xx > lim) break;       dfs2(now - 1, lim, xx);     }   }   bool cmp(long long a, long long b) { return a > b; }   int main() {     int T;     cin >> T;     for (int test = 1; test <= T; ++test) {       cin >> n;       x = 1;       for (int i = 1; i <= n; ++i) {         cin >> p[i] >> a[i];         for (int j = 1; j <= a[i]; ++j) x *= p[i];       }       memcpy(b, a, sizeof(a));       tot = 0;       dfs(n, gettri(x), 1LL);       sort(u + 1, u + tot + 1, cmp);       ans = ss(calc(x, 1, 1), x, 1, 1);       for (int i = 1; i <= tot; ++i) {         long long vw = x / u[i], v = getsqr(vw), w = u[i];         uu = u[i];         if (calc(u[i], v, v) > ans.sur) continue;         for (int j = 1; j <= n; ++j)           while (w % p[j] == 0) {             w /= p[j];             --a[j];           }         dfs2(n, getsqr(vw), 1LL);         memcpy(a, b, sizeof(b));       }       cout << ans.sur * 2 <<     << ans.x <<     << ans.y <<     << ans.z << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int depth[200005], dad[200005];   int dep = 0;   void node_depth(vector<int> vec[], int i) {     dep = depth[i] + 1;     for (auto j : vec[i - 1]) {       if (j != dad[i]) {         depth[j] = dep;       }     }     for (auto j : vec[i - 1]) {       if (j != dad[i]) {         node_depth(vec, j);       }     }   }   int entry[200005], exiit[200005];   int timer = 0;   void ancestor(vector<int> vec[], int i) {     entry[i] = timer;     timer++;     for (auto j : vec[i - 1]) {       if (j != dad[i]) {         dad[j] = i;         ancestor(vec, j);       }     }     exiit[i] = timer;     timer++;   }   bool isParent(int a, int b) {     return (entry[a] <= entry[b] && exiit[a] >= exiit[b]);   }   signed idiot() {     depth[1] = 0;     int n, m;     cin >> n >> m;     vector<int> edge[n];     dad[1] = 1;     for (int i = 0; i < n - 1; i++) {       int u, v;       cin >> u >> v;       edge[u - 1].push_back(v);       edge[v - 1].push_back(u);     }     ancestor(edge, 1);     node_depth(edge, 1);     while (m--) {       int k;       cin >> k;       int temp = 1;       vector<int> ve;       while (k--) {         int vi;         cin >> vi;         if (depth[vi] > depth[temp]) {           temp = vi;         }         ve.push_back(vi);       }       bool path = true;       for (auto i : ve) {         if (!isParent(dad[i], temp)) {           path = false;           break;         }       }       cout << (path ?  YES  :  NO ) <<   n ;     }     return 0;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int test_case = 1;     while (test_case--) idiot();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 7, maxm = 35 * maxn;   int nxt[maxm][2], tot, a[maxn];   long long ans = 0;   void ins(int x) {     int now = 0;     for (int i = 29; i >= 0; i--) {       int go = (x >> i) & 1;       if (nxt[now][go] == 0) nxt[now][go] = ++tot;       now = nxt[now][go];     }   }   long long query(int x) {     long long ret = 0;     int now = 0;     for (int i = 29; i >= 0; i--) {       int go = (x >> i) & 1;       if (nxt[now][go])         now = nxt[now][go];       else         now = nxt[now][go ^ 1], ret |= (1 << i);     }     return ret;   }   void dfs(int l, int r, int dep) {     if (dep == -1 || l >= r) return;     int mid = l - 1;     while (mid < r && (a[mid + 1] >> dep & 1) == 0) mid++;     dfs(l, mid, dep - 1);     dfs(mid + 1, r, dep - 1);     if (mid == l - 1 || mid == r) return;     for (int i = l; i <= mid; i++) ins(a[i]);     long long ret = 1e18;     for (int i = mid + 1; i <= r; i++) ret = min(ret, query(a[i]));     ans += ret;     for (int i = 0; i <= tot; i++) nxt[i][0] = nxt[i][1] = 0;     tot = 0;   }   int n;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     sort(a + 1, a + n + 1);     dfs(1, n, 29);     return 0 * printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b = 0;     cin >> a;     if (a % 2 == 1) {       b += 16;     }     if ((a >> 1) % 2 == 1) {       b += 2;     }     if ((a >> 2) % 2 == 1) {       b += 8;     }     if ((a >> 3) % 2 == 1) {       b += 4;     }     if ((a >> 4) % 2 == 1) {       b += 1;     }     if ((a >> 5) % 2 == 1) {       b += 32;     }     cout << b << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     vector<long long int> v(n);     for (long long int i = 0; i < n; i++) {       cin >> v[i];     }     sort((v).begin(), (v).end());     set<long long> s;     if (n == 1) {       cout << -1;     } else if (n == 2) {       s.insert(v[1] + (v[1] - v[0]));       s.insert(v[0] - (v[1] - v[0]));       if ((v[1] - v[0]) % 2 == 0) {         s.insert(v[0] + (v[1] - v[0]) / 2);       }       cout << s.size() <<   n ;       for (auto i : s) {         cout << i <<    ;       }     } else {       long long d = INT_MAX;       for (long long i = 0; i < n - 1; i++) {         d = min(d, v[i + 1] - v[i]);       }       bool missed = false;       bool noap = false;       for (long long i = 0; i < n - 1; i++) {         if (v[i + 1] == v[i] + d)           continue;         else {           if (v[i + 1] == v[i] + (d * 2)) {             if (missed == false) {               missed = true;               s.insert(v[i] + d);             } else {               noap = true;               break;             }           } else {             noap = true;             break;           }         }       }       if (noap) {         cout << 0;       } else if (missed) {         cout << 1 <<   n ;         cout << (*s.begin());       } else {         s.insert(v[0] - d);         s.insert(v[n - 1] + d);         cout << s.size() <<   n ;         for (auto i : s) {           cout << i <<    ;         }       }     }   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:1024000000,1024000000 )   template <class T>   bool scanff(T &ret) {     char c;     int sgn;     T bit = 0.1;     if (c = getchar(), c == EOF) return 0;     while (c !=  -  && c !=  .  && (c <  0  || c >  9 )) c = getchar();     sgn = (c ==  - ) ? -1 : 1;     ret = (c ==  - ) ? 0 : (c -  0 );     while (c = getchar(), c >=  0  && c <=  9 ) ret = ret * 10 + (c -  0 );     if (c ==     || c ==   n ) {       ret *= sgn;       return 1;     }     while (c = getchar(), c >=  0  && c <=  9 ) ret += (c -  0 ) * bit, bit /= 10;     ret *= sgn;     return 1;   }   using namespace std;   long long dp[55][55][55];   int a[55];   int n, sum;   double ans;   int main() {     ans = 0.0;     scanff(n);     int tot = 0;     for (int i = int(1); i <= int(n); i++) scanff(a[i]), tot += a[i];     scanff(sum);     if (tot <= sum) {       printf( %.10f n , n * 1.0);       return 0;     }     for (int c = int(1); c <= int(n); c++) {       memset(dp, 0, sizeof(dp));       dp[0][0][0] = 1;       for (int i = int(1); i <= int(n); i++) {         for (int j = int(0); j <= int(i - 1); j++)           for (int k = int(0); k <= int(sum); k++) {             if (dp[i - 1][j][k]) {               dp[i][j][k] += dp[i - 1][j][k];               if (i != c && k + a[i] <= sum)                 dp[i][j + 1][k + a[i]] += dp[i - 1][j][k];             }           }       }       for (int j = int(1); j <= int(n); j++) {         for (int k = int(max(0, sum - a[c] + 1)); k <= int(50); k++) {           if (dp[n][j][k]) {             double temp = dp[n][j][k] * j;             int num = n - j;             int n1 = n - j, n2 = n;             for (int l = int(1); l <= int(num); l++) {               temp *= double(n1);               temp /= double(n2);               n1--;               n2--;             }             temp /= double(n - j);             ans += temp;           }         }       }     }     printf( %.10f n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 200010;   int par[M];   int sz[M];   struct edge {     int u, v, w;     bool operator<(const edge &e) const { return w < e.w; }   };   edge E[M];   pair<int, int> q[M];   long long out[M];   int f(int u) { return par[u] = par[u] == u ? u : f(par[u]); }   int add(int u, int v) {     u = f(u);     v = f(v);     if (u == v) return 0;     par[v] = u;     sz[u] += sz[v];     return sz[u];   }   long long get(int n) {     if (n <= 0) return 0;     return ((long long)n * (long long)(n - 1)) / 2;   }   int main() {     ios_base::sync_with_stdio(false);     int n, m;     cin >> n >> m;     for (int i = 0; i < n - 1; i++) {       cin >> E[i].u >> E[i].v >> E[i].w;     }     for (int i = 0; i < m; i++) {       cin >> q[i].first;       q[i].second = i;     }     sort(E, E + n - 1);     sort(q, q + m);     for (int i = 1; i <= n; i++) par[i] = i, sz[i] = 1;     long long ans = 0;     int j = 0;     for (int i = 0; i < m; i++) {       while (j < n - 1) {         if (E[j].w > q[i].first) break;         int u = f(E[j].u), v = f(E[j].v);         ans -= (get(sz[u]) + get(sz[v]));         ans += get(add(u, v));         j++;       }       out[q[i].second] = ans;     }     for (int i = 0; i < m; i++) cout << out[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     for (int i = 1, j = n; i <= n / 2; ++i, --j) printf( %d %d  , i, j);     if (n % 2 == 1) printf( %d , n / 2 + 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b;     cin >> a >> b;     if (a == b)       cout << a << 0 <<     << b << 1 << endl;     else if (a + 1 == b) {       cout << a << 9 <<     << b << 0 << endl;     } else if (a == 9 && b == 1) {       cout <<  9 10  << endl;     } else {       cout << -1;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100123;   const int lgn = 20;   long long a[maxn], f[maxn][lgn], ans;   vector<int> G[maxn];   void dfs(int u, int p, int x) {     int w = a[u] >> x & 1;     f[u][w] = 1, f[u][w ^ 1] = 0;     for (auto& v : G[u]) {       if (v != p) {         dfs(v, u, x);         ans += (1 << x) * (f[u][1] * f[v][0] + f[u][0] * f[v][1]);         f[u][w] += f[v][0];         f[u][w ^ 1] += f[v][1];       }     }   }   int main() {     cin.sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     for (int i = 0; i < (n); ++i) cin >> a[i], ans += a[i];     for (int i = 0; i < (n - 1); ++i) {       int u, v;       cin >> u >> v;       --u, --v;       G[u].push_back(v);       G[v].push_back(u);     }     for (int i = 0; i < (lgn); ++i) dfs(0, -1, i);     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int ans;   char s[100];   int main() {     cin >> s;     for (int i = 0; i < strlen(s); i++)       if (s[i] ==  a  || s[i] ==  e  || s[i] ==  i  || s[i] ==  o  ||           s[i] ==  u  || s[i] ==  1  || s[i] ==  3  || s[i] ==  5  ||           s[i] ==  7  || s[i] ==  9 )         ans++;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int test, i, k, j, sum1, sum, n, p;     cin >> test;     for (i = 0; i < test; i++) {       cin >> n >> k;       sum = 0;       sum1 = 0;       vector<int> v1, v2;       for (j = 0; j < n; j++) {         cin >> p;         v1.push_back(p);       }       for (j = 0; j < n; j++) {         cin >> p;         v2.push_back(p);       }       sort(v1.begin(), v1.end());       sort(v2.begin(), v2.end());       for (j = 0; j < k; j++) {         if (v2[n - j - 1] > v1[j])           sum1 = sum1 + v2[n - j - 1];         else           sum1 = sum1 + v1[j];       }       for (j = k; j < n; j++) sum = sum + v1[j];       cout << sum + sum1 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0), eps = 1e-4;   double fgcd(double a, double b) {     return fabs(a) < eps ? b : (fabs(b) < eps ? a : fgcd(b, fmod(a, b)));   }   int main() {     double a, b, c, d, e, f;     cin >> a >> b >> c >> d >> e >> f;     c -= a;     e -= a;     d -= b;     f -= b;     a = (c * c + d * d) / 2;     b = (e * e + f * f) / 2;     double ov = 1.0 / (d * e - c * f);     double A = (d * b - f * a) * ov, B = (e * a - c * b) * ov;     double R = sqrt(A * A + B * B), G1 = asin(sqrt(a * 2) / (R * 2)),            G2 = asin(sqrt(b * 2) / (R * 2)),            G = asin(hypot(c - e, d - f) / (R * 2));     G = fgcd(G1, fgcd(G2, pi));     G = pi / round(pi / G);     A = round(pi / G) * R * R * sin(G * 2) / 2;     printf( %.8lf n , A);   }