malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)1e9;   const int maxn = 100010;   const int maxbit = 18;   const int sz = 1500;   inline int read() {     int x = 0, f = 1;     char ch = 0;     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) f = -1;     for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;     return x * f;   }   struct node {     int l, r, tid, ans, id;     node() {}     node(int _l, int _r, int _tid, int _ans, int _id) {       l = _l;       r = _r;       tid = _tid;       ans = _ans;       id = _id;     }   } que[maxn];   struct node2 {     int p, fr, to;     node2() {}     node2(int _p, int _fr, int _to) {       p = _p;       fr = _fr;       to = _to;     }   } cz[maxn];   vector<int> oo;   inline int bl(int x) { return (x - 1) / sz; }   bool cmp(node x, node y) {     if (bl(x.l) != bl(y.l))       return x.l < y.l;     else if (bl(x.r) != bl(y.r))       return x.r < y.r;     else       return x.tid < y.tid;   }   bool cmp2(node x, node y) { return x.id < y.id; }   int n, q, cntz, cntq;   int a[maxn], fl[maxn], Now, L, R, cnt[maxn << 2];   inline void add(int x) {     --fl[cnt[x]];     ++fl[++cnt[x]];   }   inline void del(int x) {     --fl[cnt[x]];     ++fl[--cnt[x]];   }   inline void go(node2 &t) {     if (t.p >= L && t.p <= R) del(t.fr), add(t.to);     a[t.p] = t.to;   }   inline void re(node2 &t) {     if (t.p >= L && t.p <= R) del(t.to), add(t.fr);     a[t.p] = t.fr;   }   int main() {     fl[0] = INF;     n = read();     q = read();     for (int i = 1; i <= n; ++i) a[i] = read(), oo.push_back(a[i]);     for (int i = 1; i <= q; ++i) {       int t = read();       if (t == 1) {         int l = read(), r = read();         que[++cntq] = node(l, r, Now, 0, i);       } else {         int p = read(), x = read();         oo.push_back(x);         cz[++cntz] = node2(p, a[p], x);         a[p] = x;         ++Now;       }     }     sort(oo.begin(), oo.end());     int ss = unique(oo.begin(), oo.end()) - oo.begin();     oo.resize(ss);     for (int i = 1; i <= n; ++i)       a[i] = lower_bound(oo.begin(), oo.end(), a[i]) - oo.begin() + 1;     for (int i = 1; i <= cntz; ++i) {       cz[i].fr = lower_bound(oo.begin(), oo.end(), cz[i].fr) - oo.begin() + 1;       cz[i].to = lower_bound(oo.begin(), oo.end(), cz[i].to) - oo.begin() + 1;     }     sort(que + 1, que + cntq + 1, cmp);     for (int i = 1; i <= cntq; ++i) {       node now = que[i];       while (R < now.r) add(a[++R]);       while (L > now.l) add(a[--L]);       while (R > now.r) del(a[R--]);       while (L < now.l) del(a[L++]);       while (Now < now.tid) go(cz[++Now]);       while (Now > now.tid) re(cz[Now--]);       while (fl[que[i].ans]) ++que[i].ans;     }     sort(que + 1, que + cntq + 1, cmp2);     for (int i = 1; i <= cntq; ++i) printf( %d n , que[i].ans);   }
#include <bits/stdc++.h>   using namespace std;   vector<int> myvec[100001];   set<int> myset[2];   set<int>::iterator it;   int mark[100001];   bool isbipartite(int src) {     int color[100001];     memset(color, -1, sizeof(color));     queue<int> q;     q.push(src);     mark[src] = 1;     color[src] = 1;     myset[color[src]].insert(src);     while (!q.empty()) {       int u = q.front();       q.pop();       for (int v = 0; v < myvec[u].size(); v++) {         if (color[myvec[u][v]] == -1)           color[myvec[u][v]] = 1 - color[u], q.push(myvec[u][v]),           myset[color[myvec[u][v]]].insert(myvec[u][v]), mark[myvec[u][v]] = 1;         else if (color[myvec[u][v]] == color[u])           return false;       }     }     return true;   }   int main() {     long long int x, y;     int a, b;     cin >> a >> b;     while (b--) {       cin >> x >> y;       myvec[x].push_back(y);       myvec[y].push_back(x);     }     bool solve = true;     for (int i = 1; i <= a; i++) {       if (mark[i] == 0) {         solve = (solve && isbipartite(i));       }     }     if (solve == true) {       cout << myset[0].size() << endl;       for (it = myset[0].begin(); it != myset[0].end(); it++) {         cout << *it <<    ;       }       cout << endl;       cout << myset[1].size() << endl;       for (it = myset[1].begin(); it != myset[1].end(); it++) {         cout << *it <<    ;       }       cout << endl;     } else       cout <<  -1  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int timeTook[50010][10];   int timeSpent[50010];   int main() {     int numOfPictures, numOfPainters;     scanf( %d %d , &numOfPictures, &numOfPainters);     for (int i = 0; i < numOfPictures; i++) {       for (int j = 0; j < numOfPainters; j++) {         scanf( %d , &timeTook[i][j]);       }     }     for (int i = 0; i < numOfPictures; i++) timeSpent[i] = 0;     for (int painter = 0; painter < numOfPainters - 1; painter++) {       int curTime = 0;       for (int i = 0; i < numOfPictures; i++) {         if (curTime >= timeSpent[i]) {           timeSpent[i] += (curTime - timeSpent[i]) + timeTook[i][painter];           curTime += timeTook[i][painter];         } else {           int waitTime = timeSpent[i] - curTime;           timeSpent[i] += timeTook[i][painter];           curTime += waitTime + timeTook[i][painter];         }       }     }     int curTime = 0;     for (int i = 0; i < numOfPictures; i++) {       if (curTime >= timeSpent[i]) {         curTime += timeTook[i][numOfPainters - 1];       } else {         int waitTime = timeSpent[i] - curTime;         curTime += waitTime + timeTook[i][numOfPainters - 1];       }       printf( %d  , curTime);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   string s;   int a[maxn], tot, n;   int main() {     while (cin >> n) {       memset(a, 0, sizeof a);       tot = 0;       cin >> s;       string temp = s;       if (n == 1) {         puts( 0 );         continue;       }       for (int i = n - 1; i >= 1; i--) {         if (s[i] ==  B )           s[i] =  W , s[i - 1] = (s[i - 1] ==  B  ?  W  :  B ), a[++tot] = i - 1;       }       if (s[0] ==  B ) {         tot = 0;         s = temp;         for (int i = n - 1; i >= 1; i--) {           if (s[i] ==  W )             s[i] =  B , s[i - 1] = (s[i - 1] ==  B  ?  W  :  B ),             a[++tot] = i - 1;         }         if (s[0] ==  W )           puts( -1 );         else {           cout << tot << endl;           for (int i = 1; i <= tot; i++) cout << a[i] + 1 <<    ;           cout << endl;         }       } else {         cout << tot << endl;         for (int i = 1; i <= tot; i++) cout << a[i] + 1 <<    ;         cout << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a = 0, b = 0, c = 0, d = 0, n, temp, dl;     cin >> n;     for (int i = 0; i <= n; i++) {       if (i < n) {         cin >> temp;       } else {         temp = max(a, d) + 1;       }       dl = temp - a;       if (dl != 1 && dl != -1) {         if (!b) {           b = i + 1;           d = temp;         } else if (!c) {           c = i;         } else {           b = 0;           c = 0;           break;         }       } else if (!c && b) {         if (dl != -1) {           b = 0;           c = 0;           break;         }       }       a = temp;     }     cout << b <<     << c;   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, T, q, w, e, d[100001], v[100001], t[100001], B = 130;   int main() {     scanf( %lld%lld , &a, &b);     for (int i = 1; i <= a; i++) scanf( %lld , &d[i]), v[d[i]] = i, t[i] = i;     for (int i = 1; i <= a; i++)       for (int j = 1; j <= B; j++) t[i] = d[t[i]];     for (int ii = 1; ii <= b; ii++) {       scanf( %lld%lld%lld , &q, &w, &e);       if (q == 1) {         swap(d[w], d[e]);         swap(v[d[w]], v[d[e]]);         long long tt = e, yy = e;         for (int i = 1; i <= B; i++) yy = d[yy];         for (int i = 1; i <= B + 1; i++) t[tt] = yy, tt = v[tt], yy = v[yy];         tt = w, yy = w;         for (int i = 1; i <= B; i++) yy = d[yy];         for (int i = 1; i <= B + 1; i++) t[tt] = yy, tt = v[tt], yy = v[yy];       } else {         long long ff = w;         for (int i = 1; i <= e / B; i++) ff = t[ff];         e %= B;         for (int i = 1; i <= e; i++) ff = d[ff];         printf( %lld n , ff);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, t, s;   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cin >> n >> k;     if (n < 3 * k) return cout << -1, 0;     for (int i = 0; i < n; i++)       if (i / k % 2 == 1)         cout << (1 + i) % k + 1 <<    ;       else         cout << i % k + 1 <<    ;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T1, typename T2>   istream& operator>>(istream& in, pair<T1, T2>& a) {     in >> a.first >> a.second;     return in;   }   template <typename T1, typename T2>   ostream& operator<<(ostream& out, pair<T1, T2> a) {     out << a.first <<     << a.second;     return out;   }   template <typename T, typename T1>   T amax(T& a, T1 b) {     if (b > a) a = b;     return a;   }   template <typename T, typename T1>   T amin(T& a, T1 b) {     if (b < a) a = b;     return a;   }   const long long fx[] = {+1, -1, +0, +0};   const long long fy[] = {+0, +0, +1, -1};   const int32_t M = 1e9 + 7;   const int32_t MM = 998244353;   long long xo, yo, ax, ay, bx, by, xs, ys, t;   void solve() {     cin >> xo >> yo >> ax >> ay >> bx >> by;     cin >> xs >> ys >> t;     vector<long long> x(1, xo), y(1, yo);     long long LIMIT = (1LL << 62) - 1;     while ((LIMIT - bx) / ax >= x.back() && (LIMIT - by) / ay >= y.back()) {       x.push_back(ax * x.back() + bx);       y.push_back(ay * y.back() + by);     }     long long n = x.size();     long long ans = 0;     for (long long i = 0; i < n; i++) {       for (long long j = i; j < n; j++) {         long long length = x[j] - x[i] + y[j] - y[i];         long long dist2Left = abs(xs - x[i]) + abs(ys - y[i]);         long long dist2Right = abs(xs - x[j]) + abs(ys - y[j]);         if (length <= t - dist2Left || length <= t - dist2Right)           ans = max(ans, j - i + 1);       }     }     cout << ans <<   n ;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   #define For(i, a, b) for (int i = (a), _##i = (b); i < _##i; ++i)   #define FOR(i, a, b) for (int i = (a), _##i = (b); i <= _##i; ++i)   #define Forr(i, a, b) for (int i = (a), _##i = (b); i > _##i; --i)   #define FORR(i, a, b) for (int i = (a), _##i = (b); i >= _##i; --i)   #define all(a) a.begin(), a.end()   #define range(i, a) for (auto& i : a)   #define RANGE(i, a) for (auto i = a.rbegin(); i != a.rend(); ++i)   #define SINGLE   using ll = long long;   using pii = std::pair<int, int>;   using pdd = std::pair<double, double>;      namespace Solver {     const int N = (1 << 18) + 5;     std::string opt;     int res[N << 1];     int n, cnt;     void update(int p, char c) {       if (opt[p] == c)         return;       opt[p] = c;       // if (c ==  ? )       //   res[p] = res[p << 1] + res[p << 1 | 1];       while (p) {         if (opt[p] ==  ? )           res[p] = res[p << 1] + res[p << 1 | 1];         else if (opt[p] ==  1 )           res[p] = res[p << 1];         else           res[p] = res[p << 1 | 1];         p >>= 1;       }     }     void build(int u) {       if ((u << 1) <= cnt)         build(u << 1);       if ((u << 1 | 1) <= cnt)         build(u << 1 | 1);       if (opt[u] ==  ? )         res[u] = res[u << 1] + res[u << 1 | 1];       else if (opt[u] ==  1 )         res[u] = res[u << 1];       else         res[u] = res[u << 1 | 1];     }     void main() {       std::cin >> n;       std::string temp;       std::cin >> temp;       std::fill(res, res + (N << 1) - 1, 1);       cnt = (1 << n) - 1;       opt =    ;       RANGE (i, temp)         opt.push_back(*i);       build(1);       int T;       for (std::cin >> T; T--;) {         int p;         char c;         std::cin >> p >> c;         update(cnt - p + 1, c);         std::cout << res[1] << std::endl;       }     }   }      int main() {     std::ios::sync_with_stdio(false);     std::cin.tie(0);     #ifndef SINGLE     int T;     for (std::cin >> T; T--;)     #endif       Solver::main();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ag[9][2], cg[9][2];   int main() {     int n, m, k, s, t, t2, ans = 0;     scanf( %d %d %d %d , &n, &m, &k, &s);     memset(cg, 0x3f3f3f3f, sizeof(cg));     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         scanf( %d , &t);         ag[t - 1][0] = max(ag[t - 1][0], i + 1 + j + 1);         cg[t - 1][0] = min(cg[t - 1][0], i + 1 + j + 1);         ag[t - 1][1] = max(ag[t - 1][1], i - j);         cg[t - 1][1] = min(cg[t - 1][1], i - j);       }     scanf( %d , &t);     for (int i = 1; i < s; i++) {       scanf( %d , &t2);       ans = max(ans, ag[t - 1][0] - cg[t2 - 1][0]);       ans = max(ans, ag[t2 - 1][0] - cg[t - 1][0]);       ans = max(ans, ag[t - 1][1] - cg[t2 - 1][1]);       ans = max(ans, ag[t2 - 1][1] - cg[t - 1][1]);       t = t2;     }     printf( %d n , ans);     return 0;   }
#include<iostream>   #include<vector>   #include<queue>   #include<cstring>   #include<cmath>   #include<map>   #include<set>   #include<cstdio>   #include<algorithm>   #define debug(a) cout<<#a<< = <<a<<endl;   using namespace std;   const int maxn=1e3+100;   typedef long long LL;   LL a[maxn];   int main(void)   {     cin.tie(0);std::ios::sync_with_stdio(false);     LL n;cin>>n;     if(n==1){       cout<<4<<endl;     }     else{          if(n&1) cout<<(1+ ( (3*n*(n+4)+2)+ ( (n+4)*n+2 )   )/8 )<<endl;       else cout<<(1+ ( (3*n*(n+4)+2)- ( (n+4)*n+2 )   )/8 )<<endl;     }   return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char const *argv[]) {     long long int n;     cin >> n;     if (n == 1 || n == 2) {       cout << n << endl;       return 0;     }     if (n % 2 == 1) {       cout << (n * (n - 1) * (n - 2)) << endl;       return 0;     }     if (n == 4 || n == 6) {       cout << ((n * (n - 1) * (n - 2)) / 2) << endl;       return 0;     }     if (n % 3 == 0) {       cout << ((n - 1) * (n - 2) * (n - 3)) << endl;       return 0;     }     cout << (n * (n - 1) * (n - 3)) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, t, z;   bool dfs(long long x, long long y) {     if (x < y) swap(x, y);     if (!y) return 0;     if (!dfs(y, x % y)) return 1;     z = x / y;     if (y & 1) return (z & 1) ^ 1;     return z % (y + 1) & 1 ^ 1;   }   signed main() {     scanf( %lld , &t);     while (t--) {       scanf( %lld%lld , &a, &b);       if (dfs(a, b))         printf( First n );       else         printf( Second n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     cin.tie(0);     cin.sync_with_stdio(0);     cout.tie(0);     string s, t, b;     int n;     vector<pair<char, char>> v;     set<char> z;     bool fine = false;     char a[26];     for (int i = 0; i < 26; i++) a[i] =  @ ;     cin >> s >> t;     for (int i = 0; i < s.length(); i++)       if (a[s[i] -  a ] ==  @ )         a[s[i] -  a ] = t[i];       else if (a[s[i] -  a ] != t[i]) {         cout << -1;         return 0;       }     for (int i = 0; i < 26; i++)       if (a[i] !=  @ ) {         if (((char)(i +  a ) != a[a[i] -  a ]) && ( @  != a[a[i] -  a ])) {           cout << -1;           return 0;         }       }     for (int i = 0; i < 26; i++)       if ((a[i] != (char)( a  + i)) && (a[i] !=  @ )) {         fine = false;         for (int j = 0; j < v.size(); j++)           if ((v[j].first == a[i]) && (v[j].second == (char)( a  + i)))             fine = true;         if (fine == false) v.push_back(make_pair((char)( a  + i), a[i]));       }     for (int i = 0; i < v.size(); i++) z.insert(v[i].second);     if (z.size() != v.size()) {       cout << -1;       return 0;     }     cout << v.size() << endl;     for (int i = 0; i < v.size(); i++)       cout << v[i].first <<     << v[i].second << endl;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC diagnostic ignored  -Wunused-result    #pragma GCC diagnostic ignored  -Wsign-compare    using namespace std;   void solve();   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int test_case = 1;     cin >> test_case;     while (test_case--) {       solve();     }     cerr <<  time taken :   << (float)clock() / CLOCKS_PER_SEC <<   secs  << endl;     return 0;   }   void solve() {     int n, m, t;     vector<int> arr;     bool odd = false;     bool zero = false;     cin >> n >> m;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> t;         if (t == 0) {           zero = true;         }         if (t < 0) {           odd = !odd;           arr.push_back(-t);         } else {           arr.push_back(t);         }       }     }     sort(arr.begin(), arr.end());     int sum = 0;     for (int i = 0; i < arr.size(); i++) {       sum += arr[i];     }     if (zero) {       cout << sum << endl;     } else {       if (odd) {         sum -= 2 * arr[0];         cout << sum << endl;       } else {         cout << sum << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200002;   int n, x1, x2, p[N];   pair<int, int> a[N];   int i1, i2;   bool solve() {     i1 = i2 = -1;     for (int i = n; i >= 1; --i) {       if (a[i].first * (n - i + 1) >= x1) {         i1 = i;         break;       }     }     for (int i = i1 - 1; i >= 1; --i) {       if (a[i].first * (i1 - i) >= x2) {         i2 = i;         break;       }     }     return i1 != -1 && i2 != -1;   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> x1 >> x2;     for (int i = 1; i <= n; ++i) {       cin >> a[i].first;       a[i].second = i;     }     sort(a + 1, a + 1 + n);     if (solve()) {       cout <<  Yes  << endl;       cout << (n - i1 + 1) <<     << (i1 - i2) << endl;       for (int i = i1; i <= n; ++i) cout << a[i].second <<    ;       cout << endl;       for (int i = i2; i < i1; ++i) cout << a[i].second <<    ;       cout << endl;       return 0;     }     swap(x1, x2);     if (solve()) {       cout <<  Yes  << endl;       cout << (i1 - i2) <<     << (n - i1 + 1) << endl;       for (int i = i2; i < i1; ++i) cout << a[i].second <<    ;       cout << endl;       for (int i = i1; i <= n; ++i) cout << a[i].second <<    ;       cout << endl;       return 0;     }     cout <<  No ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1E5 + 9;   vector<int> g[N];   int tin[N];   int tout[N];   int sz[N];   int tt;   int toys[N];   bool root[N];   void dfs(int v) {     tin[v] = tt++;     sz[v] = 1;     for (auto i : g[v]) {       dfs(i);       sz[v] += sz[i];     }     tout[v] = tt++;   }   bool parent(int v, int p) { return (tin[v] > tin[p] && tout[v] < tout[p]); }   int main() {     int n, m, k, q;     cin >> n >> m >> k >> q;     for (int i = 1; i <= n; i++) root[i] = true;     for (int i = 1; i <= k; i++) {       int v, t;       cin >> v >> t;       if (toys[t] == 0) {         toys[t] = v;         continue;       }       g[toys[t]].push_back(v);       root[v] = false;       toys[t] = v;     }     for (int i = 1; i <= n; i++)       if (root[i]) dfs(i);     for (int i = 1; i <= q; i++) {       int v, t;       cin >> v >> t;       if (toys[t] == 0) {         cout << 0 << endl;         continue;       }       if (parent(toys[t], v)) {         cout << sz[v] << endl;         continue;       }       cout << 0 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int sum, a, b, c, ans = 0;     cin >> sum >> a >> b >> c;     for (int i = 0; i <= a; i += 2)       for (int j = 0; j <= c; ++j)         if (sum - i / 2 - 2 * j <= b && sum - i / 2 - 2 * j >= 0) ans++;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int z = 1000000007;   int main() {     int n;     cin >> n;     if (n % 3 == 0)       cout <<  1             <<   1   << (n - 2);     else if (n % 3 == 1)       cout <<  1             <<   1   << (n - 2);     else       cout <<  1             <<   2   << (n - 3);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 128;   struct Matrix {     double a[N][N];     Matrix() {       for (int i = 0; i < N; i++)         for (int j = 0; j < N; j++) a[i][j] = (i == j ? 1 : 0);     }     Matrix operator*(const Matrix &A) const {       Matrix R = Matrix();       for (int i = 0; i < N; i++)         for (int j = 0; j < N; j++) {           R.a[i][j] = 0;           for (int h = 0; h < N; h++) R.a[i][j] += a[i][h] * A.a[h][j];         }       return R;     }   };   Matrix bin_pow(Matrix A, int p) {     if (p == 0) return Matrix();     if (p == 2 || (p & 1)) return A * bin_pow(A, p - 1);     return bin_pow(bin_pow(A, p / 2), 2);   }   double p[N];   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 0; i <= m; i++) scanf( %lf , &p[i]);     Matrix A = Matrix();     for (int i = 0; i < N; i++)       for (int j = 0; j < N; j++) A.a[i][j] = p[i ^ j];     A = bin_pow(A, n);     printf( %.13lf n , 1 - A.a[0][0]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, b, p, f, h, c;     cin >> t;     vector<int> arr(t);     for (int i = 0; i < t; ++i) {       cin >> b >> p >> f;       cin >> h >> c;       if (h > c) {         while (b >= 2 && p > 0) {           arr[i] = arr[i] + h;           b = b - 2;           p--;         }         while (b >= 2 && f > 0) {           arr[i] = arr[i] + c;           b = b - 2;           f--;         }       } else {         while (b >= 2 && f > 0) {           arr[i] = arr[i] + c;           b = b - 2;           f--;         }         while (b >= 2 && p > 0) {           arr[i] = arr[i] + h;           b = b - 2;           p--;         }       }     }     for (int i = 0; i < t; ++i) {       cout << arr[i] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int A[2222][2];   int main() {     int n, k, x, a, c, s, i;     bool j;     scanf( %d%d%d , &n, &k, &x);     for (i = 0; i < n; i++) {       scanf( %d , &a);       A[a][0]++;     }     for (j = 0; k--; j = !j) {       for (i = s = 0; i <= 2047; i++) {         c = (s + A[i][j] + 1) / 2 - (s + 1) / 2;         A[i][!j] += A[i][j] - c;         A[i ^ x][!j] += c;         s += A[i][j];         A[i][j] = 0;       }     }     for (i = 2047; i >= 0; i--) {       if (A[i][j]) {         printf( %d  , i);         break;       }     }     for (i = 0; i <= 2047; i++) {       if (A[i][j]) {         printf( %d n , i);         break;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int mod = 1e9 + 7;   void solve() {     long long int n, k;     cin >> n >> k;     if (n / 2 > k or n == 1) {       if (k == 0 and n == 1) {         cout << 1 <<   n ;         return;       }       cout << -1 <<   n ;       return;     } else {       vector<long long int> v;       k -= (n / 2);       k++;       if (k == 0) k = 1;       v.push_back(k);       v.push_back(2 * k);       map<long long int, long long int> make_pair;       make_pair[k]++;       make_pair[2 * k]++;       long long int c = 1;       for (__typeof(n / 2 - 1) i = (0) - ((0) > (n / 2 - 1));            i != (n / 2 - 1) - ((0) > (n / 2 - 1));            i += 1 - 2 * ((0) > (n / 2 - 1))) {         while (make_pair[c] + make_pair[c + 1] != 0) {           c++;         }         v.push_back(c);         v.push_back(c + 1);         make_pair[c]++;         make_pair[c + 1]++;         c += 2;       }       if (v.size() != n) {         while (make_pair[2 * k + 1] != 0) k++;         v.push_back(2 * k + 1);       }       for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));            i += 1 - 2 * ((0) > (n))) {         cout << v[i] <<    ;       }     }   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int t;     t = 1;     while (t--) {       solve();     }     return 0;   }