malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int BASE = 70;   long long dataf[BASE][BASE * 2][2];   int main() {     long long s;     scanf( %lld , &s);     long long ans = 0;     long long(*f)[BASE * 2][2] = dataf + 1;     for (int le = 0;; le++) {       long long t1 = (1LL << (le + 1));       if (t1 - 1 > s) break;       for (int ri = 0;; ri++) {         long long t2 = (1LL << (ri + 1));         if (t1 + t2 - 3 > s) break;         long long v = s / (t1 + t2 - 3);         long long tg = s - (v - 1) * (t1 + t2 - 3) + 1;         int maxbase = max(le + 1, ri + 1);         int maxc = le + ri;         for (int sumc = 0; sumc <= maxc; sumc++)           f[-1][sumc][0] = f[-1][sumc][1] = 0;         f[-1][0][0] = 1;         for (int dsumc = 0; dsumc <= maxc; dsumc++) {           long long tg2 = tg + dsumc + 2;           if (tg2 & 1) continue;           tg2 >>= 1;           tg2 -= (1LL << (le)) + (1LL << (ri));           if (tg2 < 0) continue;           for (int i = -1; i < maxbase; i++) {             for (int sumc = 0; sumc <= maxc; sumc++)               f[i + 1][sumc][0] = f[i + 1][sumc][1] = 0;             for (int sumc = 0; sumc <= maxc; sumc++)               for (int nho = 0; nho < 2; nho++) {                 if (f[i][sumc][nho] == 0) continue;                 int tgbit = (((tg2) >> (i + 1)) & 1);                 for (int b1 = 0; b1 < 2; b1++) {                   if (b1 == 1 && i + 1 >= le) continue;                   if (i + 1 == le - 1 && b1 != 0) continue;                   for (int b2 = 0; b2 < 2; b2++) {                     if (b2 == 1 && i + 1 >= ri) continue;                     if (i + 1 == ri - 1 && b2 != 1) continue;                     int kq = (b1 + b2 + nho);                     if ((kq & 1) != tgbit) continue;                     if (sumc + b1 + b2 > maxc) continue;                     kq >>= 1;                     f[i + 1][sumc + b1 + b2][kq] += f[i][sumc][nho];                   }                 }               }           }           ans += f[maxbase][dsumc][0];         }       }     }     printf( %lld , ans);   }
#include <bits/stdc++.h>   using namespace std;   vector<vector<long long>> v;   map<int, pair<int, int>> mp;   int main() {     int k;     scanf( %i , &k);     v.resize(k + 1);     for (int i = 1; i <= k; i++) {       int x;       scanf( %i , &x);       v[i].push_back(0);       for (int j = 1; j <= x; ++j) {         int y;         scanf( %i , &y);         v[i][0] += y;         v[i].push_back(y);       }     }     for (int i = 1; i <= k; ++i) {       for (int j = 1; j < v[i].size(); ++j) {         long long x = v[i][0] - v[i][j];         if (mp[x].first && mp[x].first != i) {           cout <<  YES  << endl                << mp[x].first <<     << mp[x].second << endl                << i <<     << j;           return 0;         } else {           mp[x] = make_pair(i, j);         }       }     }     printf( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 105;   int main() {     int n;     int as[maxn], bs[maxn], cs[maxn];     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d%d%d , &as[i], &bs[i], &cs[i]);       as[i]--;       bs[i]--;     }     int costA = 0;     int costB = 0;     int curEdge = 0;     int curTown = as[curEdge];     for (int i = 0; i < n; i++) {       int newEdge = -1;       int newTown = -1;       for (int j = 0; j < n; j++) {         if (j == curEdge) continue;         if (as[j] == curTown) {           newEdge = j;           newTown = bs[j];           costA += cs[j];           break;         }         if (bs[j] == curTown) {           newEdge = j;           newTown = as[j];           costB += cs[j];           break;         }       }       curEdge = newEdge;       curTown = newTown;     }     printf( %d n , min(costA, costB));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 3e5 + 7, INF = 1e9 + 7, LIM = 1e6;   int it[4 * LIM + 7] = {}, lz[4 * LIM + 7] = {}, n, m, a[MAXN], b[MAXN], q;   void lp(int g) {     if (lz[g]) {       it[g * 2] += lz[g], it[g * 2 + 1] += lz[g];       lz[g * 2] += lz[g], lz[g * 2 + 1] += lz[g];       lz[g] = 0;     }   }   void update(int g, int l, int r, int c, int delta) {     if (l > c) return;     if (r <= c) return lz[g] += delta, it[g] += delta, void();     lp(g);     int mid = (l + r) >> 1;     update(g * 2, l, mid, c, delta), update(g * 2 + 1, mid + 1, r, c, delta);     it[g] = min(it[g * 2], it[g * 2 + 1]);     return;   }   int query(int g, int l, int r, int d) {     if (r < d) return INF;     if (d <= l) return it[g];     lp(g);     int mid = (l + r) >> 1;     return min(query(g * 2, l, mid, d), query(g * 2 + 1, mid + 1, r, d));   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     for (int i = 1; i <= n; ++i) cin >> a[i];     for (int i = 1; i <= m; ++i) cin >> b[i];     for (int i = 1; i <= n; ++i) update(1, 1, LIM, a[i], -1);     for (int i = 1; i <= m; ++i) update(1, 1, LIM, b[i], 1);     cin >> q;     while (q--) {       int tp, pos, x;       cin >> tp >> pos >> x;       int pre = a[pos], delta = -1;       if (tp == 2) pre = b[pos], delta = 1;       update(1, 1, LIM, pre, -delta);       update(1, 1, LIM, x, delta);       if (tp == 1)         a[pos] = x;       else         b[pos] = x;       int l = 1, r = LIM, res = -1;       while (l <= r) {         int mid = (l + r) >> 1;         if (query(1, 1, LIM, mid) < 0)           res = mid, l = mid + 1;         else           r = mid - 1;       }       cout << res <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed long long tonum(string s) {     stringstream in(s);     signed long long x;     in >> x;     return x;   }   string tostr(signed long long n) {     stringstream in;     in << n;     string x;     in >> x;     return x;   }   signed long long gcd(signed long long a, signed long long b) {     while (1) {       a = a % b;       if (a == 0) return b;       b = b % a;       if (b == 0) return a;     }   }   int main() {     int N;     string s;     cin >> N;     cin >> s;     int len = (int)s.size();     map<char, int> used;     int marks = 0;     for (int i = 0; i < (int)(s.size()); ++i) {       if (s[i] ==  ?  && s[len - 1 - i] ==  ? ) {         marks++;         continue;       }       if (s[i] ==  ? ) {         s[i] = s[len - 1 - i];         continue;       }       if (s[len - 1 - i] ==  ? ) {         s[len - 1 - i] = s[i];         continue;       }       if (s[i] != s[len - 1 - i]) {         cout <<  IMPOSSIBLE  << endl;         return 0;       }     }     int mid = (s.size() % 2 == 0) ? (s.size() / 2 - 1) : (s.size() / 2);     char curr = N - 1 +  a ;     for (int i = 0; i < (int)(s.size()); ++i) used[s[i]] = 1;     for (int i = mid; i >= 0; --i) {       if (s[i] ==  ? ) {         while (used[curr] == 1) curr--;         if (curr <  a ) break;         s[i] = s[len - 1 - i] = curr;         used[curr] = 1;       }     }     for (int i = 0; i < (int)(s.size()); ++i)       if (s[i] ==  ? ) s[i] = s[len - 1 - i] =  a ;     for (int i = 0; i < (int)(s.size()); ++i) used[s[i]] = 1;     int req = 0, use = 0;     for (int i = 0; i < (int)(N); ++i)       if (used[char(i +  a )] == 1) req++;     for (int i = 0; i < (int)(26); ++i)       if (used[char(i +  a )] == 1) use++;     if (req != N || req != use) {       cout <<  IMPOSSIBLE  << endl;       return 0;     }     cout << s << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     double a, b, c;     cin >> a >> b >> c;     if (c == 0 && a != b) {       cout <<  NO ;       return 0;     }     if (a == b) {       cout <<  YES ;       return 0;     }     if (a > b && c > 0) {       cout <<  NO ;       return 0;     }     if (a < b && c < 0) {       cout <<  NO ;       return 0;     }     double temp = (b - a) / c;     if (floor(temp) == ceil(temp)) {       cout <<  YES ;       return 0;     } else {       cout <<  NO ;       return 0;     }   }
#include <bits/stdc++.h>   using namespace std;   long long c, t, n, I;   int main(void) {     cin >> n;     for (int i = int(1), ni = int(n); i <= ni; i++) cin >> t, c += (t == 1);     I = 1;     for (long long I1 = 1, I2 = 1, i = 2; i <= c; i++)       I = (I1 + I2 * (i - 1) % 1000000007) % 1000000007, I2 = I1, I1 = I;     for (int i = int(c + 1), ni = int(n); i <= ni; i++) I = (I * i) % 1000000007;     cout << I;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long dp[55][55][55][55];   long long ara[55];   double f[55];   long long cnt(long long i, long long k, long long sum, long long zawad) {     if (i == 0) return (k == 0 && sum == 0);     if (k > i || sum < 0) return 0;     if (dp[i][k][sum][zawad] != -1) return dp[i][k][sum][zawad];     dp[i][k][sum][zawad] = cnt(i - 1, k, sum, zawad);     if (i != zawad)       dp[i][k][sum][zawad] += cnt(i - 1, k - 1, sum - ara[i], zawad);     return dp[i][k][sum][zawad];   }   int main() {     long long n, i, j, k, p, q, x, y;     cin >> n;     long long s = 0;     for (i = 1; i <= n; i++) {       cin >> ara[i];       s += ara[i];     }     cin >> p;     if (s <= p) {       printf( %lld n , n);       return 0;     }     f[1] = 1.0 / n;     for (i = 2; i <= n; i++) f[i] = f[i - 1] * (i - 1) / (n - i + 1.0);     memset(dp, -1, sizeof(dp));     double ans = 0;     for (i = 1; i <= n; i++) {       for (j = 1; j <= n; j++) {         for (k = p - ara[i] + 1; k <= p; k++) {           q = cnt(n, j - 1, k, i);           ans += q * (j - 1) * f[j];         }       }     }     printf( %.10lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long data[4 * 150005], lazy[4 * 150005], ret;   int ll, rr, n, m;   void change(int t, long long d) { data[t] = lazy[t] = d; }   void down(int t) {     if (lazy[t]) {       change(t * 2, lazy[t]);       change(t * 2 + 1, lazy[t]);       lazy[t] = 0;     }   }   void modify(int t, int l, int r) {     if (ll <= l && r <= rr) {       change(t, ret);       return;     }     int mid = (l + r) >> 1;     down(t);     if (ll <= mid) modify(t * 2, l, mid);     if (rr > mid) modify(t * 2 + 1, mid + 1, r);     data[t] = max(data[t * 2], data[t * 2 + 1]);   }   void query(int t, int l, int r) {     if (ll <= l && r <= rr) {       ret = max(ret, data[t]);       return;     }     int mid = (l + r) >> 1;     down(t);     if (ll <= mid) query(t * 2, l, mid);     if (rr > mid) query(t * 2 + 1, mid + 1, r);   }   void build(int t, int l, int r) {     if (l == r) {       scanf( %I64d , &data[t]);       return;     }     int mid = (l + r) >> 1;     build(t * 2, l, mid);     build(t * 2 + 1, mid + 1, r);     data[t] = max(data[t * 2], data[t * 2 + 1]);   }   int main() {     scanf( %d , &n);     build(1, 1, n);     scanf( %d , &m);     while (m--) {       int h;       scanf( %d%d , &rr, &h);       ll = 1;       ret = 0;       query(1, 1, n);       printf( %I64d n , ret);       ret += h;       modify(1, 1, n);     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = (2e5 + 5);   const int mod = 1e9 + 7;   long long int n, a[N], x;   vector<vector<int>> g;   long long int pow_mod_m(long long int a, long long int n) {     if (!n) return 1;     long long int pt = pow_mod_m(a, n / 2);     pt *= pt;     pt %= mod;     if (n & 1) pt *= a, pt %= mod;     return pt;   }   struct LCA {     vector<int> height, euler, first, segtree;     vector<bool> visited;     int n;     LCA(vector<vector<int>> &adj, int root = 0) {       n = adj.size();       height.resize(n);       first.resize(n);       euler.reserve(2 * n);       visited.assign(n, false);       dfs(adj, root);       int m = euler.size();       segtree.resize(4 * m);       build(1, 0, m - 1);     }     void dfs(vector<vector<int>> &adj, int node, int h = 0) {       visited[node] = 1;       height[node] = h;       first[node] = euler.size();       euler.push_back(node);       for (auto to : adj[node]) {         if (!visited[to]) {           dfs(adj, to, h + 1);           euler.push_back(node);         }       }     }     void build(int node, int b, int e) {       if (b == e)         segtree[node] = euler[b];       else {         int m = (b + e) >> 1;         build(node << 1, b, m);         build(node << 1 | 1, m + 1, e);         int l = segtree[node << 1], r = segtree[node << 1 | 1];         segtree[node] = (height[l] < height[r]) ? l : r;       }     }     int query(int node, int b, int e, int L, int R) {       if (b > R || e < L) return -1;       if (b >= L and e <= R) return segtree[node];       int mid = (b + e) >> 1;       int left = query(node << 1, b, mid, L, R);       int right = query(node << 1 | 1, mid + 1, e, L, R);       if (left == -1) return right;       if (right == -1) return left;       return (height[left] < height[right]) ? left : right;     }     int lca(int u, int v) {       int left = first[u], right = first[v];       if (left > right) swap(left, right);       return query(1, 0, euler.size() - 1, left, right);     }     int dist(int u, int v) {       int lca_u_v = lca(u, v);       return height[u] + height[v] - 2 * height[lca_u_v];     }   };   long long int ceil(long long int m) { return x % m == 0 ? x / m : x / m + 1; }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int ts = 1;     cin >> ts;     while (ts--) {       cin >> n >> x;       bool flag = 0;       for (long long int i = 0; i < n; ++i) {         cin >> a[i];         if (x == a[i]) flag = 1;       }       if (flag)         cout << 1 <<   n ;       else         cout << max(2ll, ceil(*max_element(a, a + n))) <<   n ;     }     return 0;   }
#include  bits/stdc++.h    #define Abra_Ka_Dabra ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);   typedef long long ll;   typedef unsigned long long ull;   typedef long double ld;   using namespace std;   const long long mod = 1e9 + 7;   const double PI = acos(-1);   const double EPS = 1e-12;      bool isEqual(ld a, ld b) {    return abs(a - b) <= EPS;   }   bool isGreater(ld a, ld b) {    return a > b + EPS;   }   bool isSmaller(ld a, ld b) {    return a + EPS < b;   }         int main() {   #ifdef Half_Blood_Prince    freopen( in.txt ,  r , stdin);    freopen( out.txt ,  w , stdout);   #endif       Abra_Ka_Dabra       int t;    cin >> t;    while (t--) {     ll n, m, x;     cin >> n >> m >> x;     ll j = (x + (n - 1)) / n;     ll i = x % n;     i = (i == 0 ? n : i);     cout << (i - 1)*m + j <<   n ;    }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool compa(int i, int j) { return i > j; }   long long int power(long long int a, long long int n) {     if (n == 0)       return 1;     else if (n % 2) {       long long int d1 = power(a, n / 2);       return d1 * d1 * a;     } else {       long long int d1 = power(a, n / 2);       return d1 * d1;     }   }   int find_pivot(int a[], int l, int r) {     while (l < r) {       int mid = (l + r) / 2;       if (a[l] > a[l + 1]) {         return l;       } else if (a[r] > a[r + 1])         return r;       else if (a[mid] > a[mid + 1]) {         return mid;       } else if (a[mid] > a[r]) {         l = mid + 1;         cout <<  l   << l;       } else if (a[mid] < a[r]) {         r = mid - 1;         cout <<  r   << r;       }     }     return -1;   }   int main() {     int n;     cin >> n;     string s;     cin >> s;     bool ans[4];     for (int i = 0; i < 4; i++) ans[i] = true;     for (int i = 0; s[i] !=   0 ; i++) {       if (s[i] ==  1 ) {         ans[0] = false;         ans[2] = false;       }       if (s[i] ==  2 ) {         ans[0] = false;       }       if (s[i] ==  3 ) {         ans[0] = false;         ans[3] = false;       }       if (s[i] ==  4 ) {         ans[2] = false;       }       if (s[i] ==  6 ) {         ans[3] = false;       }       if (s[i] ==  7 ) {         ans[1] = false;         ans[2] = false;       }       if (s[i] ==  9 ) {         ans[1] = false;         ans[3] = false;       }       if (s[i] ==  0 ) {         ans[1] = false;         ans[2] = false;         ans[3] = false;       }     }     if (ans[0] || ans[1] || ans[2] || ans[3])       cout <<  NO ;     else       cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mxN = 1e5, mxV = 7001;   int n, q, qt, xi, yi, zi;   bitset<mxV> in[mxV], cq[mxV], ms[mxN], c;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     for (int i = 1; i < mxV; ++i) {       for (int j = 0; (j += i) < mxV;) in[j][i] = 1;       for (int j = i; j < mxV; ++j) {         if (j == i ? !c[j] : c[j]) {           for (int k = 0; (k += j) < mxV;) c.flip(k);           cq[i][j] = 1;         }       }       c.reset();     }     cin >> n >> q;     while (q--) {       cin >> qt;       if (qt == 1) {         cin >> xi >> yi, --xi;         ms[xi] = in[yi];       } else if (qt == 2) {         cin >> xi >> yi >> zi, --xi, --yi, --zi;         ms[xi] = ms[yi] ^ ms[zi];       } else if (qt == 3) {         cin >> xi >> yi >> zi, --xi, --yi, --zi;         ms[xi] = ms[yi] & ms[zi];       } else {         cin >> xi >> yi, --xi;         cout << ((ms[xi] & cq[yi]).count() & 1);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int mtx[2000005];   int main() {     int tc, cs = 0;     int i, j, k;     int len;     cin >> len;     for (i = 0; i < len; i++) cin >> mtx[i];     sort(mtx, mtx + len);     long long sum = 0;     i = 0;     while (1) {       int n = pow(4, i);       if (n > len) break;       for (j = len - 1; j >= len - n; j--) {         sum += mtx[j];       }       i++;     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a, b;   bool bad(int x, int y) {     return abs(x + y) % (2 * a) == 0 || abs(x - y) % (2 * b) == 0;   }   void reorder(int& x, int& y) {     int xx = (x - y) / 2;     int yy = (x + y) / 2;     x = xx;     y = yy;   }   void norm(int& x, int& y) {     if ((x + y) % 2 == 0) return;     if (!bad(x + 1, y))       x++;     else if (!bad(x - 1, y))       x--;     else if (!bad(x, y + 1))       y++;     else if (!bad(x, y - 1))       y--;   }   int torect(int x, int a) {     if (x <= 0)       return x / a;     else       return x / a + 1;   }   int main() {     int x1, y1, x2, y2;     cin >> a >> b >> x1 >> y1 >> x2 >> y2;     norm(x1, y1);     norm(x2, y2);     reorder(x1, y1);     reorder(x2, y2);     x1 = torect(x1, b);     x2 = torect(x2, b);     y1 = torect(y1, a);     y2 = torect(y2, a);     int dx = abs(x1 - x2);     int dy = abs(y1 - y2);     int ans = max(dx, dy);     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long int> a;   vector<long long int> b;   long long int fa(int l, int r) {     long long int ret = 0;     for (int i = l; i <= r; ++i) ret |= a[i];     return ret;   }   long long int fb(int l, int r) {     long long int ret = 0;     for (int i = l; i <= r; ++i) ret |= b[i];     return ret;   }   int main() {     ios_base::sync_with_stdio(0);     int n;     long long int aux, ans = 0;     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> aux;       a.push_back(aux);     }     for (int i = 0; i < n; ++i) {       cin >> aux;       b.push_back(aux);     }     for (int i = 0; i < n; ++i)       for (int j = i; j < n; ++j) {         ans = max(ans, fa(i, j) + fb(i, j));       }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   long long ln[10000], fac[15];   int cnt, ans, suf;   int tem[15];   void input() { scanf( %d%d , &n, &k); }   void dfs(long long x) {     if (x > 10000000000LL) return;     ln[cnt++] = x;     dfs(x * 10 + 4);     dfs(x * 10 + 7);   }   void make_lucky_number() {     cnt = 0;     dfs(4);     dfs(7);     sort(ln, ln + cnt);   }   void get_my_suf(int s) {     bool used[15];     memset(used, false, sizeof(used));     for (int i = 1; i <= s; ++i) {       int u = (k - 1) / fac[s - i];       k -= (u * fac[s - i]);       u++;       for (int j = 1; j <= s; ++j) {         if (!used[j]) u--;         if (u == 0) {           used[tem[i] = j] = true;           break;         }       }     }   }   bool check_lucky(int x) {     while (x) {       if (x % 10 != 4 && x % 10 != 7) return false;       x /= 10;     }     return true;   }   void solve() {     fac[0] = fac[1] = 1;     for (int i = 2; i <= 13; ++i) fac[i] = fac[i - 1] * i;     if (n <= 13 && k > fac[n]) {       puts( -1 );       return;     }     for (int i = 0; i < cnt; ++i)       if (n - 13 < ln[i]) {         ans = i;         break;       }     suf = min(n, 13);     get_my_suf(suf);     for (int i = 1; i <= suf; ++i)       if (check_lucky(n - suf + tem[i]) && check_lucky(n - suf + i)) ans++;     printf( %d n , ans);   }   int main() {     input();     make_lucky_number();     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};   int ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};   void mad(long long &a, long long b) {     a = (a + b) % 1000000007;     if (a < 0) a += 1000000007;   }   long long gcd(long long a, long long b) {     if (a > b) swap(a, b);     if (!a) return b;     return gcd(b % a, a);   }   int dp[1 << 22];   void solve() {     int n;     cin >> n;     int a[n];     for (int i = 0; i < 1 << 22; i++) dp[i] = -1;     for (int i = 0; i < n; i++) {       cin >> a[i];       dp[a[i]] = i;     }     for (int i = 0; i < 1 << 22; i++) {       if (dp[i] == -1) continue;       for (int j = 0; j < 22; j++) {         if (!(i & (1 << j))) dp[i | (1 << j)] = dp[i];       }     }     for (int i = 0; i < n; i++) {       int id = dp[(1 << 22) - 1 - a[i]];       if (id == -1)         cout << -1 <<    ;       else         cout << a[id] <<    ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const int inf = (int)1e9;   const double pi = acos(-1.0);   const double eps = 1e-9;   long long x, second, res, xx, first;   int main() {     cin >> second >> x;     xx = x;     if ((second & 1) != (x & 1)) {       cout << 0;       return 0;     }     res = 1;     while (xx) {       if (xx & 1) res *= 2;       xx /= 2;     }     if (second == x) {       cout << res - 2;       return 0;     }     first = second - x;     if (first < 0) {       cout << 0;       return 0;     }     for (int i = 0; i <= 50; i++) {       long long z = (1ll << (i));       long long zz = (1ll << (i + 1));       if ((x & z) > 0 && (first & zz) > 0) {         cout << 0;         return 0;       }     }     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 10050;   int a[maxn], b[maxn];   bool cmp(int a, int b) { return a > b; }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, k;     while (cin >> n >> k) {       memset(a, 0, sizeof(a));       for (int i = 0; i < n; i++) {         cin >> a[i];       }       for (int i = 0; i < k; i++) {         cin >> b[i];       }       sort(b, b + n, cmp);       int tmp = 0;       for (int i = 0; i < n; i++) {         if (a[i] == 0) {           a[i] = b[tmp++];         }       }       bool flag = false;       for (int i = 1; i < n; i++) {         if (a[i] - a[i - 1] < 0) {           flag = true;           break;         }       }       if (flag) {         cout <<  Yes  << endl;       } else {         cout <<  No  << endl;       }     }     return 0;   }