malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 25;   const int M = 505;   int n, m, a, b;   int i, j, k, u, v, con;   int deg[N];   bool c[N][N];   double p[N], q[N][N];   double f[M][M];   int g(int i, int j) { return i * n - n + j; }   int main() {     scanf( %d%d%d%d , &n, &m, &a, &b);     for (i = 1; i <= m; i++) {       scanf( %d%d , &u, &v);       c[u][v] = c[v][u] = 1;       deg[u]++;       deg[v]++;     }     for (i = 1; i <= n; i++) scanf( %lf , &p[i]);     for (i = 1; i <= n; i++)       for (j = 1; j <= n; j++)         if (i == j)           q[i][j] = p[i];         else if (c[i][j])           q[i][j] = (1 - p[i]) / deg[i];     con = n * n;     f[g(a, b)][con + 1] = -1;     for (i = 1; i <= n; i++)       for (j = 1; j <= n; j++) {         f[g(i, j)][g(i, j)]--;         for (a = 1; a <= n; a++)           for (b = 1; b <= n; b++)             if (a != b) f[g(i, j)][g(a, b)] += q[a][i] * q[b][j];       }     for (i = 1; i <= con; i++) {       for (j = i; j <= con; j++)         if (f[j][i] != 0) break;       if (j > con) continue;       if (j != i)         for (k = i; k <= con + 1; k++) swap(f[i][k], f[j][k]);       for (j = i + 1; j <= con; j++)         for (k = con + 1; k >= i; k--) f[j][k] -= f[j][i] / f[i][i] * f[i][k];     }     for (i = con; i; i--) {       if (f[i][i] == 0) continue;       f[i][con + 1] /= f[i][i];       for (j = i - 1; j; j--) f[j][con + 1] -= f[i][con + 1] * f[j][i];     }     for (i = 1; i <= n; i++)       printf(i < n ?  %.6lf   :  %.6lf n , f[g(i, i)][con + 1]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     char c = getchar();     int x = 0, f = 1;     for (; !isdigit(c); c = getchar())       if (c ==  - ) f = -1;     for (; isdigit(c); c = getchar()) x = x * 10 + c -  0 ;     return x * f;   }   const int MAXN = 1e5 + 5;   int N, M, ans;   int nxt[MAXN];   char s[MAXN], t[MAXN];   int main() {     scanf( %s , s + 1);     scanf( %s , t + 1);     N = strlen(s + 1);     M = strlen(t + 1);     int j = 0;     for (int i = 2; i <= M; i++) {       while (j && t[i] != t[j + 1]) j = nxt[j];       if (t[i] == t[j + 1]) j++;       nxt[i] = j;     }     int lst = 0;     j = 0;     for (int i = 1; i <= N; i++) {       while (j && s[i] != t[j + 1]) j = nxt[j];       if (s[i] == t[j + 1]) j++;       if (j == M) {         if (i - M + 1 > lst) {           if (lst) ans++;           lst = i;         }         j = nxt[j];       }     }     if (lst) ans++;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int m, x, y, a[1005] = {0}, b[1005] = {0};     cin >> m;     for (int i = 1; i <= m; i++) {       cin >> x >> y;       a[x]++;       a[y]++;     }     for (int i = 1; i <= 5; i++)       if (a[i] != 2) {         cout <<  WIN ;         return 0;       }     cout <<  FAIL ;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = (int)1e9;   const long long llinf = (long long)3e18;   const int N = (int)1e6 + 111;   const long double PI = (long double)acos(-1);   int cnt1[N], cnt[N];   int main() {     int t, x, mx = 0, len = 0, n, m;     scanf( %d , &t);     for (int i = 0; i < t; i++) {       scanf( %d , &x);       cnt[x]++;       mx = max(mx, x);     }     n = mx;     for (int i = 1; i < mx; i++)       if (4 * i != cnt[i]) {         len = i - 1;         break;       }     for (n = 1; n * n <= t; n++)       if (t % n == 0) {         m = t / n;         for (int i = 0; i < n; i++)           for (int j = 0; j < m; j++)             if (min(min(i, n - 1 - i), min(j, m - 1 - j)) == len &&                 max(i, n - 1 - i) + max(j, n - 1 - j) == mx) {               for (int cur = 0; cur <= mx; cur++) cnt1[cur] = 0;               bool ok = true;               for (int ii = 0; ii < n; ii++)                 for (int jj = 0; jj < m; jj++) cnt1[abs(i - ii) + abs(j - jj)]++;               for (int cur = 0; cur <= mx; cur++)                 if (cnt1[cur] != cnt[cur]) ok = false;               if (ok) {                 printf( %d %d n%d %d , n, m, i + 1, j + 1);                 return 0;               }             }       }     printf( -1 );   }
#include <bits/stdc++.h>   using namespace std;   const int Inf = 0x3f3f3f3f;   const long long INF = 0x3f3f3f3f3f3f3f3fll;   const int jt = 1000000007;   void inline add(int &a, int b) {     a += b - jt;     a += (a >> 31) & jt;   }   void inline sub(int &a, int b) {     a -= b;     a += (a >> 31) & jt;   }   void inline mul(int &a, int b) { a = (long long)a * b % jt; }   int inline Add(int a, int b) { return a + b >= jt ? a + b - jt : a + b; }   int inline Sub(int a, int b) { return a - b < 0 ? a - b + jt : a - b; }   int inline Mul(int a, int b) { return (long long)a * b % jt; }   int inline ksmii(int a, int b) {     int res = 1;     while (b) {       if (b & 1) mul(res, a);       mul(a, a);       b >>= 1;     }     return res;   }   int n, m;   int main() {     scanf( %d%d , &n, &m);     int fn = ksmii(n + 1, jt - 2);     printf( %d n , Mul(Sub(1, Mul(fn, m)), ksmii(Mul(2, n + 1), m)));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long x = 0, f = 1;     char ch;     for (ch = getchar(); (ch <  0  || ch >  9 ) && ch !=  - ; ch = getchar())       ;     if (ch ==  - ) f = 0, ch = getchar();     while (ch >=  0  && ch <=  9 ) {       x = (x << 1) + (x << 3) + ch -  0 ;       ch = getchar();     }     return f ? x : -x;   }   long long n, res;   long long a[500010], l[500010], r[500010];   long long fl[500010][21];   long long fr[500010][21];   long long st[500010], top;   signed main() {     n = read();     a[0] = a[n + 1] = 1e9 + 7;     for (long long i = 1; i <= n; ++i) {       a[i] = read();       fl[i][0] = fr[i][0] = a[i];       while (a[i] >= a[st[top]] && top) --top;       l[i] = st[top] + 1;       st[++top] = i;     }     top = 0;     st[top] = n + 1;     for (long long i = n; i >= 1; --i) {       while (a[i] > a[st[top]] && top) --top;       r[i] = st[top] - 1;       st[++top] = i;     }     for (long long i = 1; i <= 18; ++i) {       for (long long j = 1; j <= n; ++j) {         fl[j][i] = fl[j][i - 1] | fl[j + (1 << (i - 1))][i - 1];       }       for (long long j = n; j >= 1; --j) {         fr[j][i] = fr[j][i - 1];         if (j >= (1 << (i - 1)))           fr[j][i] = fr[j][i - 1] | fr[j - (1 << (i - 1))][i - 1];       }     }     for (long long i = 1; i <= n; ++i) {       if (i - l[i] <= r[i] - i) {         for (long long k = l[i]; k <= i; ++k) {           long long now = k;           long long sum = a[k];           for (long long d = 18; d >= 0; --d) {             if (now + (1 << d) <= r[i] && (sum | fl[now + 1][d]) <= a[i]) {               sum |= fl[now + 1][d];               now += (1 << d);             }           }           if (now >= i) res += (now - i + 1);         }       } else {         for (long long k = i; k <= r[i]; ++k) {           long long now = k;           long long sum = a[k];           for (long long d = 18; d >= 0; --d) {             if (now - (1 << d) >= l[i] && (sum | fr[now - 1][d]) <= a[i]) {               sum |= fr[now - 1][d];               now -= (1 << d);             }           }           if (now <= i) res += (i - now + 1);         }       }     }     printf( %lld n , (n) * (n + 1) / 2 - res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int t[n + 1];     for (int i = 0; i < n; i++) {       cin >> t[i];     }     for (int i = 0; i < n; i++) {       int tt = t[i];       for (int j = 1; j <= tt; j++) cout << j <<    ;       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Q {     int r1, r2, c1, c2, idx;   };   int n, m, k, q;   Q qs[200000];   vector<int> qAtRow[100001];   vector<int> qAtCol[100001];   vector<int> atCol[100001];   vector<int> atRow[100001];   bool must[200000];   bool res[200000];   int v[100001];   int Z = 400001;   int seg[400001];   int at, val;   void update(int n, int s, int e) {     if (at < s || at > e) return;     if (s == e) {       if (seg[n] == (1 << 29))         seg[n] = val;       else         seg[n] = val;       return;     }     update(n * 2, s, (s + e) / 2);     update(n * 2 + 1, (s + e) / 2 + 1, e);     seg[n] = max(seg[n * 2], seg[n * 2 + 1]);   }   int l, r;   int get(int n, int s, int e) {     if (l > e || r < s) return -1;     if (s >= l && e <= r) return seg[n];     return max(get(n * 2, s, (s + e) / 2), get(n * 2 + 1, (s + e) / 2 + 1, e));   }   int main() {     scanf( %d%d%d%d , &n, &m, &k, &q);     for (int i = 0; i < k; ++i) {       int r, c;       scanf( %d%d , &r, &c);       atCol[c].push_back(r);       atRow[r].push_back(c);     }     for (int i = 0; i < q; ++i) {       Q &t = qs[i];       scanf( %d%d%d%d , &t.r1, &t.c1, &t.r2, &t.c2);       t.idx = i;       qAtCol[t.c1].push_back(i);       qAtRow[t.r1].push_back(i);     }     for (int i = 0; i < Z; ++i) seg[i] = 1 << 29;     for (int i = n; i > 0; --i) {       for (int j = 0; j < atRow[i].size(); ++j) {         at = atRow[i][j];         val = i;         update(1, 1, m);       }       for (int j = 0; j < qAtRow[i].size(); ++j) {         Q &t = qs[qAtRow[i][j]];         l = t.c1;         r = t.c2;         int a = get(1, 1, m);         if (a <= 0 || a > t.r2) must[t.idx] = true;       }     }     for (int i = 0; i < Z; ++i) seg[i] = 1 << 29;     for (int i = m; i > 0; --i) {       for (int j = 0; j < atCol[i].size(); ++j) {         at = atCol[i][j];         val = i;         update(1, 1, n);       }       for (int j = 0; j < qAtCol[i].size(); ++j) {         Q &t = qs[qAtCol[i][j]];         l = t.r1;         r = t.r2;         int a = get(1, 1, n);         if (must[t.idx] && (a <= 0 || a > t.c2)) res[t.idx] = true;       }     }     for (int i = 0; i < q; ++i)       if (res[i])         puts( NO );       else         puts( YES );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<int, int> a[300005];   vector<int> v[300005];   int cnt;   int main(int argc, char** argv) {     int T;     cin >> T;     while (T--) {       int n;       cin >> n;       a[0] = {-1, 0};       for (int i = 1; i <= n; i++) scanf( %d , &a[i].first), a[i].second = i;       sort(a + 1, a + n + 1);       for (int i = 1; i <= cnt + 1; i++) v[i].clear();       cnt = 0;       for (int i = 1; i <= n; i++) {         if (a[i].first != a[i - 1].first) ++cnt;         v[cnt].push_back(a[i].second);       }       int lst = 1, now = 0, ans = 0;       v[cnt + 1].push_back(-1);       for (int i = 1; i <= cnt + 1; i++) {         if (!v[i - 1].size() || v[i][0] > v[i - 1][v[i - 1].size() - 1])           now += v[i].size();         else {           for (auto x : v[i])             if (x > v[i - 1][v[i - 1].size() - 1]) ++now;           for (auto x : v[lst - 1])             if (x < v[lst][0]) ++now;           ans = max(ans, now);           lst = i, now = v[i].size();         }         int nw = 0;         for (int j = 0; j < v[i].size(); j++) {           while (nw < v[i + 1].size() && v[i + 1][nw] <= v[i][j]) ++nw;           ans = max(ans, j + (int)v[i + 1].size() - nw + 1);         }       }       cout << n - ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long spf[21];   long long fac[21];   void sieve() {     spf[1] = 1;     for (long long i = 2; i < 21; i++) spf[i] = i;     for (long long i = 4; i < 21; i += 2) spf[i] = 2;     for (long long i = 3; i * i < 21; i++) {       if (spf[i] == i) {         for (long long j = i * i; j < 21; j += i)           if (spf[j] == j) spf[j] = i;       }     }   }   map<long long, long long> getfactor(long long a) {     map<long long, long long> m;     while (a > 1) {       m[spf[a]]++;       a /= spf[a];     }     return m;   }   long long power(long long x, long long y, long long p) {     long long res = 1;     x = x % p;     if (x == 0) return 0;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   long long gcd(long long a, long long b) {     if (a == 0) return b;     return gcd(b % a, a);   }   long long inverse(long long a, long long p) { return power(a, p - 2, p); }   long long ncr(long long n, long long r, long long p) {     if (r == 0) return 1;     return (fac[n] * inverse(fac[r], p) % p * inverse(fac[n - r], p) % p) % p;   }   long long seg[500000];   void update(long long v, long long l, long long r, long long pos,               long long val) {     if (l == r) {       seg[v] = val;       return;     }     long long mid = (l + r) / 2;     if (pos <= mid)       update(v * 2, l, mid, pos, val);     else       update(v * 2 + 1, mid + 1, r, pos, val);     seg[v] = max(seg[v * 2], seg[v * 2 + 1]);   }   long long query(long long v, long long l, long long r, long long posl,                   long long posr) {     if (l >= posl && r <= posr)       return seg[v];     else if (l > posr || r < posl)       return 0;     long long mid = (l + r) / 2;     return max(query(v * 2, l, mid, posl, posr),                query(v * 2 + 1, mid + 1, r, posl, posr));   }   void solve() {     long long n, temp = 0;     cin >> n;     vector<pair<pair<long long, long long>, long long> > v(n);     memset(seg, 0, sizeof(seg));     long long dp[n];     memset(dp, 0, sizeof(dp));     for (long long i = 0; i < n; i++) {       cin >> v[i].first.first;       cin >> v[i].first.second;       v[i].second = i;       v[i].first.second *= -1;     }     long long p;     sort(v.begin(), v.end());     vector<long long> v1(n);     for (long long i = 0; i < n; i++) v1[i] = v[i].first.first;     for (long long i = n - 1; i >= 0; i--) {       p = v[i].first.first - v[i].first.second - 1;       long long t = upper_bound(v1.begin(), v1.end(), p) - v1.begin();       long long ss = query(1, 1, n, i + 1, t);       if (ss == 0) ss = i + 1;       dp[v[i].second] = ss - i;       update(1, 1, n, i + 1, ss);     }     for (long long i = 0; i < n; i++) {       cout << dp[i] <<    ;     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int NAX = 2e5 + 5, MOD = 1000000007;   struct Solution {     Solution() {}     void solveCase() {       set<string> ss;       for (size_t i = 0; i <= 100; i += 4) {         auto I = to_string(i);         ss.insert(I);         if (i < 10) {           I =  0  + I;           ss.insert(I);         }       }       string str;       cin >> str;       char prev =   0 ;       ll res = 0;       ;       for (size_t i = 0; i < str.size(); i++) {         string curr =   ;         curr += str[i];         if (ss.count(curr)) res++;         if (i > 0) {           curr = prev + curr;           if (ss.count(curr)) res += i;         };         prev = str[i];       }       cout << res <<   n ;     }   };   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t = 1;     Solution mySolver;     for (int i = 1; i <= t; ++i) {       mySolver.solveCase();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dp[(1 << 22)], a[1000000];   int main() {     int N;     while (scanf( %d , &N) != EOF) {       memset(dp, -1, sizeof(dp));       for (int i = int(0); i < int(N); i++) {         scanf( %d , a + i);         dp[a[i]] = a[i];       }       for (int i = int(0); i < int(22); i++) {         for (int j = int(0); j < int((1 << 22)); j++) {           if (~dp[j]) dp[j | 1 << i] = dp[j];         }       }       for (int i = int(0); i < int(N); i++) {         printf( %d%c , dp[~a[i] & (1 << 22) - 1],    n [i == N - 1]);       }     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:200000000 )   using namespace std;   template <typename T>   inline T Abs(T x) {     return (x >= 0) ? x : -x;   }   template <typename T>   inline T sqr(T x) {     return x * x;   }   template <typename T>   string toStr(T x) {     stringstream st;     st << x;     string s;     st >> s;     return s;   }   inline int nextInt() {     int x;     if (scanf( %d , &x) != 1) throw;     return x;   }   inline long long nextInt64() {     long long x;     if (scanf( %I64d , &x) != 1) throw;     return x;   }   inline double nextDouble() {     double x;     if (scanf( %lf , &x) != 1) throw;     return x;   }   const int INF = (int)1E9;   const long long INF64 = (long long)1E18;   const long double EPS = 1E-9;   const long double PI = 3.1415926535897932384626433832795;   const int MAXN = 3000100;   int n, a[MAXN], l[MAXN], r[MAXN];   int tree[MAXN];   int get(int x) {     int ans = 0;     if (x < 0) return ans;     for (; x >= 0; x = (x & (x + 1)) - 1) ans += tree[x];     return ans;   }   int get(int l, int r) {     int ans = get(r);     if (l > 0) ans -= get(l - 1);     return ans;   }   void update(int x, int value) {     for (; x < 3 * n; x = (x | (x + 1))) tree[x] += value;   }   int main() {     n = nextInt();     for (int i = 0; i < (int)(n); i++) a[i + n] = a[i + 2 * n] = a[i] = nextInt();     int n1 = n / 2, n2 = n - n1;     vector<pair<int, int> > st;     for (int i = 0; i < (int)(3 * n); i++) {       while (!st.empty() && st.back().first <= a[i]) st.pop_back();       if (st.empty())         l[i] = i - n1 + 1;       else         l[i] = st.back().second;       st.push_back(make_pair(a[i], i));     }     st.clear();     for (int i = (int)(3 * n) - 1; i >= 0; i--) {       while (!st.empty() && st.back().first <= a[i]) st.pop_back();       if (st.empty())         r[i] = i + n2;       else         r[i] = st.back().second;       st.push_back(make_pair(a[i], i));     }     st.clear();     for (int i = 0; i < (int)(n); i++) {       update(i, +1);       update(i + n, +1);       update(i + 2 * n, +1);       st.push_back(make_pair(a[i], i));     }     long long ans = 0;     sort((st).begin(), (st).end());     for (int i = 0; i < (int)(n); i++) {       int x = st[i].second;       int ll = l[x + n], rr = r[x + n];       if ((ll % n) == (rr % n)) ll++;       update(x, -1);       update(x + n, -1);       update(x + 2 * n, -1);       ans += get(ll, rr);     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return f * x;   }   inline void chmax(int &x, int y) { x = max(x, y); }   inline void chmin(int &x, int y) { x = min(x, y); }   inline void pls(int &x, int y, int Mod) {     x = (x + y >= Mod) ? (x + y - Mod) : (x + y);   }   inline void red(int &x, int y, int Mod) {     x = (x - y < 0) ? (x - y + Mod) : (x - y);   }   const int MAXN = 200005;   int n, m;   vector<int> G[MAXN];   int fa[MAXN];   inline int find(int x) {     if (fa[x] == x) return x;     return fa[x] = find(fa[x]);   }   pair<int, int> lk[MAXN];   inline void del(int x) {     lk[lk[x].first].second = lk[x].second;     lk[lk[x].second].first = lk[x].first;   }   bool vis1[MAXN], vis2[MAXN];   int cnt[MAXN];   signed main() {     n = read(), m = read();     for (int i = 1; i <= m; i++) {       int x = read(), y = read();       G[x].push_back(y);       G[y].push_back(x);     }     for (int i = 1; i <= n; i++) {       fa[i] = i;       lk[i - 1].second = i;       lk[i].first = i - 1;     }     queue<int> q;     while (lk[0].second) {       int now = lk[0].second;       del(now);       q.push(now);       while (!q.empty()) {         int p = q.front();         q.pop();         vis1[p] = true;         for (int i : G[p])           if (!vis1[i]) vis2[i] = true;         int cur = lk[0].second;         while (cur) {           if (!vis2[cur]) {             fa[find(cur)] = find(p);             del(cur);             q.push(cur);           }           cur = lk[cur].second;         }         for (int i : G[p]) vis2[i] = false;       }     }     vector<int> ans;     memset(vis1, false, sizeof(vis1));     for (int i = 1; i <= n; i++) cnt[find(i)]++;     for (int i = 1; i <= n; i++)       if (cnt[i]) ans.push_back(cnt[i]);     sort(ans.begin(), ans.end());     cout << (int)ans.size() << endl;     for (int i : ans) cout << i <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char const *argv[]) {     int k[3];     scanf( %d%d%d , k, k + 1, k + 2);     sort(k, k + 3);     if (k[0] == 1)       printf( YES n );     else if (k[0] == 2) {       if (k[1] == 2)         printf( YES n );       else if (k[1] == 4 && k[2] == 4)         printf( YES n );       else         printf( NO n );     } else if (k[0] == 3 && k[1] == 3 && k[2] == 3)       printf( YES n );     else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     char c[51];     int n;     scanf( %s , c);     scanf( %d , &n);     for (int i = 0; i < strlen(c); i++) {       if (c[i] <  a ) c[i] +=  a  -  A ;       if (c[i] < 97 + n) c[i] +=  A  -  a ;     }     printf( %s , c);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int h, m;     scanf( %d:%d , &h, &m);     double dm = (m) / 60.0, dh = (h % 12 + dm) / 12;     cout << 360 * (dh) <<     << 360 * (dm) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1005], b[1005];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);     }     for (int i = 0; i < n; i++) {       scanf( %d , &b[i]);     }     int ans = 0;     for (int i = 0; i < n; i++) {       int p = 0;       int q = 0;       for (int j = i; j < n; j++) {         p |= a[j];         q |= b[j];         ans = max(ans, p + q);       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   const long long inf = LLONG_MAX;   void IO() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cout.setf(ios::fixed);     srand(chrono::high_resolution_clock::now().time_since_epoch().count());   }   long long pw(long long x, long long y, long long p = inf) {     long long res = 1;     x = x % p;     if (x == 0) return 0;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   long long invmod(long long a, long long m) { return pw(a, m - 2, m); }   long long cl(long long a, long long x) {     return a % x == 0 ? a / x : a / x + 1;   }   long long gcd(long long a, long long b) {     if (a == 0) return b;     return gcd(b % a, a);   }   void run_time_terror() {     long long n;     cin >> n;     cout <<  ? 1 3  << endl;     long long a, b;     cin >> a;     vector<long long> ans(n);     cout <<  ? 2 3  << endl;     cin >> b;     ans[0] = a - b;     for (long long i = 0; i < n - 1; ++i) {       long long x;       if (i == 1) {         x = b;       } else {         cout <<  ?   << i + 1 <<     << i + 2 << endl;         cin >> x;       }       ans[i + 1] = x - ans[i];     }     cout <<  !  ;     for (long long i = 0; i < n; ++i) {       cout << ans[i] <<    ;     }   }   int32_t main() {     cout << setprecision(0);     long long tt = 1;     for (long long case_no = 1; case_no <= tt; case_no++) {       run_time_terror();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     int i, cnt = 0, p = 0, n;     cin >> n;     cin >> s;     for (i = 0; i < n; i++)       if (s[i] ==  0 )         cnt++;       else         p++;     if (p > 0) {       cout << 1;       for (i = 0; i < cnt; i++) cout << 0;       cout << endl;     } else       cout << 0 << endl;   }