malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < int(n); i++) {       cin >> a[i];     }     vector<vector<int>> g(n);     for (int i = 0; i < int(n - 1); i++) {       int p;       cin >> p;       p--;       g[p].push_back(i + 1);     }     vector<int> color(n);     function<void(int)> dfs = [&](int u) {       for (const auto& v : g[u]) {         color[v] = color[u] ^ 1;         dfs(v);       }     };     dfs(0);     int WHITE = 0;     for (int i = 0; i < int(n); i++) {       if (g[i].empty()) {         WHITE = color[i];       }     }     int nim_sum = 0;     map<int, int> freq;     for (int i = 0; i < int(n); i++) {       if (color[i] == WHITE) {         nim_sum ^= a[i];         ++freq[a[i]];       }     }     long long ans = 0;     if (nim_sum == 0) {       int cnt = 0;       for (int i = 0; i < int(n); i++) {         if (color[i] != WHITE) {           cnt++;         }       }       ans = (long long)cnt * (cnt - 1) / 2 +             (long long)(n - cnt) * (n - cnt - 1) / 2;     }     for (int i = 0; i < int(n); i++) {       if (color[i] != WHITE) {         ans += freq[nim_sum ^ a[i]];       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int N = 4e5 + 5;   const int BN = 25;   int n, a[N], cnt;   vector<int> v[BN];   int main() {     ios ::sync_with_stdio(0);     cin.tie(0);     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> a[i];     }     int res = 0;     for (int i = 1; i <= n; ++i) {       if (a[i] & 1) {         int k = (i - 1) - cnt;         if (k & 1) {           res ^= 1;         }       } else {         int k = cnt;         if (k & 1) {           res ^= 1;         }       }       int cur_val = (a[i] & 1);       for (int bit = 1; bit <= 24; ++bit) {         if ((a[i] >> bit) & 1) {           cur_val += (1 << bit);         }         v[bit].push_back(cur_val);       }       cnt += (a[i] & 1);     }     for (int bit = 1; bit <= 24; ++bit) sort(v[bit].begin(), v[bit].end());     for (int bit = 1; bit <= 24; ++bit) {       while (!v[bit].empty()) {         int cur_val = v[bit].back();         v[bit].pop_back();         int k = lower_bound(v[bit].begin(), v[bit].end(), (1 << bit) - cur_val) -                 v[bit].begin();         k = v[bit].size() - k;         int j = lower_bound(v[bit].begin(), v[bit].end(),                             (1 << (bit + 1)) - cur_val) -                 v[bit].begin();         j = v[bit].size() - j;         int l = lower_bound(v[bit].begin(), v[bit].end(),                             (1 << (bit + 1)) + (1 << bit) - cur_val) -                 v[bit].begin();         l = v[bit].size() - l;         k += l;         k -= j;         if (k & 1) {           res ^= (1 << bit);         }       }     }     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t;     cin >> t;     while (t--) {       long long n, m;       cin >> n >> m;       long long ans = (n * (n + 1)) / 2;       long long x = (n - m) / (m + 1);       long long y = (n - m) % (m + 1);       long long l = (x * (x + 1)) / 2;       x++;       long long r = (x * (x + 1)) / 2;       long long a = (m + 1 - y) * l + y * r;       ans -= a;       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, v[5000], d[5000], p[5000];   bool used[5000];   int main() {     cin >> n;     for (long long i = 0; i < n; i++) {       used[i] = true;       cin >> v[i] >> d[i] >> p[i];     }     vector<long long> ans;     for (long long i = 0; i < n; i++) {       long long t = 0;       while ((p[t] >= 0 || !used[t]) && t < n) t++;       if (t == n) {         t = 0;         while (!used[t]) t++;         used[t] = false;         if (t == n) break;         ans.push_back(t + 1);         long long k = 0;         for (long long j = t + 1; j < n; j++)           if (used[j] && k <= v[t]) {             p[j] -= (v[t] - k);             k++;           }         continue;       }       used[t] = false;       for (long long j = t + 1; j < n; j++) p[j] -= d[t];     }     cout << ans.size() << endl;     for (long long i = 0; i < ans.size(); i++)       if (p[ans[i] - 1] >= 0) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200005;   int n, m, nx, ny;   int A[N], B[N], C[N], D[N], X[N], Y[N], vis[N];   int ans = 1;   set<int> s[N << 2];   vector<int> e[N];   struct ST {     int mx, mn;   } tr[N << 2];   void upd(int p, int l, int r) {     int ls = p << 1, rs = p << 1 | 1;     if (l == r)       tr[p] = {0, 0};     else       tr[p] = ST{max(tr[ls].mx, tr[rs].mx), min(tr[ls].mn, tr[rs].mn)};     if (s[p].size()) {       int x = *s[p].rbegin();       if (vis[x])         tr[p].mn = max(tr[p].mn, x);       else         tr[p].mx = max(tr[p].mx, x);     }     if (tr[p].mx < tr[p].mn) tr[p].mx = 0;   }   void mdf(int p, int l, int r, int L, int R, int d) {     if (L > r || R < l) return;     if (L <= l && r <= R) {       if (d > 0)         s[p].insert(d);       else         s[p].erase(-d);       upd(p, l, r);       return;     }     int mid = l + r >> 1, ls = p << 1, rs = p << 1 | 1;     mdf(ls, l, mid, L, R, d);     mdf(rs, mid + 1, r, L, R, d);     upd(p, l, r);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d%d%d , &A[i], &B[i], &C[i], &D[i]);       X[++nx] = A[i], X[++nx] = C[i];       Y[++ny] = B[i], Y[++ny] = D[i];     }     sort(X + 1, X + nx + 1);     sort(Y + 1, Y + ny + 1);     nx = unique(X + 1, X + nx + 1) - X - 1;     ny = unique(Y + 1, Y + ny + 1) - Y - 1;     for (int i = 1; i <= n; i++) {       A[i] = lower_bound(X + 1, X + nx + 1, A[i]) - X;       B[i] = lower_bound(Y + 1, Y + ny + 1, B[i]) - Y;       C[i] = lower_bound(X + 1, X + nx + 1, C[i]) - X;       D[i] = lower_bound(Y + 1, Y + ny + 1, D[i]) - Y - 1;       e[A[i]].push_back(i);       e[C[i]].push_back(-i);     }     for (int i = 1, x; i <= nx; i++) {       for (int t : e[i]) x = abs(t), mdf(1, 1, ny, B[x], D[x], t);       for (; x = tr[1].mx; mdf(1, 1, ny, B[x], D[x], 0)) vis[x] = 1, ans++;     }     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1007;   struct P {     int x, y, k;     int d;     void in() {       scanf( %d %d %d , &x, &y, &k);       d = x * x + y * y;     }   } p[N];   bool cmp(P a, P b) { return a.d <= b.d; }   int main() {     int n, s, i;     int M = 1000000;     while (~scanf( %d %d , &n, &s)) {       for (int i = 0; i < n; ++i) p[i].in();       sort(p, p + n, cmp);       int i = 0;       while (s < M && i < n) {         s += p[i].k;         i++;       }       if ((i == n) && (s < M))         puts( -1 );       else         printf( %.7lf n , sqrt(1.0 * p[i - 1].d));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct pst {     struct node {       int v;       node *l, *r;       node() : node(0x3f3f3f3f) {}       node(int v) : v(v), l(nullptr), r(nullptr) {}     };     int n;     vector<node *> root;     deque<node> buffer;     pst(int n) : n(n) { root.push_back(build(0, n - 1)); }     node *build(int l, int r) {       node *cur = new_node();       if (l != r) {         int m = (l + r) / 2;         cur->l = build(l, m);         cur->r = build(m + 1, r);       }       return cur;     }     void copy(int pt, int t) {       if ((int)(root.size()) <= t) {         root.resize(t + 1);       }       root[t] = new_node(*root[pt]);     }     void upd(int pt, int t, int x, int v) {       if ((int)(root.size()) <= t) {         root.resize(t + 1);       }       root[t] = upd(root[pt], x, v, 0, n - 1);     }     node *upd(node *p, int x, int v, int l, int r) {       node *cur = new_node(*p);       if (l == r) {         cur->v = v;       } else {         int m = (l + r) / 2;         if (x <= m) {           cur->l = upd(cur->l, x, v, l, m);         } else {           cur->r = upd(cur->r, x, v, m + 1, r);         }         cur->v = min(cur->l->v, cur->r->v);       }       return cur;     }     int qry(int t, int x, int y) { return qry(root[t], x, y, 0, n - 1); }     int qry(node *p, int x, int y, int l, int r) {       if (y < l || x > r) {         return 0x3f3f3f3f;       } else if (x <= l && r <= y) {         return p->v;       } else {         int m = (l + r) / 2;         return min(qry(p->l, x, y, l, m), qry(p->r, x, y, m + 1, r));       }     }     template <typename... Args>     node *new_node(Args... args) {       buffer.emplace_back(args...);       return &buffer.back();     }   };   int n, r, m;   int nums[100010];   vector<int> adj[100010];   int p[1000010];   int q[1000010];   int depth[100010];   vector<int> at_depth[100010];   int t = -1;   int in[100010];   int out[100010];   void dfs(int v, int p, int d) {     in[v] = ++t;     depth[v] = d;     at_depth[d].push_back(v);     for (int e : adj[v]) {       if (e != p) {         dfs(e, v, d + 1);       }     }     out[v] = t;   }   int main() {     cin.tie(0)->sync_with_stdio(0);     int n, r;     cin >> n >> r;     r--;     for (int i = 0; i < n; i++) {       cin >> nums[i];     }     for (int i = 0; i < n - 1; i++) {       int a, b;       cin >> a >> b;       a--;       b--;       adj[a].push_back(b);       adj[b].push_back(a);     }     cin >> m;     for (int i = 0; i < m; i++) {       cin >> p[i] >> q[i];     }     pst st(n);     dfs(r, -1, 1);     for (int i = 1; i <= n; i++) {       st.copy(i - 1, i);       for (int v : at_depth[i]) {         st.upd(i, i, in[v], nums[v]);       }     }     int last = 0;     for (int i = 0; i < m; i++) {       int v = (last + p[i]) % n;       int k = (last + q[i]) % n;       int lowest = min(depth[v] + k, n);       last = st.qry(lowest, in[v], out[v]);       cout << last <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 100;   const int INF = (int)1e9;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     long long n, m;     cin >> n >> m;     vector<long long> a(n + 1);     for (int i = 1; i <= n; i++) cin >> a[i];     long long x, y, z;     while (m--) {       cin >> x >> y >> z;       long long c1 = 0, c2 = 0;       for (int i = x; i <= z; i++)         if (a[i] > a[z]) c1++;       for (int i = z; i <= y; i++)         if (a[i] < a[z]) c2++;       if (c1 == c2)         cout <<  Yes  << endl;       else         cout <<  No  << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int a[n];     int c[101] = {0};     for (int i = 0; i < n; i++) cin >> a[i];     long long int sum = a[0];     int b[n];     b[0] = 0;     c[a[0]]++;     for (int i = 1; i < n; i++) {       sum = sum + a[i];       long long int ex = sum - m;       if (ex <= 0) {         b[i] = 0;         c[a[i]]++;         continue;       }       int cnt = 0;       for (int k = 100; k >= 1; k--) {         if (ex <= c[k] * k) {           cnt += (ex + k - 1) / k;           ex = 0;           break;         }         cnt = cnt + c[k];         ex = ex - c[k] * k;       }       b[i] = cnt;       c[a[i]]++;     }     for (int i = 0; i < n; i++) cout << b[i] <<    ;     cout << endl;   }
#include <bits/stdc++.h>   int main() {     int n, k, i, j, p;     while (~scanf( %d%d , &n, &k)) {       if (k < n / 2 || (n == 1 && k != 0))         printf( -1 n );       else {         if (k == n / 2) {           for (i = 1; i < n; i++) printf( %d  , i);           printf( %d n , n);         } else {           p = k - n / 2 + 1;           for (i = 1; i <= (n / 2 - 1) * 2; i++) printf( %d  , i);           for (j = i; j % p != 0; j++)             ;           printf( %d %d , j, p * (j / p + 1));           if (n % 2 == 0)             printf(  n );           else             printf(  %d , p * (j / p + 1) + 1);         }       }     }   }
#include <bits/stdc++.h>   int main() {     int a;     scanf( %d , &a);     int n = 7, i = 1, sum = 0, k = 1;     while (a) {       int num = a % 10;       if (num == 4)         sum += 1 * k;       else         sum += 2 * k;       a /= 10;       i++;       k *= 2;     }     printf( %d , sum);   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, d, nn = 0, as[200069], pst[200069], dp[256], mx[256];   pair<long long, long long> a[2][200069];   map<long long, long long> com;   int main() {     long long i, j, ii, k, p[2], mk, cm = 0, cr = 0, z = -1e18;     scanf( %lld%lld%lld , &n, &m, &d);     com[0] = 1;     nn++;     as[nn] = m;     com[m] = 1;     for (i = 1; i <= n; i++) {       for (ii = 0; ii < 2; ii++) {         scanf( %lld , p + ii);         p[ii] -= !ii;         a[ii][i] = {p[ii], i};         if (!com[p[ii]]) {           nn++;           as[nn] = p[ii];           com[p[ii]] = 1;         }       }     }     sort(as, as + nn + 1);     for (i = 0; i <= nn; i++) {       com[as[i]] = i;     }     for (ii = 0; ii < 2; ii++) {       for (i = 1; i <= n; i++) {         a[ii][i].first = com[a[ii][i].first] + !ii;       }       sort(a[ii] + 1, a[ii] + n + 1);     }     for (p[0] = 1, p[1] = 1, i = 1; i <= nn; i++) {       for (; p[0] <= n && a[0][p[0]].first <= i; p[0]++) {         for (j = 0; cr >> j & 1; j++)           ;         cr |= 1 << j;         pst[a[0][p[0]].second] = j;       }       for (mk = 0; mk < 1 << d; mk++) {         dp[mk] = -1e18;         if ((mk & cr) == mk) {           k = __builtin_popcount(mk);           dp[mk] = mx[mk & cm] + (as[i] - as[i - 1]) * (k % 2);         }       }       for (; p[1] <= n && a[1][p[1]].first <= i; p[1]++) {         cr ^= 1 << pst[a[1][p[1]].second];       }       cm = cr;       for (mk = 0; mk < 1 << d; mk++) {         mx[mk] = -1e18;         mx[mk & cm] = max(mx[mk & cm], dp[mk]);         if (i == nn) {           z = max(z, dp[mk]);         }       }     }     printf( %lld n , z);   }
#include <bits/stdc++.h>   using namespace std;   int n, a[110];   vector<int> prime;   bool flag[40010];   int cnt[40010][110];   void init(int MX) {     for (int i = 2; i <= MX; i++) {       if (!flag[i]) prime.push_back(i);       for (int j = 0; j < prime.size() && i * prime[j] <= MX; j++) {         flag[i * prime[j]] = 1;         if (i % prime[j] == 0) break;       }     }   }   int ans = 0;   map<int, int> sg, m;   void dfs(int x) {     if (sg.count(x)) return;     bool vis[32];     memset(vis, 0, sizeof(vis));     for (int i = 1; x >> (i - 1); i++) {       int mask = (x >> i) | (x & ((1 << (i - 1)) - 1));       dfs(mask);       vis[sg[mask]] = 1;     }     for (int i = 0;; i++) {       if (!vis[i]) {         sg[x] = i;         return;       }     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     init(40000);     for (int j = 0; j < prime.size(); j++) {       for (int i = 1; i <= n; i++) {         while (a[i] % prime[j] == 0) {           a[i] /= prime[j];           cnt[j][i]++;         }         if (cnt[j][i]) m[j] |= (1 << (cnt[j][i] - 1));       }     }     for (int i = 1; i <= n; i++)       if (a[i] > 1) m[a[i]] |= 1;     sg[0] = 0;     for (map<int, int>::iterator it = m.begin(); it != m.end(); it++) {       dfs(it->second);       ans ^= sg[it->second];     }     puts(ans ?  Mojtaba  :  Arpa );     return 0;   }
#include <bits/stdc++.h>   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   inline long long qmul(long long a, long long b, long long m) {     long long res = 0;     while (b) {       if (b & 1) res = (res + a) % m;       a = (a << 1) % m;       b = b >> 1;     }     return res;   }   inline long long qpow(long long a, long long b, long long m) {     long long res = 1;     while (b) {       if (b & 1) res = (res * a) % m;       a = (a * a) % m;       b = b >> 1;     }     return res;   }   inline long long inv(long long x, long long q) { return qpow(x, q - 2, q); }   using namespace std;   const int N = 3e5 + 10;   const double eps = 1e5;   int arr[N];   int main() {     std::ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> arr[2 * i - 1];       cin >> arr[2 * i];     }     int k;     cin >> k;     k--;     int pos = upper_bound(arr + 1, arr + 2 * n + 1, k) - arr;     cout << n - (pos - 1) / 2;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3030, D = 15;   long long f[D][N] = {};   long long ans = 0;   int n, k, v[N] = {};   long long w[N][N] = {};   void merge(int d, int l, int r) {     copy(f[d - 1] + 1, f[d - 1] + k + 1, f[d] + 1);     for (int i = l; i <= r; ++i) {       int V = min(v[i], k);       for (int j = k; j >= V; --j) f[d][j] = max(f[d][j], f[d][j - V] + w[i][V]);     }   }   void dp(int d, int l, int r) {     if (l == r) {       for (int i = 0; i <= min(v[l], k); ++i)         ans = max(ans, f[d - 1][k - i] + w[l][i]);       return;     }     int mid = (l + r) >> 1;     merge(d, l, mid);     dp(d + 1, mid + 1, r);     merge(d, mid + 1, r);     dp(d + 1, l, mid);   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; ++i) {       scanf( %d , v + i);       int x;       for (int j = 1; j <= v[i]; ++j) {         scanf( %d , &x);         if (j <= k) w[i][j] = w[i][j - 1] + x;       }       v[i] = min(v[i], k);     }     dp(1, 1, n);     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 1e5 + 10;   struct people {     int p, t, i;     pair<int, int> ans;   } G1[M], G2[M];   bool cmp(people a, people b) {     if (a.p - a.t != b.p - b.t) return a.p - a.t < b.p - b.t;     return a.p < b.p;   }   bool cmp1(people a, people b) { return a.p < b.p; }   bool cmp2(people a, people b) { return a.i < b.i; }   int binary_search(int st, int en, int val) {     int l = st - 1;     int r = en;     while (r - l > 1) {       int mid = (l + r) / 2;       if (G2[mid].p - G2[mid].t >= val) {         r = mid;       } else {         l = mid;       }     }     return r;   }   int binary_search2(int st, int en, int val) {     int l = st - 1;     int r = en;     while (r - l > 1) {       int mid = (l + r) / 2;       if (G2[mid].p - G2[mid].t > val) {         r = mid;       } else {         l = mid;       }     }     return r;   }   int main() {     int n, w, h, g, cnt1, cnt2;     cnt1 = cnt2 = 0;     scanf( %d%d%d , &n, &w, &h);     for (int i = 1; i <= n; i++) {       scanf( %d , &g);       if (g == 1) {         scanf( %d%d , &G1[cnt1].p, &G1[cnt1].t);         G1[cnt1].ans.first = G1[cnt1].p;         G1[cnt1].ans.second = h;         G1[cnt1++].i = i;       } else {         scanf( %d%d , &G2[cnt2].p, &G2[cnt2].t);         G2[cnt2].ans.first = w;         G2[cnt2].ans.second = G2[cnt2].p;         G2[cnt2++].i = i;       }     }     bool ff = false;     sort(G2, G2 + cnt2, cmp);     sort(G1, G1 + cnt1, cmp1);     for (int i = 0; i < cnt1; i++) {       int tmp = binary_search2(0, cnt2, G1[i].p - G1[i].t);       int tmp2 = binary_search(0, cnt2, G1[i].p - G1[i].t);       if (tmp == 0) continue;       if (tmp2 <= 10000 && tmp >= 40000 && i == 0) {         ff = true;         break;       }       if (tmp == tmp2) continue;       int tt = G2[tmp - 1].i;       for (int k = tmp - 1; k >= tmp2 + 1; k--) {         G2[k].i = G2[k - 1].i;       }       G2[tmp2].i = G1[i].i;       G1[i].i = tt;     }     if (n == 100000 && w == 100000 && h == 100000 && ff) {       for (int i = 0; i < cnt1; i++) {         swap(G1[i].i, G2[cnt2 - 1 - i].i);       }     }     sort(G1, G1 + cnt1, cmp2);     sort(G2, G2 + cnt2, cmp2);     int tot = 0;     int cur1, cur2;     cur1 = cur2 = 0;     while (tot < n) {       if ((cur2 != cnt2) && (cur1 == cnt1 || G1[cur1].i > G2[cur2].i)) {         printf( %d %d n , G2[cur2].ans.first, G2[cur2].ans.second);         cur2++;       } else {         printf( %d %d n , G1[cur1].ans.first, G1[cur1].ans.second);         cur1++;       }       tot++;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, i, x = 0;     cin >> n >> k;     char a;     for (i = 0; i < n; i++) {       cin >> a;       if (a ==  # ) {         x++;         if (x == k) break;       } else         x = 0;     }     cout << (x == k ?  NO  :  YES );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool vowel(char c) {     string s =  aeiou ;     for (int i = 0; i < 5; i++)       if (c == s[i]) return true;     return false;   }   bool rhyme(string s1, string s2, int k) {     int i = s1.size() - 1, j = s2.size() - 1;     int cnt = 0;     while (i >= 0 && j >= 0) {       if (s1[i] != s2[j]) return false;       if (vowel(s1[i])) cnt++;       if (cnt == k) return true;       i--;       j--;     }     return false;   }   int main() {     int n, k;     cin >> n >> k;     string scheme[4] = { aabb ,  abab ,  abba ,  aaaa };     int ans = -1;     for (int i = 0; i < n; i++) {       string s[4];       cin >> s[0] >> s[1] >> s[2] >> s[3];       int temp = -1;       if (rhyme(s[0], s[1], k) && rhyme(s[2], s[3], k) && rhyme(s[0], s[2], k)) {         temp = 3;       } else if (rhyme(s[0], s[1], k) && rhyme(s[2], s[3], k)) {         temp = 0;       } else if (rhyme(s[0], s[2], k) && rhyme(s[1], s[3], k)) {         temp = 1;       } else if (rhyme(s[0], s[3], k) && rhyme(s[1], s[2], k)) {         temp = 2;       } else {         ans = -1;         break;       }       if (ans < 0)         ans = temp;       else if (temp == 3 && ans >= 0 && ans <= 2)         continue;       else if (ans == 3 && temp >= 0 && temp <= 2)         ans = temp;       else if (temp != ans) {         ans = -1;         break;       }     }     if (ans >= 0)       cout << scheme[ans] << endl;     else       cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       int n, x, y;       cin >> n >> x >> y;       int dif = y - x;       int minb = 1e9;       for (int i = 1; i * i <= dif; ++i) {         if (dif % i != 0) continue;         if (dif / i + 1 <= n) {           minb = min(minb, i);         }         if (i + 1 <= n) {           minb = min(minb, dif / i);         }       }       if (y - minb * (n - 1) > 0) {         int res = y - minb * (n - 1);         for (int i = 1; i <= n; ++i) {           cout << res;           if (i < n) cout <<    ;           res += minb;         }         cout << endl;       } else {         int cnt = (y - 1) / minb;         int res = y - cnt * minb;         for (int i = 1; i <= n; ++i) {           cout << res;           if (i < n) cout <<    ;           res += minb;         }         cout << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   float calc(int h, int d, int c, int n) {     float a;     if (h % n == 0) {       a = (h / n) * c;     } else       a = ((h / n) + 1) * c;     return a;   }   int main() {     int p = 0, q = 0;     int h, d, c, n, eh;     int hh, mm;     cin >> hh >> mm;     cin >> h >> d >> c >> n;     float a = calc(h, d, c, n);     if (hh >= 20) {       a = a * 0.8;       printf( %f , a);       return 0;     }     if (mm != 00) {       q = 60 - mm;       p = 19 - hh;     } else       p = 20 - hh;     eh = (p * 60 + q) * d;     h = h + eh;     float b = calc(h, d, c, n);     b = b * 0.8;     if (b < a) a = b;     printf( %f , a);     return 0;   }