malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n, k;   int judge(int n) {     if (n == 2 || n == 3) return 1;     for (int i = 2; i <= sqrt(n); i++)       if (n % i == 0) return 0;     return 1;   }   int main() {     int i, j, m;     scanf( %d , &n);     if (judge(n))       printf( 1 n%d n , n);     else if (judge(n - 2))       printf( 2 n2 %d n , n - 2);     else if (judge(n - 4))       printf( 3 n2 2 %d n , n - 4);     else {       for (i = n - 2; i >= n - 300 && i >= 1; i--)         if (judge(i)) {           k = i;           m = n - i;           break;         }       for (j = 2; j <= m; j++) {         if (judge(j) && judge(m - j)) {           printf( 3 n%d %d %d n , k, j, n - i - j);           break;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 10;   const int MOD = 1e9 + 7;   int n, revfact[N << 1], fact[N << 1];   int mul(int, int);   int sum(int, int);   int pow(int, int);   int choose(int, int);   int32_t main() {     cin >> n;     fact[0] = 1;     for (int i = 1; i < 2 * n + 3; i++) fact[i] = mul(fact[i - 1], i);     for (int i = 0; i < 2 * n + 3; i++) revfact[i] = pow(fact[i], MOD - 2);     int res = choose((2 * n) + 2, n + 1) - 1;     if (res < 0) res += MOD;     cout << res << endl;   }   int mul(int a, int b) { return 1LL * a * b % MOD; }   int sum(int a, int b) {     int c = a + b;     if (c >= MOD) c -= MOD;     return c;   }   int pow(int n, int md) {     int res = 1;     for (; md; md /= 2) {       if (md % 2 == 1) res = mul(res, n);       n = mul(n, n);     }     return res;   }   int choose(int m, int k) {     return mul(fact[m], mul(revfact[k], revfact[m - k]));   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a, b, x, t = 1, y;     cin >> a >> b;     x = abs(a - b);     if (x % 2 != 0) t = 0;     x = (x / 2);     y = (x * (x + 1)) / 2;     y *= 2;     if (!t) x++, y += x;     cout << y << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   using ll = long long;   using ld = long double;   const int MOD = 1e9 + 7, inf = 1e9, N = 2e5 + 1;   const ll INF = 1e18;   ld tic, tac;   void solve() {     int n, count = 0;     cin >> n;     int i, a[n];     for (i = 0; i < n; i++) {       cin >> a[i];       if (a[i] == 1) count++;     }     cout << count <<   n ;     for (i = 1; i < n; i++) {       if (a[i] == 1) {         cout << a[i - 1] <<     ;       }     }     cout << a[n - 1] <<   n ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     t = 1;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 1000100;   const int off = 1 << 19;   const int inf = 1e9;   int a[MAX], s[MAX], c[MAX];   pair<int, int> T[2 * off];   int n, k;   pair<int, int> getmax(int i, int lo, int hi, int a, int b) {     if (lo >= b || hi <= a) return {-inf, -1};     if (lo >= a && hi <= b) return T[i];     return max(getmax(i * 2, lo, (lo + hi) / 2, a, b),                getmax(i * 2 + 1, (lo + hi) / 2, hi, a, b));   }   long long solve(int lo, int hi) {     if (lo >= hi) {       for (int i = lo; i <= hi; ++i) c[s[i]]--;       return 0;     }     int m = getmax(1, 0, off, lo, hi).second;     assert(m != -1);     long long ans = 0;     if (hi - m < m - lo) {       for (int i = m + 1; i <= hi; ++i) c[s[i]]--;       for (int i = m + 1; i <= hi; ++i) ans += c[(s[i] - (a[m] % k) + k) % k];       ans--;       ans += solve(lo, m);       for (int i = m + 1; i <= hi; ++i) c[s[i]]++;       ans += solve(m + 1, hi);     } else {       for (int i = lo; i <= m; ++i) c[s[i]]--;       for (int i = lo; i <= m; ++i) ans += c[(s[i] + a[m]) % k];       ans--;       ans += solve(m + 1, hi);       for (int i = lo; i <= m; ++i) c[s[i]]++;       ans += solve(lo, m);     }     return ans;   }   int main(void) {     scanf( %d %d , &n, &k);     for (int i = (0); i < (n); ++i) scanf( %d , a + i);     s[0] = 0;     for (int i = (0); i < (n); ++i) s[i + 1] = (s[i] + a[i]) % k;     for (int i = (0); i < (n + 1); ++i) c[s[i]]++;     for (int i = (0); i < (n); ++i) T[off + i] = {a[i], i};     for (int i = off - 1; i > 0; --i) T[i] = max(T[i * 2], T[i * 2 + 1]);     long long ans = solve(0, n);     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 500005;   const int inf = 100000000;   struct elem {     long long val;     int l, r;   };   struct V {     long long val;     int ind;   };   bool compare(V x, V y) {     if (x.val < y.val) return true;     if (x.val == y.val && x.ind < y.ind) return true;     return false;   }   V a[MAXN];   elem L[MAXN];   int main() {     int N;     cin >> N;     for (int i = 1; i <= N; i++) {       cin >> a[i].val;       a[i].ind = i;       L[i].val = a[i].val;       L[i].l = i - 1;       L[i].r = i + 1;     }     int GlobalLeft = 1;     int GlobalRight = N;     sort(a + 1, a + N + 1, compare);     long long ans = 0;     a[N + 1].val = inf;     int pntL = 1, pntR = 1;     int Left = N;     while (pntL <= N && Left > 2) {       pntR = pntL;       while (a[pntR].val == a[pntL].val) pntR++;       int NextL = pntR;       pntR--;       while (pntL <= pntR && a[pntL].ind == GlobalLeft && Left > 2) {         ans += L[GlobalLeft].val;         GlobalLeft = L[GlobalLeft].r;         pntL++;         Left--;       }       while (pntL <= pntR && a[pntR].ind == GlobalRight && Left > 2) {         ans += L[GlobalRight].val;         GlobalRight = L[GlobalRight].l;         pntR--;         Left--;       }       while (pntL <= pntR && Left > 2) {         ans += min(L[L[a[pntL].ind].l].val, L[L[a[pntL].ind].r].val);         L[L[a[pntL].ind].l].r = L[a[pntL].ind].r;         L[L[a[pntL].ind].r].l = L[a[pntL].ind].l;         pntL++;         Left--;       }       pntL = NextL;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Edge {     int u, v;     int c;     int w;     int id;     bool use;   };   bool operator<(const Edge& l, const Edge& r) { return l.w < r.w; }   class Node {     int depth;     pair<int, int> w;     Node* parent;       public:     Node() : depth(0), w(0, -1), parent(nullptr) {}     static pair<int, int> merge(Node* a, Node* b, int W, int id) {       pair<int, int> mx = {-1, -1};       while ((a->parent || b->parent) && a != b) {         if (!b->parent || a->parent && a->depth <= b->depth) {           mx = max(mx, a->w);           a = a->parent;         } else {           mx = max(mx, b->w);           b = b->parent;         }       }       if (a == b) return {W - mx.first, mx.second};       if (a->depth < b->depth) swap(a, b);       b->parent = a;       b->w.first = W;       b->w.second = id;       a->depth = max(a->depth, b->depth + 1);       return {0, -id};     }   };   int main(int argc, const char* argv[]) {     int N, M;     std::vector<int> W, C;     int S;     scanf( %d%d , &N, &M);     W.resize(M);     C.resize(M);     for (auto&& x : W) scanf( %d , &x);     for (auto&& x : C) scanf( %d , &x);     vector<Edge> edges(M);     for (int i = 0; i < M; i++) {       Edge& e = edges[i];       scanf( %d %d , &e.u, &e.v);       e.u--;       e.v--;       e.c = C[i];       e.w = W[i];       e.id = i + 1;     }     scanf( %d , &S);     sort((edges).begin(), (edges).end());     vector<Node> nodes(N);     int best = 1 << 30;     int exc = -1;     const Edge* useE = nullptr;     long long sumw = 0;     for (auto&& e : edges) {       pair<int, int> r = Node::merge(&nodes[e.u], &nodes[e.v], e.w, e.id);       if (r.second < 0) {         e.use = true;         sumw += e.w;         r.second = -r.second;       } else {         e.use = false;       }       int bonus = r.first - S / e.c;       if (bonus < best) {         best = bonus;         exc = r.second;         useE = &e;       }     }     printf(          %I64d            n ,         sumw + best);     for (auto&& e : edges)       if (e.use && e.id != exc) printf( %d %d n , e.id, e.w);     printf( %d %d n , useE->id, useE->w - S / useE->c);     return 0;   }
#include <bits/stdc++.h>   int star[100005];   int scnt;   int pack[100005];   int pcnt;   int unit(int x) {     if (x > 0) return x;     return 0;   }   int check(int time) {     int i;     int sat = 0;     for (i = 1; i <= pcnt; i++) {       if (sat >= star[scnt]) return 1;       int l = 1, r = scnt, mid, idx;       while (l <= r) {         mid = (l + r) / 2;         if (star[mid] > sat) {           idx = mid;           r = mid - 1;         } else           l = mid + 1;       }       if (star[idx] < pack[i]) {         if (pack[i] - star[idx] > time) return 0;         int t = pack[i] - star[idx];         sat = pack[i] + unit(time - 2 * t);         if (sat < pack[i] + (time - t) / 2) sat = pack[i] + (time - t) / 2;       } else         sat = pack[i] + time;     }     if (sat >= star[scnt]) return 1;     return 0;   }   int main(void) {     int n;     char tmp[100005];     scanf( %d , &n);     scanf( %s , &tmp[1]);     int i;     for (i = 1; i <= n; i++) {       if (tmp[i] ==  * ) star[++scnt] = i;       if (tmp[i] ==  P ) pack[++pcnt] = i;     }     int l = 1, r = 2 * n - 1, mid, ans;     while (l <= r) {       mid = (l + r) / 2;       if (check(mid)) {         ans = mid;         r = mid - 1;       } else         l = mid + 1;     }     printf( %d , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int mxN = 2e5;   int n, a[mxN], k;   void solve() {     long long n;     cin >> n;     if (n == 0) {       cout << 1 << endl;       return;     }     if (n % 4 == 1) {       cout << 8 << endl;     } else if (n % 4 == 2) {       cout << 4 << endl;     } else if (n % 4 == 3) {       cout << 2 << endl;     } else if (n % 4 == 0) {       cout << 6 << endl;     }   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     solve();   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   long long x, a[N], b[N];   long long n, k;   int main() {     cin >> n >> k;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     sort(a + 1, a + 1 + n);     b[1] = a[1];     int j = 2;     for (int i = 2; i <= n; i++) {       if (a[i] != a[i - 1]) {         b[j] = a[i] - a[i - 1];         j++;       }     }     for (int i = 1; i <= k; i++) {       cout << b[i] <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 100;   int a[maxn];   long long dp[maxn][2];   int get1(long long n) {     int sum = 0;     while (n != 0) {       if ((n & 1) == 1) sum += 1;       n >>= 1;     }     return sum;   }   int main() {     int N;     cin >> N;     for (int i = 1; i <= N; i++) {       long long x;       cin >> x;       a[i] = get1(x);     }     dp[0][0] = 0;     dp[0][1] = 0;     dp[1][0] = 0;     dp[1][1] = 0;     for (int i = 2; i <= N; i++) {       if (a[i] & 1) {         dp[i][0] = dp[i - 1][1] + (a[i - 1] & 1);         dp[i][1] = dp[i - 1][0] + !(a[i - 1] & 1);       } else {         dp[i][0] = dp[i - 1][0] + !(a[i - 1] & 1);         dp[i][1] = dp[i - 1][1] + (a[i - 1] & 1);       }     }     long long ans = 0;     for (int i = 2; i <= N; i++) {       int L = max(1, i - 120);       int sum = a[i];       int pmax = a[i];       int res = 0;       for (int j = i - 1; j >= L; j--) {         pmax = max(pmax, a[j]);         sum += a[j];         if (sum & 1) continue;         if (pmax > sum / 2) res += 1;       }       ans += dp[i][0] - res;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   namespace chu_xuan {   void swap(int &a, int &b) {     register int tmp = a;     a = b, b = tmp;   }   void read(long long &a) {     a = 0;     int b = 1, c = getchar();     while (c >  9  || c <  0 ) {       if (c ==  - ) b = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) a = (a << 3) + (a << 1) + c - 48, c = getchar();     a *= b;   }   int In() {     int a = 0, b = 1, c = getchar();     while (c >  9  || c <  0 ) {       if (c ==  - ) b = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) a = (a << 3) + (a << 1) + c - 48, c = getchar();     return a * b;   }   int max(int a, int b) { return a > b ? a : b; }   int min(int a, int b) { return a > b ? b : a; }   }  // namespace chu_xuan   using namespace chu_xuan;   const int N = 3e5;   long long n, a[N];   long long ans;   int main() {     read(n);     for (int i = 0; i < n; i++) read(a[i]);     sort(a, a + n);     for (int i = 0; i < n / 2; i++) {       ans += (a[i] + a[n - i - 1]) * (a[i] + a[n - i - 1]);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   long long fastpow(int b, int e) {     if (!e) return 1;     if (e & 1) return b * fastpow(b, e - 1);     long long temp = fastpow(b, e / 2);     return temp * temp;   }   int notwork(char a, char b) {     set<char> s;     s.insert(a);     s.insert(b);     if (a == b && a ==  o ) return 0;     if (a == b && a ==  A ) return 0;     if (a == b && a ==  v ) return 0;     if (a == b && a ==  V ) return 0;     if (a == b && a ==  I ) return 0;     if (a == b && a ==  H ) return 0;     if (a == b && a ==  O ) return 0;     if (a == b && a ==  M ) return 0;     if (a == b && a ==  x ) return 0;     if (a == b && a ==  X ) return 0;     if (a == b && a ==  Y ) return 0;     if (a == b && a ==  w ) return 0;     if (a == b && a ==  W ) return 0;     if (a == b && a ==  U ) return 0;     if (a == b && a ==  T ) return 0;     if (s.count( b ) && s.count( d )) return 0;     if (s.count( p ) && s.count( q )) return 0;     return 1;   }   int midwork(char a) {     char arr[] = { U ,  T ,  W ,  w ,  Y ,  x ,  X ,  M ,                    o ,  O ,  H ,  I ,  v ,  V ,  A };     for (int i = 0; i < 15; i++)       if (arr[i] == a) return 1;     return 0;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> s;     int len = s.length();     int mid = len / 2;     if (s.length() & 1 == 0) mid++;     if (len & 1) {       if (!midwork(s[mid])) return cout <<  NIE , 0;     }     for (int i = 0, j = len - 1; i < mid; i++, j--) {       if (notwork(s[i], s[j])) return cout <<  NIE , 0;     }     cout <<  TAK ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct chess {     bool used;     int x, y;     char p;   } up, down, Left, Right, up_Left, up_Right, down_Left, down_Right;   int n, kx, ky;   void add(int x, int y, char c) {     if (x == kx) {       if (y < ky) {         if (!Left.used || y > Left.y) {           Left.x = x;           Left.y = y;           Left.p = c;           Left.used = true;         }       } else {         if (!Right.used || y < Right.y) {           Right.x = x;           Right.y = y;           Right.p = c;           Right.used = true;         }       }     }     if (y == ky) {       if (x < kx) {         if (!up.used || x > up.x) {           up.x = x;           up.y = y;           up.p = c;           up.used = true;         }       } else {         if (!down.used || x < down.x) {           down.x = x;           down.y = y;           down.p = c;           down.used = true;         }       }     }     if (x - y == kx - ky) {       if (x < kx) {         if (!up_Left.used || x > up_Left.x) {           up_Left.x = x;           up_Left.y = y;           up_Left.p = c;           up_Left.used = true;         }       } else {         if (!down_Right.used || x < down_Right.x) {           down_Right.x = x;           down_Right.y = y;           down_Right.p = c;           down_Right.used = true;         }       }     }     if (x + y == kx + ky) {       if (x < kx) {         if (!up_Right.used || x > up_Right.x) {           up_Right.x = x;           up_Right.y = y;           up_Right.p = c;           up_Right.used = true;         }       } else {         if (!down_Left.used || x < down_Left.x) {           down_Left.x = x;           down_Left.y = y;           down_Left.p = c;           down_Left.used = true;         }       }     }   }   bool check() {     if (up.p ==  R  || up.p ==  Q  || down.p ==  R  || down.p ==  Q ) return true;     if (Left.p ==  R  || Left.p ==  Q  || Right.p ==  R  || Right.p ==  Q )       return true;     if (up_Right.p ==  B  || up_Right.p ==  Q  || up_Left.p ==  B  ||         up_Left.p ==  Q )       return true;     if (down_Right.p ==  B  || down_Right.p ==  Q  || down_Left.p ==  B  ||         down_Left.p ==  Q )       return true;     return false;   }   int main() {     int x, y;     ios::sync_with_stdio(false);     cin.tie(0);     char c;     cin >> n >> kx >> ky;     for (int i = 0; i < n; i++) {       cin >> c >> x >> y;       add(x, y, c);     }     if (check())       cout <<  YES ;     else       cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long x;     cin >> x;     for (long long i = 0; i <= 1000; i++) {       for (long long j = 0; j <= 10000; j++) {         long long g = i * 1234567 + j * 123456;         long long m = (x - g) / 1234;         double l = (double)((x - g) / 1234);         long long d = (long long)(l);         if (m == d && m >= 0 && g + m * 1234 == x) {           cout <<  YES  << endl;           return 0;         }       }     }     cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2007;   const int mod = 1e9 + 7;   int n, m;   int dp[maxn][maxn][2], block[maxn][maxn][2], sum[maxn][maxn][2], vec[maxn][2];   char s[maxn][maxn];   int calc(int u, int v, int w) {     if (w == 0) {       for (; vec[v][1] < u; ++vec[v][1]) {         if (block[vec[v][1] + 1][v][1] <= n - u) break;       }       return (sum[u - 1][v][1] - sum[vec[v][1] - 1][v][1] + mod) % mod;     } else {       for (; vec[u][0] < v; ++vec[u][0]) {         if (block[u][vec[u][0] + 1][0] <= m - v) break;       }       return (sum[u][v - 1][0] - sum[u][vec[u][0] - 1][0] + mod) % mod;     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     cin >> n >> m;     if (n == 1 && m == 1) {       cout << 1 << endl;       return 0;     }     for (int i = 1; i <= max(n, m); ++i) {       vec[i][0] = vec[i][1] = 1;     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         cin >> s[i][j];         if (s[i][j] ==  R ) block[i + 1][j + 1][0] = block[i + 1][j + 1][1] = 1;       }     }     for (int i = 0; i <= n; ++i) {       for (int j = m; j > 0; --j) {         block[i][j - 1][0] += block[i][j][0];       }     }     for (int j = 0; j <= m; ++j) {       for (int i = n; i > 0; --i) {         block[i - 1][j][1] += block[i][j][1];       }     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         if (i == 0 && j == 0) {           dp[0][0][0] = dp[0][0][1] = 1;           sum[1][1][0] = sum[1][1][1] = 1;           continue;         }         dp[i][j][0] = calc(i + 1, j + 1, 0);         dp[i][j][1] = calc(i + 1, j + 1, 1);         sum[i + 1][j + 1][0] = (sum[i + 1][j][0] + dp[i][j][0]) % mod;         sum[i + 1][j + 1][1] = (sum[i][j + 1][1] + dp[i][j][1]) % mod;       }     }     printf( %d n , (dp[n - 1][m - 1][0] + dp[n - 1][m - 1][1]) % mod);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   long long k, p;   long long getZCY(long long x) {     long long res = x;     while (x) {       res *= 10LL;       res += x % 10;       x /= 10;     }     return res;   }   int main() {     scanf( %I64d , &k);     scanf( %I64d , &p);     long long ans = 0;     for (int i = (1); i <= (int)(k); ++i) {       ans += getZCY(i);       ans %= p;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> neigh[200009];   int ans[200009];   int a[200009];   int b[200009];   int c[200009];   int f[200009];   int Q[200009];   int L, R;   int main() {     int n, m;     scanf( %d %d , &n, &m);     for (int i = 0; i < m; i++) {       scanf( %d %d %d , &a[i], &b[i], &c[i]);       f[a[i]] += c[i];       f[b[i]] += c[i];       neigh[a[i]].push_back(i);       neigh[b[i]].push_back(i);     }     f[1] = f[n] = 0;     for (int i = 2; i <= n - 1; i++) f[i] /= 2;     Q[R++] = 1;     while (L < R) {       int cur = Q[L++];       for (int i = 0; i < neigh[cur].size(); i++) {         int u;         if (cur == a[neigh[cur][i]])           u = b[neigh[cur][i]];         else           u = a[neigh[cur][i]];         if (u != n && f[u] == 0) continue;         if (u == a[neigh[cur][i]]) ans[neigh[cur][i]] = 1;         f[u] -= c[neigh[cur][i]];         if (u != n && f[u] == 0) Q[R++] = u;       }     }     for (int i = 0; i < m; i++) printf( %d n , ans[i]);   }
#include <bits/stdc++.h>   using namespace std;   long long modpow(long long base, long long exp, long long modulus) {     base %= modulus;     long long result = 1;     while (exp > 0) {       if (exp & 1) result = (result * base) % modulus;       base = (base * base) % modulus;       exp >>= 1;     }     return result;   }   long long n;   long long a[100005];   long long dp[5004][5005];   long long bin(long long lo, long long hi, long long val) {     long long ans = -1;     while (lo <= hi) {       long long mid = (lo + hi) / 2;       if (a[mid] >= val) {         ans = mid;         hi = mid - 1;       } else {         lo = mid + 1;       }     }     return ans;   }   long long doit(long long prev, long long curr, int flag) {     if (curr == n + 1) return 0;     if (dp[prev][curr] != -1) return dp[prev][curr];     long long ans = 0;     long long y = 100009;     long long x = 1 + doit(prev, curr + 1, flag);     long long val = a[curr - 1] - a[prev - 1] + a[curr - 1];     long long ind = bin(curr, n, val);     if (ind != -1) {       y = doit(curr, ind + 1, flag) + (ind - curr);     }     ans = min(x, y);     dp[prev][curr] = ans;     return ans;   }   int main() {     scanf( %lld , &n);     memset(dp, -1, sizeof(dp));     for (int i = 1; i <= n; i++) {       scanf( %lld , &a[i]);       a[i] = a[i] + a[i - 1];     }     long long ans = doit(1, 2, 0);     cout << ans;     printf(  n );     ;     return 0;   }