malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int a, b, c, x, y, z;     cin >> a >> b >> c >> x >> y >> z;     long long int a1, b1, c1;     a1 = a - x;     b1 = b - y;     c1 = c - z;     long long int pol = 0, otr = 0;     pol += max(a1 / 2, (long long)0) + max(b1 / 2, (long long)0) +            max(c1 / 2, (long long)0);     otr += min(a1, (long long)0) + min(b1, (long long)0) + min(c1, (long long)0);     if (pol + otr >= 0)       cout <<  Yes ;     else       cout <<  No ;     cin.get();     cin.get();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, M;   vector<vector<int> > G;   vector<long long> cnt;   vector<long long> dp;   int main(int argc, char const* argv[]) {     cin >> N >> M;     for (int i = 0; i < N; i++) {       G.push_back(vector<int>());       cnt.push_back(0);       dp.push_back(1);     }     for (int i = 0; i < M; i++) {       int u, v;       cin >> u >> v;       u--;       v--;       cnt[u]++;       cnt[v]++;       if (u >= v) {         swap(u, v);       }       G[u].push_back(v);     }     long long res = 0;     for (int i = 0; i < N; i++) {       const auto& es = G[i];       res = max(res, dp[i] * cnt[i]);       for (int j : es) {         dp[j] = max(dp[j], dp[i] + 1);       }     }     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c;     cin >> a >> b >> c;     int x, y, z;     cin >> x >> y >> z;     int a_rest = 0, a_sh = 0, b_rest = 0, b_sh = 0, c_sh = 0, c_rest = 0;     if (a > x) {       a_rest = a - x;       if (a_rest % 2 == 1) a_rest--;       a_sh = 0;     } else {       a_rest = 0;       a_sh = x - a;     }     if (b > y) {       b_rest = b - y;       if (b_rest % 2 == 1) b_rest--;       b_sh = 0;     } else {       b_rest = 0;       b_sh = y - b;     }     if (c > z) {       c_rest = c - z;       if (c_rest % 2 == 1) c_rest--;       c_sh = 0;     } else {       c_rest = 0;       c_sh = z - c;     }     int free_pair = (a_rest + b_rest + c_rest) / 2;     int need = a_sh + b_sh + c_sh;     if (free_pair >= need)       cout <<  Yes  << endl;     else       cout <<  No  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> v, v1;     for (int i = 0; i < n; i++) {       int t, y;       cin >> t >> y;       v.push_back(t);       v1.push_back(y);     }     sort(v.begin(), v.end());     sort(v1.begin(), v1.end());     long long ans = n;     for (int i = 0; i < n; i++) {       ans += max(v[i], v1[i]);     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 100009;   struct query {     long long a, b, op, s;   } q[N * 9], b[N * 9];   long long n, m, a[N], ans[N], cnt, cntq, tr[N];   set<long long> Set[N];   inline void add(long long x, long long c) {     while (x <= n) {       tr[x] += c, x += (x & -x);     }   }   inline long long ask(long long x) {     long long res = 0;     while (x) {       res += tr[x], x -= (x & -x);     }     return res;   }   inline bool cmp(query x, query y) {     if (x.op != y.op)       return x.op < y.op;     else if (x.op)       return x.a < y.a;     else       return x.b < y.b;   }   void cdq(long long l, long long r) {     if (l >= r) return;     long long mid = (l + r) >> 1;     cdq(l, mid), cdq(mid + 1, r);     long long p1 = l, p2 = mid + 1, Cnt = l;     for (long long i = mid + 1; i <= r; i++)       if (q[i].op) {         while (p1 <= mid && (q[p1].b <= q[i].b)) {           if (!q[p1].op) add(q[p1].a, (q[p1].s * (q[p1].b - q[p1].a)));           p1++;         }         ans[q[i].op] += ask(n) - ask(q[i].a - 1);       }     for (long long i = l; i < p1; i++)       if (!q[i].op) add(q[i].a, -(q[i].s * (q[i].b - q[i].a)));     for (long long k = l, i = l, j = mid + 1; k <= r; k++)       b[k] = (j > r || (i <= mid && q[i].b <= q[j].b)) ? q[i++] : q[j++];     for (long long i = l; i <= r; i++) q[i] = b[i];   }   signed main() {     scanf( %lld%lld , &n, &m);     for (long long i = 1; i <= n; i++) {       scanf( %lld , &a[i]);       Set[a[i]].insert(i);       if (Set[a[i]].size() != 1) q[++cnt] = {*(--Set[a[i]].rbegin()), i, 0, 1};     }     for (long long i = 1; i <= m; i++) {       long long op, b, c, l = 0, r = 0;       scanf( %lld%lld%lld , &op, &b, &c);       if (op == 2) {         q[++cnt] = {b, c, ++cntq, 0};       } else {         set<long long>::iterator i = Set[a[b]].find(b);         if (i != Set[a[b]].begin()) {           l = *--i;           q[++cnt] = {l, b, 0, -1};           i++;         }         if (++i != Set[a[b]].end()) {           r = *i;           q[++cnt] = {b, r, 0, -1};         }         if (l && r) q[++cnt] = {l, r, 0, 1};         Set[a[b]].erase(b);         Set[c].insert(b);         l = r = 0;         i = Set[c].find(b);         a[b] = c;         if (i != Set[c].begin()) {           l = *--i;           q[++cnt] = {l, b, 0, 1};           i++;         }         if (++i != Set[c].end()) {           r = *i;           q[++cnt] = {b, r, 0, 1};         }         if (l && r) q[++cnt] = {l, r, 0, -1};       }     }     cdq(1, cnt);     for (long long i = 1; i <= cntq; i++) printf( %lld n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int func(char c) {     if (c >=  a  && c <=  z ) {       return 1;     }     if (c >=  A  && c <=  Z ) {       return 2;     }     return 0;   }   void solve() {     string s;     cin >> s;     long long int lw = 0;     long long int up = 0;     long long int nm = 0;     string str = s;     long long int mp[3] = {0};     for (long long int i = 0; i < s.length(); i++) {       mp[func(s[i])]++;     }     long long int cn = 0;     for (long long int i = 0; i < 3; i++) {       if (!mp[i]) cn++;     }     if (!cn) {       cout << s << endl;       return;     }     if (cn == 1) {       for (long long int i = 0; i < s.length(); i++) {         if (mp[func(s[i])] > 1) {           long long int index = 0;           for (long long int id = 0; id < 3; id++) {             if (!mp[id]) index = id;           }           if (index == 0) {             s[i] =  0 ;             break;           } else if (index == 1) {             s[i] =  a ;             break;           } else {             s[i] =  A ;             break;           }         }       }       cout << s << endl;     } else {       long long int index;       for (long long int i = 0; i < 3; i++) {         if (mp[i]) {           index = i;           break;         }       }       if (index == 1) {         s[0] =  A ;         s[1] =  0 ;       } else if (index == 0) {         s[0] =  A ;         s[1] =  a ;       } else {         s[0] =  0 ;         s[1] =  a ;       }       cout << s << endl;     }   }   int main() {     long long int t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   vector<int> v;   int main() {     int n, k, l, r, sall, sk, i, res, ext, j, a, b;     while (scanf( %d %d %d %d %d %d , &n, &k, &l, &r, &sall, &sk) == 6) {       v.clear();       if (sk % k == 0) {         res = sk / k;         for (i = 0; i < k; i++) {           v.push_back(res);         }       } else {         res = sk / k;         ext = sk % k;         for (i = 0, j = 0; i < k; i++, j++) {           if (j < ext)             v.push_back(res + 1);           else             v.push_back(res);         }       }       a = sall - sk;       b = n - k;       if (b > 0) {         if (a % b == 0) {           res = a / b;           for (i = 0; i < b; i++) {             v.push_back(res);           }         } else {           res = a / b;           ext = a % b;           for (i = 0, j = 0; i < b; i++, j++) {             if (j < ext)               v.push_back(res + 1);             else               v.push_back(res);           }         }       }       for (i = 0; i < ((int)v.size()); i++) {         if (!i)           cout << v[i];         else           cout <<     << v[i];       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool pr[10000005] = {false};   vector<long long> prime;   void prim() {     pr[0] = true;     pr[1] = true;     for (long long i = 2; i <= sqrt(100005); i++) {       for (long long j = i * 2; j <= sqrt(100005); j += i) {         pr[j] = true;       }     }   }   vector<long long> divisor(long long n) {     vector<long long> div;     div.push_back(n);     for (long long i = 2; i * i <= n; i++) {       if (n % i == 0) {         div.push_back(i);         if (n / i != i) div.push_back(n / i);       }     }     sort(div.begin(), div.end());     return div;   }   long long modInverse(long long a, long long m) {     long long m0 = m;     long long y = 0, x = 1;     if (m == 1) return 0;     while (a > 1) {       long long q = a / m;       long long t = m;       m = a % m, a = t;       t = y;       y = x - q * y;       x = t;     }     if (x < 0) x += m0;     return x;   }   long long find(long long n) {     long long count = 0;     while (n) {       count++;       n = n / 2;     }     return count;   }   void solve() {     long long n;     cin >> n;     long long arr[n];     for (long long i = 0; i < (long long)n; i++) cin >> arr[i];     vector<vector<long long>> ans;     if (n % 2 == 0) {       long long ans1 = 0;       for (long long i = 0; i < n; i++) {         ans1 = ans1 ^ arr[i];       }       if (ans1 != 0) {         cout <<  NO n ;         return;       } else {         cout <<  YES n ;         for (long long i = 0; i < n - 2; i += 2) {           ans.push_back({i + 1, i + 2, i + 3});         }         for (long long i = 0; i < n - 2; i += 2) {           ans.push_back({i + 1, i + 2, n});         }         ans.push_back({n - 2, n - 1, n});         cout << ans.size() <<   n ;         for (long long i = 0; i < (long long)ans.size(); i++) {           cout << ans[i][0] <<     << ans[i][1] <<     << ans[i][2] <<   n ;         }         return;       }     }     cout <<  YES n ;     for (long long i = 0; i < n - 2; i += 2) {       ans.push_back({i + 1, i + 2, n});       arr[n] = arr[n] ^ arr[i + 1] ^ arr[i + 2];     }     for (long long i = 0; i < n - 2; i += 2) {       ans.push_back({i + 1, i + 2, n});     }     cout << ans.size() <<   n ;     for (long long i = 0; i < (long long)ans.size(); i++) {       cout << ans[i][0] <<     << ans[i][1] <<     << ans[i][2] <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     prim();     for (long long i = 2; i <= 100005; i++) {       if (pr[i] == false) {         prime.push_back(i);       }     }     long long t;     t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n;     string s;     cin >> s;     n = s.size();     int z = 0, o = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  1 )         o++;       else         z++;     }     if (min(o, z) & 1) {       cout <<  DA n ;     } else {       cout <<  NET n ;     }   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s1, s2;     getline(cin, s1);     getline(cin, s2);     int a;     for (int i = 0; i < s2.size(); i++) {       if (s2[i] ==    ) continue;       a = 0;       for (int j = 0; j < s1.size(); j++)         if (s1[j] ==    )           continue;         else if (s1[j] == s2[i]) {           a = 1;           s1.erase(j, 1);           break;         }       if (!a) {         cout <<  NO ;         break;       }     }     if (a) cout <<  YES ;   }
#include <bits/stdc++.h>   int x[30];   template <class T>   inline void read(T &num) {     num = 0;     char c = getchar();     T sign = 1;     while (c <  0  || c >  9 ) {       if (c ==  - ) sign = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       num = (num << 1) + (num << 3) + (c ^ 48);       c = getchar();     }     num *= sign;   }   int main() {     int t, a;     read(t);     while (t--) {       read(a);       int tag = a, cnt = 0, ok = 0, ans = 0;       while (tag) {         x[++cnt] = tag & 1;         if (!x[cnt]) ok = 1;         tag >>= 1;       }       if (ok) {         for (register int i = cnt; i; --i) {           ans <<= 1;           if (!x[i]) ++ans;         }         printf( %d n , ans ^ a);       } else {         for (register int i = 2; i * i <= a; ++i)           if (a % i == 0) {             printf( %d n , a / i);             ok = 1;             break;           }         if (!ok) puts( 1 );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)1e9;   const int N = 155;   int old[N][N * N];   int now[N][N * N];   int q[N];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(nullptr);     int n, k, s;     cin >> n >> k >> s;     for (int i = 0; i < n; i++) cin >> q[i];     for (int i = 0; i < N; i++)       for (int j = 0; j < N * N / 2; j++) old[i][j] = INF;     old[0][0] = 0;     for (int pos = 0; pos < n; pos++) {       for (int i = 0; i < N; i++)         for (int j = 0; j < N * N / 2; j++) now[i][j] = INF;       for (int taken = 0; taken <= k; taken++) {         for (int swaps = 0; swaps <= N * N / 2; swaps++) {           now[taken][swaps] = min(now[taken][swaps], old[taken][swaps]);           if (taken <= pos)             now[taken + 1][swaps + pos - taken] = min(                 now[taken + 1][swaps + pos - taken], old[taken][swaps] + q[pos]);         }       }       for (int i = 0; i < N; i++)         for (int j = 0; j < N * N / 2; j++) old[i][j] = now[i][j];     }     int res = INF;     for (int swaps = 0; swaps <= min(N * N / 2 - 1, s); swaps++)       res = min(res, now[k][swaps]);     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<vector<int> > g;   vector<int> col;   int n, m;   void dfs(int v) {     int cnt = 0;     for (size_t i = 0; i < g[v].size(); i++)       if (col[g[v][i]] == col[v]) cnt++;     if (cnt > 1) {       col[v] ^= 1;       for (size_t i = 0; i < g[v].size(); i++)         if (col[g[v][i]] == col[v]) dfs(g[v][i]);     }   }   int main() {     ios_base ::sync_with_stdio(false);     cin >> n >> m;     int x, y;     g.resize(n);     col.resize(n, 0);     for (int i = 0; i < m; i++) {       cin >> x >> y;       x--, y--;       g[x].push_back(y);       g[y].push_back(x);     }     for (int i = 0; i < n; i++) {       dfs(i);     }     for (int i = 0; i < n; i++) cout << col[i];     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cnt0, cnt1, timer;   void dfs(int v, vector<int> &colour, vector<int> &comp,            vector<vector<pair<int, int>>> &g) {     if (colour[v] == 0)       cnt0++;     else       cnt1++;     comp[v] = timer;     for (auto &now : g[v])       if (colour[now.first] == -1) {         colour[now.first] = (colour[v] ^ now.second);         dfs(now.first, colour, comp, g);       }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       timer = 0;       int n;       cin >> n;       vector<int> a(n), b(n);       for (int i = 0; i < n; i++) {         cin >> a[i];         a[i]--;       }       for (int i = 0; i < n; i++) {         cin >> b[i];         b[i]--;       }       vector<int> cnt(n);       for (int i = 0; i < n; i++) cnt[a[i]]++, cnt[b[i]]++;       bool tf = true;       for (int i = 0; i < n; i++)         if (cnt[i] != 2) tf = false;       if (!tf) {         cout << -1 <<   n ;         continue;       }       vector<int> pos1(n, -1), pos2(n, -1);       for (int i = 0; i < n; i++) {         if (pos1[a[i]] == -1)           pos1[a[i]] = i;         else           pos2[a[i]] = i;       }       for (int i = 0; i < n; i++) {         if (pos1[b[i]] == -1)           pos1[b[i]] = i;         else           pos2[b[i]] = i;       }       vector<vector<pair<int, int>>> g(n);       for (int i = 0; i < n; i++) {         if (pos1[i] == pos2[i]) continue;         int ina_1 = (a[pos1[i]] != i), ina_2 = (a[pos2[i]] != i);         g[pos1[i]].push_back({pos2[i], ina_1 == ina_2});         g[pos2[i]].push_back({pos1[i], ina_1 == ina_2});       }       vector<int> colour(n, -1), comp(n, -1);       int ans = 0;       vector<bool> arr;       for (int i = 0; i < n; i++)         if (colour[i] == -1) {           cnt0 = cnt1 = 0;           colour[i] = 0;           dfs(i, colour, comp, g);           timer++;           ans += min(cnt0, cnt1);           arr.push_back((bool)(cnt0 < cnt1));         }       for (int i = 0; i < n; i++)         for (auto &now : g[i])           if (colour[i] != (colour[now.first] ^ now.second)) tf = false;       if (!tf) {         cout << -1 <<   n ;         continue;       }       cout << ans <<   n ;       for (int i = 0; i < n; i++)         if (arr[comp[i]] ^ colour[i]) cout << i + 1 <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   using VV = vector<vector<T>>;   template <class T>   inline T SMIN(T& a, const T b) {     return a = (a > b) ? b : a;   }   template <class T>   inline T SMAX(T& a, const T b) {     return a = (a < b) ? b : a;   }   template <class Iter>   void __kumaerrc(Iter begin, Iter end) {     for (; begin != end; ++begin) {       cerr << *begin <<  , ;     }     cerr << endl;   }   void __kumaerr(istream_iterator<string> it) {     (void)it;     cerr << endl;   }   template <typename T, typename... Args>   void __kumaerr(istream_iterator<string> it, T a, Args... args) {     cerr << *it <<  =  << a <<  ,  , __kumaerr(++it, args...);   }   template <typename S, typename T>   std::ostream& operator<<(std::ostream& _os, const std::pair<S, T>& _p) {     return _os <<  {  << _p.first <<  ,  << _p.second <<  } ;   }   const int MAX_N = 1e6 + 1;   long long A[MAX_N];   int N;   long long f(vector<long long> bs) {     int N = int((bs).size());     long long cur = 0, mn = 0, res = 0;     for (int i = 0; i < (N); ++i) {       cur += bs[i];       SMAX(res, cur - mn);       SMIN(mn, cur);     }     return res;   }   void solve() {     long long base = 0;     for (int i = 0; i < (N); ++i)       if (i % 2 == 0) base += A[i];     vector<long long> bs;     for (int i = 0; i < (N / 2); ++i) bs.push_back(A[2 * i + 1] - A[2 * i]);     long long res = base;     SMAX(res, base + f(bs));     bs.clear();     for (int i = (1); i <= ((N - 1) / 2); ++i)       bs.push_back(A[2 * i - 1] - A[2 * i]);     SMAX(res, base + f(bs));     cout << res << endl;   }   const long long Inf = 1e18;   long long dp[MAX_N][4];   void solve_dp() {     for (int i = 0; i <= (N); ++i)       for (int j = 0; j < (4); ++j) dp[i][j] = -Inf;     dp[0][0] = dp[0][2] = dp[0][3] = 0;     for (int i = 0; i < (N); ++i)       for (int j = 0; j < (4); ++j) {         if (j == 0) {           if (i % 2 == 0) {             SMAX(dp[i + 1][j], dp[i][j] + A[i]);             SMAX(dp[i + 1][1], dp[i][j] + A[i]);           } else {             SMAX(dp[i + 1][j], dp[i][j]);             SMAX(dp[i + 1][2], dp[i][j]);           }         }         if (j == 1 || j == 2) {           if (i % 2 == 0) {             SMAX(dp[i + 1][j], dp[i][j]);             if (j == 1) SMAX(dp[i + 1][3], dp[i][j]);           } else {             SMAX(dp[i + 1][j], dp[i][j] + A[i]);             if (j == 2) SMAX(dp[i + 1][3], dp[i][j] + A[i]);           }         }         if (j == 3) {           if (i % 2 == 0) {             SMAX(dp[i + 1][j], dp[i][j] + A[i]);           } else {             SMAX(dp[i + 1][j], dp[i][j]);           }         }       }     long long res = 0;     if (N % 2 == 0) dp[N][1] = -Inf;     for (int j = 0; j < (4); ++j) {       SMAX(res, dp[N][j]);     }     cout << res << endl;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout << setprecision(12) << fixed;     int t;     cin >> t;     while (t--) {       cin >> N;       for (int i = 0; i < (N); ++i) cin >> A[i];       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }   long long n, k;   vector<long long int> v[50005];   long long ans;   vector<long long int> dfs(long long node, long long par) {     vector<long long int> temp(k + 1);     temp[0] = 1;     for (auto i : v[node]) {       if (i != par) {         vector<long long int> cc = dfs(i, node);         for (long long i = 0; i <= k; i++) ans += cc[i] * temp[k - i];         for (long long i = 0; i <= k; i++) temp[i] += cc[i];       }     }     for (long long i = k; i >= 1; i--) temp[i] = temp[i - 1];     temp[0] = 0;     return temp;   }   void solve() {     cin >> n >> k;     for (long long i = 1; i <= n - 1; i++) {       long long x, y;       cin >> x >> y;       v[x].push_back(y);       v[y].push_back(x);     }     ans = 0;     dfs(1, -1);     cout << ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int TESTS = 1;     while (TESTS--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Mod = 1e9 + 9;   int Pow(int x, int e) {     int ret = 1;     while (e) {       if (e & 1) ret = 1ll * ret * x % Mod;       x = 1ll * x * x % Mod;       e >>= 1;     }     return ret;   }   const int N = 1e5 + 10;   char S[N];   int main() {     int n, a, b, k;     scanf( %d%d%d%d%s , &n, &a, &b, &k, S);     int ia = Pow(a, Mod - 2);     int coe = Pow(a, n), ans = 0;     for (int i = 0; i <= k - 1; i++) {       ans = (ans + 1ll * (S[i] ==  +  ? 1 : Mod - 1) * coe) % Mod;       coe = 1ll * coe * ia % Mod * b % Mod;     }     int p = 1ll * Pow(ia, k) * Pow(b, k) % Mod;     if (p == 1)       ans = 1ll * ans * ((n + 1) / k) % Mod;     else       ans =           1ll * ans * (Pow(p, (n + 1) / k) - 1) % Mod * Pow(p - 1, Mod - 2) % Mod;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n, su = 0;     cin >> n;     vector<long long> a(n);     for (long long i = 0; i < n; ++i) {       cin >> a[i];       su += a[i];     }     if (su % 2) {       cout <<  NO n ;       return;     }     long long s = 0, ind = -1;     for (long long i = 0; i < n; ++i) {       if (!a[i] && s % 2 == 0) {         ind = i;         break;       }       s += a[i];     }     vector<long long> ans;     if (ind == -1) {       for (long long i = n - 2; i > 0; i -= 2) {         if (a[i - 1] && a[i]) continue;         ans.push_back(i);         a[i] = 1;         if (a[i - 1]) {           ind = i - 1;           a[i - 1] = a[i] = a[i + 1] = 0;           break;         }         a[i - 1] = 1;       }       if (ind == -1) {         cout <<  NO n ;         return;       }     }     for (long long i = ind - 1; i >= 0; --i) {       if (a[i]) {         if (a[i - 1]) {           ans.push_back(i);           a[i - 1] = a[i] = 0;         } else {           if (a[i - 2]) {             ans.push_back(i - 1);             a[i - 2] = a[i] = 0;           } else {             ans.push_back(i - 1);             ans.push_back(i);             a[i - 2] = 1;             a[i] = 0;           }         }       }     }     for (long long i = ind + 1; i < n; ++i) {       if (a[i]) {         if (a[i + 1]) {           ans.push_back(i);           a[i + 1] = a[i] = 0;         } else {           if (a[i + 2]) {             ans.push_back(i + 1);             a[i + 2] = a[i] = 0;           } else {             ans.push_back(i + 1);             ans.push_back(i);             a[i + 2] = 1;             a[i] = 0;           }         }       }     }     cout <<  YES n  << ans.size() <<   n ;     for (long long i = 0; i < ans.size(); ++i) {       cout << ans[i] <<    ;     }     cout <<   n ;   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(nullptr), cout.tie(nullptr);     long long t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   int main() {     int vladik, valera;     std::cin >> vladik >> valera;     int vladik_rounds = sqrt(vladik);     int valera_rounds = valera > vladik_rounds ? sqrt(valera - vladik_rounds) : 0;     if (valera_rounds >= vladik_rounds) {       std::cout <<  Vladik n ;     } else {       std::cout <<  Valera n ;     }     return 0;   }