malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   pair<int, int> add(pair<int, int> p1, pair<int, int> p2, int odd, int even) {     return make_pair(p1.first + p2.first - odd, p1.second + p2.second - even);   }   pair<int, int> dfs(vector<int>* adj, int* visited, int* store, int u,                      int parent, int odd, int even, int* l, int* m,                      vector<int>& v) {     visited[u] = 1;     int level = store[u];     if (level % 2 == 1) {       if (l[u] != m[u] ^ odd % 2 == 1) {         odd++;         v.push_back(u);       }     } else {       if (l[u] != m[u] ^ even % 2 == 1) {         even++;         v.push_back(u);       }     }     pair<int, int> p = make_pair(odd, even);     int a = p.first, b = p.second;     for (int i = 0; i < adj[u].size(); i++) {       if (adj[u][i] != parent && !visited[adj[u][i]])         p = add(p, dfs(adj, visited, store, adj[u][i], u, a, b, l, m, v), a, b);     }     return p;   }   int main() {     int n;     scanf( %d , &n);     ;     vector<int>* adj = new vector<int>[n];     for (int i = 0; i < n - 1; i++) {       int a, b;       scanf( %d , &a);       ;       scanf( %d , &b);       ;       a--;       b--;       adj[a].push_back(b);       adj[b].push_back(a);     }     int l[n], m[n];     for (int i = 0; i < n; i++) scanf( %d , &l[i]);     ;     for (int i = 0; i < n; i++) scanf( %d , &m[i]);     ;     int* visited = (int*)calloc(n, sizeof(int));     int* store = (int*)calloc(n, sizeof(int));     queue<int> q;     int even = 0, odd = 0, level = 1;     q.push(0);     q.push(-1);     visited[0] = 1;     while (!q.empty()) {       int u = q.front();       q.pop();       if (u == -1 && !q.empty()) {         level++;         q.push(-1);         continue;       } else if (u == -1)         break;       visited[u] = 1;       store[u] = level;       for (int i = 0; i < adj[u].size(); i++) {         if (!visited[adj[u][i]]) {           q.push(adj[u][i]);           visited[adj[u][i]] = 1;         }       }     }     for (int i = 0; i < n; i++) visited[i] = 0;     vector<int> v;     pair<int, int> p = dfs(adj, visited, store, 0, -1, 0, 0, l, m, v);     cout << p.first + p.second << endl;     for (int i = 0; i < v.size(); i++) cout << v[i] + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   int main() {     int t, j;     scanf( %d , &t);     for (j = 1; j <= t; j++) {       int n, d = 0, i;       char a[100000], b[100000], c[100000];       scanf( %s %s %s , a, b, c);       n = strlen(a);       for (i = 0; i < n; i++) {         if (a[i] == c[i] || b[i] == c[i]) d++;         if (a[i] == b[i] && b[i] != c[i]) break;       }       if (d == n)         printf( YES n );       else         printf( NO n );     }   }
#include <bits/stdc++.h>   using namespace std;   template <class S, class T>   pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {     return pair<S, T>(s.first + t.first, s.second + t.second);   }   template <class S, class T>   pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {     return pair<S, T>(s.first - t.first, s.second - t.second);   }   template <class S, class T>   ostream &operator<<(ostream &os, pair<S, T> p) {     os <<  (  << p.first <<  ,   << p.second <<  ) ;     return os;   }   template <class T>   bool chmax(T &a, const T &b) {     if (a < b) {       a = b;       return 1;     }     return 0;   }   template <class T>   bool chmin(T &a, const T &b) {     if (a > b) {       a = b;       return 1;     }     return 0;   }   const long long inf = 1000000001;   const long long INF = 2e18;   const long long MOD = 1000000007;   const double pi = 3.14159265358979323846;   int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};   int dx2[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy2[8] = {0, 1, 1, 1, 0, -1, -1, -1};   int main() {     int n;     cin >> n;     vector<int> a(n);     for (long long i = 0; i < (long long)(n); i++) {       cin >> a[i];     }     set<int> st;     st.insert(0);     for (long long i = 0; i < (long long)(n); i++) {       st.insert(a[i]);     }     cout << (int)st.size() - 1 << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string temp;     cin >> temp;     string a[4];     a[0] = temp[0];     a[1] = temp[1];     cin >> temp;     a[3] = temp[0];     a[2] = temp[1];     cin >> temp;     string b[4];     b[0] = temp[0];     b[1] = temp[1];     cin >> temp;     b[3] = temp[0];     b[2] = temp[1];     string A =   ;     string B =   ;     for (int i = 0; i < 4; i++) {       if (a[i] !=  X ) {         A += a[i];       }       if (b[i] !=  X ) {         B += b[i];       }     }     A = A + A;     string ans =  NO ;     for (int i = 0; i < 3; i++) {       if (A.substr(i, 3) == B) {         ans =  YES ;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = 3.141592653589793238;   const double E = 2.718281828459045235;   const int MOD = 1000000007;   const long long INF = 1000000000;   int main() {     ios_base::sync_with_stdio(0);     string s;     cin >> s;     cout << s;     reverse((s).begin(), (s).end());     cout << s;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int query(int x1, int y1, int x2, int y2) {     if (x1 > x2 || y1 > y2) return 0;     printf( ? %d %d %d %d n , x1, y1, x2, y2);     fflush(stdout);     int ans;     scanf( %d , &ans);     return ans;   }   int get_right(int x1, int y1, int x2, int y2) {     int left = x1 - 1, right = x2;     while (right - left > 1) {       int mid = (left + right) / 2;       if (query(x1, y1, mid, y2) == 1)         right = mid;       else         left = mid;     }     return right;   }   int get_left(int x1, int y1, int x2, int y2) {     int left = x1, right = x2 + 1;     while (right - left > 1) {       int mid = (left + right) / 2;       if (query(mid, y1, x2, y2) == 1)         left = mid;       else         right = mid;     }     return left;   }   int get_up(int x1, int y1, int x2, int y2) {     int left = y1 - 1, right = y2;     while (right - left > 1) {       int mid = (left + right) / 2;       if (query(x1, y1, x2, mid) == 1)         right = mid;       else         left = mid;     }     return right;   }   int get_down(int x1, int y1, int x2, int y2) {     int left = y1, right = y2 + 1;     while (right - left > 1) {       int mid = (left + right) / 2;       if (query(x1, mid, x2, y2) == 1)         left = mid;       else         right = mid;     }     return left;   }   bool solve_x() {     int left = 0, right = n;     while (right - left > 1) {       int mid = (left + right) / 2;       if (query(1, 1, mid, n) > 0)         right = mid;       else         left = mid;     }     if (query(right + 1, 1, n, n) != 1) return false;     int L1 = get_left(1, 1, right, n);     int R1 = get_right(1, 1, right, n);     int D1 = get_down(1, 1, right, n);     int U1 = get_up(1, 1, right, n);     int L2 = get_left(right + 1, 1, n, n);     int R2 = get_right(right + 1, 1, n, n);     int D2 = get_down(right + 1, 1, n, n);     int U2 = get_up(right + 1, 1, n, n);     printf( ! %d %d %d %d %d %d %d %d n , L1, D1, R1, U1, L2, D2, R2, U2);     fflush(stdout);     return true;   }   bool solve_y() {     int left = 0, right = n;     while (right - left > 1) {       int mid = (left + right) / 2;       if (query(1, 1, n, mid) > 0)         right = mid;       else         left = mid;     }     if (query(1, right + 1, n, n) != 1) return false;     int L1 = get_left(1, 1, n, right);     int R1 = get_right(1, 1, n, right);     int D1 = get_down(1, 1, n, right);     int U1 = get_up(1, 1, n, right);     int L2 = get_left(1, right + 1, n, n);     int R2 = get_right(1, right + 1, n, n);     int D2 = get_down(1, right + 1, n, n);     int U2 = get_up(1, right + 1, n, n);     printf( ! %d %d %d %d %d %d %d %d n , L1, D1, R1, U1, L2, D2, R2, U2);     fflush(stdout);     return true;   }   void solve() {     scanf( %d , &n);     if (!solve_x())       if (!solve_y()) throw;   }   int main() {     solve();     0;   }
#include <bits/stdc++.h>   using namespace std;   int nodistinct(string s, string a) {     int counter = 0;     for (int i = 0; i < a.size(); i++) {       for (int j = 0; j < s.size(); j++) {         if (a[i] == s[j]) {           counter++;           break;         }       }     }     return counter;   }   int main() {     string alpha =  abcdefghijklmnopqrstuvwxyz ;     string s;     cin >> s;     if (nodistinct(s, alpha) % 2 != 0) {       cout <<  IGNORE HIM! ;     } else       cout <<  CHAT WITH HER! ;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, k, lp, i, j, mp;   long long CNM[120][12000];   long long dp[120][10];   long long ans[120][12000];   long long xar(long long now) {     if (now == 0) return 1;     if (now == 1) return CNM[n][i];     long long ans = xar(now % 2);     long long res = xar(now / 2);     return (((res * res) % 1000000007) * ans) % 1000000007;   }   void init() {     for (i = 0; i <= n; i++) {       CNM[i][0] = 1;       for (j = 1; j <= i; j++)         CNM[i][j] = (CNM[i - 1][j - 1] + CNM[i - 1][j]) % 1000000007;     }     for (i = 0; i <= n; i++)       dp[i][1] = xar(lp), dp[i][2] = (dp[i][1] * CNM[n][i]) % 1000000007;   }   long long DP(long long N, long long K) {     if (N == 0 && K == 0) return 1;     if (N != n || K != k) return ans[N][K] % 1000000007;     int a1, a2, a3;     for (a1 = 0; a1 < N; a1++)       for (a2 = 0; a2 <= K; a2++)         if (DP(a1, a2))           for (a3 = 0; a3 <= min(N, K - a2); a3++)             if (mp > a1)               ans[a1 + 1][a2 + a3] += (DP(a1, a2) * dp[a3][2]) % 1000000007;             else               ans[a1 + 1][a2 + a3] += (DP(a1, a2) * dp[a3][1]) % 1000000007;     return ans[N][K];   }   int main() {     ans[0][0] = 1;     cin >> n >> m >> k;     lp = m / n;     mp = m % n;     init();     cout << DP(n, k) % 1000000007 << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long sum[55];   long long two[55];   const int maxn = 200000 + 10;   struct node {     long long l;     long long r;   } jiedian[maxn];   int cmp(node a, node b) { return a.l < b.l || (a.l == b.l && a.r < b.r); }   int main() {     two[0] = 1;     sum[1] = 1;     for (int i = 1; i <= 50; i++) two[i] = two[i - 1] * 2;     for (int i = 2; i <= 50; i++) sum[i] = sum[i - 1] + two[i - 1];     int h, q;     scanf( %d%d , &h, &q);     int cnt = 0;     for (int i = 1; i <= q; i++) {       long long a, l, r, ans;       scanf( %lld%lld%lld%lld , &a, &l, &r, &ans);       l = l * two[h - a];       int temp1 = a;       while (temp1 < h) {         r = r * 2 + 1;         temp1++;       }       if (ans) {         if (l > sum[h - 1] + 1) {           jiedian[cnt].l = sum[h - 1] + 1;           jiedian[cnt++].r = l - 1;         }         if (r < sum[h]) {           jiedian[cnt].l = r + 1;           jiedian[cnt++].r = sum[h];         }       } else {         jiedian[cnt].l = l;         jiedian[cnt++].r = r;       }     }     sort(jiedian, jiedian + cnt, cmp);     long long t = 0;     long long head = sum[h - 1] + 1;     long long temp = sum[h - 1];     long long ans;     if (cnt > 0) {       t += jiedian[0].l - head;       if (t == 1) ans = sum[h - 1] + 1;       temp = jiedian[0].r;     }     for (int i = 1; i < cnt; i++) {       if (jiedian[i].l > temp + 1) {         t += jiedian[i].l - temp - 1;         if (t == 1) ans = jiedian[i].l - 1;         temp = jiedian[i].r;       } else {         if (jiedian[i].r <= temp)           continue;         else {           temp = jiedian[i].r;         }       }     }     if (sum[h] != temp) {       t = t + sum[h] - temp;       if (t == 1) ans = sum[h];     }     if (t == 0) printf( Game cheated! n );     if (t == 1) printf( %lld n , ans);     if (t > 1) printf( Data not sufficient! n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, s, len;     scanf( %d%d%d , &n, &s, &len);     vector<int> a(n);     for (int &t : a) scanf( %d , &t);     if (len > n) {       puts( -1 );       return 0;     }     multiset<int> ms;     vector<int> dp(n + 1, 1 << 20);     for (int r = 0; r < len; r++) {       ms.insert(a[r]);     }     auto getDif = [](multiset<int> &ms) { return *ms.rbegin() - *ms.begin(); };     int ans = -1;     dp[0] = 0;     if (getDif(ms) <= s) dp[len] = 1;     int st = 0;     multiset<int> best;     best.insert(dp[0]);     for (int r = len; r < n; r++) {       best.insert(dp[r - len + 1]);       ms.insert(a[r]);       while (!best.empty() && getDif(ms) > s) {         best.erase(best.find(dp[st++]));         ms.erase(ms.find(a[r - ms.size() + 1]));       }       if (!best.empty()) dp[r + 1] = *best.begin() + 1;     }     cout << (dp[n] >= (1 << 20) ? -1 : dp[n]) << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long ext_gcd(long long a, long long b, long long& x, long long& y) {     long long t, ret;     if (!b) {       x = 1, y = 0;       return a;     }     ret = ext_gcd(b, a % b, x, y);     t = x, x = y, y = t - a / b * y;     return ret;   }   long long Invmod(long long a, long long n) {     long long x, y;     if (ext_gcd(a, n, x, y) != 1) return -1;     return (x % n + n) % n;   }   long long mul(long long x, long long y, long long mod) {     x %= mod, y %= mod;     if (!x || !y) return 0;     if (y & 1)       return (x + 2 * mul(x, y >> 1, mod)) % mod;     else       return 2 * mul(x, y >> 1, mod) % mod;   }   long long mergef(long long b1, long long c1, long long b2, long long c2,                    long long& b, long long& c) {     swap(b1, c1);     swap(b2, c2);     c1 = (c1 % b1 + b1) % b1;     c2 = (c2 % b2 + b2) % b2;     long long tb1 = b1, tb2 = b2;     c = ((c2 - c1) % b2 + b2) % b2;     long long G = gcd(b1, b2);     if (c % G) return 0;     c /= G;     b1 /= G;     b2 /= G;     assert(tb1 % G == 0);     b = tb1 / G * tb2;     c = mul(c, Invmod(b1, b2), b);     c = mul(tb1 % b, c, b);     c += c1;     c %= b;     swap(b, c);     return 1;   }   const int maxn = 10000 + 10;   long long data[maxn];   int main() {     long long n, m, k;     while (cin >> n >> m >> k) {       long long lcm = 1;       bool fail = false;       for (int i = 1; i <= k; ++i) {         cin >> data[i];         lcm = lcm / gcd(lcm, data[i]);         if (fail || 1. * lcm * data[i] > 1e13 || lcm * data[i] > n)           fail = true;         else           lcm = lcm * data[i];       }       if (fail) {         puts( NO );         continue;       }       long long b = 0, c = 1;       for (int i = 1; i <= k; ++i) {         if (mergef(b, c, ((-i + 1) % data[i] + data[i]) % data[i], data[i], b, c))           ;         else {           fail = true;           break;         }       }       if (b == 0) b = lcm;       if (b + k - 1 > m) fail = true;       if (fail) {         puts( NO );         continue;       }       for (int i = 1; i <= k; ++i) {         if (gcd(b + i - 1, lcm) != data[i]) {           fail = true;         }       }       puts(fail ?  NO  :  YES );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int a, b, c, d;     cin >> a >> b >> c >> d;     if (a <= c && b <= d)       cout <<  Polycarp ;     else if (a + b <= c + d - min(c, d))       cout <<  Polycarp ;     else       cout <<  Vasiliy ;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000006;   const long long mod = 1000000000 + 7;   long long x, y;   long long fact[MAXN + 25], inv_fact[MAXN + 25];   long long fast_pow(long long base, long long exp) {     if (exp == 0) return 1;     if (exp == 1) return base;     long long ret = fast_pow(base, exp / 2) % mod;     ret = (ret * ret) % mod;     if (exp % 2 == 1) ret = (ret * base) % mod;     return ret % mod;   }   void init() {     fact[0] = 1;     for (long long i = 1; i < MAXN + 25; i++) fact[i] = (i * fact[i - 1]) % mod;     inv_fact[0] = 1;     for (long long i = 1; i < MAXN + 25; i++)       inv_fact[i] = (inv_fact[i - 1] * fast_pow(i, mod - 2)) % mod;   }   int main() {     init();     int q;     scanf( %d , &q);     while (q--) {       scanf( %lld %lld , &x, &y);       long long ans = fast_pow(2, y - 1) % mod;       long long X = x;       for (int d = 2; d * d <= X; d++) {         if (X % d) continue;         long long m = 0;         while (x % d == 0) {           x /= d, m++;         }         long long aux = (fact[m + y - 1] * inv_fact[m]) % mod;         aux = (aux * inv_fact[y - 1]) % mod;         ans = (ans * aux) % mod;       }       if (x > 1) {         long long m = 1;         long long aux = (fact[m + y - 1] * inv_fact[m]) % mod;         aux = (aux * inv_fact[y - 1]) % mod;         ans = (ans * aux) % mod;       }       printf( %lld n , (ans + mod) % mod);     }   }
#include <bits/stdc++.h>   using namespace std;   long long n, h[100005], num = 0, lt = 0, rt, dp[100005], dp1[100005], cur;   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> h[i];     for (long long i = 1; i <= n; i++) {       long long temp = dp[lt] + (i - lt);       if (h[i] - cur <= 0 || temp <= cur) {         dp[i] = min(h[i], temp);         lt = i;         continue;       } else {         dp[i] = cur + 1;         cur++;       }     }     cur = 0;     lt = n + 1;     for (long long i = n; i >= 1; i--) {       long long temp = dp1[lt] + (lt - i);       if (h[i] - cur <= 0 || temp <= cur) {         dp1[i] = min(h[i], temp);         lt = i;         continue;       } else {         dp1[i] = cur + 1;         cur++;       }     }     long long ans = 0;     for (int i = 1; i <= n; i++) {       dp[i] = min(dp[i], dp1[i]);       ans = max(ans, dp[i]);     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   long long int BinSea(vector<long long int>& a, long long int low,                        long long int high, long long int n) {     long long int ct = high;     long long int ans = high;     while (low <= high) {       long long int mid = low + ((high - low) / 2);       long long int val = a[ct] - a[mid];       if (val <= n) {         ans = mid;         high = mid - 1;       } else {         low = mid + 1;       }     }     return ans;   }   int main() {     long long int n, k;     cin >> n >> k;     vector<long long int> a(2 * n + 1);     vector<long long int> p1(2 * n + 1), p2(2 * n + 1);     for (long long int i = 0; i < n; i++) {       cin >> a[i];       a[n + i] = a[i];     }     long long int v1 = 0, v2 = 0;     for (long long int i = 0; i < 2 * n; i++) {       v1 += (a[i] * (a[i] + 1)) / 2;       v2 += a[i];       p1[i] = v1;       p2[i] = v2;     }     long long int mx = 0;     for (long long int i = 2 * n - 1; i > n - 1; i--) {       long long int val = BinSea(p2, 0, i, k);       long long int fullmt = p1[i] - p1[val];       long long int remdy = a[val] - (k - (p2[i] - p2[val]));       long long int sumrem = remdy * (remdy + 1) / 2;       long long int sum = a[val] * (a[val] + 1) / 2;       fullmt += (sum - sumrem);       mx = max(mx, fullmt);     }     cout << mx << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9;   const long long INF = 1e18;   const int N = 100010;   struct E {     int to, nxt;   } e[N << 3];   vector<int> a[N];   int n, m, head[N], cnt, f[N], ans[N], t, g[N];   int Write[20];   int read() {     int d = 0, f = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) d = (d << 3) + (d << 1) + c - 48, c = getchar();     return d * f;   }   void write(int x) {     int t = 0;     if (x < 0) putchar( - ), x = -x;     for (; x; x /= 10) Write[++t] = x % 10;     if (!t) putchar( 0 );     for (int i = t; i >= 1; i--) putchar((char)(Write[i] + 48));   }   void judge() {     freopen( .in ,  r , stdin);     freopen( .out ,  w , stdout);   }   void work(int x, int y) {     if (!g[x])       g[x] = y;     else if (g[x] != y) {       puts( No );       exit(0);     }   }   void addedge(int x, int y) {     e[++cnt] = (E){y, head[x]};     head[x] = cnt;   }   void dfs(int u) {     for (int i = head[u]; i; i = e[i].nxt) {       int v = e[i].to;       if (g[v] == 1) {         puts( No );         exit(0);       }       if (g[v] == 0) g[v] = -1, dfs(v);     }   }   int main() {     n = read();     m = read();     for (int i = 1; i <= n; i++) {       int x = read();       for (int j = 1; j <= x; j++) a[i].push_back(read());     }     for (int i = n - 1; i; i--) {       int l = min(a[i].size(), a[i + 1].size());       bool bo = 0;       for (int j = 0; j < l; j++)         if (a[i][j] < a[i + 1][j]) {           bo = 1;           addedge(a[i + 1][j], a[i][j]);           break;         } else if (a[i][j] > a[i + 1][j]) {           bo = 1;           work(a[i][j], -1);           work(a[i + 1][j], 1);           break;         }       if (!bo && a[i].size() > a[i + 1].size()) {         puts( No );         return 0;       }     }     for (int i = 1; i <= m; i++)       if (g[i] == -1) dfs(i);     for (int i = 1; i <= m; i++)       if (g[i] == -1) ans[++t] = i;     puts( Yes );     printf( %d n , t);     for (int i = 1; i <= t; i++) write(ans[i]), putchar(   );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   int dp[2][20005];   inline void add(int &x, int y) {     x += y;     if (x >= mod) x -= mod;   }   int main() {     int n;     scanf( %d , &n);     int ans = 0, now = 0;     for (int _i = 1; _i <= n; ++_i) {       memset(dp[now], 0, sizeof dp[now]);       int x;       scanf( %d , &x);       add(ans, dp[now ^ 1][x + 10000]), add(ans, dp[now ^ 1][-x + 10000]);       dp[now][x + 10000] = dp[now][-x + 10000] = 1;       for (int i = x + 1; i <= 20000 - x; ++i) {         if (dp[now ^ 1][i]) {           add(dp[now][i + x], dp[now ^ 1][i]);           add(dp[now][i - x], dp[now ^ 1][i]);         }       }       now ^= 1;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   complex<long long int> convex[1000006];   long long int cross(complex<long long int> a, complex<long long int> b) {     return a.real() * b.imag() - b.real() * a.imag();   }   int main() {     long long int n;     scanf( %lld , &n);     long long int sum = 0;     vector<complex<long long int>> vertexs;     vertexs.push_back(complex<long long int>(0, 0));     for (long long int i = 0; i < n; i++) {       long long int tmp;       scanf( %lld , &tmp);       sum += tmp;       vertexs.push_back(complex<long long int>(i + 1, sum));     }     convex[0] = vertexs[0];     long long int vn = 1;     for (long long int i = 1; i <= n; i++) {       convex[vn++] = vertexs[i];       while (vn > 2) {         if (cross(convex[vn - 1] - convex[vn - 3],                   convex[vn - 2] - convex[vn - 3]) > 0) {           convex[vn - 2] = convex[vn - 1];           vn--;         } else {           break;         }       }     }     for (long long int i = 1; i < vn; i++) {       double len = convex[i].real() - convex[i - 1].real();       for (long long int j = 0; j < len; j++) {         printf( %.10lf n , (convex[i].imag() - convex[i - 1].imag()) / len);       }     }   }
#include <bits/stdc++.h>   using namespace std;   using longInt = long long;   const int maxL = 204;   int r[maxL], g[maxL], b[maxL], l[3];   longInt f[maxL][maxL][maxL];   void get_array(int *a, int n) {     for (int i = 1; i <= n; ++i) cin >> a[i];     sort(a + 1, a + n + 1, [](int x, int y) -> bool { return x > y; });   }   int main() {     ios::sync_with_stdio(false);     longInt ans = 0;     cin >> l[0] >> l[1] >> l[2];     get_array(r, l[0]);     get_array(g, l[1]);     get_array(b, l[2]);     for (int i = 0; i <= l[0]; ++i)       for (int j = 0; j <= l[1]; ++j)         for (int k = 0; k <= l[2]; ++k) {           f[i][j][k] = 0;           if (i > 0 && j > 0)             f[i][j][k] = max(f[i][j][k], f[i - 1][j - 1][k] + r[i] * g[j]);           if (j > 0 && k > 0)             f[i][j][k] = max(f[i][j][k], f[i][j - 1][k - 1] + g[j] * b[k]);           if (k > 0 && i > 0)             f[i][j][k] = max(f[i][j][k], f[i - 1][j][k - 1] + b[k] * r[i]);           ans = max(ans, f[i][j][k]);         }     cout << ans << endl;     return 0;   }