malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e+7;   const int N = 1e5 + 5;   long long pwr(long long x, long long y);   long long a[N];   vector<long long> v;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n, m, k;     cin >> n >> m >> k;     for (int i = 0; i < m; i++) {       cin >> a[i];       v.push_back(a[i]);     }     long long ans = 0, l = k;     long long cur = 0, pre = 0;     while (pre < m) {       cur = (upper_bound(v.begin(), v.end(), l) - v.begin());       if (cur == pre) {         long long po = (v[cur] - l) / k;         l += (long long)(po + bool((v[cur] - l) % k)) * k;       } else {         l += (cur - pre);         ans++;       }       pre = cur;     }     cout << ans << endl;     return 0;   }   long long pwr(long long x, long long y) {     long long ans = 1;     x = x % mod;     while (y > 0) {       if (y & 1) ans = (x * (ans % mod)) % mod;       x = (x * x) % mod;       y = y / 2;     }     return ans % mod;   }
#include <bits/stdc++.h>   using namespace std;   long long b[60005], c[60005];   signed main() {     long long a;     scanf( %lld , &a);     long long MIN = LLONG_MAX / 3, MAX = 0;     for (long long d = 0; d < a; d++) {       scanf( %lld , &b[d]);       MIN = min(MIN, b[d]);       MAX = max(MAX, b[d]);     }     for (long long d = 0; d < a; d++) {       scanf( %lld , &c[d]);     }     double s = MIN, g = MAX;     for (long long i = 0; i < 10000; i++) {       double k = (s + g) / 2;       double n = -1;       bool t = false;       for (long long j = 0; j < a; j++) {         double m = abs(k - b[j]) / (double)c[j];         if (m > n) {           if (b[j] > k)             t = true;           else             t = false;           n = m;         }       }       if (i == 9999) {         printf( %.15lf n , n);       }       if (t)         s = k;       else         g = k;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a[101], b[101], c[101], i;     cin >> n;     for (i = 0; i < n; i++) cin >> a[i];     for (i = 0; i < n; i++) cin >> b[i];     for (i = 0; i < n; i++)       if (a[i] <= b[i]) c[i] = 1;     int bs = 0, rc = 0, sett;     for (i = 0; i < n; i++)       if (a[i] > b[i])         rc++;       else if (a[i] < b[i])         bs++;     if (rc == 0)       cout <<  -1 ;     else       cout << bs / rc + 1;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, k;     cin >> n >> k;     vector<long long> a;     vector<long long> b;     long long sum;     if (k + 1 < n) {       sum = k + 1;       b.push_back(sum);     } else {       for (long long i = 0; i < n; i++) {         cout << n <<    ;       }       return 0;     }     for (long long i = 0; i < n; i++) {       long long te;       cin >> te;       te--;       a.push_back(te);     }     for (long long i = 1; i < n; i++) {       long long re = 0;       if (a[i] > -1) {         if (a[i] + k > i) {           if (a[i] + k < n) {             re = a[i] + k - i;           } else {             re = n - i - 1;           }         }         if (a[i] + k < i) {           sum = 1;         } else {           sum = 0;         }         if (sum) {           if (i - k > a[i] + k) {             sum += k;           } else {             sum += i - 1 - (a[i] + k);           }         }         sum += b[a[i]];       } else {         sum = 1;         if (i - k > -1) {           sum += k;         } else {           sum += i;         }       }       if (i + k < n) {         sum += k - re;       } else {         sum += n - 1 - i - re;       }       b.push_back(sum);     }     for (long long i = 0; i < n; i++) {       cout << b[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     long long int a[n];     for (int i = 0; i < n; i++) {       scanf( %lld , &a[i]);     }     int m;     cin >> m;     long long int b[m];     for (int i = 0; i < m; i++) {       scanf( %lld , &b[i]);     }     int i = 0, j = 0, ans = 0;     while (i < n && j < m) {       if (a[i] == b[j]) {         i++;         j++;         ans++;       } else if (a[i] > b[j]) {         j++;         if (j < m) {           b[j] += b[j - 1];         }       } else {         i++;         if (i < n) {           a[i] += a[i - 1];         }       }     }     if (i != n || j != m) {       ans = -1;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int c[100], w[2000], q[2000];     int b[100];     for (int i = 0; i <= 20; i++) {       q[i] = 0;       b[i] = 0;       c[i] = 0;     }     for (int i = 5; i <= 9; i++) {       cin >> c[i];     }     int n = 0;     string a;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a;       if (a ==  S ) {         b[1]++;         q[i] = 5;       }       if (a ==  M ) {         b[2]++;         q[i] = 6;       }       if (a ==  L ) {         b[3]++;         q[i] = 7;       }       if (a ==  XL ) {         b[4]++;         q[i] = 8;       }       if (a ==  XXL ) {         b[5]++;         q[i] = 9;       }     }     for (int i = 0; i <= 20; i++) w[i] = 0;     for (int i = 1; i <= n; i++) {       if (c[q[i]] != 0) {         w[i] = 0;         c[q[i]]--;       } else {         if (c[q[i] + 1] != 0) {           w[i] = 1;           c[q[i] + 1]--;         } else {           if (c[q[i] - 1] != 0) {             w[i] = -1;             c[q[i] - 1]--;           } else {             if (c[q[i] + 2] != 0) {               w[i] = 2;               c[q[i] + 2]--;             } else {               if (c[q[i] - 2] != 0) {                 w[i] = -2;                 c[q[i] - 2]--;               } else {                 if (c[q[i] + 3] != 0) {                   w[i] = 3;                   c[q[i] + 3]--;                 } else {                   if (c[q[i] - 3] != 0) {                     w[i] = -3;                     c[q[i] - 3]--;                   } else {                     if (c[q[i] + 4] != 0) {                       w[i] = 4;                       c[q[i] + 4]--;                     } else {                       if (c[q[i] - 4] != 0) {                         w[i] = -4;                         c[q[i] - 4]--;                       }                     }                   }                 }               }             }           }         }       }     }     for (int i = 1; i <= n; i++) {       w[i] += q[i];     }     for (int i = 1; i <= n; i++) {       if (w[i] == 5) cout <<  S  << endl;       if (w[i] == 6) cout <<  M  << endl;       if (w[i] == 7) cout <<  L  << endl;       if (w[i] == 8) cout <<  XL  << endl;       if (w[i] == 9) cout <<  XXL  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int X[1000000], F[100000], i, j, x, y, k, N = 1000000;   int main() {     int n;     cin >> n;     for (i = 1; i < N; i++) X[i] = 1;     for (i = 2; i < N; i++)       if (X[i] == 1) {         j = i + i;         while (j < N) {           X[j] = 0;           j += i;         }       }     for (i = 2; i < N; i++)       if (X[i] == 1) {         x = i;         y = 0;         while (x > 0) {           y *= 10;           y += (x % 10);           x /= 10;         }         if ((X[y] == 1) && (i != y)) {           k++;           F[k] = i;         }       }     cout << F[n] << endl;   }
#include <bits/stdc++.h>   int main() {     int n, h, a, b, t, f;     int t1, f1, t2, f2;     int sum;     while (~scanf( %d%d%d%d%d , &n, &h, &a, &b, &t)) {       while (t--) {         sum = 0;         scanf( %d%d%d%d , &t1, &f1, &t2, &f2);         if (t1 > t2) {           f = t1;           t1 = t2;           t2 = f;         }         if (f1 > f2) {           f = f1;           f1 = f2;           f2 = f;         }         if (t1 == t2)           sum = f2 - f1;         else if (f1 > b && f2 > b)           sum = (f1 - b) + (f2 - b) + t2 - t1;         else if (f1 < a && f2 < a)           sum = (a - f1) + (a - f2) + t2 - t1;         else           sum = f2 - f1 + t2 - t1;         printf( %d n , sum);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 1, LOGN = 20;   vector<pair<int, long long> > adj[N];   long long a[N], dis[N];   int lca[N][LOGN];   int upd[N];   void dfs1(int u, long long d = 0, int par = 0) {     dis[u] = d;     lca[u][0] = par;     for (int i = 1; i < LOGN; i++) lca[u][i] = lca[lca[u][i - 1]][i - 1];     long long del = dis[u] - a[u];     int v = u;     for (int i = LOGN - 1; i >= 0; i--) {       if (dis[lca[v][i]] >= del) v = lca[v][i];     }     if (v != 0) {       v = lca[v][0];       upd[v]--;     }     for (auto& ch : adj[u]) {       dfs1(ch.first, d + ch.second, u);       upd[u] += upd[ch.first];     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n - 1; i++) {       int p, w;       cin >> p >> w;       adj[p - 1].emplace_back(i + 1, w);     }     fill(upd, upd + n, 1);     dfs1(0);     for (int i = 0; i < n; i++) cout << upd[i] - 1 <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 7;   const int inf = INT_MAX;   const long long inff = 1e18;   const long long mod = 1e9 + 7;   int n, m, x, y;   int a[maxn], p[maxn];   int b[maxn];   int dp1[maxn], dp2[maxn];   vector<int> v;   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     for (int i = 1; i <= n; i++) {       cin >> x >> y;       p[x]++;       p[y + 1]--;     }     for (int i = 1; i <= m; i++) a[i] = a[i - 1] + p[i], b[m - i + 1] = a[i];     for (int i = 1; i <= m; i++) {       auto now = upper_bound((v).begin(), (v).end(), a[i]);       if (now == v.end())         v.push_back(a[i]);       else         v[now - v.begin()] = a[i];       dp1[i] = ((int)(v).size());     }     v.clear();     for (int i = 1; i <= m; i++) {       auto now = upper_bound((v).begin(), (v).end(), b[i]);       if (now == v.end())         v.push_back(b[i]);       else         v[now - v.begin()] = b[i];       dp2[i] = ((int)(v).size());     }     int ans = 0;     for (int i = 0; i <= m; i++) ans = max(ans, dp1[i] + dp2[m - i]);     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e6 + 10;   const long long int md = 1e9 + 7;   long long int n, fac[MAXN], invf[MAXN];   inline long long int inv(long long int a, long long int b = 1e9 + 5ll) {     long long int k = 1ll;     while (b) {       if (b & 1) k = (k * a) % md;       a = (a * a) % md;       b /= 2ll;     }     return k;   }   inline long long int ch(long long int a, long long int b) {     return ((((invf[b] * invf[a - b]) % md) * fac[a]) % md);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     fac[0] = 1ll;     invf[0] = 1ll;     cin >> n;     for (long long int i = 1ll; i < MAXN; i++)       fac[i] = (fac[i - 1] * i) % md, invf[i] = inv(fac[i]);     long long int ans = inv(2ll, 2ll * n + 1ll);     ans--;     ans = (ans + md) % md;     long long int bad = 0ll;     for (long long int i = n + 1; i <= 2ll * n; i++) {       long long int tmp = (2ll * ch(i - 1ll, n)) % md;       tmp += ((2ll * bad) % md);       tmp %= md;       ans = (((ans - tmp) % md) + md) % md;       bad = tmp;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool seen[100005], x[100005];   vector<int> g[100005], ans;   inline void add(int u) { ans.push_back(u + 1), x[u] ^= 1; }   void dfs(int u, int p) {     seen[u] = true;     add(u);     for (auto v : g[u])       if (v != p && !seen[v]) dfs(v, u), add(u);     if (x[u]) {       if (p != -1)         add(p), add(u);       else         x[u] = 0, ans.pop_back();     }   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (auto i = (0); i < m; i++) {       int u, v;       scanf( %d%d , &u, &v);       u--, v--;       g[u].push_back(v), g[v].push_back(u);     }     for (auto i = (0); i < n; i++) scanf( %d , x + i);     for (auto i = (0); i < n; i++)       if (x[i]) {         dfs(i, -1);         break;       }     for (auto i = (0); i < n; i++)       if (x[i]) {         printf( -1 );         return 0;       }     printf( %d n , ans.size());     for (auto u : ans) printf( %d  , u);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool compare(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }   int main() {     int maxz, tempbuff, tempbuff2;     cin >> maxz;     vector<pair<int, int>> z;     for (int i = 0; i < maxz; i++) {       cin >> tempbuff >> tempbuff2;       z.push_back(make_pair(tempbuff, tempbuff2));     }     sort(z.begin(), z.end(), compare);     for (int i = 0; i < maxz - 1; i++) {       if (z[i].first > z[i + 1].first) {         cout <<  Happy Alex ;         return 0;       }     }     cout <<  Poor Alex ;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   template <typename T>   T sqr(T a) {     return a * a;   }   template <typename T>   int sign(T a) {     if (a == 0) return 0;     return (a > 0 ? 1 : -1);   }   template <typename T1, typename T2>   T2 sum_mod(T1 x, T2 MOD) {     if (x < 0) x += MOD;     if (x >= MOD) x -= MOD;     return x;   }   template <typename T1, typename T2>   T2 mul_mod(T1 x, T2 MOD) {     if (x < 0) return (abs(x) % MOD == 0 ? 0 : MOD - abs(x) % MOD);     return x % MOD;   }   template <typename T>   bool uax(T& a, const T b) {     if (a < b) {       a = b;       return true;     }     return false;   }   template <typename T>   bool uin(T& a, const T b) {     if (a > b) {       a = b;       return true;     }     return false;   }   template <typename T1, typename T2>   istream& operator>>(istream& in, pair<T1, T2>& p) {     in >> p.first >> p.second;     return in;   }   template <typename T1, typename T2>   ostream& operator<<(ostream& out, pair<T1, T2>& p) {     out << p.first <<     << p.second;     return out;   }   const int LOG = 18;   const int N = (int)1e5 + 7;   const int MAXN = (int)2e3 + 7;   const int MOD = (int)998244353;   const int INF = (int)1e9 + 7;   const int CONST = 300;   const long long LINF = (int64_t)2e15;   const long double PI = 3.1415926535897932384626433832795;   const long double EPS = 1;   string a[3];   vector<int> zfunc(const string& a, const string& b) {     string s = a +  #  + b;     int n = (int)s.size();     vector<int> z(n);     int l = 0, r = 0;     for (int i = 1; i < n; i++) {       if (i <= r) z[i] = min(z[i - l], r - i + 1);       while (i + z[i] < n && s[z[i]] == s[i + z[i]]) z[i]++;       if (i + z[i] > r) l = i, r = i + z[i] - 1;     }     return z;   }   string unite(const string& a, const string& b) {     auto v = zfunc(b, a);     string res = a;     for (int i = (int)b.size() + 1; i <= (int)a.size() + (int)b.size(); i++) {       if (v[i] >= (int)b.size()) return res;       if (v[i] + i == (int)a.size() + (int)b.size() + 1) {         res += b.substr(v[i], (int)b.size() - v[i]);         return res;       }     }     return a + b;   }   int get(const string& a, const string& b, const string& c) {     string s = unite(a, b);     s = unite(s, c);     return (int)s.size();   }   int main() {     double start = clock();     cout << fixed << setprecision(20);     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> a[0] >> a[1] >> a[2];     vector<int> perm = {0, 1, 2};     int ans = INF;     do {       uin(ans, get(a[perm[0]], a[perm[1]], a[perm[2]]));     } while (next_permutation(perm.begin(), perm.end()));     cout << ans;   }
#include <bits/stdc++.h>      /*   ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);   int t;   cin >> t;   while(t--) solve();   */   using namespace std;      typedef long long ll;   typedef long double ld;      int magic(vector<int> &a, int del){       auto it = lower_bound(a.begin(), a.end(), del);       if(it == a.end()) return -1;       return *it;   }      void solve(){       int n;       cin >> n;       vector<int> a(n);       map<int, int> mp;       for(int i = 0;i < n;i++){           cin >> a[i];           mp[a[i]] = i + 1;       }       //sort(a.begin(), a.end());       int ans = 0;       for(int i = 2;i <= 2 * n;i++){           for(int j = 2;j * j <= i;j++){               if(i % j == 0){                   int v1 = j, v2 = i / j;                   if(mp[v1] == 0 || mp[v2] == 0 || (mp[v1] == mp[v2])) continue;                   if(mp[v1] + mp[v2] == i) ans++;                   //cout << v1 <<     << v2 <<   n                }           }              if(mp[i] != 0 && mp[1] != 0){               if(mp[i] + mp[1] == i) ans++;           }       }          cout << ans <<   n ;   }      int main(){       ios_base::sync_with_stdio(0);       cin.tie(0);       cout.tie(0);       int t;       cin >> t;       while(t--) solve();       return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long int i, j, n, m, k;     cin >> n;     long long int a[n];     for (i = 0; i < n; i++) {       cin >> a[i];     }     cin >> m;     long long int b[m];     for (i = 0; i < m; i++) {       cin >> b[i];     }     sort(a, a + n);     sort(b, b + m);     long long int c = 0;     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         if (abs(a[i] - b[j]) <= 1) {           b[j] = 1005;           c++;           break;         }       }     }     cout << c << endl;     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int tst, t = 1;     for (tst = 1; tst <= t; tst++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     vector<long long> a(n);     for (long long& v : a) cin >> v;     vector<long long> p(n);     for (long long& v : p) cin >> v;     int m;     cin >> m;     vector<long long> b(m);     for (long long& v : b) cin >> v;     vector<long long> cost(m + 1);     for (int i = 0; i < n; i++) {       int j = lower_bound(b.begin(), b.end(), a[i]) - b.begin();       if (j == m)         cost[m] += p[i];       else if (p[i] < 0) {         cost[j] += p[i];       }     }     vector<long long> dp(m + 1, 1e18);     dp[0] = 0;     for (int i = 0; i < n; i++) {       int j = lower_bound(b.begin(), b.end(), a[i]) - b.begin();       if (j == m) continue;       if (b[j] == a[i]) {         long long take_cost = 0;         if (p[i] < 0) take_cost = -p[i];         dp[j + 1] = min(dp[j + 1], dp[j] + cost[j] + take_cost);       }       if (p[i] > 0) {         cost[j] += p[i];       }     }     if (dp[m] > 1e17) {       cout <<  NO  << endl;       return 0;     }     cout <<  YES  << endl;     cout << dp[m] + cost[m] << endl;   }
#include <bits/stdc++.h>   double Pow(double x, int n) {     double ans = 1;     for (; n; n >>= 1) {       if (n & 1) ans *= x;       x *= x;     }     return ans;   }   int main() {     int n, m;     double ans = 0;     scanf( %d%d , &m, &n);     for (int i = 1; i < m; i++) ans += Pow((double)i / (double)m, n);     ans = (double)m - ans;     printf( %lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int i, j, m, n, c;     cin >> n >> c;     int ar[n];     for (i = 0; i < n; i++) {       cin >> ar[i];     }     long long int l = 1, h = n, mid;     long long int co = 0, res1 = 0, res2 = 0;     while (l <= h) {       co = 0;       mid = (l + h) / 2;       vector<long long int> v(n);       for (i = 0; i < n; i++) {         v[i] = ar[i] + mid * (i + 1);       }       sort(v.begin(), v.end());       for (i = 0; i < mid; i++) {         co = co + v[i];       }       if (co > c)         h = mid - 1;       else if (co <= c)         l = mid + 1, res1 = co, res2 = mid;     }     cout << res2 <<     << res1;   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());   const int N = 19;   int g[N];   unsigned long long dp[1 << N][N + 1];   unsigned long long ok[1 << N];   unsigned long long slen[N + 1][1 << N];   unsigned long long cur[N + 1][1 << N];   unsigned long long val[1 << N];   unsigned long long ans[1 << N];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         char c;         cin >> c;         if (c ==  1 ) {           g[i] |= (1 << j);         }       }     }     for (int i = 0; i < n; i++) {       dp[1 << i][i] = 1;     }     for (int mask = 0; mask < (1 << n); mask++) {       for (int i = 0; i < n; i++) {         int cands = g[i] & (~mask);         for (int j = 0; j < n; j++) {           if ((cands >> j) & 1) {             dp[mask | (1 << j)][j] += dp[mask][i];           }         }         ok[mask] += dp[mask][i];       }     }     for (int len = 1; len <= n; len++) {       for (int mask = 0; mask < (1 << n); mask++) {         if (__builtin_popcount(mask) == len) {           slen[len][mask] += ok[mask];         }       }       for (int i = 0; i < n; i++) {         for (int mask = 0; mask < (1 << n); mask++) {           if ((mask >> i) & 1) {             slen[len][mask] += slen[len][mask ^ (1 << i)];           }         }       }     }     map<vector<int>, vector<int> > ok;     for (int mask = 0; mask < (1 << (n - 1)); mask++) {       int x = 0;       vector<int> t;       while (x < n) {         int len = 1;         while ((mask >> x) & 1) {           x++;           len++;         }         t.push_back(len);         x++;       }       sort(t.begin(), t.end());       ok[t].push_back(mask);     }     vector<int> a;     for (int mask = 0; mask < (1 << n); mask++) val[mask] = 1;     function<void(int, int)> f = [&](int s, int last) {       if (s == n) {         unsigned long long ret = 0;         int x = (1 << n) - 1;         for (int mask = 0; mask < (1 << n); mask++) {           if (__builtin_popcount(mask) % 2 == 0)             ret += val[x ^ mask];           else             ret -= val[x ^ mask];         }         for (auto c : ok[a]) {           ans[c] += ret;         }         return;       }       if (s + last > n) {         return;       }       for (int mask = 0; mask < (1 << n); mask++) {         cur[s][mask] = val[mask];       }       for (int i = last; s + i <= n; i++) {         if (s + i != n && s + i + i > n) continue;         a.push_back(i);         for (int mask = 0; mask < (1 << n); mask++) {           val[mask] *= slen[i][mask];         }         f(s + i, i);         for (int mask = 0; mask < (1 << n); mask++) {           val[mask] = cur[s][mask];         }         a.pop_back();       }     };     f(0, 1);     for (int i = 0; i < (n - 1); i++) {       for (int mask = 0; mask < (1 << (n - 1)); mask++) {         if (!((mask >> i) & 1)) {           ans[mask] -= ans[mask + (1 << i)];         }       }     }     for (int mask = 0; mask < (1 << (n - 1)); mask++) {       cout << ans[mask] <<    ;     }     cout << endl;   }