malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   class point {    public:     int x, ind;     point(int dx = 0, int _ind = 0) {       x = dx;       ind = _ind;     }   };   int n, k, f[210][210];   point a[210], c[210];   bool cmpx(point A, point B) { return A.x < B.x; }   bool cmpi(point A, point B) { return A.ind < B.ind; }   int main() {     cin >> n >> k;     for (int i = 0; i < n; ++i) {       cin >> a[i].x;       a[i].ind = i;       c[i] = a[i];     }     sort(c, c + n, cmpx);     for (int i = 0; i < n; ++i)       for (int j = i; j < n; ++j)         for (int q = i; q <= j; ++q) f[i][j] += a[q].x;     for (int i = 0; i < n; ++i)       for (int j = i; j < n; ++j) {         sort(a + i, a + j + 1, cmpx);         int t = n - 1;         int cnt = k;         for (int q = i; q <= j; ++q) {           while ((c[t].ind >= i) && (c[t].ind <= j) && (t >= 0)) --t;           if ((t >= 0) && (cnt > 0) && (c[t].x > a[q].x)) {             f[i][j] = f[i][j] - a[q].x + c[t].x;             --t;             --cnt;           } else             break;         }         sort(a + i, a + j + 1, cmpi);       }     int mx = f[0][0];     for (int i = 0; i < n; ++i)       for (int j = i; j < n; ++j)         if (mx < f[i][j]) mx = f[i][j];     cout << mx;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   double h, d, c, n, mx;   int hh, mm;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> hh >> mm;     hh = hh * 60 + mm;     cin >> h >> d >> c >> n;     double nec = ceil(h / n) * c;     if (hh >= 1200 && hh < 1440)       return cout << setprecision(5) << fixed << nec * 0.8, 0;     mm = 20 * 60;     int diff = mm - hh;     double nec2 = ceil((diff * d + h) / n) * c;     cout << setprecision(5) << fixed << min(nec2 * 0.8, nec);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   static int i = 0;   int fun(long long n) {     i++;     if (n % 2 == 1)       return 0;     else       fun(n / 2);   }   int main() {     int n;     long long k;     scanf( %d %lld , &n, &k);     fun(k);     printf( %d , i);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, id[105], m, i, j;   unsigned long long cant[105], c[105], T[105], total, sol, factor, x, llevo;   bool cmp(const int i, const int j) { return c[i] < c[j]; }   int main() {     scanf( %d , &n);     for (i = 0; i < n; i++) {       cin >> cant[i] >> c[i];       total += cant[i];       id[i] = i;     }     sort(id, id + n, cmp);     scanf( %d , &m);     for (i = 0; i < m; i++) cin >> T[i];     factor = 1;     llevo = 0;     i = 0;     while (total > 0 && i < m) {       if (llevo == T[i]) factor++, i++;       j = 0;       while (total > 0 && i < m && llevo < T[i]) {         x = min(cant[id[j]], T[i] - llevo);         cant[id[j]] -= x;         total -= x;         sol += x * factor * c[id[j]];         llevo += x;         j++;       }     }     for (i = 0; i < n; i++) sol += cant[i] * factor * c[i];     cout << sol << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct segment {     int l, r, p;   } seg[300005];   struct PS {     int l, r, val;   } P[300005 * 20];   int n, m, k, a, b, l, r, tot;   int suf[300005];   int get(int node, int bas, int son, int x, int y) {     if (bas >= x && son <= y) return P[node].val;     bool l = (((bas + son) >> 1) >= x);     bool r = (((bas + son) >> 1) + 1 <= y);     if (l & r)       return max(get(P[node].l, bas, ((bas + son) >> 1), x, y),                  get(P[node].r, ((bas + son) >> 1) + 1, son, x, y));     if (l) return get(P[node].l, bas, ((bas + son) >> 1), x, y);     return get(P[node].r, ((bas + son) >> 1) + 1, son, x, y);   }   void create(int& node) {     node = ++tot;     P[node].val = 1005000000;   }   void up(int& node, int prv, int bas, int son, int x, int val) {     if (!node) create(node);     if (bas == x && son == x) {       P[node].val = min(val, P[prv].val);       return;     }     if (x <= ((bas + son) >> 1)) {       P[node].r = P[prv].r;       up(P[node].l, P[prv].l, bas, ((bas + son) >> 1), x, val);     } else {       P[node].l = P[prv].l;       up(P[node].r, P[prv].r, ((bas + son) >> 1) + 1, son, x, val);     }     P[node].val = max(P[P[node].l].val, P[P[node].r].val);   }   int main() {     P[0].val = 1005000000;     scanf( %d %d %d , &n, &m, &k);     for (int i = 1; i <= k; i++) {       scanf( %d %d %d , &seg[i].l, &seg[i].r, &seg[i].p);     }     sort(seg + 1, seg + 1 + k, [](segment a, segment b) { return a.l < b.l; });     for (int i = k; i >= 1; i--) {       up(suf[i], suf[i + 1], 1, n, seg[i].p, seg[i].r);     }     while (m--) {       scanf( %d %d %d %d , &a, &b, &l, &r);       int bas = 1, son = k;       while (bas <= son) {         if (seg[((bas + son) >> 1)].l < l)           bas = ((bas + son) >> 1) + 1;         else           son = ((bas + son) >> 1) - 1;       }       printf(get(suf[bas], 1, n, a, b) > r ?  no  :  yes );       puts(  );       fflush(stdout);     }   }