malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   inline int read();   const int M = 200016, MOD = 1000000007;   int sz;   int ch[M][26], len[M], link[M], pre[M];   void extend(const char *s) {     for (int i = 0, lst = 0; s[i]; ++i) {       int c = s[i] -  a , cur = ++sz;       len[cur] = len[lst] + 1;       int p = lst;       while (!ch[p][c]) ch[p][c] = cur, p = link[p];       if (ch[p][c] != cur) {         int q = ch[p][c];         if (len[p] + 1 == len[q])           link[cur] = q;         else {           int clone = ++sz;           memcpy(ch[clone], ch[q], sizeof(ch[q]));           link[clone] = link[q];           len[clone] = len[p] + 1;           while (ch[p][c] == q) ch[p][c] = clone, p = link[p];           link[q] = link[cur] = clone;         }       }       lst = cur;       pre[cur] = i + 1;     }   }   pair<int, int> qrys[M * 2 * 26];   int qcnt;   int qans[M * 2 * 26];   vector<int> sons[M];   vector<int> qry[M];   set<int> st[M];   int tar[M];   void merge(int a, int b) {     if (st[tar[a]].size() < st[tar[b]].size()) swap(a, b);     for (auto x : st[tar[b]]) st[tar[a]].insert(x);     st[tar[b]].clear();     tar[b] = tar[a];   }   void solve(int u) {     for (auto v : sons[u]) solve(v), merge(u, v);     for (auto qid : qry[u]) {       int l = qrys[qid].first, r = qrys[qid].second;       auto it = st[tar[u]].lower_bound(l);       if (it != st[tar[u]].end() && *it <= r) qans[qid] = 1;     }   }   char tex[M], pat[M * 2];   int lef[M], rig[M], pid[M], pln[M], pcnt;   int solved[M];   void foreach_query(int ftq, int id, int now, int tag) {     if (pat[id] && ch[now][pat[id] -  a ])       foreach_query(ftq, id + 1, ch[now][pat[id] -  a ], tag);     for (int c = pat[id] ? pat[id] + 1 :  a ; c <=  z ; ++c) {       int tmp = ch[now][c -  a ];       if (tmp && rig[ftq] - lef[ftq] >= id - pid[ftq]) {         ++qcnt;         if (tag == 0) {           qrys[qcnt] = {lef[ftq] + id - pid[ftq], rig[ftq]};           qry[tmp].push_back(qcnt);         } else if (qans[qcnt] == 1 && !solved[ftq]) {           solved[ftq] = 1;           for (int xj = pid[ftq]; xj < id; ++xj) putchar(pat[xj]);           putchar(c);           printf(  n );         }       }     }   }   int main(void) {     scanf( %s , tex);     extend(tex);     for (int i = 1; i <= sz; ++i) sons[link[i]].push_back(i);     for (int i = 0; i <= sz; ++i) {       tar[i] = i;       if (pre[i]) st[i].insert(pre[i]);     }     int q = read();     for (int i = 1; i <= q; ++i) {       lef[i] = read(), rig[i] = read(), pid[i] = pcnt;       scanf( %s , pat + pid[i]);       pln[i] = strlen(pat + pid[i]);       pcnt += pln[i] + 1;       foreach_query(i, pid[i], 0, 0);     }     solve(0);     qcnt = 0;     for (int i = 1; i <= q; ++i) {       foreach_query(i, pid[i], 0, 1);       if (!solved[i]) printf( -1 n );     }     return 0;   }   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     int arr[n];     for (int i = 0; i < n; ++i) {       cin >> arr[i];     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; ++j) {         if (j == i) continue;         for (int k = 0; k < n; ++k) {           if (j == k)             continue;           else if (i == k)             continue;           if (arr[j] + arr[k] == arr[i]) {             cout << i + 1 <<     << k + 1 <<     << j + 1;             return 0;           }         }       }     }     cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int lowbit(int x) { return x & -x; }   int read() {     int kkk = 0, x = 1;     char c = getchar();     while ((c <  0  || c >  9 ) && c !=  - ) c = getchar();     if (c ==  - ) c = getchar(), x = -1;     while (c >=  0  && c <=  9 ) kkk = kkk * 10 + (c -  0 ), c = getchar();     return kkk * x;   }   int n, K, p, minn[101], dp[500001], tree[110], DP[10001][101], a[500001];   inline int MOD(int x) { return x + ((x >> 31) & p); }   void sbsolve() {     memset(DP, 0x3f, sizeof(DP));     DP[0][0] = 0;     for (int j = 1; j <= K; ++j) {       memset(minn, 0x3f, sizeof(minn));       for (int i = j - 1; i <= n; ++i) {         for (int k = 0; k < p; ++k)           DP[i][j] = min(DP[i][j], minn[k] + MOD(a[i] - k));         minn[a[i]] = min(minn[a[i]], DP[i][j - 1]);       }     }     printf( %d n , DP[n][K]);   }   void xg(int zone, int v) {     while (zone <= p) {       tree[zone] = max(tree[zone], v);       zone += lowbit(zone);     }   }   int cx(int zone) {     int bck = 0;     while (zone) {       bck = max(tree[zone], bck);       zone -= lowbit(zone);     }     return bck;   }   int main() {     n = read(), K = read(), p = read();     for (int i = 1; i <= n; ++i) a[i] = MOD(a[i - 1] + read() % p - p);     if (n < K * p) {       sbsolve();       return 0;     }     int ans = a[n];     for (int i = 1; i <= n; ++i) a[i] += 1;     dp[1] = 1;     xg(a[1], dp[1]);     for (int i = 2; i <= n; ++i) {       dp[i] = cx(a[i]) + 1;       xg(a[i], dp[i]);     }     if (dp[n] >= K)       printf( %d n , ans);     else       printf( %d n , ans + p);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int max_n = 1000, max_k = 100;   int dp[max_n][max_k];   int p[max_n + 5];   int main() {     int n, k, mod;     cin >> n >> k >> mod;     p[0] = 10 % k;     for (int i = 0; i < n; i++) p[i + 1] = p[i] * 10 % k;     memset(dp, 0, sizeof dp);     for (int dig = 1; dig < 10; dig++)       dp[0][dig % k] = (1 + dp[0][dig % k]) % mod;     for (int i = 0; i < n - 1; i++)       for (int dig = (i + 1 == n - 1); dig < 10; dig++) {         if (dig) {           int newr = dig * p[i] % k;           dp[i + 1][newr] = (1 + dp[i + 1][newr]) % mod;         }         for (int r = 0; r < k; r++) {           int newr = r ? (dig * p[i] + r) % k : 0;           dp[i + 1][newr] = (dp[i][r] + dp[i + 1][newr]) % mod;         }       }     cout << dp[n - 1][0] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const ll INF = 4e18;   const int N = 5e5 + 1;   vector<int> vec;   vector<pair<int, ll> > g[N];   int n, op, t, l, r, q, s, pos[N][2];   void construct(int node = 1, int b = 1, int e = n) {     pos[node][op] = ++t;     if (b == e) {       if (op == 0)         g[pos[node][0]].push_back({b, 0});       else         g[b].push_back({pos[node][1], 0});       return;     }     int m = (b + e) >> 1;     construct(node << 1, b, m);     construct(node << 1 | 1, m + 1, e);     if (op == 0) {       g[pos[node][0]].push_back({pos[node << 1][0], 0});       g[pos[node][0]].push_back({pos[node << 1 | 1][0], 0});     } else {       g[pos[node << 1][1]].push_back({pos[node][1], 0});       g[pos[node << 1 | 1][1]].push_back({pos[node][1], 0});     }   }   void query(int node = 1, int b = 1, int e = n) {     if (b > e || b > r || e < l) return;     if (l <= b && e <= r) {       vec.push_back(pos[node][op]);       return;     }     int m = (b + e) >> 1;     query(node << 1, b, m);     query(node << 1 | 1, m + 1, e);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> q >> s;     t = n;     op = 0;     construct();     op = 1;     construct();     while (q--) {       cin >> op;       if (op == 1) {         int v, u, w;         cin >> v >> u >> w;         g[v].push_back({u, w});       } else {         op -= 2;         int v, w;         cin >> v >> l >> r >> w;         query();         if (op == 0) {           for (int x : vec) {             g[v].push_back({x, w});           }         } else {           for (int x : vec) {             g[x].push_back({v, w});           }         }         vec.clear();       }     }     priority_queue<pair<ll, int> > pq;     pq.push({0, s});     vector<ll> dis(N, INF);     dis[s] = 0;     for (int i = 1; i <= n; i += 1) {       pq.push({-dis[i], i});     }     while (!pq.empty()) {       int u = pq.top().second;       pq.pop();       for (auto x : g[u]) {         int v = x.first;         int cost = x.second;         if (dis[v] > dis[u] + cost) {           dis[v] = dis[u] + cost;           pq.push({-dis[v], v});         }       }     }     for (int i = 1; i <= n; i += 1) {       if (dis[i] >= INF) dis[i] = -1;       cout << dis[i] <<    ;     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> primes;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     int n, q;     cin >> n >> q;     vector<pair<int, int> > ans;     int tmp(-1);     vector<bool> state;     for (int i = 0; i < n; ++i) {       int x;       cin >> x;       if (tmp <= x) {         if (!i)           tmp = x;         else {           ans.push_back(make_pair(tmp, x));           tmp = x;           state.push_back(true);         }       } else {         ans.push_back(make_pair(x, tmp));         state.push_back(false);       }     }     int nw = n - 1;     while (q--) {       long long y;       cin >> y;       if (!y)         cout <<   n ;       else {         if (y < n) {           if (state[y - 1])             cout << ans[y - 1].first <<     << ans[y - 1].second <<   n ;           else             cout << ans[y - 1].second <<     << ans[y - 1].first <<   n ;         } else {           y -= n;           if (!y)             cout << tmp <<     << ans[0].first <<   n ;           else             cout << tmp <<     << ans[y % nw].first <<   n ;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int powP[2001] = {1};   int invPowP[2001] = {1};   int hashW[2001] = {0};   vector<pair<int, int> > hashTable[100003];   void findPos(string& w, string& subW, vector<int>& posSubW) {     unsigned int j = 0, k = subW.size();     for (unsigned int i = 0; (i + k) <= w.size(); i++) {       while (j < subW.size() && w[i] == subW[j]) {         i++;         j++;       }       if (j == subW.size()) posSubW.push_back(i - j + 1);       if (j > 0) {         i -= j;         j = 0;       }     }   }   void fillHash(string& w) {     for (unsigned int i = 0; i < w.size(); i++)       hashW[i + 1] =           (hashW[i] + (((long long)w[i] - 96) * (long long)powP[i]) % 100003) %           100003;   }   int myMod(int a, int m) {     if (a >= 0) return a % m;     return m * ((-a / m) + 1) + a;   }   int getHash(int i, int j) {     int hashVal = myMod(hashW[j] - hashW[i - 1], 100003),         inverse = invPowP[i - 1];     return ((long long)hashVal * (long long)inverse) % (long long)100003;     ;   }   inline int modPow(long long a, int b, int m) {     long long ans = 1;     while (b > 0) {       if (b & 1) ans = (ans * a) % m;       a = (a * a) % m;       b >>= 1;     }     return ans;   }   int getInverse(int a, int m) { return modPow(a, m - 2, m); }   bool cmpHash(unsigned int wSize, pair<int, int>& a, pair<int, int> b) {     unsigned int i = 0, j = wSize, mid;     while (i < j) {       mid = (i + j) / 2;       if (getHash(a.first, a.first + mid) != getHash(b.first, b.first + mid))         return false;       else         i = mid + 1;     }     return true;   }   int main() {     vector<int> posS, posE;     string w, s, e;     for (unsigned int i = 1; i < 2001; i++)       powP[i] = (((long long)powP[i - 1] * (long long)37)) % (long long)100003;     for (unsigned int i = 1; i < 2001; i++)       invPowP[i] = getInverse(powP[i], 100003);     cin >> w >> s >> e;     findPos(w, s, posS);     findPos(w, e, posE);     fillHash(w);     int cont = 0, hashVal;     bool found = false;     for (unsigned int i = 0; i < posS.size(); i++)       for (unsigned int j = 0; j < posE.size(); j++) {         if (posS[i] <= posE[j] &&             (posS[i] + s.size() - 1) <= (posE[j] + e.size() - 1)) {           found = 0;           hashVal = getHash(posS[i], posE[j] + e.size() - 1);           for (unsigned int k = 0; k < hashTable[hashVal].size(); k++) {             if ((hashTable[hashVal][k].second - hashTable[hashVal][k].first) ==                 (posE[j] - posS[i])) {               if (cmpHash(1 + posE[j] - posS[i], hashTable[hashVal][k],                           make_pair(posS[i], posE[j]))) {                 found = true;                 break;               }             }           }           if (!found) {             cont++;             hashTable[hashVal].push_back(make_pair(posS[i], posE[j]));           }         }       }     cout << cont << endl;     return 0;   }
#include <bits/stdc++.h>   const long long mod = 1e8;   using namespace std;   bool in(int x, int l, int r) { return l <= x && x <= r; }   void solve() {     long long l, r;     cin >> l >> r;     vector<long long> v;     long long p = -1;     for (int i = 61; i >= 0; i--) {       unsigned long long mask = 1ull << i;       if (mask & r) {         v.push_back(i);         if (mask & l) {           continue;         } else {           p = i;           break;         }       }     }     long long ans = 0;     if (v.size() == 0) {       cout << l <<   n ;       return;     }     int q = 0;     for (int i = p - 1; i >= 0; i--) {       unsigned long long mak = 1ull << i;       if (mak & r) q++;     }     if (q == p) {       cout << r <<   n ;       return;     }     for (int i = 0; i < v.size(); i++) {       if (v[i] != p) ans += pow(2, v[i]);     }     for (int i = p - 1; i >= 0; i--) ans += pow(2, i);     cout << ans <<   n ;   }   int main() {     ios_base::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;   template <typename T>   void read(T &x) {     x = 0;     bool f = 0;     char c = getchar();     for (; !isdigit(c); c = getchar())       if (c ==  - ) f = 1;     for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);     if (f) x = -x;   }   template <typename T>   inline void Mx(T &x, T y) {     x < y && (x = y);   }   template <typename T>   inline void Mn(T &x, T y) {     x > y && (x = y);   }   long long T, n, l, r;   int main() {     read(T);     while (T--) {       read(n), read(l), read(r);       if (n == 2) {       }       long long sum = 0, pre = 0;       for (int i = 1; i < n; i++) {         sum += (n - i) * 2;         if (l < sum) {           long long t = l - pre;           long long x = (t & 1) ? i : (t / 2) + i, y = (t / 2) + i;           while (l < sum && l <= r) {             printf( %lld  , x);             x == i ? y++, x = y : x = i;             l++;           }         }         if (l == sum && l <= r) printf( %lld  , n), l++;         pre = sum;         if (l > r) break;       }       if (l <= r) printf( 1 );       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const int maxn = 100;   int b, d, lenA, lenC;   string a, c;   int dp[maxn + 10], nex[maxn + 10];   void cope(int x) {     dp[x] = 0;     nex[x] = x;     int use = 0;     while (use < lenA) {       if (a[use] == c[nex[x]]) {         if (++nex[x] == lenC) {           dp[x]++;           nex[x] = 0;         }       }       use++;     }   }   int main() {     std::ios::sync_with_stdio(false);     while (cin >> b >> d) {       cin >> a >> c;       lenA = a.length(), lenC = c.length();       for (int(i) = 0; (i) < (lenC); (i)++) cope(i);       int x = 0, num = 0;       for (int(i) = 0; (i) < (b); (i)++) {         num += dp[x];         x = nex[x];       }       num /= d;       cout << num << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, m, i, j, k, ct;     bool swapped = false;     cin >> n >> m;     if (n < m) {       swap(n, m);       swapped = true;     }     vector<vector<int>> ans(n, vector<int>(m, -1));     ct = 0;     if (m == 1) {       for (i = 1; i < n; i += 2) ans[i][0] = ++ct;       for (i = 0; i < n; i += 2) ans[i][0] = ++ct;     } else {       for (i = 0; i < n; i++) {         for (j = i % 2; j < m; j += 2) ans[i][j] = ++ct;       }       for (i = 0; i < n; i++) {         for (j = 1 - (i % 2); j < m; j += 2) ans[i][j] = ++ct;       }     }     bool solved = true;     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         if ((i < n - 1) && (abs(ans[i][j] - ans[i + 1][j]) == 1)) solved = false;         if ((j < m - 1) && (abs(ans[i][j] - ans[i][j + 1]) == 1)) solved = false;       }     }     if (!solved)       cout <<  -1 n ;     else {       if (!swapped) {         for (i = 0; i < n; i++) {           for (j = 0; j < m; j++) cout << ans[i][j] <<    ;           cout <<   n ;         }       } else {         for (j = 0; j < m; j++) {           for (i = 0; i < n; i++) cout << ans[i][j] <<    ;           cout <<   n ;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t = 1;     while (t--) {       unsigned long long int a, b, c, d;       cin >> a >> b >> c >> d;       unordered_map<unsigned long long int, unsigned long long int> mp, mp1;       for (int i = 0; i <= 100000; i++) {         ++mp[b + (i * a)];         ++mp1[d + (i * c)];       }       for (int i = 0; i <= 100000; i++) {         if (mp[i] && mp1[i]) {           cout << i;           return 0;         }       }       cout << -1;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x, y;     cin >> n >> x >> y;     int people = n - x;     int wizards = x;     people *= 100;     wizards *= 100;     int needed = max(0, n * y - wizards);     cout << (needed + 99) / 100 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[400500], b[400500], n, tot;   long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   int main() {     n = read();     tot = 0;     for (int i = 1; i <= n; i++) {       int x = read();       if (x) a[++tot] = x;     }     tot = 0;     for (int i = 1; i <= n; i++) {       int x = read();       if (x) b[++tot] = x;     }     for (int i = n; i <= 2 * n - 2; i++) b[i] = b[i - (n - 1)];     n--;     int loc = 0;     for (int i = 1; i <= n; i++)       if (a[1] == b[i]) loc = i;     int flag = 0;     for (int i = loc, j = 1; j <= n; i++, j++)       if (b[i] != a[j]) {         flag = 1;         break;       }     if (!flag)       puts( YES );     else       puts( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<string> v;     vector<int> vn;     for (int i = 0; i < n; i++) {       string a;       cin >> a;       bool cn = false;       int y = 0;       for (int j = 0; j < v.size(); j++) {         if (a == v[j]) {           y = j;           cn = true;           break;         }       }       if (cn) {         vn[y]++;       } else {         v.push_back(a);         vn.push_back(1);       }     }     int rpta = vn[0];     for (int i = 1; i < vn.size(); i++) {       rpta = max(rpta, vn[i]);     }     cout << rpta <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool vowel(char c) {     return (c ==  a  || c ==  e  || c ==  o  || c ==  i  || c ==  u );   }   int cvowel(string& s) {     int n = 0;     for (char& c : s) {       n += vowel(c);     }     return n;   }   int getlast(string& s) {     for (int i = s.size() - 1;; i--) {       if (vowel(s[i])) {         return s[i];       }     }   }   const int KEK = 1000001;   vector<string> ss[KEK];   vector<pair<char, int>> vv[KEK];   int main() {     ios::sync_with_stdio(0);     int n;     cin >> n;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       int cnt = cvowel(s);       ss[cnt].push_back(s);       vv[cnt].push_back(make_pair(getlast(s), ss[cnt].size() - 1));     }     vector<pair<string, string>> q1, q2;     for (int i = 1; i < KEK; i++) {       sort(vv[i].begin(), vv[i].end());       int m = vv[i].size();       vector<bool> inpair(m, false);       for (int j = 1; j < m; j++) {         if (vv[i][j - 1].first == vv[i][j].first) {           inpair[j - 1] = inpair[j] = true;           q2.push_back(               make_pair(ss[i][vv[i][j - 1].second], ss[i][vv[i][j].second]));           j++;         }       }       int last = -1;       for (int j = 0; j < m; j++) {         if (inpair[j] == false) {           if (last == -1) {             last = j;           } else {             q1.push_back(                 make_pair(ss[i][vv[i][last].second], ss[i][vv[i][j].second]));             last = -1;           }         }       }     }     while (q2.size() > q1.size()) {       q1.push_back(q2.back());       q2.pop_back();     }     while (q1.size() > q2.size()) {       q1.pop_back();     }     cout << q1.size() << endl;     for (int i = 0; i < q1.size(); i++) {       cout << q1[i].first <<     << q2[i].first <<   n ;       cout << q1[i].second <<     << q2[i].second <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int n, c, a[2], r = 0;   int main() {     cin >> n >> c >> a[0];     for (int i = 1; i < n; i++)       cin >> a[i % 2], r = max(r, a[i % 2 ^ 1] - a[i % 2] - c);     cout << r;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> tab(n);     for (int i = 0; i < n; i++) cin >> tab[i];     for (int i = 0; i < n; i++) {       if (tab[i] % 2 == 0)         continue;       else {         if (i == (n - 1) || tab[i + 1] == 0) {           cout <<  NO ;           return 0;         } else           tab[i + 1] -= 1;       }     }     cout <<  YES ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, a, b, x, cnt, ans;   deque<long long> V;   map<long long, long long> mp;   long long arr[1000001];   int main() {     cin >> n >> a >> b;     for (int i = 1; i <= n; i++) {       cin >> arr[i];     }     sort(arr + 1, arr + n + 1);     ans = (n - a) + 1;     x = arr[ans] - arr[b];     cout << x << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   const int MAXN = 200001;   int c[MAXN * 3 + 10];   int n;   char s[MAXN + 10];   int sum[MAXN + 10];   int lowbit(int x) { return x & (-x); }   void update(int pos, int delta) {     while (pos <= n) {       c[pos] = min(c[pos], delta);       pos += lowbit(pos);     }   }   int query(int end) {     int res = INF;     while (end > 0) {       res = min(res, c[end]);       end -= lowbit(end);     }     return res;   }   bool isvowel(char x) {     if (x ==  a  || x ==  e  || x ==  i  || x ==  o  || x ==  u ) return true;     if (x ==  A  || x ==  E  || x ==  I  || x ==  O  || x ==  U ) return true;     return false;   }   int main() {     scanf( %s , s);     int len = strlen(s);     n = 3 * len + 1;     for (int i = 0; i <= n; i++) {       c[i] = INF;     }     memset(sum, 0, sizeof(sum));     for (int i = 0; i < len; i++) {       sum[i + 1] = sum[i] + (isvowel(s[i]) ? -1 : 2);     }     int ret = -1;     update(sum[0] + len + 1, 0);     for (int i = 1; i <= len; i++) {       int p = query(sum[i] + len + 1);       if (p != INF && i - p > ret) {         ret = i - p;       }       update(sum[i] + len + 1, i);     }     if (ret == -1) {       printf( No solution n );     } else {       int count = 0;       for (int i = 0; i <= len; i++) {         if (i + ret > len) break;         if (sum[i + ret] - sum[i] >= 0) {           count++;         }       }       printf( %d %d n , ret, count);     }     return 0;   }