malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   const long long M = 1e9 + 7;   const long long inf = 1e18 + 5;   vector<int> pre_fn(string &s) {     int n = s.size();     vector<int> pre(n);     int pos = 0;     pre[0] = 0;     for (int i = 1; i < n; i++) {       while (pos and s[pos] != s[i]) pos = pre[pos - 1];       if (s[pos] == s[i]) pos++;       pre[i] = pos;     }     return pre;   }   int main() {     string s, t;     cin >> s >> t;     int n = s.size();     int m = t.size();     vector<int> pre = pre_fn(t);     int a[m][26];     for (int i = 0; i < m; i++) {       for (int c = 0; c < 26; c++) {         if (i and t[i] !=  a  + c)           a[i][c] = a[pre[i - 1]][c];         else           a[i][c] = i + (t[i] ==  a  + c);       }     }     int dp[n + 1][m + 1];     memset(dp, -1, sizeof(dp));     dp[0][0] = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (dp[i][j] != -1) {           if (s[i] ==  ? ) {             for (int k = 0; k < 26; k++) {               int get = a[j][k];               if (get == m)                 dp[i + 1][pre[m - 1]] = max(dp[i][j] + 1, dp[i + 1][pre[m - 1]]);               else                 dp[i + 1][get] = max(dp[i + 1][get], dp[i][j]);             }           } else {             int get = a[j][s[i] -  a ];             if (get == m)               dp[i + 1][pre[m - 1]] = max(dp[i][j] + 1, dp[i + 1][pre[m - 1]]);             else               dp[i + 1][get] = max(dp[i + 1][get], dp[i][j]);           }         }       }     }     int ans = 0;     for (int i = 0; i <= m; i++) ans = max(ans, dp[n][i]);     printf( %d  , ans);   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:256000000 )   using namespace std;   const double EPS = 1e-9;   const double pi = acos(-1.0);   const long long MAXN = (long long)1e5 + 7;   const long long INF = (long long)1e9 + 7;   const long long LINF = (long long)1 << 63 - 5;   const long long MOD = (long long)2000000033;   const long long P = 2390117;   const long long SZ = (long long)1e5;   bool check(char c) {     return (c ==  A  || c ==  E  || c ==  I  || c ==  O  || c ==  U  || c ==  Y );   }   int main() {     string s;     cin >> s;     long long ans = 0;     long long curcnt = 0;     int i = 0;     while (i < s.size()) {       long long curans = 0;       while (check(s[i])) {         i++;         if (i == s.size()) break;       }       if (i == s.size()) break;       curans = 0;       while (!check(s[i])) {         i++;         curans++;         if (i == s.size()) break;       }       ans = max(ans, curans);     }     cout << ans + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int n, a[1000005], an = 0, fact = 1;   long long int egcd(long long int aa, long long int bb, long long int &xx,                      long long int &yy) {     if (aa == 0) {       xx = 0, yy = 1;       return bb;     }     long long int x1, y1, dd;     dd = egcd(bb % aa, aa, x1, y1);     xx = y1 - (bb / aa) * x1;     yy = x1;     return dd;   }   long long int modinverse(long long int aa, long long int mm) {     long long int xx, yy;     long long int dd = egcd(aa, mm, xx, yy);     if (dd != 1) {       cout <<  fault  << endl;       return 0;     }     long long int res = (xx + mm) % mm;     return res;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     scanf( %lld , &n);     for (int i = 1; i <= n; i++) scanf( %lld , &a[i]);     for (int i = 1; i <= n; i++) fact = (fact * (long long int)i) % 1000000007;     sort(a + 1, a + n + 1);     long long int bef = 0, lol;     for (int i = 1; i <= n; i++) {       if (a[i] != a[n] && a[i] != bef) {         lol = (fact * modinverse(n - i + 1, 1000000007)) % 1000000007;         lol = (lol * a[i]) % 1000000007;         an = (an + lol) % 1000000007;         bef = a[i];       } else if (a[i] == bef && a[i] != a[n])         an = (an + lol) % 1000000007;     }     printf( %lld n , an);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const double PI = acos(-1.0);   template <class Int>   Int __gcd(Int a, Int b) {     return (b == 0 ? abs(a) : __gcd(b, a % b));   }   int dx[] = {0, 0, -1, 1, 1, 1, -1, -1};   int dy[] = {-1, 1, 0, 0, 1, -1, -1, 1};   const int N = 2e5 + 10;   void file() {}   bool ok(string s) {     string t = s;     sort(((t).rbegin()), ((t).rend()));     return s == t;   }   string solve(string s, int k) {     if (k == 0 || ok(s)) return s;     string r = s;     for (int i = 0; i < ((int)(s).size()) - 1; i++) {       if (s[i] < s[i + 1]) {         string t = s;         swap(t[i], t[i + 1]);         r = max(r, solve(t, k - 1));       }     }     return r;   }   int main() {     file();     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string s;     int k;     cin >> s >> k;     for (int i = 0; i < ((int)(s).size()); i++) {       char ch = s[i];       int idx = i;       for (int j = i + 1; j < min(i + k + 1, ((int)(s).size())); j++) {         if (s[j] > ch) {           ch = s[j];           idx = j;         }       }       for (int j = idx; j > i; j--) {         swap(s[j], s[j - 1]);         k--;       }     }     cout << s << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9;   inline void gmx(long long &x, long long y) {     if (x < y) x = y;   }   inline void gmn(long long &x, long long y) {     if (x > y) x = y;   }   inline int read() {     char c = getchar();     int z = 0, f = 1;     while (c !=  -  && (c >  9  || c <  0 )) c = getchar();     if (c ==  - ) f = -1, c = getchar();     while (c >=  0  && c <=  9 ) z = (z << 1) + (z << 3) + c -  0 , c = getchar();     return z * f;   }   const int N = 1e4 + 5;   int n, c, p[N], s[N];   long long f[2][N], ans = 1e18;   int main() {     n = read();     c = read();     for (int i = 1; i <= n; i++) p[i] = read();     for (int i = 1; i <= n; i++) s[i] = read();     for (int i = 1; i <= n; i++) {       int o = i & 1;       memset(f[o], 0x3f, sizeof(f[o]));       f[o][0] = f[o ^ 1][0] + p[i];       for (int j = 1; j <= i; j++)         f[o][j] = min(f[o ^ 1][j] + 1ll * c * j + p[i], f[o ^ 1][j - 1] + s[i]);     }     for (int i = 0; i <= n; i++) gmn(ans, f[n & 1][i]);     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a[11], b[11];   bool flag[11];   int main() {     int i;     scanf( %d%d , &n, &m);     for (i = 1; i <= n; ++i) scanf( %d , &a[i]);     for (i = 1; i <= m; ++i) scanf( %d , &b[i]), flag[b[i]] = true;     for (i = 1; i <= n; ++i)       if (flag[a[i]]) printf( %d  , a[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<vector<int>> graph;   vector<int> isBlack;   vector<long long> dp[2];   long long previous[2];   void dfs(int curr) {     dp[0][curr] = 1 - isBlack[curr];     dp[1][curr] = isBlack[curr];     for (int child : graph[curr]) {       dfs(child);       previous[0] = dp[0][curr];       previous[1] = dp[1][curr];       dp[0][curr] = 0;       dp[1][curr] = 0;       dp[1][curr] =           (previous[1] * (dp[0][child] + dp[1][child]) % 1000000007) % 1000000007;       if (isBlack[curr] == 0) {         dp[0][curr] = (previous[0] * (dp[0][child] + dp[1][child]) % 1000000007) %                       1000000007;         dp[1][curr] = (dp[1][curr] + (previous[0] * dp[1][child]) % 1000000007) %                       1000000007;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     graph.resize(n);     isBlack.resize(n);     dp[1].resize(n);     dp[0].resize(n);     for (int i = 0; i < n - 1; i++) {       int p;       cin >> p;       graph[p].push_back(i + 1);     }     for (int i = 0; i < n; i++) {       cin >> isBlack[i];     }     dfs(0);     cout << dp[1][0] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a, b, c, d, e, f;     cin >> a >> b;     c = a / 2;     if (b < c || (a == 1 && b != 0))       cout << -1;     else if (a == 1 && b == 0)       cout << 1;     else if (b % c == 0) {       e = b / c;       if (b / c != 1) {         for (int i = 0; i < a; i++) {           cout << e <<    ;           e += (b / c);         }       } else {         for (int i = 0; i < a; i++) {           cout << e <<    ;           e += 1;         }       }     } else {       f = b / c;       e = b / c + b % c;       cout << e <<     << 2 * e <<     << f <<    ;       if (b / c != 1) {         for (int i = 3; i < a; i++) {           if (b / c + f != 2 * e && b / c + f != e)             cout << (b / c) + f <<    ;           else {             f += b / c;             cout << b / c + f <<    ;           }           f += (b / c);         }       } else {         for (int i = 3; i < a; i++) {           cout << (e * e + 1) + f <<    ;           f += 1;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   template <class T>   void out(T x) {     if (x < 0) {       putchar( - );       x = -x;     }     if (x > 9) out(x / 10);     putchar(x % 10 +  0 );   }   long long dp[2005];   struct node {     int x, y;   } a[2005];   bool cmp(node a, node b) {     if (a.x == b.x) return a.y < b.y;     return a.x < b.x;   }   long long O[201005], I[201005];   long long C(int a, int b) { return O[a] * I[b] % mod * I[a - b] % mod; }   int main() {     O[0] = 1;     for (int i = 1; i < 200105; i++) O[i] = O[i - 1] * i % mod;     I[0] = I[1] = 1;     for (int i = 2; i < 200105; i++) I[i] = mod / i * (mod - I[mod % i]) % mod;     for (int i = 1; i < 200105; i++) I[i] = I[i] * I[i - 1] % mod;     int h, w, n;     scanf( %d%d%d , &h, &w, &n);     for (int i = 0; i < n; i++) scanf( %d%d , &a[i].x, &a[i].y);     sort(a, a + n, cmp);     long long ans = C(h + w - 2, h - 1);     for (int i = 0; i < n; i++) {       dp[i] = C(a[i].x + a[i].y - 2, a[i].y - 1);       for (int j = 0; j < i; j++)         if (a[j].x <= a[i].x && a[j].y <= a[i].y) {           dp[i] = (dp[i] -                    dp[j] * C(a[i].x - a[j].x + a[i].y - a[j].y, a[i].x - a[j].x) +                    mod) %                   mod;         }       ans = (ans - dp[i] * C(h - a[i].x + w - a[i].y, h - a[i].x) + mod) % mod;     }     out((ans + mod) % mod);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ans;   int main() {     int a[101010];     int b, c;     cin >> b >> c;     for (int i = 1; i <= b; ++i) {       cin >> a[i];     }     for (int i = 1; i <= b; ++i) {       if (a[i] > c)         ans += 2;       else if (a[i] <= c)         ans++;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, sum;   string a;   int main() {     cin >> n >> k;     for (int i = (0); i < (n); i++) {       int l, r;       cin >> l >> r;       sum += (r - l + 1);     }     if (sum % k == 0)       cout << 0 << endl;     else {       int u = sum;       while (u % k) u++;       cout << u - sum << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int pos;     cin >> pos;     long long tmp = 0;     long long n;     for (int i = 1; i < 1000000000; i++) {       tmp += i;       if (tmp > pos) {         n = n - (tmp - i);         break;       }       if (tmp == pos) {         n = i;         break;       }     }     cout << n;     cout << endl;   }
#include <bits/stdc++.h>   #pragma warning(disable : 4244 4267 4018 4996 4800)   #pragma comment(linker,  /stack:20000000 )   using namespace std;   istream& in = cin;   ostream& out = cout;   vector<int> cnt;   string s;   int pos, res;   vector<string> v;   void parse(int node) {     assert(s[pos] ==  < );     while (pos + 1 < s.size() && s[pos] ==  <  && s[pos + 1] !=  / ) {       static string tag;       tag.clear();       ++pos;       while (pos < s.size() && s[pos] !=  /  && s[pos] !=  > ) {         tag.push_back(s[pos]);         ++pos;       }       int ts = tag.size();       if (node >= v.size() - 1 && tag == v.back()) ++res;       if (s[pos] ==  / ) {         pos += 2;       } else {         ++pos;         parse(node < v.size() && v[node] == tag ? node + 1 : node);         pos += 3 + ts;       }     }   }   int main() {     getline(in, s);     int n;     in >> n;     string line;     getline(in, line);     for (int i = 0; i < n; ++i) {       getline(in, line);       istringstream iss(line);       int tok = 1;       v.clear();       for (;;) {         string t;         iss >> t;         if (!iss) break;         v.push_back(t);       }       res = 0;       pos = 0;       parse(0);       out << res <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MaxN = 1e5;   int main() {     int a[5], b[5], s[5], vis;     while (~scanf( %d %d %d , &a[1], &a[2], &a[3])) {       sort(a + 1, a + 4);       vis = 0;       s[1] = 1;       s[2] = 0;       s[3] = 0;       b[1] = 1;       for (int i = 2; i <= MaxN; i++) {         if ((i - b[1]) % a[1] != 0 && s[2] == 0) {           s[2] = 1;           b[2] = i;         }         if (s[2] == 1 && (i - b[1]) % a[1] != 0 && (i - b[2]) % a[2] != 0 &&             s[3] == 0) {           s[3] = 1;           b[3] = i;         }         if (s[3] == 1 && (i - b[1]) % a[1] != 0 && (i - b[2]) % a[2] != 0 &&             (i - b[3]) % a[3] != 0) {           vis = 1;           break;         }       }       if (vis == 1)         printf( NO n );       else         printf( YES n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200001;   long long a[N + 1], tree[4 * N], lazy[4 * N];   void build(int idx, int l, int r) {     if (l == r)       tree[idx] = a[l];     else {       int m = (l + r) / 2;       build(2 * idx, l, m);       build(2 * idx + 1, m + 1, r);       tree[idx] = min(tree[2 * idx], tree[2 * idx + 1]);     }   }   void push(int idx) {     tree[2 * idx] += lazy[idx];     lazy[2 * idx] += lazy[idx];     tree[2 * idx + 1] += lazy[idx];     lazy[2 * idx + 1] += lazy[idx];     lazy[idx] = 0;   }   void update(int idx, int l, int r, int ql, int qr, long long val) {     if (ql > qr) return;     if (l == ql && r == qr) {       tree[idx] += val;       lazy[idx] += val;     } else {       push(idx);       int m = (l + r) / 2;       update(2 * idx, l, m, ql, min(qr, m), val);       update(2 * idx + 1, m + 1, r, max(ql, m + 1), qr, val);       tree[idx] = min(tree[2 * idx], tree[2 * idx + 1]);     }   }   long long query(int idx, int l, int r, int ql, int qr) {     if (ql > qr) return 1000000000000000000;     if (l == ql && r == qr)       return tree[idx];     else {       push(idx);       int m = (l + r) / 2;       return min(query(2 * idx, l, m, ql, min(qr, m)),                  query(2 * idx + 1, m + 1, r, max(ql, m + 1), qr));     }   }   int main() {     int n;     scanf( %d  , &n);     for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]);     build(1, 1, n);     int m;     scanf( %d  , &m);     while (m--) {       char c[105];       fgets(c, 100, stdin);       int id = 0;       long long now[3], temp = 0;       bool b = 0;       for (int i = 0;; i++) {         if (c[i] ==  - ) {           b = 1;           continue;         }         if (c[i] ==     || c[i] ==   n ) {           now[id++] = temp;           temp = 0;         } else           temp = 10 * temp + (c[i] -  0 );         if (c[i] ==   n ) break;       }       if (b) now[2] *= -1;       now[0]++;       now[1]++;       if (id == 2) {         long long res;         if (now[0] <= now[1])           res = query(1, 1, n, now[0], now[1]);         else           res = min(query(1, 1, n, 1, now[1]), query(1, 1, n, now[0], n));         printf( %I64d n , res);       } else {         if (now[0] <= now[1])           update(1, 1, n, now[0], now[1], now[2]);         else {           update(1, 1, n, 1, now[1], now[2]);           update(1, 1, n, now[0], n, now[2]);         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x, y;     cin >> n;     vector<int> adj[n + 1], deg(n + 1, 0);     vector<pair<int, int>> input;     for (int i = 0; i < n - 1; i++) {       cin >> x >> y;       input.push_back(make_pair(x, y));       adj[x].push_back(y);       adj[y].push_back(x);       deg[x]++;       deg[y]++;     }     vector<pair<int, int>> s;     for (int i = 1; i <= n; i++) {       s.push_back(make_pair(deg[i], i));     }     sort(s.begin(), s.end());     int number = 0;     map<pair<int, int>, int> m;     for (auto x : s) {       int degree = x.first;       int vertex = x.second;       for (int k : adj[vertex]) {         pair<int, int> temp = {k, vertex};         pair<int, int> revr = {vertex, k};         if (m.find(temp) == m.end()) {           m[temp] = number;           m[revr] = number;           number++;         }       }     }     for (auto x : input) {       pair<int, int> temp = {x.first, x.second};       cout << m[temp] <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline void Int(T &n) {     n = 0;     int f = 1;     register int ch = getchar();     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) f = -1;     for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch -  0 ;     n = n * f;   }   template <typename T>   T gcd(T a, T b) {     return !b ? a : gcd(b, a % b);   }   template <typename T>   inline void umin(T &a, T b) {     a = a < b ? a : b;   }   template <typename T>   inline void umax(T &a, T b) {     a = a > b ? a : b;   }   template <typename T, typename W>   inline void Int(T &x, W &y) {     Int(x), Int(y);   }   template <typename T, typename W, typename Q>   inline void Int(T &x, W &y, Q &z) {     Int(x, y), Int(z);   }   const int N = (int)1e7 + 5;   const int INF = (int)1e9 + 7;   const long long MOD = (long long)1e9 + 7;   long long pa, pb, pc, pd, a, b, c, d;   int main() {     int n;     Int(n);     pa = pb = pc = 0, pd = 1;     for (int i = 1; i <= n; ++i) {       a = (pb + pc + pd) % MOD;       b = (pa + pc + pd) % MOD;       c = (pa + pb + pd) % MOD;       d = (pa + pb + pc) % MOD;       pa = a, pb = b, pc = c, pd = d;     }     printf( %lld n , d);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 5;   const long long inf = 1e16 + 7;   long long m, n, h;   long long ans = 0;   long long seg[4 * N];   long long lazy[4 * N];   long long ind[N];   vector<long long> b;   vector<long long> a;   void build(long long p, long long val, long long v = 1, long long s = 0,              long long e = n + 1) {     if (e - s == 1) {       seg[v] = val;       return;     }     long long mid = (e + s) / 2;     long long lc = 2 * v;     long long rc = lc + 1;     if (p < mid) {       build(p, val, lc, s, mid);     } else {       build(p, val, rc, mid, e);     }     seg[v] = min(seg[lc], seg[rc]);   }   void shift(long long v, long long s, long long e) {     long long mid = (s + e) / 2;     long long lc = 2 * v;     long long rc = lc + 1;     seg[lc] += lazy[v];     seg[rc] += lazy[v];     lazy[lc] += lazy[v];     lazy[rc] += lazy[v];     lazy[v] = 0;   }   void add(long long l, long long r, long long val, long long v = 1,            long long s = 0, long long e = n + 1) {     if (r <= s || e <= l) {       return;     }     if (l <= s && e <= r) {       seg[v] += val;       lazy[v] += val;       return;     }     shift(v, s, e);     long long mid = (s + e) / 2;     long long lc = 2 * v;     long long rc = lc + 1;     add(l, r, val, lc, s, mid);     add(l, r, val, rc, mid, e);     seg[v] = min(seg[lc], seg[rc]);   }   long long get(long long l, long long r, long long v = 1, long long s = 0,                 long long e = n + 1) {     if (r <= s || e <= l) {       return inf;     }     if (l <= s && e <= r) {       return seg[v];     }     shift(v, s, e);     long long mid = (s + e) / 2;     long long lc = 2 * v;     long long rc = lc + 1;     return min(get(l, r, lc, s, mid), get(l, r, rc, mid, e));   }   int main() {     memset(seg, 127, sizeof seg);     cin >> m >> n >> h;     for (long long i = 0; i < n; i++) {       long long tmp;       cin >> tmp;       b.push_back(tmp);     }     for (long long i = 0; i < m; i++) {       long long tmp;       cin >> tmp;       a.push_back(tmp);     }     sort(b.begin(), b.end());     for (long long i = 0; i < m; i++) {       ind[i] = lower_bound(b.begin(), b.end(), h - a[i]) - b.begin();     }     for (long long i = 0; i <= n; i++) {       build(i, n - i);     }     for (long long i = 0; i <= n; i++) {     }     for (long long i = 0; i < n; i++) {       add(0, ind[i] + 1, -1);     }     if (get(0, n + 1) >= 0) {       ans++;     }     for (long long i = n; i < m; i++) {       add(0, ind[i - n] + 1, +1);       add(0, ind[i] + 1, -1);       if (get(0, n + 1) >= 0) {         ans++;       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int N = 1e5 + 5, MOD = 1e9 + 7;   const ll INF = 1e18 + 17;   int n;   void solve() {     cin >> n;     if ((n - 2) % 3 != 0) {       cout <<  1 1   << n - 2;     } else {       cout <<  1 2   << n - 3;     }   }   int main() {     ios ::sync_with_stdio(0);     cin.tie(0);     int tt = 1;     while (tt--) {       solve();       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n, k;     cin >> n >> k;     vector<long long> arr(n, 0);     for (long long i = 0; i < n; i++) cin >> arr[i];     queue<pair<pair<long long, long long>, long long> > q;     for (long long i = 0; i < min(n, k); i++)       q.push(make_pair(make_pair(arr[i], arr[i]), i));     long long ind = k;     long long ans = 0;     long long per = 0;     long long tim = 0;     long long comp = 0;     set<long long> s;     while (ind < n) {       tim++;       queue<pair<pair<long long, long long>, long long> > temp;       long long fl1 = 0;       long long comp1 = 0;       while (!q.empty()) {         long long z = q.front().first.first;         long long z1 = q.front().first.second;         long long a = q.front().second;         q.pop();         z--;         if (z == 0) {           fl1 = 1;           comp++;         } else           temp.push(make_pair(make_pair(z, z1), a));       }       long double y1 = (100 * (comp / (n * 1.0)));       long long y = floor(y1 + 0.5);       long long fl = 0;       while (temp.size() < k && ind < n) {         temp.push(make_pair(make_pair(arr[ind], arr[ind]), ind));         ind++;       }       while (!temp.empty()) {         long long z = temp.front().first.first;         long long z1 = temp.front().first.second;         long long a1 = temp.front().second;         temp.pop();         long long a = z1 - z + 1;         if (a == y && s.find(a1) == s.end()) {           fl++;           s.insert(a1);         }         q.push(make_pair(make_pair(z, z1), a1));       }       if (fl != 0) {         ans += fl;       }     }     long long z = 1;     while (!q.empty()) {       tim++;       queue<pair<pair<long long, long long>, long long> > temp;       long long fl1 = 0;       long long comp1 = 0;       while (!q.empty()) {         long long z = q.front().first.first;         long long z1 = q.front().first.second;         long long a1 = q.front().second;         z--;         if (z == 0) {           fl1 = 1;           comp++;         } else           temp.push(make_pair(make_pair(z, z1), a1));         q.pop();       }       long double y1 = (100 * (comp / (n * 1.0)));       long long y = floor(y1 + 0.5);       long long fl = 0;       while (!temp.empty()) {         long long z = temp.front().first.first;         long long z1 = temp.front().first.second;         long long a1 = temp.front().second;         long long a = z1 - z + 1;         if (a == y && s.find(a1) == s.end()) {           fl++;           s.insert(a1);         }         q.push(make_pair(make_pair(z, z1), a1));         temp.pop();       }       if (fl != 0) {         ans = ans + fl;       }     }     cout << ans <<   n ;     return 0;   }