malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <class T1>   void deb(T1 e1) {     cout << e1 << endl;   }   template <class T1, class T2>   void deb(T1 e1, T2 e2) {     cout << e1 <<     << e2 << endl;   }   template <class T1, class T2, class T3>   void deb(T1 e1, T2 e2, T3 e3) {     cout << e1 <<     << e2 <<     << e3 << endl;   }   template <class T1, class T2, class T3, class T4>   void deb(T1 e1, T2 e2, T3 e3, T4 e4) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 << endl;   }   template <class T1, class T2, class T3, class T4, class T5>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 << endl;   }   template <class T1, class T2, class T3, class T4, class T5, class T6>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 <<     << e6          << endl;   }   template <class T>   T gcd(const T a, const T b) {     return (b ? gcd<T>(b, a % b) : a);   }   template <class T>   T lcm(const T a, const T b) {     return (a / gcd<T>(a, b) * b);   }   struct node {     long long x, y;     node() {}     node(long long x, long long y) : x(x), y(y) {}     bool operator<(const node& p) const { return x < p.x; }   };   string s1, s2;   long long convert_10(long long n, string s) {     long long l;     l = s.size() - 1;     long long x = 1, y = 0, p;     for (long long i = l; i >= 0; i--) {       if (s[i] >=  0  && s[i] <=  9 )         p = s[i] -  0 ;       else         p = 10 + s[i] -  A ;       y += x * p;       x *= n;     }     return y;   }   string convert_base(long long n, long long x) {     string s =   ;     while (x > 0) {       long long y = x % n;       x /= n;       char c;       if (y > 9)         c =  A  + (y - 10);       else         c =  0  + y;       s = c + s;     }     if (s ==   ) s =  0 ;     return s;   }   string convert_roman(long long n) {     string s =   ;     string one[10] = {  ,  I ,  II ,  III ,  IV ,  V ,  VI ,  VII ,  VIII ,  IX };     string ten[10] = {  ,  X ,  XX ,  XXX ,  XL ,  L ,  LX ,  LXX ,  LXXX ,  XC };     string hundred[10] = {  ,   C ,   CC ,   CCC ,   CD ,                            D ,  DC ,  DCC ,  DCCC ,  CM };     string thousand[4] = {  ,  M ,  MM ,  MMM };     s += thousand[n / 1000];     n %= 1000;     s += hundred[n / 100];     n %= 100;     s += ten[n / 10];     n %= 10;     s += one[n];     return s;   }   long long convert_num(string s) {     long long x = 0;     for (long long i = 0; i < s.size(); i++) x = x * 10 + s[i] -  0 ;     return x;   }   int main() {     long long i, j, k, l, x, y, z, t, m, n;     cin >> n >> s1 >> s2;     x = convert_10(n, s2);     string s;     if (s1 ==  R ) {       s = convert_roman(x);     } else {       y = convert_num(s1);       s = convert_base(y, x);     }     deb(s);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200005;   int arr[N], f[N];   int main() {     int n;     scanf( %d , &n);     set<int> st;     for (int i = 1; i <= n; ++i) {       st.insert(i);       scanf( %d , arr + i);     }     st.insert(n + 1);     int q;     scanf( %d , &q);     int t, x, v;     while (q--) {       scanf( %d , &t);       if (t == 1) {         scanf( %d %d , &x, &v);         int cur = *st.lower_bound(x);         while (v && cur <= n) {           if (f[cur] + v < arr[cur]) {             f[cur] += v;             v = 0;           } else {             v -= (arr[cur] - f[cur]);             f[cur] = arr[cur];             st.erase(cur);             cur = *st.lower_bound(x);           }         }       } else {         scanf( %d , &x);         printf( %d n , f[x]);       }     }   }
#include <bits/stdc++.h>   using namespace std;   #define F first   #define S second   #define pb push_back   #define ll long long   #define all(x) x.begin() , x.end()   #define rep(i,s,e) for (int i = s; i < e; ++i)   #define rev(i,s,e) for (int i = s; i > e; --i)      const int N = 2e5 + 99 ;            int main() {       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);   #ifdef CLion       freopen( input.txt  ,  r  , stdin);   //    freopen( output.txt ,  w  , stdout);   #endif          int t; cin >> t;       while ( t-- ){           int n ; cin >> n;           vector<int> vec(n);           for ( int &i : vec ){               cin >> i;           }           sort( all(vec) );           cout << n - (upper_bound(all(vec) , vec.front()) - vec.begin()) <<   n ;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> tmp;   vector<vector<int>> sol[4];   int lov[7][7];   int hero(string s) {     if (s ==  Troll ) return 0;     if (s ==  Dracul ) return 1;     if (s ==  Anka ) return 2;     if (s ==  Snowy ) return 3;     if (s ==  Hexadecimal ) return 4;     if (s ==  Chapay )       return 5;     else       return 6;   }   void rec(int i, int a, int b, int c) {     if (i == 7) {       int z[] = {a, b, c};       sort(z, z + 3);       if (z[2] == 5 && z[1] == 1 && z[0] == 1) sol[0].push_back(tmp);       if (z[2] == 4 && z[1] == 2 && z[0] == 1) sol[1].push_back(tmp);       if (z[2] == 3 && z[1] == 3 && z[0] == 1) sol[2].push_back(tmp);       if (z[2] == 3 && z[1] == 2 && z[0] == 2) sol[3].push_back(tmp);       return;     }     tmp.push_back(1);     rec(i + 1, a + 1, b, c);     tmp.pop_back();     tmp.push_back(2);     rec(i + 1, a, b + 1, c);     tmp.pop_back();     tmp.push_back(3);     rec(i + 1, a, b, c + 1);     tmp.pop_back();   }   int main() {     rec(0, 0, 0, 0);     int arr[4][3];     pair<int, int> exp[3];     int mini = 1e9, maxi = 0;     set<int> minI;     arr[0][0] = 5, arr[0][1] = 1, arr[0][2] = 1;     arr[1][0] = 4, arr[1][1] = 2, arr[1][2] = 1;     arr[2][0] = 3, arr[2][1] = 3, arr[2][2] = 1;     arr[3][0] = 3, arr[3][1] = 2, arr[3][2] = 2;     int n;     cin >> n;     for (int i = 0; i < n; i++) {       string s, tmp, s2;       cin >> s >> tmp >> s2;       int x = hero(s), y = hero(s2);       lov[x][y] = 1;     }     for (int i = 0; i < 3; i++) {       cin >> exp[i].second;       exp[i].first = i;     }     for (int i = 0; i < 4; i++) {       int a = 0;       do {         int ans[3] = {};         for (int j = 0; j < 3; j++) ans[j] = exp[j].second / arr[i][j];         sort(ans, ans + 3);         if (ans[2] - ans[0] < mini) minI.clear();         if (ans[2] - ans[0] <= mini) minI.insert(i);         mini = min(ans[2] - ans[0], mini);         a++;       } while (next_permutation(exp, exp + 3));     }     for (set<int>::iterator it = minI.begin(); it != minI.end(); it++) {       for (int i = 0; i < sol[*it].size(); i++) {         int tmpA = 0;         for (int x = 0; x < 7; x++) {           for (int y = 0; y < 7; y++) {             if (x != y && sol[*it][i][x] == sol[*it][i][y] && lov[x][y]) tmpA++;           }         }         maxi = max(tmpA, maxi);       }     }     cout << mini <<     << maxi << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, n;     scanf( %d , &n);     for (i = 1; i <= 4; ++i) {       int m1, m2, a, b;       scanf( %d%d , &a, &b);       m1 = min(a, b);       scanf( %d%d , &a, &b);       m2 = min(a, b);       if (m1 + m2 <= n) {         printf( %d %d %d n , i, m1, n - m1);         return 0;       }     }     puts( -1 );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1 << 29;   const double EPS = 1e-9;   const char *crop[3] = { Carrots ,  Kiwis ,  Grapes };   int m, n, nw, nq;   int main() {     scanf( %d%d%d%d , &m, &n, &nw, &nq);     set<int> waste[40000];     for (int i = (0); i < (nw); ++i) {       int x, y;       scanf( %d%d , &y, &x);       x--, y--;       waste[y].insert(x);     }     int hd[40000];     for (int i = 0, tmp = 0; i < m; i++) {       hd[i] = tmp;       tmp = (tmp + (n - waste[i].size())) % 3;     }     for (int i = (0); i < (nq); ++i) {       int x, y;       scanf( %d%d , &y, &x);       x--, y--;       if (waste[y].count(x) == 1) {         puts( Waste );       } else {         int tmp = distance(waste[y].begin(), waste[y].lower_bound(x));         tmp = x - tmp;         tmp = (hd[y] + tmp) % 3;         puts(crop[tmp]);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 100000000;   const double eps = 1e-10;   const int MAXN = 110;   set<int> sx, sy;   int in[10][2];   set<int>::iterator it1, it2;   int main() {     int x, y;     for (int i = 0; i < (8); ++i) {       scanf( %d%d , &x, &y);       in[i][0] = x;       in[i][1] = y;       if (!sx.count(x)) sx.insert(x);       if (!sy.count(y)) sy.insert(y);     }     if ((int)sx.size() != 3 || (int)sy.size() != 3)       printf( %s n ,  ugly );     else {       int mat[5][5];       memset(mat, 0, sizeof(mat));       int cnt = 0, f = 1;       map<int, int> xx, yy;       for (__typeof((sx).begin()) it1 = (sx).begin(); it1 != (sx).end(); it1++)         xx[(*it1)] = cnt++;       cnt = 0;       for (__typeof((sy).begin()) it2 = (sy).begin(); it2 != (sy).end(); it2++)         yy[(*it2)] = cnt++;       for (int i = 0; i < (8); ++i) mat[xx[in[i][0]]][yy[in[i][1]]] = 1;       for (int i = 0; i < (3); ++i) {         for (int j = 0; j < (3); ++j) {           if (i == 1 && j == 1 && mat[i][j]) f = 0;           if ((i != 1 || j != 1) && !mat[i][j]) f = 0;         }       }       if (f)         printf( %s n ,  respectable );       else         printf( %s n ,  ugly );     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     long long int a, b, c;     cin >> t;     while (t--) {       cin >> a >> b >> c;       long long int max_val = (a + c);       long long int min_val = b;       if (a + c <= b) {         cout << 0 << endl;       } else if (b + c < a) {         cout << c + 1 << endl;       } else {         long long int ans = (max_val - min_val + 1) / 2;         cout << ans << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 110;   long long read(void) {     char ch = getchar();     long long sum = 0;     bool f = 0;     while ((ch <  0  || ch >  9 ) && ch !=  - ) ch = getchar();     if (ch ==  - ) {       f = 1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) sum = sum * 10 + ch -  0 , ch = getchar();     if (f) sum = -sum;     return sum;   }   int T, n, m;   string st;   int col[N][N];   int tA;   struct node {     int x1, y1, x2, y2, x3, y3;   } que[N * N * 3];   void update(int x, int y) {     if (x + 1 <= n) {       if (y + 1 <= m) {         que[++tA] = (node){x, y, x, y + 1, x + 1, y + 1};         que[++tA] = (node){x, y, x + 1, y, x + 1, y + 1};         que[++tA] = (node){x, y, x + 1, y, x, y + 1};       } else {         que[++tA] = (node){x, y, x, y - 1, x + 1, y - 1};         que[++tA] = (node){x, y, x + 1, y, x + 1, y - 1};         que[++tA] = (node){x, y, x + 1, y, x, y - 1};       }     } else {       if (y + 1 <= m) {         que[++tA] = (node){x, y, x, y + 1, x - 1, y + 1};         que[++tA] = (node){x, y, x - 1, y, x - 1, y + 1};         que[++tA] = (node){x, y, x - 1, y, x, y + 1};       } else {         que[++tA] = (node){x, y, x, y - 1, x - 1, y - 1};         que[++tA] = (node){x, y, x - 1, y, x - 1, y - 1};         que[++tA] = (node){x, y, x - 1, y, x, y - 1};       }     }   }   void solve(void) {     n = read();     m = read();     tA = 0;     for (int i = 1; i <= n; i++) {       cin >> st;       for (int j = 1; j <= m; j++) col[i][j] = (st[j - 1] ==  0 ) ? 0 : 1;     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (col[i][j] == 1) update(i, j);     printf( %d n , tA);     for (int i = 1; i <= tA; i++)       printf( %d %d %d %d %d %d n , que[i].x1, que[i].y1, que[i].x2, que[i].y2,              que[i].x3, que[i].y3);     return;   }   int main() {     T = read();     while (T--) solve();     return 0;   }
#include <bits/stdc++.h>   int main(void) {     int a[5];     int Min;     while (scanf( %d%d%d%d%d , a, a + 1, a + 2, a + 3, a + 4) != EOF) {       Min = a[0];       if (a[1] < Min) Min = a[1];       if (a[2] / 2 < Min) Min = a[2] / 2;       if (a[3] / 7 < Min) Min = a[3] / 7;       if (a[4] / 4 < Min) Min = a[4] / 4;       printf( %d n , Min);     }     return EXIT_SUCCESS;   }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   long long int gcd(long long int a, long long int b) {     if (a < b)       return gcd(b, a);     else if (b == 0)       return a;     else       return gcd(b, a % b);   }   long long int isPrime(long long int n) {     long long int p = (long long int)sqrt(n);     for (int i = (2); i <= (p); i += (1))       if (n % i == 0) return 0;     return 1;   }   long long int pow(long long int b, long long int e) {     if (e == 0)       return 1;     else if (e % 2 == 0) {       long long int a = pow(b, e / 2);       return a * a;     } else {       long long int a = pow(b, e / 2);       return b * a * a;     }   }   long long int powm(long long int x, long long int y,                      long long int m = 1000000007) {     x = x % m;     long long int res = 1;     while (y) {       if (y & 1) res = res * x;       res %= m;       y = y >> 1;       x = x * x;       x %= m;     }     return res;   }   long long int modInverse(long long int a, long long int m) {     return powm(a, m - 2, m);   }   void solve() {     long long int x, y;     cin >> x >> y;     long long int c[7];     for (int i = (1); i <= (6); i += (1)) cin >> c[i];     long long int ans = LLONG_MAX;     int isnegx = 1, isnegy = 1;     if (x < 0) isnegx = -1;     if (y < 0) isnegy = -1;     swap(x, y);     if (x >= 0 and y >= 0) {       if (x <= y) {         ans = min({ans, c[1] * x + (y - x) * c[6], c[1] * y + (y - x) * c[5],                    c[2] * x + c[6] * y});       } else {         ans = min({ans, c[1] * x + (x - y) * c[3], c[1] * y + (x - y) * c[2],                    c[2] * x + c[6] * y});       }     } else if (x <= 0 and y <= 0) {       x *= -1;       y *= -1;       if (x <= y) {         ans = min({ans, c[4] * x + (y - x) * c[3], c[4] * y + (y - x) * c[2],                    c[5] * x + c[3] * y});       } else {         ans = min({ans, c[4] * x + (x - y) * c[6], c[4] * y + (x - y) * c[5],                    c[5] * x + c[3] * y});       }     } else {       x = isnegx * abs(x);       y = isnegy * abs(y);       if (x <= 0) {         x *= -1;         ans = min({ans, c[1] * x + (x + y) * c[3], c[4] * y + (x + y) * c[2],                    c[2] * x + c[3] * y});       } else {         y *= -1;         ans = min({ans, c[4] * x + (x + y) * c[6], c[1] * y + (x + y) * c[5],                    c[5] * x + c[6] * y});       }     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     int T;     cin >> T;     while (T--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, ar[1000001], x, ars[1000001];   int main() {     cin >> n >> x;     for (int i = 0; i < n; i++) {       cin >> ar[i];       ars[ar[i]]++;     }     long long ans = 0;     for (int i = 0; i < n; i++) {       ars[ar[i]]--;       ans += (ars[(ar[i] ^ x)]);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   const int MaxN = 300;   using namespace std;   int n, m;   long long K;   int A1[MaxN + 5][2], A3[MaxN + 5][MaxN + 5];   const long long INF = 1e18;   long long A2[MaxN + 5][MaxN + 5];   int fail[MaxN + 5];   void Get(string s) {     int z = (int)s.length();     fail[0] = 0;     for (int i = 1; i < z; i++) {       int j = fail[i - 1];       while (j > 0 && s[j] != s[i]) j = fail[j - 1];       if (s[j] == s[i]) j++;       fail[i] = j;     }     for (int i = 0; i <= z; i++) {       for (int j = 0; j < 2; j++) {         if (i < z && s[i] == char( 0  + j))           A1[i][j] = i + 1;         else if (i == 0)           A1[i][j] = 0;         else           A1[i][j] = A1[fail[i - 1]][j];       }     }     for (int i = 0; i <= z; i++) {       for (int j = 0; j < 2; j++) {         A3[i][j] = A1[i][j];         A2[i][j] = (A3[i][j] == z ? 1 : 0);       }     }     for (int i = 2; i <= n; i++) {       for (int j = 0; j <= z; j++) {         A3[j][i] = A3[A3[j][i - 2]][i - 1];         A2[j][i] = min((A2[j][i - 2] + A2[A3[j][i - 2]][i - 1]), INF);       }     }   }   int main() {     while (~scanf( %d%lld%d , &n, &K, &m)) {       string res =   ;       for (int i = 0; i < m; i++) {         if (res !=   ) Get(res);         int x = 0;         if (res !=    && A3[0][n] == i) x = 1;         if (K == 1 && x == 1) break;         K -= x;         Get(res +  0 );         long long tmp = A2[0][n];         if (K > tmp) {           res +=  1 ;           K -= tmp;         } else           res +=  0 ;       }       cout << res << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a, b, c, d, i;   int digits(int n) {     int d = 0;     while (n) {       n /= 10;       d++;     }     return d;   }   int main() {     cin >> a >> b;     c = a;     d = digits(b);     for (i = 1; b; i++) {       c += (b % 10) * (int)floor(pow((double)10, (double)d - i));       b /= 10;     }     cout << c;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int main() {     multiset<int> Q;     cin >> n;     long long ans = 0;     long long times = 0;     bool b = false;     int count = 0;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       if (Q.size() == 0 || (*Q.begin()) > x) {         Q.insert(x);       } else {         ans += x - *Q.begin();         if (b) {           times += 2;           count++;           if (count == 2) {             b = false;             count = 0;           }         } else           b = true;         Q.erase(Q.begin());         Q.insert(x);         Q.insert(x);       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5;   const int INF = 0x3f3f3f3f;   long long get(long long n) {     long long res = 2;     long long ans = 0;     while (res <= n) {       ans += n / res;       res *= 2;     }     return ans;   }   int main() {     long long n;     cin >> n;     long long m = n;     long long ans = n;     long long p = 1;     while (p < n) {       ans += ((n - (p + 1)) / (2 * p) * p) + p;       p *= 2;     }     cout << ans - n << endl;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int n, k;     cin >> n >> k;     set<int> s;     for (int i = 0; i < n; i++) {       int a;       cin >> a;       s.insert(a);     }     if (s.size() > k) {       cout << -1 << endl;       return;     }     cout << n * k << endl;     for (int i = 0; i < n; i++) {       for (int b : s) cout << b <<    ;       for (int j = 0; j < k - (int)s.size(); j++) cout << 1 <<    ;     }     cout << endl;   }   int main() {     int t;     cin >> t;     for (int i = 0; i < t; i++) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   long parent[100];   long nm[100];   vector<long> v[100];   long pp(long z) {     if (parent[z] == z) {       return z;     } else {       parent[z] = pp(parent[z]);     }   }   int main() {     long i, j, k, l, m, n, p, two, one;     scanf( %ld%ld , &n, &m);     for (i = 1; i <= n; i++) parent[i] = i;     for (i = 1; i <= m; i++) {       scanf( %ld%ld , &k, &l);       parent[l] = k;     }     for (i = 1; i <= n; i++) {       k = pp(i);     }     for (i = 1; i <= n; i++) {       nm[parent[i]]++;       if (nm[parent[i]] > 3) {         printf( -1 n );         return 0;       }     }     l = one = two = 0;     for (i = 1; i <= n; i++) {       if (nm[i] == 3) {         k = 0;         for (j = 1; j <= n; j++) {           if (parent[j] == i) {             v[l].push_back(j);             parent[j] = -1;             k++;           }         }         nm[i] = -1;         l++;       }       if (nm[i] == 2)         two++;       else if (nm[i] == 1)         one++;     }     if (one >= two) {       if ((one - two) % 3) {         printf( -1 n );         return 0;       }       while (two) {         for (i = 1; i <= n; i++) {           if (nm[i] == 2) {             for (j = 1; j <= n; j++) {               if (nm[j] == 1) {                 for (k = 1; k <= n; k++) {                   if (parent[k] == j) {                     v[l].push_back(k);                     nm[j] = -1;                     parent[k] = -1;                     break;                   }                 }                 break;               }             }             for (j = 1; j <= n; j++) {               if (parent[j] == i) {                 v[l].push_back(j);                 parent[j] = -1;               }             }             nm[i] = -1;             two--;             one--;             l++;             break;           }         }       }       while (one) {         k = 0;         for (i = 1; i <= n; i++) {           if (nm[i] == 1) {             v[l].push_back(i);             nm[i] = -1;             k++;             one--;             if (k == 3) {               l++;               break;             }           }         }       }       for (i = 0; i < l; i++) printf( %ld %ld %ld n , v[i][0], v[i][1], v[i][2]);     } else {       printf( -1 n );       return 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int compare(const void* pa, const void* pb) {     long long int p1 = *(const long long int*)pa;     long long int p2 = *(const long long int*)pb;     if (p1 < p2)       return 1;     else if (p1 > p2)       return -1;     else if (p1 == p2)       return 0;   }   long long int arr[200500], s[200500][2], ans[200500];   int main() {     int j, t, n;     cin >> t;     while (t--) {       int p = 0, x, y, a1, b1, a, b, low, high, mx, l = 0, m = 0, h = 0, w = -1;       long long sum = 0, k;       cin >> n;       for (j = 0; j < n; j++) cin >> arr[j];       cin >> x >> a;       cin >> y >> b;       cin >> k;       a1 = a;       b1 = b;       qsort(arr, n, sizeof(arr[0]), compare);       while (1) {         if (a < b) {           s[p][0] = a;           s[p][1] = x;           p++;           a += a1;         } else if (b < a) {           s[p][0] = b;           s[p][1] = y;           p++;           b += b1;         } else {           s[p][0] = a;           s[p][1] = x + y;           p++;           a += a1;           b += b1;         }         if (a > n && b > n) break;       }       low = min(x, y);       high = max(x, y);       mx = x + y;       for (j = 0; j < p; j++) {         if (s[j][1] == low) {           sum += (arr[l] / 100) * (s[j][1] - ans[l]);           ans[l] = low;           l++;         } else if (s[j][1] == high) {           sum += (arr[h] / 100) * (s[j][1] - ans[h]);           ans[h] = high;           if (h != l) {             sum += (arr[l] / 100) * (low - ans[l]);             ans[l] = low;           }           h++;           l++;         } else if (s[j][1] == mx) {           sum += (arr[m] / 100) * (s[j][1] - ans[m]);           ans[m] = mx;           if (m != h) {             sum += (arr[h] / 100) * (high - ans[h]);             ans[h] = high;           }           if (h != l) {             sum += (arr[l] / 100) * (low - ans[l]);             ans[l] = low;           }           m++;           h++;           l++;         }         if (sum >= k) {           w = s[j][0];           break;         }       }       cout << w <<   n ;       for (j = 0; j < n; j++) {         s[j][0] = 0;         s[j][1] = 0;         arr[j] = 0;         ans[j] = 0;       }     }   }