malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     string inp;     cin >> inp;     bool found = false;     for (int i = 0; (i < n - 1) && k; ++i) {       if (inp[i] ==  4  && inp[i + 1] ==  7 ) {         if (((i + 1) & 1) && (i < n - 2) && (inp[i + 2] ==  7 )) {           if (k & 1) inp[i + 1] =  4 ;           cout << inp << endl;           found = true;           break;         } else if ((((i + 1) & 1) == 0) && (i) && (inp[i - 1] ==  4 )) {           if (k & 1) inp[i] =  7 ;           cout << inp << endl;           found = true;           break;         } else if (((i + 1) & 1)) {           inp[i + 1] =  4 ;           --k;         } else if (((i + 1) % 2) == 0) {           inp[i] =  7 ;           --k;         }       }     }     if (!found) cout << inp << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = (1 << 20) + 69;   int heap[N], idx[N], val[N];   int g, h;   void dream(int curr) {     while (curr < ((1 << (h - 1)) - 1) &&            heap[curr] > min(heap[2 * curr + 1], heap[2 * curr + 2])) {       int& left = heap[2 * curr + 1];       int& right = heap[2 * curr + 2];       if (left < right) {         swap(left, heap[curr]);         curr = 2 * curr + 1;       } else {         swap(right, heap[curr]);         curr = 2 * curr + 2;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     scanf( %d , &t);     for (int i = 0; i < t; i++) {       scanf( %d %d , &h, &g);       set<int> remain;       for (int j = 0; j < (1 << h) - 1; j++) {         scanf( %d , &heap[j]);         remain.insert(heap[j]);         idx[heap[j]] = j;       }       for (int j = (1 << h) - 2; j >= (1 << g) - 1; j--) dream(j);       for (int j = (1 << (g - 1)) - 1; j < (1 << g) - 1; j++) {         val[j] = min(heap[2 * j + 1], heap[2 * j + 2]);         dream(j);       }       for (int j = (1 << (g - 1)) - 2; j >= 0; j--) {         int lbound = max(val[2 * j + 1], val[2 * j + 2]);         while (heap[2 * j + 1] <= lbound) {           heap[2 * j + 1] = INT_MAX;           dream(2 * j + 1);         }         while (heap[2 * j + 2] <= lbound) {           heap[2 * j + 2] = INT_MAX;           dream(2 * j + 2);         }         val[j] = min(heap[2 * j + 1], heap[2 * j + 2]);         dream(j);       }       long long ans1 = 0;       for (int j = 0; j < (1 << g) - 1; j++) {         ans1 += val[j];         remain.erase(val[j]);       }       printf( %I64d n , ans1);       for (auto v : remain) printf( %d  , idx[v] + 1);       printf(  n );     }   }
#include <bits/stdc++.h>   using namespace std;   struct node {     vector<int> adj;   } graf[5 * 10010];   bool mark[5 * 10010];   int last[5 * 10010];   void DFS(int u, int lst) {     last[u] = lst;     mark[u] = true;     for (int i = 0; i < graf[u].adj.size(); i++)       if (!mark[graf[u].adj[i]]) DFS(graf[u].adj[i], u);   }   int main() {     int n, r1, r2;     scanf( %d%d%d , &n, &r1, &r2);     for (int i = 1; i <= n; i++) {       if (i == r1) continue;       int tmp;       scanf( %d , &tmp);       graf[i].adj.push_back(tmp);       graf[tmp].adj.push_back(i);     }     DFS(r2, 0);     for (int i = 1; i <= n; i++) {       if (i == r2) continue;       printf( %d  , last[i]);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> cyc;   vector<int> path;   void dfs(vector<int> *graph, int node, vector<bool> vis, int pnode) {     if (vis[node] == true) {       path.pop_back();       for (int i = path.size() - 1; i >= 0; i--) {         if (path[i] != node) {           cyc.push_back(path[i]);         } else {           cyc.push_back(node);           break;         }       }       path.push_back(node);       return;     }     vis[node] = true;     for (int i = 0; i < graph[node].size(); i++) {       if (graph[node][i] != pnode && cyc.size() == 0) {         path.push_back(graph[node][i]);         dfs(graph, graph[node][i], vis, node);         path.pop_back();       }     }   }   void doWork(vector<int> *graph, int node, vector<int> &dp, vector<bool> &vis,               int pnode) {     if (dp[node] == -1) {       dp[node] = dp[pnode] + 1;     }     vis[node] = true;     for (int i = 0; i < graph[node].size(); i++) {       if (vis[graph[node][i]] == false) {         doWork(graph, graph[node][i], dp, vis, node);       }     }   }   int main() {     int n;     cin >> n;     vector<int> graph[n + 1];     int p, q;     for (int i = 0; i < n; i++) {       cin >> p >> q;       graph[p].push_back(q);       graph[q].push_back(p);     }     vector<bool> vis(n + 1, false);     path.push_back(1);     dfs(graph, 1, vis, -1);     vector<int> dp(n + 1, -1);     for (int i = 0; i < cyc.size(); i++) {       dp[cyc[i]] = 0;     }     vector<bool> vis1(n + 1, false);     doWork(graph, cyc[0], dp, vis1, -1);     for (int i = 1; i <= n; i++) {       cout << dp[i] <<    ;     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[200009], b[200009];   bool k[200009];   int mx;   int main() {     scanf( %d , &n);     for (int j = 1; j <= n; j++) scanf( %d , &a[j]);     for (int j = 1; j <= n; j++) scanf( %d , &b[j]);     for (int j = 1; j <= n; j++) k[a[j]] = 1;     if (!k[1]) {       int o = 1;       bool kk = 0;       while (b[o] != 1) o++;       for (int j = o; j <= n; j++)         if (b[j] != j - o + 1) {           kk = 1;           break;         }       if (kk == 0) {         if (o == 1) {           printf( 0 );           return 0;         }         if (k[n - o + 2] == 1) {           for (int j = 1; j < o; j++)             if (b[j] != 0 && j - b[j] + n - o + 2 > 0) {               kk = 1;               break;             }           if (kk == 0) {             printf( %d , o - 1);             return 0;           }         }       }     }     for (int j = 1; j <= n; j++)       if (b[j] != 0 && j - b[j] + 1 > mx) mx = j - b[j] + 1;     printf( %d , mx + n);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   int n;   int ok = 0;   int main() {     ios::sync_with_stdio(false);     cin >> n;     cin >> s;     for (int i = 0; i <= n - 5; i++) {       if (s[i] ==  * ) {         for (int j = 1; j <= n; j++) {           int now = i, total = 0;           while (now < n && s[now] ==  *  && total < 5) {             total++;             now = now + j;           }           if (total == 5) {             ok = 1;             goto output;           }         }       }     }   output:     if (ok) {       cout <<  yes ;     } else       cout <<  no ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 500500, MOD = 1e9 + 7;   long long Norm(long long x) { return ((x % MOD + MOD) % MOD); }   int n;   long long prefsumx[2 * MAX], prefsumy[2 * MAX];   long long prefpov[2 * MAX];   long long prefob[2 * MAX], prefprav[2 * MAX];   pair<int, int> tocke[2 * MAX];   long long UmToc(int a, int b) {     return (long long)tocke[a].first * tocke[b].second -            (long long)tocke[b].first * tocke[a].second;   }   long long Suma(long long polje[2 * MAX], int a, int b) {     if (a > b) b += n;     long long ret = polje[b];     if (a) ret -= polje[a - 1];     return ret;   }   long long Povrsina(int a, int b) {     if (a == b || a + 1 == b) return 0;     return Suma(prefpov, a, b - 1) + UmToc(b, a);   }   void GenPref() {     for (int i = 0; i < 2 * n; i++) {       prefpov[i] = UmToc(i, i + 1);       prefsumx[i] = tocke[i].first;       prefsumy[i] = tocke[i].second;       if (i) {         prefpov[i] += prefpov[i - 1];         prefsumx[i] += prefsumx[i - 1];         prefsumy[i] += prefsumy[i - 1];       }       prefsumx[i] = Norm(prefsumx[i]);       prefsumy[i] = Norm(prefsumy[i]);     }   }   int main() {     scanf( %d , &n);     for (int i = n - 1; i >= 0; i--)       scanf( %d%d , &tocke[i].first, &tocke[i].second);     for (int i = n; i <= 2 * n; i++) tocke[i] = tocke[i % n];     GenPref();     long long summanj = 0;     for (int i = 0, j = 1; i < n; i++) {       j = max(j, i + 1);       for (; Povrsina(i, j) <= Povrsina(j, i); j++)         ;       j--;       if (Povrsina(i, j) == Povrsina(j, i) && i > (j % n)) j--;       if (j == i + 1) continue;       int kol = j - (i + 1);       prefob[i] += kol;       prefprav[i + 2]--;       prefprav[j + 1]++;       summanj = Norm(summanj + Norm(Suma(prefsumx, i + 2, j)) * tocke[i].second -                      Norm(Suma(prefsumy, i + 2, j)) * tocke[i].first);     }     long long tprav = 0, tsum = 0;     for (int i = 0; i < 2 * n; i++) {       tprav += prefprav[i];       tsum += prefob[i] + tprav;       tsum = Norm(tsum);       summanj = Norm(summanj + Norm(UmToc(i, i + 1)) * tsum);     }     long long rje =         Norm(Norm((long long)n * (n - 3) / 2) * Norm(Povrsina(0, n - 1)) -              2 * summanj);     printf( %lld n , rje);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( Ofast )   #pragma GCC optimize(3)   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   #pragma GCC target( sse3 ,  sse2 ,  sse )   #pragma GCC target( avx ,  sse4 ,  sse4.1 ,  sse4.2 ,  ssse3 )   #pragma GCC target( f16c )   #pragma GCC optimize( inline ,  fast-math ,  unroll-loops ,                          no-stack-protector )   #pragma GCC push_options   #pragma GCC pop_options   #pragma GCC reset_options   #pragma GCC optimize( O3 )   const double eps = 1e-9;   const int INFMEM = 63;   const int INF = 1061109567;   const long long LINF = 4557430888798830399LL;   const double DINF = numeric_limits<double>::infinity();   const long long MOD = 1000000007;   const int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};   const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};   const double PI = 3.141592653589793;   inline void fastll(long long &input_number) {     input_number = 0;     int ch = getchar_unlocked();     int sign = 1;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) sign = -1;       ch = getchar_unlocked();     }     while (ch >=  0  && ch <=  9 ) {       input_number = (input_number << 3) + (input_number << 1) + ch -  0 ;       ch = getchar_unlocked();     }     input_number *= sign;   }   inline void open(string a) {     freopen((a +  .in ).c_str(),  r , stdin);     freopen((a +  .out ).c_str(),  w , stdout);   }   inline void fasterios() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   long long n, q;   long long isi[200005];   long long sufmax[200005];   pair<long long, long long> forced[200005];   int main() {     fasterios();     memset(forced, -1, sizeof(forced));     memset(sufmax, -1, sizeof(sufmax));     cin >> n;     for (int i = 1; i <= n; i++) cin >> isi[i];     cin >> q;     for (int i = 1; i <= n; i++) forced[i] = {isi[i], 0};     for (int i = 1; i <= q; i++) {       long long t;       cin >> t;       if (t == 1) {         long long pos, val;         cin >> pos >> val;         forced[pos] = {val, i};       } else {         long long val;         cin >> val;         sufmax[i] = val;       }     }     for (int i = q - 1; i >= 0; i--) sufmax[i] = max(sufmax[i], sufmax[i + 1]);     for (int i = 1; i <= n; i++) {       cout << max(forced[i].first, sufmax[forced[i].second]) <<    n [i == n];     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline int Chkmax(T &a, T b) {     return a < b ? a = b, 1 : 0;   }   template <typename T>   inline int Chkmin(T &a, T b) {     return a > b ? a = b, 1 : 0;   }   template <typename T>   inline T read() {     T sum = 0, fl = 1;     char ch = getchar();     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) fl = -1;     for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch -  0 ;     return sum * fl;   }   inline void proc_status() {     ifstream t( /proc/self/status );     cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())          << endl;   }   const int Maxn = 100000 + 100;   int N, Stack[Maxn], top;   pair<long long, long long> A[Maxn];   inline double get_slope(pair<long long, long long> a,                           pair<long long, long long> b) {     return (double)(b.second - a.second) / (b.first - a.first);   }   inline void Solve() {     sort(A + 1, A + N + 1);     int tot = 0;     A[N + 1].first = 1e7;     for (int i = 1; i <= N; ++i)       if (A[i].first != A[i + 1].first) A[++tot] = A[i];     for (int i = 1; i <= tot; ++i) {       while (top >= 2 &&              get_slope(A[i], A[Stack[top]]) >= get_slope(A[i], A[Stack[top - 1]]))         --top;       Stack[++top] = i;     }     cout << top - 1 << endl;   }   inline void Input() {     N = read<int>();     for (int i = 1; i <= N; ++i)       A[i].first = read<long long>(),       A[i].second = read<long long>() - A[i].first * A[i].first;   }   int main() {     Input();     Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, k, m;     cin >> n >> k >> m;     vector<string> words;     words.push_back( ____jj );     long long cost[n + 1];     unordered_map<string, long long> u;     for (int i = 0; i < n; ++i) {       string h;       cin >> h;       words.push_back(h);     }     for (int i = 1; i <= n; ++i) {       cin >> cost[i];     }     for (int i = 1; i <= n; ++i) {       u[words[i]] = cost[i];     }     for (int i = 1; i <= k; i++) {       int j;       cin >> j;       int arr[j + 1];       long long min = 0;       long long min_ind = 0;       for (int l = 1; l <= j; l++) {         cin >> arr[l];         if (cost[arr[l]] < min) {           min = cost[arr[l]];           min_ind = arr[l];         }         if (min == 0) {           min = cost[arr[l]];           min_ind = arr[l];         }       }       for (int p = 1; p <= j; ++p) {         u[words[arr[p]]] = cost[min_ind];       }     }     long long tot_cost = 0;     for (int i = 0; i < m; ++i) {       string d;       cin >> d;       tot_cost += u[d];     }     cout << tot_cost <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long sz = 2 * 1e5 + 5, mod = 1e9 + 7;   vector<long long> adj[sz];   long long dp[sz][2], x[sz];   void dfs(long long v, long long p) {     dp[v][x[v]] = 1;     for (auto u : adj[v]) {       if (u == p) continue;       dfs(u, v);       dp[v][1] =           (dp[v][1] * dp[u][1] + dp[v][1] * dp[u][0] + dp[v][0] * dp[u][1]) % mod;       dp[v][0] = (dp[v][0] * dp[u][1] + dp[v][0] * dp[u][0]) % mod;     }   }   int main() {     long long n, u, i;     cin >> n;     for (i = 1; i < n; i++) {       cin >> u;       adj[u].push_back(i);     }     for (i = 0; i < n; i++) cin >> x[i];     dfs(0, -1);     cout << dp[0][1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353;   map<tuple<unsigned long, int, int>, pair<long long, long long> > m;   pair<long long, long long> zml(long long x, bitset<10> s, int p, int k,                                  bool limit) {     if (int(s.count()) > k) return {0, 0};     if (p == -1) return {1, 0};     if (s.count() == 1 && s[0]) s.reset();     if (!limit && m.count({s.to_ulong(), p, k})) return m[{s.to_ulong(), p, k}];     long long r = 1;     for (int i = 0; i < p; i++) r *= 10;     long long y = x / r;     long long ret1 = 0;     long long ret2 = 0;     for (int i = 0; i <= y; i++) {       bitset<10> t = s;       t[i] = 1;       pair<long long, long long> z =           zml(i == y ? x - y * r : r - 1, t, p - 1, k, limit && i == y);       ret1 += z.first;       ret1 %= mod;       ret2 += z.second;       ret2 %= mod;       ret2 += z.first * (((r % mod) * i) % mod);       ret2 %= mod;     }     if (!limit)       return m[{s.to_ulong(), p, k}] = {ret1, ret2};     else       return {ret1, ret2};   }   int main() {     long long l, r;     int k;     cin >> l >> r >> k;     cout << (zml(r, bitset<10>(), 18, k, 1).second -              zml(l - 1, bitset<10>(), 18, k, 1).second + mod) %                 mod          << endl;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:102400000,102400000 )   using namespace std;   const int maxn = 1e3 + 10;   const int inf = 0x7fffffff;   const long long INF = 9E18;   const int mod = 1e9 + 7;   const long long mod2 = 1e9 + 9;   const double eps = 1e-7;   const double pi = acos(-1.0);   template <typename T>   inline bool read(T &x) {     T f = 1;     char ch = getchar();     if (ch == EOF) return false;     for (; ch <  0  || ch >  9 ; ch = getchar())       if (ch ==  - ) f = -1;     for (x = 0; ch >=  0  && ch <=  9 ; ch = getchar()) x = x * 10 + ch -  0 ;     x *= f;     return true;   }   int dcmp(double x) { return fabs(x) <= eps ? 0 : (x > 0 ? 1 : -1); }   int main() {     int test;     cin >> test;     while (test--) {       double x;       cin >> x;       if (dcmp(x) == 0)         cout <<  Y 0 0  << endl;       else {         if (x * x - 4 * x < 0)           cout <<  N  << endl;         else {           double res = (x + sqrt(x * x - 4 * x)) / 2;           double a = x / res;           cout << fixed << setprecision(10) <<  Y   << a <<     << res << endl;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline void read(T &x) {     bool b = 0;     char c;     while (!isdigit(c = getchar()) && c !=  - )       ;     if (c ==  - ) c = getchar(), b = 1;     x = c - 48;     while (isdigit(c = getchar())) x = (x << 3) + (x << 1) + c - 48;     if (b) x = -x;   }   template <typename T>   inline void wrip(T x) {     if (x > 9) wrip(x / 10);     putchar(x % 10 + 48);   }   template <typename T>   inline void write(T x) {     if (x < 0) putchar( - ), x = -x;     wrip(x);     putchar(   );   }   template <typename T>   inline void writeln(T x) {     if (x < 0) putchar( - ), x = -x;     wrip(x);     putchar(  n );   }   inline char readch() {     char c;     do c = getchar();     while (c ==   n  || c ==    );     return c;   }   inline void reads(string &s) {     char c;     while ((c = getchar()) ==     || c ==   n )       ;     s = c;     while ((c = getchar()) !=     && c !=   n  && c != EOF) s += c;   }   inline void getlines(string &s) {     char c;     while ((c = getchar()) ==   n )       ;     s = c;     while ((c = getchar()) !=   n ) s += c;   }   const long double pi = acos(-1);   const int inf = 1e9, mod = 1e9 + 7, N = 1e6 + 11;   int n;   long long m, a[N], cnt[N], pwm[N];   inline long long pw(long long a, long long b) {     long long res = 1;     while (b) {       if (b % 2) res = res * a % mod;       a = a * a % mod;       b /= 2;     }     return res;   }   int main() {     int ntest;     read(ntest);     while (ntest--) {       read(n);       read(m);       for (int i = 1; i <= n; i++) read(a[i]);       if (m == 1) {         if (n % 2)           cout << 1 <<   n ;         else           cout << 0 <<   n ;         continue;       }       for (int i = 1; i <= n; i++) cnt[a[i]]++;       sort(a + 1, a + n + 1);       n = unique(a + 1, a + n + 1) - a - 1;       reverse(a + 1, a + n + 1);       long long lim = 2e6, res = 0;       long long Max = 0;       pwm[0] = 1;       for (int i = 1; i <= 1e6; i++) {         pwm[i] = pwm[i - 1] * m;         if (pwm[i] >= 1e7) {           Max = i;           break;         }       }       for (int i = 1; i <= n; i++) {         if (cnt[a[i]] % 2 == 0) continue;         long long num = 1, sum = 0;         for (int j = i + 1; j <= n; j++) {           num *= pwm[min(Max, a[j - 1] - a[j])];           if (num <= cnt[a[j]]) {             cnt[a[j]] -= num;             goto line0;           }           sum = (sum + pw(m, a[j]) * cnt[a[j]]) % mod;           num -= cnt[a[j]];           cnt[a[j]] = 0;           if (num >= lim) break;         }         for (int j = i + 1; j <= n; j++)           if (cnt[a[j]]) sum = (sum + pw(m, a[j]) * cnt[a[j]]) % mod;         res = (pw(m, a[i]) - sum + mod) % mod;         break;       line0:;       }       for (int i = 1; i <= n; i++) cnt[a[i]] = 0;       cout << res <<   n ;     }   }
#include <bits/stdc++.h>   #pragma comment(linker,  /stack:640000000 )   using namespace std;   int fx[] = {0, 0, -1, 1, -1, 1, 1, -1};   int fy[] = {1, -1, 0, 0, 1, 1, -1, -1};   struct debugger {     template <typename T>     debugger& operator,(const T& v) {       cerr << v <<    ;       return *this;     }   } dbg;   const int N = (int)3e5;   int a[N], b[N], c[N], d[N], n, b1[N], c1[N];   int bits[32][N], k[32];   bool valid() {     memset(bits, 0, sizeof(bits));     for (int i = 0; i < 31; i++) {       for (int j = 0; j < n; j++) {         if (a[j] < 0) return false;         if (a[j] & (1 << i))           bits[i][j] = 1;         else           bits[i][j] = 0;       }     }     memset(k, 0, sizeof(k));     for (int i = 0; i < 31; i++) {       for (int j = 0; j < n; j++) {         k[i] += bits[i][j];       }     }     memset(b1, 0, sizeof(b1));     memset(c1, 0, sizeof(c1));     for (int i = 0; i < 31; i++) {       for (int j = 0; j < n; j++) {         int _b = bits[i][j] ? k[i] : 0;         int _c = bits[i][j] ? n : k[i];         b1[j] += _b << i;         c1[j] += _c << i;       }     }     for (int i = 0; i < n; i++) {       if (b[i] != b1[i] || c[i] != c1[i]) return false;     }     return true;   }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &b[i]);     for (int i = 0; i < n; i++) scanf( %d , &c[i]);     long long int sum = 0LL;     for (int i = 0; i < n; i++) {       d[i] = b[i] + c[i];       sum += (long long int)d[i];     }     sum /= (2 * n);     for (int i = 0; i < n; i++) a[i] = (d[i] - sum) / n;     if (!valid())       printf( -1 n );     else {       for (int i = 0; i < n; i++) printf( %d  , a[i]);       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string proc(char *a) {     int n = strlen(a);     char s[100];     int i = 0, j = 0;     while (i < n) {       if (a[i] ==  u )         s[j++] =  o , s[j++] =  o ;       else         s[j++] = a[i];       i++;     }     s[j] =   0 ;     strcpy(a, s);     n = j;     i = j = 0;     while (i < n) {       if (i < n - 1 && a[i] == a[i + 1] && a[i] ==  o )         s[j++] =  u , i += 2;       else         s[j++] = a[i++];     }     s[j] =   0 ;     strcpy(a, s);     n = j;     i = j = 0;     while (i < n) {       int t = i;       if (a[i] ==  k ) {         while (a[i] ==  k  && i < n) i++;         if (a[i] ==  h )           s[j++] =  h , i++;         else {           while (t < i) s[j++] =  k , t++;           s[j++] = a[i++];         }       } else         s[j++] = a[i++];     }     s[j] =   0 ;     return string(s);   }   int main() {     int n;     cin >> n;     cin.ignore();     char a[1000][100];     vector<string> ret;     for (int i = 0; i < n; i++) {       cin.getline(a[i], 100);       ret.push_back(proc(a[i]));     }     sort(ret.begin(), ret.end());     int ans = 0;     int i = 0;     while (i < n) {       int t = i + 1;       while (t < n && ret[i] == ret[t]) t++;       ans++;       i = t;     }     cout << ans;     return 0;   }