malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n;   pair<pair<int, int>, int> p[200005];   int t[200005], ans[2000005], a[200005];   void san() {     for (int i = 1; i <= n; ++i) t[i] = p[i].first.first;     sort(t + 1, t + 1 + n);     for (int i = 1; i <= n; ++i)       p[i].first.first = lower_bound(t + 1, t + 1 + n, p[i].first.first) - t;   }   bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {     return a.first.second < b.first.second;   }   void add(int x) {     while (x <= n) {       a[x]++;       x += x & (-x);     }   }   int getSum(int x) {     int res = 0;     while (x >= 1) {       res += a[x];       x -= x & (-x);     }     return res;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d%d , &p[i].first.first, &p[i].first.second);       p[i].second = i;     }     san();     sort(p + 1, p + 1 + n, cmp);     for (int i = 1; i <= n; ++i) {       ans[p[i].second] = i - 1 - getSum(p[i].first.first);       add(p[i].first.first);     }     for (int i = 1; i <= n; ++i) printf( %d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string x, y, z;     cin >> x;     cin >> y;     cin >> z;     x += y;     sort(x.begin(), x.end());     sort(z.begin(), z.end());     if (x.length() != z.length())       cout <<  NO             <<   n ;     else {       for (int i = 0; i < x.length(); i++) {         if (x[i] != z[i]) {           cout <<  NO                 <<   n ;           return 0;         }       }       cout <<  YES             <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 510;   int n, k;   int a[MAX], b[MAX];   void init() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     cin >> k;     for (int i = 1; i <= k; i++) cin >> b[i];   }   bool valid(int i, int l, int r) {     int x = i, y = i, sum = a[i];     while (true) {       int old_x = x, old_y = y;       while (x - 1 >= l && sum > a[x - 1]) {         x--;         sum += a[x];       }       while (y + 1 <= r && sum > a[y + 1]) {         y++;         sum += a[y];       }       if (old_x == x && old_y == y) break;     }     return x == l && y == r;   }   void print(int i, int l, int r) {     int x = i, y = i, sum = a[i];     while (true) {       int old_x = x, old_y = y;       while (x - 1 >= l && sum > a[x - 1]) {         cout << x <<   L  <<   n ;         x--;         sum += a[x];       }       while (y + 1 <= r && sum > a[y + 1]) {         cout << x <<   R  <<   n ;         y++;         sum += a[y];       }       if (old_x == x && old_y == y) break;     }   }   void process() {     vector<pair<int, pair<int, int> > > p;     bool found = true;     int l, r = n, pb = k;     while (r >= 1 && pb >= 1) {       l = r;       int sum = a[r];       while (l - 1 >= 1 && a[l - 1] + sum <= b[pb]) {         l--;         sum += a[l];       }       if (sum == b[pb]) {         bool exist = false;         for (int i = l; i <= r; i++)           if (valid(i, l, r)) {             exist = true;             p.push_back(make_pair(i, make_pair(l, r)));             break;           }         if (exist) {           sum = 0;           pb--;         } else {           found = false;           break;         }       } else {         found = false;         break;       }       r = l - 1;     }     if (r != 0 || pb != 0) found = false;     if (!found)       cout <<  NO ;     else {       cout <<  YES  <<   n ;       for (int i = 0; i < (int)p.size(); i++)         print(p[i].first, p[i].second.first, p[i].second.second);     }   }   int main() {     ios_base::sync_with_stdio(false);     init();     process();   }
#include <bits/stdc++.h>   using namespace std;   int a[2 * 50004];   int main(void) {     int n, k;     cin >> n >> k;     for (int i = 1; i <= 2 * n; i++) {       a[i] = i;     }     for (int i = 1; i <= k; i++) {       swap(a[2 * i], a[2 * i - 1]);     }     for (int i = 1; i <= 2 * n; i++) {       cout << a[i] <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dx[5] = {0, -1, 1, 0, 0}, dy[5] = {0, 0, 0, -1, 1};   int n, m, k, i, j, dis[2005][2005], vis[2005][2005], s1, s2;   bool check(int x, int y, int d, bool f = 0) {     int i, l = max(1, x - d), r = min(n, x + d);     if (f) l = s1;     for (i = l; i <= r; i++) {       int t = d - abs(x - i);       if (i >= 1 && i <= n && y - t >= 1 && y - t <= m && !vis[i][y - t]) {         s1 = i;         s2 = y - t;         return 1;       }       if (i >= 1 && i <= n && y + t >= 1 && y + t <= m && !vis[i][y + t]) {         s1 = i;         s2 = y + t;         return 1;       }     }     return 0;   }   int main() {     scanf( %d%d%d , &n, &m, &k);     int lx = -1, ly = -1;     while (k--) {       int x, y;       scanf( %d%d , &x, &y);       for (i = max(1, x - 5); i <= min(n, x + 5); i++) {         for (j = max(1, y - 5); j <= min(m, y + 5); j++) {           dis[x][y] = max(dis[x][y], dis[i][j] - abs(i - x) - abs(j - y));         }       }       if (x == lx && y == ly) {         if (!check(x, y, dis[x][y], 1))           while (!check(x, y, dis[x][y])) dis[x][y]++;       } else         while (!check(x, y, dis[x][y])) dis[x][y]++;       vis[s1][s2] = 1;       printf( %d %d n , s1, s2);       lx = x;       ly = y;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);     int n, m;     cin >> n >> m;     vector<int> a(n);     for (int i = 0; i < n; ++i) {       cin >> a[i];     }     cout <<  0  ;     vector<int> cnt(110, 0);     cnt[a[0]]++;     for (int w = 1; w < n; ++w) {       int s = a[w];       int k = 0;       for (int i = 1; i <= 100; ++i) {         if (s + i * cnt[i] <= m) {           s += i * cnt[i];           k += cnt[i];         } else {           int l = -1, r = cnt[i] + 1;           while (r - l > 1) {             int mid = (l + r) / 2;             if (s + i * mid <= m) {               l = mid;             } else {               r = mid;             }           }           k += l;           break;         }       }       cout << w - k <<    ;       cnt[a[w]]++;     }   }
#include <bits/stdc++.h>   const int N = 100010;   using namespace std;   namespace YKY {   inline int rnd() {     int res = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       res = res * 10 + ch -  0 ;       ch = getchar();     }     return res * f;   }   inline void wr(int x) {     if (x < 0) {       putchar( - );       x = -x;     }     if (x > 9) wr(x / 10);     putchar(x % 10 +  0 );   }   char s[N];   int n, m, k;   int Main() {     n = rnd();     m = rnd();     k = rnd();     scanf( %s , s + 1);     m = m + k;     for (int i = 1, opt, l, r, c; i <= m; i++) {       opt = rnd();       l = rnd();       r = rnd();       c = rnd();       if (opt == 1)         memset(s + l, c +  0 , r - l + 1);       else         puts(memcmp(s + l, s + l + c, r - l - c + 1) ?  NO  :  YES );     }     return 0;   }   }  // namespace YKY   int main() { return YKY ::Main(); }
#include <bits/stdc++.h>   using namespace std;   struct point {     int x, y;     bool operator<(const point &other) const {       return x <= other.x && y <= other.y;     }   };   map<int, set<point> > m;   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       point p;       scanf( %d %d , &p.x, &p.y);       m[p.y - p.x].insert(p);     }     vector<point> v;     bool ok = true;     for (int i = 0; i < n; i++) {       int d;       scanf( %d , &d);       if (m.find(d) == m.end())         ok = false;       else if (m[d].size() == 0)         ok = false;       else {         v.push_back(*m[d].begin());         m[d].erase(m[d].begin());       }     }     if ((int)v.size() != n || !ok) {       printf( NO );       return 0;     }     for (int i = 1; i < v.size(); i++) {       if (v[i] < v[i - 1]) {         printf( NO n );         return 0;       }     }     printf( YES n );     for (int i = 0; i < v.size(); i++) {       printf( %d %d n , v[i].x, v[i].y);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   int a[maxn];   int main() {     int n, m, k;     scanf( %d%d%d , &n, &m, &k);     if (n > min(m, k))       printf( No n );     else       printf( Yes n );     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     for (; ch <  0  || ch >  9 ; ch = getchar())       if (ch ==  - ) f = -1;     for (; ch >=  0  && ch <=  9 ; ch = getchar())       x = (x << 1) + (x << 3) + ch -  0 ;     return x * f;   }   const int N = 250025;   const int M = 1e6 + 10;   int n, m, k, w0, w1, tot;   int u[M], nex[M], a[5];   int h[N], b[N], deep[N], fa[N];   void addedge(int w0, int w1) {     u[++tot] = w1;     nex[tot] = h[w0];     h[w0] = tot;   }   void dfs(int w, int depth) {     if (depth > w1) w0 = w;     deep[w] = depth;     bool leaf = true;     for (int i = h[w]; i; i = nex[i])       if (!deep[u[i]]) {         fa[u[i]] = w;         dfs(u[i], depth + 1);         leaf = false;       }     if (leaf) b[tot++] = w;   }   int main() {     n = read();     m = read();     k = read();     while (m--) {       w0 = read();       w1 = read();       addedge(w0, w1);       addedge(w1, w0);     }     w1 = n / k;     w0 = tot = 0;     fa[1] = 1;     dfs(1, 1);     if (w0) {       printf( PATH n%d n , deep[w0]);       for (; w0 != 1; w0 = fa[w0]) printf( %d  , w0);       printf( 1 n );     } else {       printf( CYCLES n );       for (int i = 0; i < k; i++) {         int j = h[w0 = b[i]];         tot = 0;         for (int cnt = 3; cnt; j = nex[j], cnt--)           if (u[j] != fa[w0]) a[tot++] = u[j];         if ((deep[w0] - deep[a[0]] + 1) % 3 != 0) {           printf( %d n , deep[w0] - deep[a[0]] + 1);           for (; w0 != a[0]; w0 = fa[w0]) printf( %d  , w0);           printf( %d n , a[0]);         } else if ((deep[w0] - deep[a[1]] + 1) % 3 != 0) {           printf( %d n , deep[w0] - deep[a[1]] + 1);           for (; w0 != a[1]; w0 = fa[w0]) printf( %d  , w0);           printf( %d n , a[1]);         } else {           if (deep[a[0]] < deep[a[1]]) swap(a[0], a[1]);           printf( %d n , deep[a[0]] - deep[a[1]] + 2);           printf( %d  , w0);           for (w0 = a[0]; w0 != a[1]; w0 = fa[w0]) printf( %d  , w0);           printf( %d n , a[1]);         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cur;   bool c[1011][1011];   int x[33], y[33], z[33];   void connect(int target, int between) {     for (int i = (1), _b = (between); i <= _b; i++) z[i] = ++cur;     z[between + 1] = target;     z[0] = 1;     for (int i = (0), _b = (between); i <= _b; i++) c[z[i]][z[i + 1]] = true;   }   int main() {     int n;     while (cin >> n) {       memset(c, 0, sizeof c);       cur = 2;       for (int i = (1), _b = (30); i <= _b; i++) x[i] = ++cur;       for (int i = (1), _b = (30); i <= _b; i++) y[i] = ++cur;       c[x[30]][2] = c[y[30]][2] = true;       for (int i = (1), _b = (29); i <= _b; i++) {         c[x[i]][x[i + 1]] = true;         c[y[i]][y[i + 1]] = true;         c[y[i]][x[i + 1]] = true;         c[x[i]][y[i + 1]] = true;       }       for (int i = (29), _b = (0); i >= _b; i--)         if ((1 << i) <= n) {           n -= 1 << i;           connect(x[30 - i], 30 - i - 1);         }       cout << cur << endl;       for (int i = (1), _b = (cur); i <= _b; i++) {         for (int j = (1), _b = (cur); j <= _b; j++)           if (c[i][j] || c[j][i])             putchar( Y );           else             putchar( N );         puts(  );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char const *argv[]) {     int t;     cin >> t;     bool even;     bool odd;     for (int i = 1; i <= t; i++) {       int size;       even = false;       odd = false;       cin >> size;       int arr[size];       for (int j = 0; j < size; j++) cin >> arr[j];       for (int j = 0; j < size; j++)         if (arr[j] % 2 == 0)           even = true;         else           odd = true;       if (even == true && odd == true)         cout <<  YES  << endl;       else if (even == false && size % 2 != 0)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using vint = vector<int>;   using pint = pair<int, int>;   using vpint = vector<pint>;   template <typename A, typename B>   inline void chmin(A& a, B b) {     if (a > b) a = b;   }   template <typename A, typename B>   inline void chmax(A& a, B b) {     if (a < b) a = b;   }   template <class A, class B>   ostream& operator<<(ostream& ost, const pair<A, B>& p) {     ost <<  {  << p.first <<  ,  << p.second <<  } ;     return ost;   }   template <class T>   ostream& operator<<(ostream& ost, const vector<T>& v) {     ost <<  { ;     for (int i = 0; i < v.size(); i++) {       if (i) ost <<  , ;       ost << v[i];     }     ost <<  } ;     return ost;   }   struct Cactus {     vector<vector<int>> G;     vector<vector<int>> cs;     vector<int> vis, par, dep;     void dfs(int v) {       vis[v] = 1;       for (auto u : G[v]) {         if (!vis[u]) {           par[u] = v;           dep[u] = dep[v] + 1;           dfs(u);         } else if (dep[u] < dep[v]) {           int w = v;           vector<int> c{w};           while (true) {             w = par[w];             c.push_back(w);             if (w == u) break;           }           cs.push_back(c);         }       }     }     Cactus(const vector<vector<int>>& G) : G(G) {       vis.resize(G.size());       par.resize(G.size());       dep.resize(G.size());       dfs(0);     }   };   int N, M;   int A[555555], B[555555];   int info[555555];   int dp[555555];   int memA[555555], memB[555555];   signed main() {     scanf( %d%d , &N, &M);     vint lis;     vector<vint> G(N);     map<pint, int> edgeID;     for (int i = 0; i < (M); i++) {       scanf( %d%d , &A[i], &B[i]);       A[i]--;       B[i]--;       G[A[i]].push_back(B[i]);       G[B[i]].push_back(A[i]);       edgeID[{A[i], B[i]}] = i;       edgeID[{B[i], A[i]}] = i;     }     Cactus cac(G);     fill_n(info, M, -1);     for (auto c : cac.cs) {       if (c.size() == 2) continue;       vint id;       for (int i = 0; i < (c.size()); i++) {         int a = c[i];         int b = c[(i + 1) % c.size()];         id.push_back(edgeID[{a, b}]);       }       rotate(id.begin(), min_element((id).begin(), (id).end()), id.end());       int m = max_element((id).begin(), (id).end()) - id.begin();       bool ok = true;       for (int i = 0; i < m; i++)         if (id[i] > id[i + 1]) ok = false;       for (int i = m; i + 1 < id.size(); i++)         if (id[i] < id[i + 1]) ok = false;       if (!ok) continue;       info[id[0]] = id[m];     }     for (int i = 0; i < (N); i++) dp[i] = 1;     for (int i = M - 1; i >= 0; i--) {       int addA = dp[B[i]];       int addB = dp[A[i]];       if (info[i] != -1) {         int k = info[i];         int tmp = memA[k] + memB[k];         addA -= tmp;         addB -= tmp;       }       memA[i] = dp[A[i]];       memB[i] = dp[B[i]];       dp[A[i]] += addA;       dp[B[i]] += addB;     }     for (int i = 0; i < (N); i++) dp[i]--;     for (int i = 0; i < (N); i++) {       if (i) printf(   );       printf( %d , dp[i]);     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   const int mod = 1000000007;   using namespace std;   pair<int, int> a[12345];   vector<int> ans[3];   map<pair<int, int>, bool> used;   map<int, int> cnts;   int main() {     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       scanf( %d , &a[i].first);       a[i].second = i + 1;       cnts[a[i].first]++;     }     int x = 0, y = 0;     for (map<int, int>::iterator it = cnts.begin(); it != cnts.end(); ++it) {       if (it->second >= 3)         y++;       else {         if (it->second == 2) {           x++;         }       }     }     if (x >= 2 || y >= 1) {       puts( YES );       sort(a, a + n);       for (int i = 0; i < n; ++i) {         ans[0].push_back(a[i].second);         if (i != n) {           used[make_pair(i, i + 1)] = false;           used[make_pair(i + 1, i)] = false;         }       }       int temp;       for (int i = 0; i < n - 1; ++i) {         if (!used[make_pair(i, i + 1)] && a[i].first == a[i + 1].first) {           temp = a[i].second;           a[i].second = a[i + 1].second;           a[i + 1].second = temp;           used[make_pair(i, i + 1)] = true;           used[make_pair(i + 1, i)] = true;           break;         }       }       for (int i = 0; i < n; ++i) {         ans[1].push_back(a[i].second);       }       for (int i = 0; i < n - 1; ++i) {         if (!used[make_pair(i, i + 1)] && a[i].first == a[i + 1].first) {           temp = a[i].second;           a[i].second = a[i + 1].second;           a[i + 1].second = temp;           used[make_pair(i, i + 1)] = true;           used[make_pair(i + 1, i)] = true;           break;         }       }       for (int i = 0; i < n; ++i) {         ans[2].push_back(a[i].second);       }       for (int i = 0; i < 3; ++i) {         for (int j = 0; j < ans[i].size(); ++j) {           printf( %d  , ans[i][j]);         }         printf(  n );       }     } else {       cout <<  NO  << endl;       return 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   void max_swap(T& a, const T& b) {     a = max(a, b);   }   template <class T>   void min_swap(T& a, const T& b) {     a = min(a, b);   }   const double EPS = 1e-8;   const double PI = acos(-1.0);   const int dx[] = {0, 1, 0, -1};   const int dy[] = {1, 0, -1, 0};   bool valid_pos(int x, int y, int w, int h) {     return 0 <= x && x < w && 0 <= y && y < h;   }   int main() {     ios::sync_with_stdio(false);     string s, t;     cin >> s >> t;     int n = s.size(), m = t.size();     static int dp[5555][5555];     const int mod = 1000000007;     for (int i = 0; i < n; ++i) {       int sum = 0;       for (int j = 0; j < m; ++j) {         if (s[i] == t[j]) {           (dp[i + 1][j + 1] += sum + 1) %= mod;         }         (sum += dp[i][j + 1]) %= mod;       }     }     int res = 0;     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j) (res += dp[i + 1][j + 1]) %= mod;     cout << res << endl;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   char block[][3][4] = {{ ### ,  .#. ,  .#. },                         { #.. ,  ### ,  #.. },                         { .#. ,  .#. ,  ### },                         { ..# ,  ### ,  ..# }};   int cell[10][10], anscell[10][10];   int bcnt, ans;   bool isPlacable(int i, int j, int k) {     for (int p = 0; p < 3; ++p)       for (int q = 0; q < 3; ++q) {         if (cell[i + p][j + q] != -1 && block[k][p][q] ==  # ) return false;       }     return true;   }   void setBlock(int i, int j, int k) {     for (int p = 0; p < 3; ++p)       for (int q = 0; q < 3; ++q) {         if (block[k][p][q] ==  # ) cell[i + p][j + q] = bcnt;       }     ++bcnt;   }   void removeBlock(int i, int j, int k) {     for (int p = 0; p < 3; ++p)       for (int q = 0; q < 3; ++q) {         if (block[k][p][q] ==  # ) cell[i + p][j + q] = -1;       }     --bcnt;   }   void go(int i, int j) {     if (j >= m - 2) {       go(i + 1, 0);       return;     }     if (i == n - 2) {       if (ans < bcnt) {         ans = bcnt;         memcpy(anscell, cell, sizeof(cell));       }       return;     }     if (bcnt + (n * m - (i * m + j)) / 6 <= ans) {       return;     }     for (int k = 0; k < 4; ++k) {       if (isPlacable(i, j, k)) {         setBlock(i, j, k);         go(i, j + (k == 3 ? 3 : 2));         removeBlock(i, j, k);       }     }     go(i, j + 1);   }   int main() {     memset(cell, -1, sizeof(cell));     memset(anscell, -1, sizeof(anscell));     scanf( %d %d , &n, &m);     if (n >= 3 && m >= 3) go(0, 0);     printf( %d n , ans);     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         putchar(anscell[i][j] == -1 ?  .  : ( A  + anscell[i][j]));       }       putchar(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, i, o = 0, e = 0;     cin >> n;     for (i = 0; i < n; i = i + 1) {       long long int x;       cin >> x;       if (x % 2 == 0)         e = e + 1;       else         o = o + 1;     }     long long int res = min(o, e);     o = o - res;     res = res + (o / 3);     cout << res << endl;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   const long long N = 1e5 + 5;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     string s;     cin >> s;     vector<long long> pref(n + 2), suff(n + 2);     for (long long i = 1; i <= n; i++) {       if (s[i - 1] ==  G ) {         pref[i] = 1;         pref[i] += pref[i - 1];       }     }     for (long long i = n; i >= 1; i--) {       if (s[i - 1] ==  G ) {         suff[i] = 1;         suff[i] += suff[i + 1];       }     }     long long ans = 0;     long long cnt = 0;     for (long long i = 1; i <= n; i++) {       if (s[i - 1] ==  G ) cnt++;       ans = max(ans, pref[i]);     }     for (long long i = 1; i <= n; i++) {       if (s[i - 1] ==  S ) {         if (i == 4) {           debug() <<   [                    <<  pref[i - 1]                        :                     << (pref[i - 1])                   <<  ]                          [                    <<  suff[i + 1]                        :                     << (suff[i + 1]) <<  ]  ;         }         if (pref[i - 1] + suff[i + 1] < cnt)           ans = max(ans, pref[i - 1] + suff[i + 1] + 1);         else if (pref[i - 1] + suff[i + 1] == cnt) {           ans = max(ans, pref[i - 1] + suff[i + 1]);         }       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using pii = pair<int, int>;   using cd = complex<ld>;   int query(int l, int r) {     cout <<  ?   << l <<     << r << endl;     cin >> l;     return l;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     vector<int> sums;     for (int i = 1; i < n; i++) {       sums.push_back(query(i, i + 1));     }     int sum123 = query(1, 3);     vector<int> a(n);     int a2 = sums[0] + sums[1] - sum123;     a[0] = sums[0] - a2;     a[1] = a2;     for (int i = 2; i < n; i++) {       a[i] = sums[i - 1] - a[i - 1];     }     cout <<  !  ;     for (int x : a) {       cout << x <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long ar[100009], f[100009], b[100009], fl = 1;   map<long long, long long> mb, mf;   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, m;     cin >> n >> m;     for (long long i = 1; i <= n; i++) {       cin >> f[i];       mf[f[i]]++;       ar[f[i]] = i;     }     for (long long i = 1; i <= m; i++) {       cin >> b[i];       mb[b[i]]++;     }     for (auto pp : mb) {       long long x = pp.first;       if (mf[x] == 0) {         cout <<  Impossible  << endl;         return 0;       }       if (mf[x] != 1) fl = 0;     }     if (!fl)       cout <<  Ambiguity  << endl;     else {       cout <<  Possible  << endl;       for (long long i = 1; i <= m; i++) {         long long x = b[i];         cout << ar[x] <<    ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, x = 0;     scanf( %d , &n);     for (i = 2; i <= n / 2; i += 2) {       if ((n - i) % 2 == 0 && i / 2 != (n - i) / 2) x++;     }     printf( %d n , x);   }