malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;         void solve(){       int n; scanf( %d , &n);       if (n == 2){           printf( 1 n2 1 n1 n2 1 n );       }       else if (n == 3){           printf( 5 n2 3 1 n2 n1 3 n2 3 n );       }       else {           long long t = 0;           vector<int> ans;           vector<pair<int, int>> vc;           ans.push_back(n / 2 + 1);           for (int i = 3; i <= n / 2; ++i) ans.push_back(i);           ans.push_back(1);           for (int i = n / 2 + 2; i <= n; ++i) ans.push_back(i);           ans.push_back(2);           for (int i = 2; i <= n / 2; ++i){               vc.push_back({i, n});               t += (long long)(n - i) * (n - i);           }           for (int i = n / 2 + 1; i <= n; ++i){               vc.push_back({i, 1});               t += (long long)(i - 1) * (i - 1);           }           printf( %lld n , t);           for (int it : ans) printf( %d  , it);           printf(  n );           printf( %d n , n - 1);           for (auto it : vc){               printf( %d %d n , it.first, it.second);           }       }   }      int main(){       int T; scanf( %d , &T);       while (T--) solve();       return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, k;   long long bmm(long long x, long long y) {     if (y) return bmm(y, x % y);     return x;   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> k;     long long d = k;     for (long long i = 0; i < n; i++) {       long long x;       cin >> x;       d = bmm(d, x % k);     }     if (d == k) {       cout << 1 <<   n ;       cout << 0 <<   n ;     } else {       n = (k + d - 1) / d;       cout << n <<   n ;       for (long long i = 0; i < n; i++) cout << i * d <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const int N = 2e5 + 4;   int main() {     string s;     int n;     scanf( %d , &n);     cin >> s;     int pre[n], suf[n], minm = 0, bal = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  ( ) {         pre[i] = 1;         suf[i] = -1;       } else {         pre[i] = -1;         suf[i] = 1;       }       bal += pre[i];       minm = min(minm, bal);     }     if (bal == 0) {       if (minm > -2) {         printf( Yes );         return 0;       }     }     printf( No );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, o = 0, x = 0;     cin >> n;     for (int i = 0; i < n; i++) {       int a;       cin >> a;       if (a)         x++;       else         o++;     }     int s = x / 9;     if (s && o) {       for (int i = 0; i < 9 * s; i++) {         cout << 5;       }       for (int i = 0; i < o; i++) {         cout << 0;       }     } else if (o)       cout << 0;     else       cout << -1;     return 0;   }
#include <bits/stdc++.h>   char a[200005], b[200005], c[200005];   int v[200005], n, m;   bool verif(int poz) {     int i, j;     for (i = 1; i <= n; i++) c[i] = a[i];     for (i = 1; i <= poz; i++) c[v[i]] = 0;     for (i = 1, j = 1; i <= n && j <= m; i++)       if (c[i] == b[j]) j++;     if (j == m + 1) return true;     return false;   }   int main() {     int i, st, dr, mij, rasp = 0;     char ch;     ch = fgetc(stdin);     while (ch >=  a  && ch <=  z ) {       n++;       a[n] = ch;       ch = fgetc(stdin);     }     ch = fgetc(stdin);     while (ch >=  a  && ch <=  z ) {       m++;       b[m] = ch;       ch = fgetc(stdin);     }     for (i = 1; i <= n; i++) fscanf(stdin,  %d , &v[i]);     st = 1;     dr = n;     while (st <= dr) {       mij = (st + dr) / 2;       if (verif(mij) == true) {         rasp = mij;         st = mij + 1;       } else {         dr = mij - 1;       }     }     fprintf(stdout,  %d , rasp);     fclose(stdin);     fclose(stdout);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, a, b, c, ans;   int main() {     cin >> n >> a >> b >> c;     if (n >= b)       ans = (n - ((n - b) / (b - c) + 1) * (b - c)) / a + (n - b) / (b - c) + 1;     cout << max(n / a, ans);   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC target(         sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native )   using namespace std;   int a1, b1, c1, a2, b2, c2;   int d1, d2, d3, d4, d5, d6, d7;   int f1, f2, f3, f4, f5, f6, f7;   bool check() {     return f1 <= d1 && f2 <= d2 && f3 <= d3 && f4 <= d4 && f5 <= d5 && f6 <= d6 &&            f7 <= d7 && (f1 + f2 + f3 + f4 <= a1) && (f1 + f2 + f5 + f6 <= b1) &&            (f1 + f3 + f5 + f7 <= c1) &&            (f1 + f2 + f3 + f4 >= d1 + d2 + d3 + d4 - a2) &&            (f1 + f2 + f5 + f6 >= d1 + d2 + d5 + d6 - b2) &&            (f1 + f3 + f5 + f7 >= d1 + d3 + d5 + d7 - c2);   }   void solve() {     cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;     cin >> d1 >> d2 >> d3 >> d4 >> d5 >> d6 >> d7;     if (d1 + d2 + d3 + d4 > a1 + a2 || d1 + d2 + d5 + d6 > b1 + b2 ||         d1 + d3 + d5 + d7 > c1 + c2) {       cout <<  -1 n ;       return;     }     int t = d2 + d3 + d5;     for (int A = 0; A <= a1; ++A) {       for (int B = 0; B <= t; ++B) {         int lf3 = max({0, A + B - b1});         int rf3 = min({d3, A + B + b2 - d1 - d2 - d5});         int lf5 = max({0, A + B - a1});         int rf5 = min({d5, A + B + a2 - d1 - d2 - d3});         int lf3f5 = max({0, B - d2, d1 + d3 + d5 - A - c2});         int rf3f5 = min({d3 + d5, c1 - A, B});         if (rf3 < lf3 || rf5 < lf5 || rf3f5 < lf3f5) continue;         f3 = lf3;         f5 = lf5;         if (f3 + f5 > rf3f5) continue;         if (f3 + f5 < lf3f5) {           int tmp;           int delta = lf3f5 - (f3 + f5);           tmp = min(delta, rf3 - f3);           f3 += tmp;           delta -= tmp;           tmp = min(delta, rf5 - f5);           f5 += tmp;           delta -= tmp;           if (delta > 0) continue;         }         f1 = A;         f2 = B - f3 - f5;         f4 = max(0, d1 + d2 + d3 + d4 - a2 - A - B + f5);         f6 = max(0, d1 + d2 + d5 + d6 - b2 - A - B + f3);         f7 = max(0, d1 + d3 + d5 + d7 - c2 - A - B + f2);         if (check()) {           cout << f1 <<     << f2 <<     << f3 <<     << f4 <<     << f5 <<                    << f6 <<     << f7 <<   n ;           return;         }       }     }     cout <<  -1 n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline string to_string(char c) {     string s;     s.push_back(c);     return s;   }   struct Node {     bool can_delete_all = true;     char first_cant = 0;     bool more = false;     string first =   ;     string last =   ;     int ans_len = 0;     Node(bool can_delete_all = true, char first_cant = 0, bool more = false,          string first =   , string last =   , int ans_len = 0)         : can_delete_all(can_delete_all),           first_cant(first_cant),           more(more),           first(first),           last(last),           ans_len(ans_len) {}     friend Node operator+(pair<int, char> p, Node n) {       auto [len, c] = p;       if (n.can_delete_all)         return Node(len % 2 == 0, c, false, (len % 2 == 0 ?    : to_string(c)),                     (len % 2 == 0 ?    : to_string(c)), len % 2);       auto add = [](string &first, string &last, int len, char c, int &ans_len) {         ans_len += len;         reverse(last.begin(), last.end());         for (int i = 0; i < len && (int)last.size() < 2; i++) last.push_back(c);         reverse(last.begin(), last.end());         reverse(first.begin(), first.end());         for (int i = 0; i < len && i < 12; i++) first.push_back(c);         reverse(first.begin(), first.end());         while ((int)first.size() > 12) first.pop_back();       };       if (c == n.first_cant) {         if (n.more)           add(n.first, n.last, len, c, n.ans_len);         else           add(n.first, n.last, len % 2, c, n.ans_len);         return n;       }       if (c < n.first_cant) {         add(n.first, n.last, len, c, n.ans_len);         n.more = true;         n.first_cant = c;         return n;       }       assert(c > n.first_cant);       if (len % 2 == 0) return n;       add(n.first, n.last, 1, c, n.ans_len);       n.more = false;       n.first_cant = c;       return n;     }     void print() {       cout << ans_len <<    ;       if (ans_len <= 10)         cout << first <<   n ;       else         cout << first.substr(0, 5) <<  ...  << last <<   n ;     }   };   signed main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     string s;     cin >> s;     int n = (int)s.size();     vector<pair<int, int>> segs;     for (int i = 0; i < n;) {       int j = i;       while (j < n && s[i] == s[j]) j++;       segs.emplace_back(i, j);       i = j;     }     int m = (int)segs.size();     segs.emplace_back(n, n);     vector<Node> dp(m + 1);     for (int i = m - 1; i >= 0; i--)       dp[i] = pair<int, char>{segs[i].second - segs[i].first, s[segs[i].first]} +               dp[i + 1];     int segi = 0;     pair<int, char> cur;     for (int i = 0; i < n; i++) {       while (segs[segi].first < i) segi++;       if (segs[segi].first == i) {         dp[segi].print();         cur = {segs[segi].second - segs[segi].first, s[segs[segi].first]};         cur.first--;       } else {         (cur + dp[segi]).print();         cur.first--;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000005;   int a[MAXN], ans[MAXN];   pair<int, int> tab[MAXN];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) {       cin >> tab[i].first;       tab[i].second = i;     }     sort(a, a + n, greater<int>());     sort(tab, tab + n);     for (int i = 0; i < n; i++) ans[tab[i].second] = a[i];     for (int i = 0; i < n; i++) cout << ans[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k;   int a[15][123];   int b[15][123];   int c[15][123];   vector<int> v;   bool cmp(int x, int y) { return x > y; }   int main() {     cin >> n >> m >> k;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       for (int j = 0; j < m; j++) cin >> a[i][j] >> b[i][j] >> c[i][j];     }     int ans = 0;     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         if (i == j) continue;         v.clear();         for (int h = 0; h < m; h++)           for (int t = 0; t < c[i][h]; t++)             if (b[j][h] - a[i][h] > 0) v.push_back(b[j][h] - a[i][h]);         sort(v.begin(), v.end(), cmp);         int tmp = 0;         for (int h = 0; h < min(k, (int)v.size()); h++) tmp += v[h];         ans = max(ans, tmp);       }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int const inf = 1000 * 1000 * 1000;   long long const inf64 = 1ll * inf * inf;   struct Fenwick {     int n;     vector<long long> fen;     Fenwick() { n = 0; }     Fenwick(int nn) {       n = nn;       fen.resize(n + 1);     }     void put(int pos, int val) {       for (int cur = pos; cur <= n; cur |= (cur + 1)) fen[cur] += val;     }     long long get(int pos) {       long long res = 0;       for (int cur = pos; cur > 0; cur = (cur & (cur + 1)) - 1) res += fen[cur];       return res;     }     long long get(int l, int r) { return get(r) - get(l - 1); }   };   bool solve() {     int n, m, k;     scanf( %d %d %d , &n, &m, &k);     vector<vector<pair<pair<int, int>, int> > > add(m + 1);     for (int i = 1; i <= m; i++) add[i].reserve(n);     for (int len, i, j, w, iter = 0; iter < k; iter++) {       scanf( %d , &len);       for (int iter2 = 0; iter2 < len; iter2++) {         scanf( %d %d %d , &i, &j, &w);         add[j].push_back({{i, w}, iter});       }     }     int q;     scanf( %d , &q);     vector<char> type(q);     vector<int> sw(q);     vector<pair<int, int> > ask(q);     vector<vector<long long> > res(2005, vector<long long>(k));     vector<vector<int> > era(m + 1), ins(m + 1);     vector<int> ide(q);     char buffer[10];     for (int i, x1, y1, x2, y2, iter = 0; iter < q; iter++) {       scanf( %s , buffer);       if (string(buffer) ==  SWITCH ) {         scanf( %d , &i);         type[iter] = 0;         sw[iter] = i - 1;       } else {         scanf( %d %d %d %d , &x1, &y1, &x2, &y2);         type[iter] = 1;         ask[iter] = {x1, x2};         ins[y1].push_back(iter);         era[y2].push_back(iter);         static int rectange_size = 0;         ide[iter] = rectange_size++;       }     }     vector<Fenwick> fen(k, Fenwick(n));     for (int pos, value, id, l, r, j = 1; j <= m; j++) {       for (int iter : ins[j]) {         tie(l, r) = ask[iter];         for (int kk = 0; kk < k; kk++) {           res[ide[iter]][kk] -= fen[kk].get(l, r);         }       }       for (auto _iter : add[j]) {         tie(pos, value) = _iter.first;         id = _iter.second;         fen[id].put(pos, value);       }       for (int iter : era[j]) {         tie(l, r) = ask[iter];         for (int kk = 0; kk < k; kk++) {           res[ide[iter]][kk] += fen[kk].get(l, r);         }       }     }     vector<char> state(k, 1);     for (int iter = 0; iter < q; iter++) {       if (type[iter] == 0) {         state[sw[iter]] ^= 1;       } else {         long long result = 0;         for (int i = 0; i < k; i++) {           if (state[i]) result += res[ide[iter]][i];         }         printf( %I64d n , result);       }     }     return true;   }   int main() {     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<pair<int, int>, int> id;   vector<int> a[100005];   int main() {     int i, j, k, n;     cin >> n;     cout << n - 1 << endl;     int idd = 1;     for (k = (1); k <= (n - 1); k++) {       cin >> i >> j;       a[i].push_back(j);       a[j].push_back(i);       id[make_pair(i, j)] = idd;       id[make_pair(j, i)] = idd++;       printf( 2 %d %d n , i, j);     }     for (i = (1); i <= (n); i++)       for (j = 1; j < a[i].size(); j++) {         cout << id[make_pair(i, a[i][j - 1])] <<     << id[make_pair(i, a[i][j])]              << endl;       }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t;   char a[30];   int main() {     cin >> t;     while (t--) {       string s;       cin >> s;       int len = s.size(), id = 0;       for (int i = 0; i < len; i++) {         int temp = 1;         while (s[i + 1] == s[i]) {           i++;           temp++;         }         if (temp % 2 == 0) continue;         int flag = 0;         for (int j = 0; j < id; j++) {           if (a[j] == s[i]) {             flag = 1;             break;           }         }         if (!flag) a[id++] = s[i];       }       if (!id)         cout << endl;       else {         sort(a, a + id);         for (int i = 0; i < id; i++) cout << a[i];         cout << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void swap(long long &a, long long &b) {     long long t = a;     a = b;     b = t;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long t;     cin >> t;     while (t--) {       long long n, k;       cin >> n >> k;       set<long long> s;       long long arr[n];       for (long long i = 0; i < n; i++) {         cin >> arr[i];         s.insert(arr[i]);       }       if (n > 1 && s.size() > 1 && k == 1) {         cout << -1 << endl;         continue;       }       if (s.size() == 1) {         cout << 1 << endl;         continue;       }       long long count = 0;       while (1) {         if (s.size() == 1) {           break;         }         set<long long> s1;         long long j = 0;         long long last = 0;         for (auto x : s) {           if (j < k) {             s1.insert(0);             j++;             last = x;           } else {             s1.insert(x - last);             j++;           }         }         count++;         s = s1;       }       cout << count << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 19;   int a[1 << N];   int main() {     int n, q;     cin >> n >> q;     long long sum = 0;     for (int i = 0; i < (1 << n); i++) cin >> a[i], sum += a[i];     cout << setprecision(10) << 1.0 * sum / (1 << n) <<   n ;     for (int i = 0; i < q; i++) {       int id, v;       cin >> id >> v;       sum += v - a[id];       a[id] = v;       cout << setprecision(10) << 1.0 * sum / (1 << n) <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int p(string s) {     string a = s;     s +=  # ;     reverse(a.begin(), a.end());     s += a;     int n = s.size();     vector<int> pi(n);     pi[0] = 0;     int j = 0;     for (int i = 1; i < n; i++) {       j = pi[i - 1];       while (j > 0 && s[i] != s[j]) j = pi[j - 1];       if (s[i] == s[j]) j++;       pi[i] = j;     }     return j;   }   int main() {     int t = 1;     cin >> t;     while (t--) {       string s;       cin >> s;       int cnt = 0;       int n = s.size();       for (int i = 0; i < n / 2; i++) {         if (s[i] != s[n - 1 - i]) break;         cnt++;       }       string ans;       if (cnt > 0) cout << s.substr(0, cnt);       ;       string a = s;       reverse(a.begin(), a.end());       int pos = p(s.substr(cnt, n - 2 * cnt));       string w = s.substr(cnt, pos);       pos = p(a.substr(cnt, n - 2 * cnt));       w = (pos > w.length()) ? a.substr(cnt, pos) : w;       cout << w;       if (cnt > 0) cout << s.substr(n - cnt, cnt);       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     string s;     deque<char> vec;     cin >> s;     for (int i = 0; i < s.size(); ++i) vec.push_back(s[i]);     int cnt = 0, i;     while (vec.size() > 1) {       if (vec[vec.size() - 1] ==  0 ) {         ++cnt;         vec.pop_back();       } else {         for (i = vec.size() - 1; i >= 0; --i) {           if (vec[i] ==  0 ) break;           vec[i] =  0 ;         }         if (i < 0)           vec.push_front( 1 );         else           vec[i] =  1 ;         ++cnt;       }     }     cout << cnt;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2005, M = 998244353;   int read(int x = 0, int f = 1, char c = getchar()) {     for (; c <  0  || c >  9 ; c = getchar())       if (c ==  - ) f = -1;     for (; c >=  0  && c <=  9 ; c = getchar()) x = x * 10 + c -  0 ;     return x * f;   }   int n, a[N][N], f[N][N], p[N], fac[N], ans;   struct Tree {     int t[N], v[N];     void Add(int x, int w) {       if (w == -1 && !v[x]) return;       v[x] ^= 1;       for (; x <= n; x += x & -x) t[x] += w;     }     int Ask(int x, int w = 0) {       for (; x; x -= x & -x) w += t[x];       return w;     }     void Init() {       for (int i = 1; i <= n; ++i) t[i] = i & -i, v[i] = 1;     }   } t1, t2;   int main() {     n = read();     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) a[i][j] = read();     f[0][0] = 1;     f[1][1] = 0;     f[2][2] = 1;     for (int i = 3; i <= n; ++i)       f[i][i] = 1ll * (i - 1) * (f[i - 1][i - 1] + f[i - 2][i - 2]) % M;     for (int i = 1; i <= n; ++i)       for (int j = i - 1; j >= 0; --j)         if ((f[i][j] = f[i][j + 1] + f[i - 1][j]) >= M) f[i][j] -= M;     fac[0] = p[0] = 1;     for (int i = 1; i <= n; ++i) {       fac[i] = 1ll * fac[i - 1] * i % M;       p[i] = 1ll * p[i - 1] * f[n][n] % M;     }     t1.Init();     for (int j = 1; j <= n; ++j)       t1.Add(a[1][j], -1), ans = (ans + 1ll * t1.Ask(a[1][j]) * fac[n - j]) % M;     ans = 1ll * ans * p[n - 1] % M;     for (int i = 2; i <= n; ++i) {       int sum = 0;       t1.Init();       t2.Init();       for (int j = 1; j <= n; ++j) {         int tot, cnt, tmp;         t1.Add(a[i][j], -1);         tot = t1.Ask(a[i][j]);         if (a[i - 1][j] < a[i][j] && t1.v[a[i - 1][j]]) tot--;         t2.Add(a[i - 1][j], -1);         tmp = t2.Ask(n);         cnt = t2.Ask(a[i][j] - 1);         sum = (sum + 1ll * cnt * f[n - j][tmp - 1] +                1ll * (tot - cnt) * f[n - j][tmp]) %               M;         t2.Add(a[i][j], -1);       }       ans = (ans + 1ll * sum * p[n - i]) % M;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k;   vector<long long> v;   vector<pair<pair<long long, long long>, long long> > vv;   vector<long long> ary;   void update(int pos, long long val, int mx) {     while (pos <= mx) {       ary[pos] += val;       pos += pos & -pos;     }   }   long long get(int pos, int mx) {     long long re = 0;     while (pos > 0) {       re += ary[pos];       pos -= pos & -pos;     }     return re;   }   int main(void) {     ios_base::sync_with_stdio(0);     cin >> n >> m >> k;     v.resize(n);     for (int i = 0; i < (n); i++) cin >> v[i];     vv.resize(m);     for (int i = 0; i < (m); i++)       cin >> vv[i].first.first >> vv[i].first.second >> vv[i].second;     ary.resize(m + 1, 0);     for (int i = 0; i < (k); i++) {       long long t, tt;       cin >> t >> tt;       update(t, 1, m);       update(tt + 1, -1, m);     }     for (int i = 0; i < (m); i++) {       vv[i].second *= get(i + 1, m);     }     ary.clear();     ary.resize(n + 2, 0);     for (int i = 0; i < (m); i++) {       update(vv[i].first.first, vv[i].second, n);       update(vv[i].first.second + 1, -vv[i].second, n);     }     for (int i = 0; i < (n); i++) {       v[i] += get(i + 1, n);     }     for (int i = 0; i < (n); i++) cout << v[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int X, t[10000], h[10000], m[10000], v[10000];   int f(int x) {     int ht = X;     memset(v, 0, sizeof(v));     for (int i = (0); i < (n); i++) {       int tmp = -1;       for (int j = (0); j < (n); j++) {         if (v[j] || t[j] != ((i + x) & 1) || h[j] > ht) continue;         if (tmp == -1) tmp = j;         if (m[j] > m[tmp]) tmp = j;       }       if (tmp == -1) return i;       ht += m[tmp];       v[tmp] = 1;     }     return n;   }   int main() {     scanf( %d%d , &n, &X);     for (int i = (0); i < (n); i++) scanf( %d%d%d , t + i, h + i, m + i);     int ans = 0, tmp = 0;     ans = f(0);     ans = max(ans, f(1));     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   string s;   set<string> aux;   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       cin >> s;       string ns =   ;       for (int j = 0; j < s.size(); j++) {         if (s[j] ==  u )           ns +=  oo ;         else if (s[j] ==  h ) {           while (!ns.empty() && ns.back() ==  k ) ns.pop_back();           ns += s[j];         } else           ns += s[j];       }       aux.insert(ns);     }     printf( %d n , aux.size());     return 0;   }
#include<bits/stdc++.h>   using namespace std;   #define ll long long int   #define inf 1e18   #define F first   #define S second   #define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)   #define pb push_back   #define pll pair<ll,ll>   #define vl vector<ll>   #define all(x) (x).begin(),(x).end()   #define siz 300005   #define MOD   998244353   vector<vector<ll> > adj(siz);   vector<ll> vis(siz,0);   ll mod=MOD;   ll power(ll x, ll y){       if (y == 0)           return 1;       else if (y % 2 == 0)           return ((power(x, y / 2))%mod * (power(x, y / 2))%mod)%mod;       else           return (x%mod * (power(x, y / 2))%mod * (power(x, y / 2))%mod)%mod;   }   ll foo(ll n){    return ( n*(n+1) )/2;   }   int main(){    ll q=1;    cin>>q;    while(q--){     string s;     cin>>s;     ll n=s.size(),gap=0,last=-1,l=0,r=0,ans=0;     while(l<n){      //cout<<last<<   <<l<<   <<r<<   <<ans<<endl;      if(r==n or (last!=-1 and s[r]!= ?  and        ((s[r]!=s[last] and gap%2==1)        or(s[r]==s[last] and gap%2==0)) ) ){       if(r==n){        ans+=foo(r-l);        break;       }       ll nl=last+1;       ans+=(foo(r-l)-foo(r-nl));       if(last<nl)last=-1;l=nl;      }      else{       if(s[r]!= ? ){last=r;gap=0;}       else gap++;       r++;      }     }     cout<<ans<<endl;    }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, i, j, k, l;     cin >> n >> m;     k = (n - m) / 2;     j = 1;     while (j <= n) {       if (j % (k + 1) == 0) {         cout <<  1 ;       } else {         cout <<  0 ;       }       j++;     }   }