malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 300010;   int h[MAXN], v[MAXN];   int main() {     int n;     scanf(  %d , &n);     for (int i = 0; i < (n); ++i) {       scanf(  %d , &h[i]);     }     v[0] = 1;     v[n - 1] = 1;     for (int i = (1); i < (n - 1); ++i) {       v[i] = min(h[i], v[i - 1] + 1);     }     for (int i = n - 2; i >= 0; --i) {       v[i] = min(v[i], min(h[i], v[i + 1] + 1));     }     int ans = -1;     for (int i = 0; i < (n); ++i) ans = max(ans, v[i]);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   const int nmax = 500000;   int ans[nmax + 5];   int main() {     int n, i, j, x1, y1, x2, y2;     scanf( %d , &n);     for (i = 1; i <= n; i++) {       scanf( %d%d%d%d , &x1, &y1, &x2, &y2);       ans[i] = (((x2 % 2) + 2) % 2) * 2 + ((y2 % 2) + 2) % 2 + 1;     }     printf( YES n );     for (i = 1; i <= n; i++) printf( %d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   int main() {     long long n;     while (~scanf( %I64d , &n)) {       long long m = sqrt(n);       long long m1 = sqrt(m);       long long i;       long long sum;       int flag = 0;       for (i = m + 1; i >= m + 1 - 100; i--) {         sum = 0;         long long b = i;         while (b) {           sum += b % 10;           b /= 10;         }         long long num = sum * i + i * i;         if (num == n) {           printf( %I64d n , i);           flag = 1;           break;         }       }       if (flag == 0) {         printf( -1 n );       }     }   }
#include <bits/stdc++.h>   using namespace std;   int bit[200005];   void update(long long int x) {     while (x < 200005) {       bit[x] += 1;       if (x == 0) break;       x += x & (-x);     }   }   long long int query(long long int x) {     long long int ans = 0;     while (x >= 0) {       ans += bit[x];       if (x == 0) break;       x -= x & (-x);     }     return ans;   }   int main() {     long long int n, t;     cin >> n >> t;     vector<long long int> v(n);     for (long long int i = 0; i < n; i++) {       cin >> v[i];       if (i) v[i] += v[i - 1];     }     vector<long long int> v2 = v;     sort(v.begin(), v.end());     long long int ans = 0;     for (long long int i = (n - 1); i >= 0; i--) {       int pos = lower_bound(v.begin(), v.end(), v2[i] + t) - v.begin();       ans += query(pos - 1);       update(lower_bound(v.begin(), v.end(), v2[i]) - v.begin());     }     ans += query(lower_bound(v.begin(), v.end(), t) - v.begin() - 1);     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int get(int a) {     int maxx = 0;     for (int i = 0; i < 21; i++)       if (a & (1 << i)) maxx = i;     int ans = (1 << (maxx + 1)) - 1;     return (ans ^ a);   }   int main() {     int n;     cin >> n;     vector<int> a(n + 1);     for (int i = n; i >= 0; i--) {       if (a[i] == 0) {         for (int j = 21; j >= 0; j--) {           int tmp = get(i);           if ((i ^ tmp) == i + tmp && a[tmp] == 0) {             a[tmp] = i;             a[i] = tmp;             break;           }         }       }     }     long long ans = 0;     for (int i = 0; i <= n; i++) ans += (a[i] ^ i);     cout << ans << endl;     for (int i = 0; i <= n; i++) cout << a[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 0x3f3f3f3f;   const int N = 4e5 + 10;   const int M = 1e6 + 10;   const long long mod = 1e9 + 7;   const double PI = acos(-1);   long long w[N];   int fa[N][21];   long long wi[N][21];   long long mx[N][21];   int Find(int x, int y) {     for (int i = 20; i >= 0; --i)       if (mx[x][i] < y) x = fa[x][i];     return x;   }   int dd[21];   int main() {     dd[0] = 1;     for (int i = 1; i <= 20; ++i) dd[i] = dd[i - 1] * 2;     int cnt = 1, last = 0;     w[0] = 1e16;     for (int i = 0; i <= 20; ++i) fa[0][i] = 0, wi[0][i] = 1e16, mx[0][i] = 1e16;     w[1] = 0, fa[1][0] = 0, wi[1][0] = 0;     for (int i = 1; i <= 20; ++i) fa[1][i] = 0, wi[1][i] = 1e16, mx[1][i] = 1e16;     int q, to, op;     long long x, y;     scanf( %d , &q);     while (q--) {       scanf( %d%I64d%I64d , &op, &x, &y);       x ^= last, y ^= last;       if (op == 1) {         w[++cnt] = y;         fa[cnt][0] = Find(x, y);         mx[cnt][0] = wi[cnt][0] = w[cnt];         for (int i = 1; i <= 20; ++i) {           to = fa[cnt][i - 1];           fa[cnt][i] = fa[to][i - 1];           mx[cnt][i] = max(mx[cnt][i - 1], mx[to][i - 1]);           wi[cnt][i] = wi[cnt][i - 1] + wi[to][i - 1];         }       } else {         last = 0;         for (int i = 20; i >= 0; --i) {           if (wi[x][i] <= y) {             last += dd[i];             y -= wi[x][i];             x = fa[x][i];           }         }         printf( %d n , last);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int prime = 999983;   const int INF = 0x7FFFFFFF;   const long long INFF = 0x7FFFFFFFFFFFFFFF;   const double pi = acos(-1.0);   const double inf = 1e18;   const double eps = 1e-6;   const long long mod = 1e9 + 7;   long long qpow(long long a, long long b) {     long long s = 1;     while (b > 0) {       if (b & 1) s = s * a % mod;       a = a * a % mod;       b >>= 1;     }     return s;   }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   int dr[2][4] = {1, -1, 0, 0, 0, 0, -1, 1};   const int maxm = 2e7, maxn = 3e5 + 10;   int a[maxn];   int num[maxm][2];   int main(void) {     int n;     cin >> n;     long long ans = 0;     num[0][0] = 1;     for (int i = 1; i < n + 1; i++) {       scanf( %d , &a[i]);       a[i] ^= a[i - 1];       ans += num[a[i]][i % 2];       num[a[i]][i % 2]++;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int k, i;   int main() {     cin >> k;     for (i = 1; i <= k; i <<= 1) {     }     cout <<  2 3  << endl;     cout << i * 2 - 1 <<     << k <<   0  << endl;     cout << i <<     << i * 2 - 1 <<     << k << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int ma = -1, mi = 1000000000000000;   inline long long int gcd(long long int a, long long int b) {     return b ? gcd(b, a % b) : a;   }   inline long long int lcm(long long int a, long long int b, long long int MOD) {     return a / gcd(a, b) * b % MOD;   }   long long int power(long long int x, unsigned int y) {     if (y == 0)       return 1;     else if (y % 2 == 0)       return power(x, y / 2) * power(x, y / 2);     else       return x * power(x, y / 2) * power(x, y / 2);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     long long int i, j, k, a[100000] = {0}, n, m, b[100009] = {0}, c = 0, d = 0,                            e[30] = {0}, x = 0;     cin >> n >> m;     for (i = 0; i < n; i++) {       cin >> a[i];     }     for (i = 0; i < n - 1; i++) {       if (a[i] + a[i + 1] < m) {         d = m - a[i] - a[i + 1];         a[i + 1] += d;         c += d;       }     }     cout << c << endl;     for (i = 0; i < n; i++) cout << a[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int AA[100010];   int BB[100010];   long long dp[100010];   int N;   vector<long long> M;   vector<long long> B;   bool bad(long long l1, long long l2, long long l3) {     long double XX1 = 1.00000 * (M[l1] - M[l2]) / (M[l1] - M[l3]);     long double XX2 = 1.00000 * (B[l2] - B[l1]) / (B[l3] - B[l1]);     return XX1 < XX2;   }   void add(long long m, long long b) {     M.push_back(m);     B.push_back(b);     while (M.size() >= 3 && bad(M.size() - 3, M.size() - 2, M.size() - 1)) {       M.erase(M.end() - 2);       B.erase(B.end() - 2);     }   }   int pointer;   long long query(long long x) {     if (pointer >= M.size()) pointer = M.size() - 1;     while (pointer < M.size() - 1 &&            M[pointer + 1] * x + B[pointer + 1] > M[pointer] * x + B[pointer])       pointer++;     return M[pointer] * x + B[pointer];   }   int main() {     ios_base::sync_with_stdio(0);     cin >> N;     for (int i = 1; i <= N; i++) {       cin >> AA[i];     }     for (int i = 1; i <= N; i++) {       cin >> BB[i];     }     dp[1] = 0LL;     add(-BB[1], -dp[1]);     for (int i = 2; i <= N; i++) {       dp[i] = -1LL * query(AA[i]);       add(-BB[i], -dp[i]);     }     cout << dp[N] << endl;     return 0;   }
#include <bits/stdc++.h>   #pragma warning(disable : 4996)   using namespace std;   int n, m;   int a[200000];   char tmp[200000];   int b[200000];   int bi;   int c[200000];   int ci;   int d[200000];   vector<int> dab;   void calc() {     int i, j;     int cnt = 0;     d[0] = -((1 << 30) - 1);     ci = 0;     for (i = 0; i < bi; i++) {       if (b[i] == ((1 << 30) - 1))         cnt++;       else {         c[++ci] = cnt;         d[ci] = b[i];         cnt = 0;       }     }     c[++ci] = cnt;     d[ci++] = ((1 << 30) - 1);     for (i = 0; i < ci - 1; i++) {       if (d[i + 1] - d[i] - 1 < c[i + 1]) {         printf( Incorrect sequence );         exit(0);       }     }     dab.clear();     for (i = 0; i < ci - 1; i++) {       if (c[i + 1] == 0) continue;       if (d[i] <= 0 && d[i + 1] <= 0) {         for (j = d[i + 1] - c[i + 1]; j <= d[i + 1] - 1; j++) dab.push_back(j);       } else if (d[i] >= 0 && d[i + 1] >= 0) {         for (j = d[i] + 1; j <= d[i] + c[i + 1]; j++) dab.push_back(j);       } else {         if (min(abs(d[i + 1] - 1), abs(d[i] + 1)) * 2 + 1 >= c[i + 1]) {           for (j = -(c[i + 1] - 1) / 2; j <= (c[i + 1] / 2); j++)             dab.push_back(j);         } else {           int u = min(abs(d[i + 1] - 1), abs(d[i] + 1));           if (abs(d[i + 1] - 1) > abs(d[i] + 1)) {             for (j = -u; j <= u; j++) dab.push_back(j);             for (j = u + 1;                  j <=                  u + c[i + 1] - min(abs(d[i + 1] - 1), abs(d[i] + 1)) * 2 - 1;                  j++)               dab.push_back(j);           } else {             for (j = -u -                      (c[i + 1] - min(abs(d[i + 1] - 1), abs(d[i] + 1)) * 2 - 1);                  j <= -u - 1; j++)               dab.push_back(j);             for (j = -u; j <= u; j++) dab.push_back(j);           }         }       }     }   }   int main() {     int i, j, k;     cin >> n >> m;     for (i = 0; i < n; i++) {       scanf( %s , tmp);       if (tmp[0] ==  ? )         a[i] = ((1 << 30) - 1);       else         a[i] = atoi(tmp);     }     for (i = 0; i < m; i++) {       bi = 0;       for (j = i; j < n; j += m) {         b[bi++] = a[j];       }       calc();       int u = 0;       for (j = i; j < n; j += m) {         if (a[j] == ((1 << 30) - 1)) a[j] = dab[u++];       }     }     for (i = 0; i < n; i++) printf( %d  , a[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int delta = (int)1e9 + 7;   int n, a[(int)3e5 + 20], b[(int)3e5 + 20], x, y, z, ans, h[(int)3e5 + 20];   vector<int> G[(int)3e5 + 20];   bool cmp(int u, int v) {     if (a[u] == a[v]) return u < v;     return a[u] > a[v];   }   bool ac1() {     for (int i = 0; i < G[b[1]].size(); ++i) h[G[b[1]][i]] = 1;     int w = 2;     while (a[b[w]] == a[b[1]] - 1 && w <= n) {       if (!h[b[w]]) return 1;       ++w;     }     return 0;   }   bool ac2() {     for (int i = 1; i <= n; ++i)       if (a[i] == z) ++y;     for (int i = 1; i <= n; ++i) {       if (a[i] == z)         x = 1;       else         x = 0;       for (int j = 0; j < G[i].size(); ++j)         if (a[G[i][j]] == z) ++x;       if (x == y) return 0;     }     return 1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n;     for (int i = 1; i <= n; ++i) cin >> a[i], b[i] = i;     for (int i = 1; i < n; ++i) {       cin >> x >> y;       G[x].push_back(y);       G[y].push_back(x);     }     sort(b + 1, b + n + 1, cmp);     z = ans = a[b[1]];     if (n == 1 || a[b[1]] - a[b[2]] > 1)       ;     else if (a[b[1]] == a[b[2]] + 1) {       if (ac1()) ++ans;     } else {       y = 0;       ans += ac2() + 1;     }     cout << ans;     return cout << endl, 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int f[100010], n, a[100010];   const long long int inf = 2000000000000;   int main() {     long long int i, j, k;     scanf( %I64d , &n);     for (i = 1; i <= n; i++) {       scanf( %I64d , &a[i]);     }     f[0] = 0;     sort(a + 1, a + 1 + n);     for (i = 1; i <= n; i++) {       f[i] = f[i - 1] + 20;       long long int t;       t = lower_bound(a + 1, a + 1 + n, a[i] - 89) - a - 1;       f[i] = min(f[i], f[t] + 50);       t = lower_bound(a + 1, a + 1 + n, a[i] - 1439) - a - 1;       f[i] = min(f[i], f[t] + 120);       printf( %I64d n , f[i] - f[i - 1]);     }     return 0;   }
#include <bits/stdc++.h>   long long read() {     long long x = 0, f = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x * f;   }   using namespace std;   const long long maxn = 1e5 + 7;   const double eps = 1e-10;   const long long mod = 1e9 + 7;   long long n;   long long totA = 0, totB = 0;   long long casA[maxn * 2], casB[maxn * 2];   long long tot = 0;   struct Node {     long long set, score;   };   Node node[maxn];   bool cmp(Node a, Node b) {     if (a.set < b.set) return 1;     if (a.set == b.set && a.score < b.score) return 1;     return 0;   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n;     for (long long i = 1; i < 2 * maxn; i++)       casA[i] = casB[i] = 9223372036854775807;     bool flagA = 0, flagB = 0;     for (long long i = 1; i <= n; i++) {       long long x;       cin >> x;       if (x == 1)         casA[++totA] = i;       else         casB[++totB] = i;       if (i == n) {         if (x == 1)           flagA = 1;         else           flagB = 1;       }     }     for (long long i = n; i >= 1; i--) {       long long winA = 0, winB = 0, tarA = 0, tarB = 0;       long long now = 1;       bool flag = 1;       while (now <= n) {         if (casA[tarA + i] == 9223372036854775807 &&             casB[tarB + i] == 9223372036854775807) {           flag = 0;           break;         }         if (casA[tarA + i] < casB[tarB + i]) {           winA++;           tarA += i;           tarB = casA[tarA] - tarA;           now = casA[tarA] + 1;         } else {           winB++;           tarB += i;           tarA = casB[tarB] - tarB;           now = casB[tarB] + 1;         }       }       if (winA == winB) flag = 0;       if (winA > winB && flagB) flag = 0;       if (winA < winB && flagA) flag = 0;       if (flag) {         node[++tot].set = max(winA, winB);         node[tot].score = i;       }     }     sort(node, node + tot, cmp);     cout << tot <<   n ;     if (tot) {       for (long long i = 1; i <= tot; i++)         cout << node[i].set <<     << node[i].score <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 3E5 + 5;   int n, m, sz, val, x, y, color[MAXN];   vector<int> v[MAXN], G[MAXN];   template <class T>   void read(T& x, T f = 1, char ch = getchar()) {     x = 0;     while (ch <  0  || ch >  9 ) f = (ch ==  -  ? -1 : 1), ch = getchar();     while (ch >=  0  && ch <=  9 ) x = x * 10 + ch - 48, ch = getchar();     x *= f;   }   void dfs(int now, int f) {     map<int, int> vis;     for (int i = 0; i < v[now].size(); i++)       if (color[v[now][i]]) vis[color[v[now][i]]] = 1;     int l = 0;     for (int i = 0; i < v[now].size(); i++) {       if (!color[v[now][i]]) {         while (vis[++l])           ;         color[v[now][i]] = l;       }     }     for (int i = 0; i < G[now].size(); i++) {       int to = G[now][i];       if (to != f) dfs(to, now);     }   }   signed main() {     read(n), read(m);     int ans = 1;     for (int i = 1; i <= n; i++) {       read(sz);       for (int j = 1; j <= sz; j++) {         read(val);         v[i].push_back(val);       }       ans = max(ans, sz);     }     for (int i = 1; i <= n - 1; i++) {       read(x), read(y);       G[x].push_back(y), G[y].push_back(x);     }     dfs(1, 1);     printf( %d n , ans);     for (int i = 1; i <= m; i++) printf( %d  , color[i] ? color[i] : 1);     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC optimize( -O2 )   using namespace std;   const long long N = 500000 + 10;   const long long MOD = 1000000000 + 7;   const long long INF = 100000000000000010;   const long long LOG = 25;   long long dp[N], n, a[N], lazy[N << 2], m, b[N], seg[N << 2], p[N], koj[N];   void modify(long long id, long long x) {     seg[id] += x;     lazy[id] += x;   }   void shift(long long id) {     modify(id << 1, lazy[id]);     modify(id << 1 | 1, lazy[id]);     lazy[id] = 0;   }   void add(long long id, long long lq, long long rq, long long x, long long l,            long long r) {     if (rq <= l || r <= lq) return;     if (lq <= l && r <= rq) {       modify(id, x);       return;     }     long long md = (l + r) >> 1;     shift(id);     add(id << 1, lq, rq, x, l, md);     add(id << 1 | 1, lq, rq, x, md, r);     seg[id] = seg[id << 1] + seg[id << 1 | 1];   }   long long get(long long id, long long lq, long long rq, long long l,                 long long r) {     if (rq <= l || r <= lq) return 0;     if (lq <= l && r <= rq) return seg[id];     shift(id);     long long md = (l + r) >> 1;     return get(id << 1, lq, rq, l, md) + get(id << 1 | 1, lq, rq, md, r);   }   void Set(long long id, long long lq, long long rq, long long x, long long l,            long long r) {     if (rq <= l || r <= lq) return;     if (lq <= l && r <= rq) {       seg[id] = x;       return;     }     long long md = (l + r) >> 1;     shift(id);     Set(id << 1, lq, rq, x, l, md);     Set(id << 1 | 1, lq, rq, x, md, r);     seg[id] = seg[id << 1] + seg[id << 1 | 1];   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (long long i = 1; i <= n; i++) {       cin >> a[i];     }     for (long long i = 1; i <= n; i++) cin >> p[i];     cin >> m;     for (long long i = 1; i <= m; i++) {       cin >> b[i];       koj[b[i]] = i;     }     add(1, 1, m + 1, INF, 0, m + 1);     for (long long i = 1; i <= n; i++) {       if (koj[a[i]] == 0) {         long long x = lower_bound(b + 1, b + m + 1, a[i]) - b;         add(1, 0, x, p[i], 0, m + 1);         long long zed = min(0ll, p[i]);         add(1, x, m + 1, zed, 0, m + 1);       } else {         long long j = koj[a[i]];         long long zed = min(0ll, p[i]);         long long mn =             min(get(1, j - 1, j, 0, m + 1), get(1, j, j + 1, 0, m + 1) + zed);         Set(1, j, j + 1, mn, 0, m + 1);         add(1, 0, j, p[i], 0, m + 1);         add(1, j + 1, m + 1, zed, 0, m + 1);       }     }     long long ans = get(1, m, m + 1, 0, m + 1);     if (ans > 1000000000000000) return cout <<  NO , 0;     cout <<  YES n ;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = (int)1e5 + 100;   double alpha[maxn], beta[maxn];   double a[maxn], b[maxn];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %lf , &beta[i]);     for (int i = 0; i < n; i++) scanf( %lf , &alpha[i]);     double Sa = 0, Sb = 0;     for (int i = 0; i < n; i++) {       double c = alpha[i] + beta[i];       double A = 1, B = -(c + (Sb - Sa)), C = beta[i] - c * Sa;       double x1 = (-B + sqrt(max(0., B * B - 4. * A * C))) / 2.;       double y1 = c - x1;       a[i] = x1;       b[i] = y1;       Sa += a[i];       Sb += b[i];     }     cout.precision(15);     for (int i = 0; i < n; i++) printf( %.9lf  , a[i]);     printf(  n );     for (int i = 0; i < n; i++) printf( %.9lf  , b[i]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5010;   const int mod = 1e9 + 7;   const long long INF = 1e15;   int nex[N];   long long x[N], a[N], b[N], c[N], d[N];   int main() {     int n, s, e;     while (~scanf( %d%d%d , &n, &s, &e)) {       nex[s] = e;       for (int i = 1; i <= n; i++) scanf( %I64d , &x[i]);       for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]);       for (int i = 1; i <= n; i++) scanf( %I64d , &b[i]);       for (int i = 1l; i <= n; i++) scanf( %I64d , &c[i]);       for (int i = 1; i <= n; i++) scanf( %I64d , &d[i]);       for (int i = 1; i <= n; i++) {         if (i == s || i == e) continue;         long long mi = INF, id;         for (int j = s; j != e; j = nex[j]) {           long long tmpans = 0;           int from = j, to = i;           if (to < from)             tmpans += abs(x[from] - x[to]) + c[from] + b[to];           else             tmpans += abs(x[from] - x[to]) + d[from] + a[to];           from = i, to = nex[j];           if (to < from)             tmpans += abs(x[from] - x[to]) + c[from] + b[to];           else             tmpans += abs(x[from] - x[to]) + d[from] + a[to];           from = j, to = nex[j];           if (to < from)             tmpans -= abs(x[from] - x[to]) + c[from] + b[to];           else             tmpans -= abs(x[from] - x[to]) + d[from] + a[to];           if (mi > tmpans) {             mi = tmpans;             id = j;           }         }         int tmpnex = nex[id];         nex[id] = i;         nex[i] = tmpnex;       }       long long ans = 0;       for (int i = s; i != e; i = nex[i]) {         long long tmpans = 0;         int from = i, to = nex[i];         if (to < from)           tmpans += abs(x[from] - x[to]) + c[from] + b[to];         else           tmpans += abs(x[from] - x[to]) + d[from] + a[to];         ans += tmpans;       }       printf( %I64d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using namespace chrono;   long long int ceil(long long int r, long long int d) {     return (r / d) + (bool)(r % d);   }   void inputAArray(int siz, vector<int> &arr) {     for (int i = 0; i < siz; i++) arr[i] = 1 + rand();   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     srand(time(0));     int t;     cin >> t;     while (t--) {       string s;       cin >> s;       int n = s.length();       if (n & 1) {         cout <<  NO  << endl;         continue;       }       if (s.substr(0, n / 2) == s.substr(n / 2))         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double n, l, v1, v2, k;   bool c(double x) {     int num;     if ((int)n % (int)k == 0)       num = n / k;     else       num = n / k + 1;     if (num * x + (num - 1) * x * (v2 - v1) / (v2 + v1) <= x + (l - x * v2) / v1)       return 1;     return 0;   }   int main() {     scanf( %lf%lf%lf%lf%lf , &n, &l, &v1, &v2, &k);     double lb = 0, rb = 1000000001;     for (int i = 0; i < 100; i++) {       double m = (lb + rb) / 2;       if (c(m))         lb = m;       else         rb = m;     }     printf( %lf , rb + (l - rb * v2) / v1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t, n, m, i, ans, a;   int main() {     cin >> t;     while (t--) {       cin >> n >> m;       ans = 0;       for (i = 1; i <= n; i++) {         cin >> a;         ans += a;       }       if (ans == m)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }   }