malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long double PI = 4.0 * atan(1.0);   void EnchomSolve() {     int l;     long double L;     long double ans = 0.0;     long double area;     long double height;     long double help, help2;     scanf( %d , &l);     L = (long double)l;     help = L / sqrt(3.0);     height = sqrt(L * L - help * help);     help = (sqrt(3.0) / 2.0) * L;     area = (help * L) / 2.0;     ans += area * height / 3.0;     scanf( %d , &l);     L = (long double)l;     help = (sqrt(2.0) / 2.0) * L;     height = sqrt(L * L - help * help);     area = L * L;     ans += area * height / 3.0;     scanf( %d , &l);     L = (long double)l;     help = L / (sqrt(2.0 - 2.0 * cos(72.0 * PI / 180.0)));     height = sqrt(L * L - help * help);     help2 = sqrt(help * help - (L / 2.0) * (L / 2.0));     area = L * help2 / 2.0;     area *= 5.0;     ans += area * height / 3.0;     printf( %.10f n , (double)ans);     return;   }   int main() {     EnchomSolve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct EDGE {     int to, next, w, co;   } e[100000];   int head[100], top, vis[100000];   void add(int u, int v, int w, int co) {     e[top].to = v;     e[top].w = w;     e[top].co = co;     e[top].next = head[u];     head[u] = top++;   }   struct _ {     int max_flow, co;   };   int dis[100], vvis[100], prep[100], pree[100];   queue<int> q;   deque<int> node;   void spfa(int s) {     memset(dis, 63, sizeof(dis));     memset(vvis, 0, sizeof(vvis));     dis[s] = 0;     q.push(s);     int i;     while (!q.empty()) {       s = q.front();       q.pop();       vvis[s] = 0;       int i;       for (i = head[s]; ~i; i = e[i].next) {         if (!e[i].w) continue;         if (dis[s] + e[i].co < dis[e[i].to]) {           dis[e[i].to] = dis[s] + e[i].co;           pree[e[i].to] = i;           prep[e[i].to] = s;           if (vvis[e[i].to]) continue;           vvis[e[i].to] = 1;           q.push(e[i].to);         }       }     }   }   _ dfs(int s, int t, int rest) {     int flow = 998244353, co = 0;     int temp = t;     _ rv;     while (t != s) {       flow = min(flow, e[pree[t]].w);       co += e[pree[t]].co;       t = prep[t];     }     if (co > 0) flow = min(flow, rest / co);     if (flow == 0) return rv = (_){0, 0};     t = temp;     while (t != s) {       temp = pree[t];       e[temp].w -= flow;       e[temp ^ 1].w += flow;       t = prep[t];     }     rv = (_){flow, co};     return rv;   }   long long EK(int s, int t, int rest) {     long long sum = 0;     _ _;     while (1) {       spfa(s);       if (dis[t] > 998244353) break;       _ = dfs(s, t, rest);       if (_.max_flow == 0) break;       sum += _.max_flow;       rest -= _.max_flow * _.co;     }     return sum;   }   int main() {     memset(head, 255, sizeof(head));     int n, k;     scanf( %d%d , &n, &k);     int i, j, t;     for (i = 1; i <= n; i++) {       for (j = 1; j <= n; j++) {         scanf( %d , &t);         if (t) {           add(i, j, t, 0);           add(j, i, 0, 0);           add(i, j, k, 1);           add(j, i, 0, -1);         }       }     }     long long ans = EK(1, n, k);     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct station {     int pos, price;   } a[200003];   int T[800008], d, n, m;   long long cnt;   bool comp(station A, station B) { return (A.pos < B.pos); }   void Build_MinIT(int, int, int);   int Find_Min(int, int, int, int, int);   int main() {     scanf( %d %d %d , &d, &n, &m);     for (int i = 1; i <= m; i++) scanf( %d %d , &a[i].pos, &a[i].price);     sort(a + 1, a + 1 + m, comp);     a[++m].pos = d;     for (int i = 1; i <= m; i++) {       if (a[i].pos - a[i - 1].pos > n) {         cout << -1;         return 0;       }     }     if (n >= d) {       cout << 0;       return 0;     }     a[200002].price = 1E+9;     Build_MinIT(1, m, 1);     int i = 0, j = 1, t = n;     while (j <= m) {       while (a[i].price < a[j].price && a[j].pos - a[i].pos <= n && j <= m) j++;       if (a[j].pos - a[i].pos <= n) {         cnt += (long long)(a[j].pos - (a[i].pos + t)) * a[i].price;         t = 0;         i = j++;       } else {         int k = Find_Min(i + 1, j - 1, 1, m, 1);         cnt += (long long)(n - t) * a[i].price;         t = a[i].pos + n - a[k].pos;         i = k;       }     }     cout << cnt;     return 0;   }   void Build_MinIT(int L, int R, int v) {     if (L == R) {       T[v] = L;       return;     }     int m = (L + R) / 2;     Build_MinIT(L, m, v * 2);     Build_MinIT(m + 1, R, v * 2 + 1);     T[v] = (a[T[v * 2]].price < a[T[v * 2 + 1]].price ? T[v * 2] : T[v * 2 + 1]);   }   int Find_Min(int l, int r, int L, int R, int v) {     if (l > r) return 200002;     if (l == L && r == R) return T[v];     int m = (L + R) / 2;     int x = Find_Min(l, min(r, m), L, m, v * 2),         y = Find_Min(max(l, m + 1), r, m + 1, R, v * 2 + 1);     return (a[x].price < a[y].price ? x : y);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     double lo = 0.0, hi = 10000000.0;     for (int i = 1; i <= n; i++) {       int sta;       cin >> sta;       lo = max(lo, (double)10.0 * sta / i);       hi = min(hi, (double)10.0 * (sta + 1) / i);     }     int nextlo = floor(lo * (n + 1) / 10.0);     int nexthi = ceil(hi * (n + 1) / 10.0);     if (nextlo + 1 >= nexthi) {       cout <<  unique  << endl << nextlo << endl;     } else {       cout <<  not unique  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int arr[111];   int main() {     int n;     scanf( %d , &n);     arr[0] = 0;     for (int i = (1); i < (n + 1); ++i) scanf( %d , &arr[i]);     int ans = 0;     if (n % 2 == 0 || n == 1) {       printf( -1 n );       return 0;     }     for (int i = n; i >= 1; i -= 2) {       int tmp = max(arr[i], arr[i - 1]);       ans += tmp;       arr[i] = arr[i - 1] = 0;       arr[(i - 1) / 2] = max(0, arr[(i - 1) / 2] - tmp);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   namespace {};   int sgn(int x) { return x >= 0 ? 1 : -1; }   int arr[200001];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, k;     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> arr[i];       arr[i] = sgn(arr[i]);       if (arr[i] == -1) k--;     }     if (k < 0) {       cout <<  -1 n ;       return 0;     }     vector<pair<int, int>> segs;     int flips = 0;     int curr = 1, c = 0;     for (int i = 0; i < n; i++) {       if (arr[i] == curr)         c++;       else {         flips++;         if (curr == 1 && i - c > 0) segs.emplace_back(c, -2);         c = 1;         curr = arr[i];       }     }     for (auto seg : segs) {       ;     }     sort(segs.begin(), segs.end());     ;     for (auto seg : segs) {       if (seg.first > k) break;       k -= seg.first;       flips += seg.second;     }     if (curr == 1 && c > 0) {       if (k >= c) flips--;     }     if (flips < 0) flips = 0;     cout << flips <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct info {     long long fs, sm, id;   } bd[100001];   int cmp(info a, info b) { return a.fs < b.fs; }   int main() {     ios_base::sync_with_stdio(0);     long long int i, j, x, n, cnt = 0, m, y, k, ans = 0, cf, cm, a, rr1 = 0, l, r,                               md, r1, r2, xxx, flg;     cin >> n >> a >> cf >> cm >> m;     long long in[n + 1], bs[n + 1];     for (i = 1; i <= n; i++) {       cin >> in[i];       bd[i].fs = a - in[i];       bd[i].id = i;       bs[i] = a - in[i];     }     sort(bd + 1, bd + 1 + n, cmp);     sort(bs + 1, bs + 1 + n);     for (i = 2; i <= n; i++) {       bd[i].fs += bd[i - 1].fs;     }     bd[n].sm = 0;     for (i = n - 1; i >= 1; i--) {       x = abs(in[bd[i + 1].id] - in[bd[i].id]);       bd[i].sm = bd[i + 1].sm + x * (n - i);     }     bd[0].fs = bd[0].id = 0;     bd[0].sm = (a - in[bd[1].id]) * n + bd[1].sm;     for (i = 1; i <= n; i++) {       if (bs[i] > 0) break;       cnt++;     }     ans = cnt * cf + cm * in[bd[n].id];     for (i = n; i >= 0; i--) {       x = m;       y = cnt * cf;       rr1 = cnt;       flg = 0;       if (x >= bd[i].fs) {         flg = 1;         y = i * cf;         x -= bd[i].fs;         rr1 = i;       }       l = i;       r = n;       while (r - l > 1) {         md = (l + r) / 2;         if (bd[md].sm > x)           l = md;         else           r = md;       }       if (bd[l].sm <= x && i != 0) r = l;       x -= bd[r].sm;       if (r == i && flg) {         if (i == n) {           y = a * cm + n * cf;           if (ans <= y) {             ans = y;             r1 = n;             r2 = n + 1;           }         } else {           y += cm * (min(a, in[bd[r].id] + x / (n - r)));           if (ans <= y) {             ans = y;             r1 = i;             xxx = min(a, in[bd[r].id] + x / (n - r));             r2 = i + 1;           }         }         continue;       }       if (r - 1 > 0)         y += cm * (min(a, min(in[bd[r - 1].id], in[bd[r].id] + x / (n - r + 1))));       else         y += cm * (min(a, in[bd[r].id] + x / (n - r + 1)));       if (y >= ans) {         ans = y;         r1 = rr1;         r2 = r;         if (r - 1 > 0)           xxx = min(a, min(in[bd[r - 1].id], in[bd[r].id] + x / (n - r + 1)));         else           xxx = min(a, in[bd[r].id] + x / (n - r + 1));       }     }     for (i = 1; i <= r1; i++) {       in[bd[i].id] = a;     }     for (i = r2; i <= n; i++) {       in[bd[i].id] = xxx;     }     cout << ans << endl;     for (i = 1; i <= n; i++) cout << in[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       vector<long long int> a(n);       vector<long long int> b(n);       for (int i = 0; i < n; i++) {         cin >> a[i];       }       for (int i = 0; i < n; i++) {         cin >> b[i];       }       long long int cnt = 0;       long long int min_a = *min_element(a.begin(), a.end());       long long int min_b = *min_element(b.begin(), b.end());       for (int i = 0; i < n; i++) {         if (a[i] > min_a && b[i] > min_b) {           long long int num;           num = min(a[i] - min_a, b[i] - min_b);           cnt += num;           a[i] -= num;           b[i] -= num;         }       }       for (int i = 0; i < n; i++) {         cnt += (a[i] - min_a);         cnt += (b[i] - min_b);       }       cout << cnt << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   long long n, num;   long long a[maxn];   long long vis[maxn];   priority_queue<long long> pq;   void fnd(long long x) {     if (vis[a[x]] == 0) {       vis[a[x]] = 1;       num++;       fnd(a[x]);     } else       return;   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     memset(vis, 0, sizeof(vis));     for (int i = 1; i <= n; i++) {       num = 1;       if (vis[i] == 0) {         vis[i] = 1;         fnd(i);         pq.push(num);       }     }     long long t = pq.top();     pq.pop();     if (!pq.size()) {       cout << t * t << endl;     } else {       t += pq.top();       pq.pop();       long long ans = t * t;       while (pq.size()) {         t = pq.top();         pq.pop();         ans += t * t;       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = 1e5 + 5;   vector<int> adj[maxN];   int s[maxN], par[maxN];   void dfs(int n, int p) {     par[n] = p;     for (int i = int(0); i < int((int)adj[n].size()); i++) {       if (adj[n][i] != p) dfs(adj[n][i], n);     }   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0), cout.tie(0),         cout.precision(15);     int n, tmp;     cin >> n;     for (int i = int(0); i < int(n - 1); i++) {       cin >> tmp;       tmp -= 1;       adj[tmp].push_back(i + 1);     }     dfs(0, -1);     for (int i = int(0); i < int(n); i++) {       cin >> s[i];     }     long long ans = s[0];     for (int i = int(0); i < int(n); i++) {       if (s[i] == -1) {         int n = i, tt = s[par[i]];         int mini = 2000000000;         for (int j = int(0); j < int((int)adj[n].size()); j++) {           if (s[adj[n][j]] < tt) {             cout << -1;             return 0;           }           mini = min(mini, s[adj[n][j]] - tt);         }         if (mini != 2000000000) ans += mini;         for (int j = int(0); j < int((int)adj[n].size()); j++) {           ans += s[adj[n][j]] - tt - mini;         }       }     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000001;   const long double EPS = 1e-9;   const int MOD = 1000000007;   const long long LLINF = 1000000000000000001;   const int maxn = 1042;   int n;   int a[maxn];   char ans[maxn][maxn];   bool good[maxn];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       for (int j = 1; j <= n; j++) ans[i][j] =  . ;     }     bool none = true;     for (int i = 1; i <= n; i++)       if (a[i] != i) none = false;     if (none)       cout << n <<   n ;     else {       cout << n - 1 <<   n ;       int mostleft = 1;       while (a[mostleft] == mostleft) {         good[mostleft] = true;         mostleft++;       }       int row = 1;       int z = mostleft;       good[z] = true;       z = a[z];       while (!good[z]) {         good[z] = true;         char mirror = (z < a[z]) ?  /  :     ;         ans[row][z] = mirror;         ans[row][a[z]] = mirror;         row++;         z = a[z];       }       good[z] = true;       for (int i = mostleft + 1; i <= n; i++) {         if (a[i] != i && !good[i]) {           int firstrow = row;           z = i;           while (a[z] > z) z = a[z];           z = a[z];           good[z] = true;           row++;           z = a[z];           while (!good[z]) {             good[z] = true;             char mirror = (z < a[z]) ?  /  :     ;             ans[row][z] = mirror;             ans[row][a[z]] = mirror;             row++;             z = a[z];           }           ans[row - 1][mostleft] =     ;           ans[firstrow][mostleft] =  / ;           ans[firstrow][a[z]] =  / ;         }       }     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) cout << ans[i][j];       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int h[n];     for (int i = 0; i < n; i++) cin >> h[i];     int max;     int a[n];     a[n - 1] = 0;     max = h[n - 1];     for (int i = n - 2; i >= 0; i--) {       if (h[i] > max) {         a[i] = 0;         max = h[i];       } else {         a[i] = max - h[i] + 1;       }     }     for (int i = 0; i < n; i++) {       printf( %d  , a[i]);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 50 + 5, maxL = (1 << 20) + 10;   int N, L;   char s[maxn][25];   bool vis[maxL];   long double F[maxL], R[25];   long long dask[maxL];   bool check(int tt, int k) {     if (dask[tt] & (1LL << k))       return false;     else       return true;   }   long double dfs(int tt, int g) {     if (g == 0) return 0.0;     if (vis[tt]) return F[tt];     long double ret = 0.0;     long double step = L - g + 1;     for (int i = 0; i < L; i++) {       if ((1 << i) & tt) continue;       int nt = (1 << i) | tt;       int wq = __builtin_popcountll(dask[nt] ^ dask[tt]);       ret += step * R[g] * wq;       ret += dfs(nt, g - 1);     }     vis[tt] = true;     F[tt] = ret;     return ret;   }   void Prepare() {     memset(dask, 0, sizeof(dask));     for (int i = (1), _i = (N); i <= _i; i++)       for (int j = (i + 1), _j = (N); j <= _j; j++) {         int same = 0;         for (int k = 0; k < L; k++)           if (s[i][k] == s[j][k]) same |= (1 << k);         dask[same] |= (1LL << j) | (1LL << i);       }     for (int i = (1 << L) - 1; i; i--)       for (int k = 0; k < L; k++)         if (i & (1 << k)) dask[i ^ (1 << k)] |= dask[i];   }   int main() {     for (; scanf( %d , &N) != EOF;) {       for (int i = (1), _i = (N); i <= _i; i++) scanf( %s , s[i]);       L = strlen(s[1]);       int gg = L;       R[L] = 1.0 / (long double)L;       for (int i = (L - 1), _i = (1); i >= _i; i--) {         gg--;         R[i] = R[i + 1] / (long double)gg;       }       memset(vis, 0, sizeof(vis));       long double ans = 0.0;       Prepare();       ans = dfs(0, L);       ans /= (long double)N;       printf( %.15lf n , (double)ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int tot, n;   int vis[110];   int p[110];   int dp[2][262144], cs[110][262144], pre[110][262144];   int have[100];   int a[110], b[110];   string print(int sta) {     string x =   ;     for (int i = tot - 1; i >= 0; i--) {       if (sta & (1 << i))         x +=  1 ;       else         x +=  0 ;     }     return x;   }   int main() {     for (int i = 2; i <= 59; i++) {       if (!vis[i]) p[tot++] = i;       for (int j = i; j <= 59; j += i) vis[j] = 1;     }     for (int i = 1; i <= 59; i++) {       for (int j = 0; j < tot; j++) {         if (i % p[j] == 0) have[i] |= (1 << j);       }     }     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     memset(dp, 0x3f, sizeof(dp));     dp[0][0] = 0;     register int tmp;     register int nowt = 1, pret = 0;     for (int i = 1; i <= n; i++) {       for (int sta = 0; sta < (1 << tot); sta++) {         dp[nowt][sta] = 0x3f3f3f3f;         for (int j = 1; j <= 59; j++) {           if ((have[j] & sta) != have[j]) continue;           tmp = dp[pret][have[j] ^ sta] + abs(j - a[i]);           if (tmp < dp[nowt][sta]) {             dp[nowt][sta] = tmp;             pre[i][sta] = have[j] ^ sta;             cs[i][sta] = j;           }         }       }       nowt ^= 1;       pret ^= 1;     }     int mi = 0x3f3f3f3f;     for (int i = 0; i < (1 << tot); i++) {       mi = min(mi, dp[pret][i]);     }     int pp;     for (int i = 0; i < (1 << tot); i++) {       if (mi == dp[pret][i]) {         pp = i;         for (int now = n; now >= 1; now--) {           b[now] = cs[now][pp];           pp = pre[now][pp];         }         for (int now = 1; now <= n; now++) {           printf( %d  , b[now]);         }         puts(  );         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, b;     cin >> n >> a >> b;     int c[100];     for (int i = 0; i < n; i++) cin >> c[i];     int ans = 0;     int min = a > b ? b : a;     for (int i = 0; i < n / 2; i++) {       if (c[i] == 0 && c[n - 1 - i] == 2 || c[i] == 2 && c[n - 1 - i] == 0)         ans += a;       else if (c[i] == 1 && c[n - 1 - i] == 2 || c[i] == 2 && c[n - 1 - i] == 1)         ans += b;       else if (c[i] == 2 && c[n - 1 - i] == 2)         ans += min * 2;       else if (c[i] == 0 && c[n - 1 - i] == 1 || c[i] == 1 && c[n - 1 - i] == 0) {         cout << -1 << endl;         return 0;       }     }     if (n % 2 == 1 && c[n / 2] == 2) ans += min;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void read(long long a = 0) {     freopen( in ,  r , stdin);     if (a) freopen( out ,  w , stdout);   }   long long a[100009 * 10], b[100009 * 10];   long long n, m;   bool bs(long long num) {     bool vis[100009 * 10] = {};     long long space = 0;     for (int i = num; i >= 0; i--) {       if (a[i] && !vis[a[i]]) {         vis[a[i]] = 1;         space += b[a[i] - 1];       } else {         space--;         space = max(space, 0ll);       }     }     for (int i = 1; i <= m; i++)       if (!vis[i]) return 0;     if (space == 0)       return 1;     else       return 0;   }   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < m; i++) cin >> b[i];     long long lo = 0, hi = n + 1;     while (lo < hi) {       long long mid = (lo + hi - 1) >> 1;       if (bs(mid))         hi = mid;       else         lo = mid + 1;     }     if (hi == n + 1)       cout <<  -1 ;     else       cout << hi + 1;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 9;   const int N = 4040;   int n, w, b;   long long fac[N], f[N][N], inv[N];   long long qpow(long long x, long long p) {     long long res = 1ll;     while (p) {       if (p & 1) {         res = (res * x) % mod;       }       x = (x * x) % mod;       p >>= 1;     }     return res;   }   long long INV(long long k) { return qpow(k, mod - 2); }   long long calc(int x, int y) {     return fac[x] * inv[y] % mod * inv[x - y] % mod;   }   void init() {     fac[0] = 1ll;     inv[0] = 1ll;     for (int i = 1; i < N; i++) {       fac[i] = (fac[i - 1] * 1ll * i) % mod;       inv[i] = INV(fac[i]);     }   }   int main() {     scanf( %d%d%d , &n, &w, &b);     init();     for (int i = 1; i <= n; i++) {       for (int j = i; j < N; j++) {         f[i][j] = (fac[j] * calc(j - 1, i - 1)) % mod;       }     }     long long ans = 0;     for (int i = 1; i < n - 1; i++) {       ans =           (ans + f[n - i][w] * f[i][b] % mod * (1ll * n - 1ll * i - 1ll) % mod) %           mod;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long f(string s, long long m) {     map<char, long long> a;     map<char, long long>::iterator ii;     long long i;     for (i = 0; i < s.size(); i++) {       a[s[i]]++;     }     long long best = 0;     for (ii = a.begin(); ii != a.end(); ii++) best = max(best, ii->second);     long long p = s.size();     if (best == p && m == 1) return p - 1;     return min(p, best + m);   }   int main() {     string s1, s2, s3;     long long n;     cin >> n;     cin >> s1 >> s2 >> s3;     if (f(s1, n) > f(s2, n) && f(s1, n) > f(s3, n)) {       cout <<  Kuro ;       return 0;     }     if (f(s2, n) > f(s1, n) && f(s2, n) > f(s3, n)) {       cout <<  Shiro ;       return 0;     }     if (f(s3, n) > f(s1, n) && f(s3, n) > f(s2, n)) {       cout <<  Katie ;       return 0;     }     cout <<  Draw ;     return 0;   }
#include <bits/stdc++.h>   template <class T>   void rd(T &x) {     x = 0;     int f = 1;     char c;     while (!isdigit(c = getchar()))       if (c ==  - ) f = -1;     do {       x = (x << 3) + (x << 1) + (c ^ 48);     } while (isdigit(c = getchar()));     x *= f;   }   using namespace std;   const int N = 1e5 + 5;   int n, dp[N], s[N], p[N], cnt, tp;   map<int, int> Map[N];   int main() {     rd(n);     for (int i = 1; i <= n; i++) {       int v, c, l, r;       rd(v), rd(c), rd(l), rd(r);       if (r + c <= 1e5 && (!l || Map[l].find(r + c) != Map[l].end())) {         int t = Map[l][r + c];         dp[i] = dp[t] + v;         p[i] = t;         if (!r && dp[i] > dp[tp]) tp = i;         if (dp[i] > dp[Map[l + c][r]]) Map[l + c][r] = i;       }     }     while (tp) s[++cnt] = tp, tp = p[tp];     printf( %d n , cnt);     for (; cnt > 0; cnt--) printf( %d  , s[cnt]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, v1, v2, L;   bool can(double m) {     double bus = 0, nbus = 0;     for (int i = 0; i < (n + k - 1) / k; i++) {       if (i == 0)         bus += m * v2;       else         bus += m * v1;       nbus += m * v1;       if (bus > L) return false;       double sb = (bus - nbus) / (v1 + v2);       bus += sb * v1;       nbus += sb * v1;     }     return true;   }   int main() {     scanf( %d%d%d%d%d , &n, &L, &v1, &v2, &k);     double l = 0, r = (double)L / v2, m;     for (int i = 0; i < 100; i++) {       m = (l + r) / 2.0;       if (can(m))         l = m;       else         r = m;     }     printf( %.12f , m + (L - m * v2) / v1);   }