malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>      using namespace std;      using ll = long long;      void solve()   {       int n;       int q;       cin >> n >> q;          string s;       cin >> s;          vector<array<int, 26>> pref(n + 1);       pref[0].fill(0);       for (int i = 0; i < n; i++)       {           for (int c = 0; c < 26; c++)               pref[i + 1][c] = pref[i][c] + (c == s[i] -  a );       }          for (int z = 0; z < q; z++)       {           int l, r;           cin >> l >> r;              int add = 0;           for (int c = 0; c < 26; c++)               add += (pref[r][c] - pref[l - 1][c]) * (c + 1);              cout << add <<   n ;       }   }      int main()   {       ios_base::sync_with_stdio(false), cin.tie(NULL);          solve();          return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   const long long xx = 2e5;   vector<long long> g1[xx + 10];   vector<long long> g2[xx + 10];   long long v[xx + 10];   long long p1[xx], p2[xx];   void make_first(long long h) {     long long node = 1;     for (long long i = 1; i < h + 1; i++) {       if (v[i - 1] == 1) {         long long root = node;         for (long long j = 0; j < v[i]; j++) {           ++node;           g1[root].push_back(node);         }       } else {         long long r2 = node;         long long r1 = node - 1;         ++node;         g1[r1].push_back(node);         for (long long j = 0; j < v[i] - 1; j++) {           ++node;           g1[r2].push_back(node);         }       }     }   }   long long mx_node = 0;   void make_second(long long h) {     long long node = 1;     for (long long i = 1; i < h + 1; i++) {       long long root = node;       for (long long j = 0; j < v[i]; j++) {         ++node;         g2[root].push_back(node);         mx_node = max(mx_node, node);       }     }   }   void dfs1(long long r, long long p) {     for (auto i : g2[r]) {       if (i != p) {         p1[i] = r;         dfs1(i, r);       }     }   }   void dfs2(long long r, long long p) {     for (auto i : g1[r]) {       if (i != p) {         p2[i] = r;         dfs2(i, r);       }     }   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long h;     cin >> h;     for (long long i = 0; i < h + 1; i++) {       cin >> v[i];     }     bool per = true;     if (h >= 2) {       for (long long i = 2; i < h + 1; i++) {         if (v[i] > 1 && v[i - 1] > 1) {           per = false;           break;         }       }     }     if (per) {       cout <<  perfect  <<   n ;       return 0;     }     make_first(h);     make_second(h);     dfs1(1, -1);     dfs2(1, -1);     cout <<  ambiguous  <<   n ;     for (long long i = 1; i <= mx_node; i++) cout << p1[i] <<    ;     cout <<   n ;     for (long long i = 1; i <= mx_node; i++) cout << p2[i] <<    ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   typedef vector<int> vt;   int a[110000];   int n;   void solve() {     vt v;     vt::iterator it;     for (int i = 0; i < n; i++) {       it = upper_bound(v.begin(), v.end(), a[i]);       if (it == v.end())         v.push_back(a[i]);       else         *it = a[i];     }     cout << v.size() << endl;   }   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s1, s2;     cin >> s1;     s2 =  hello ;     int i = 0, j = 0, count = 0;     int l = s1.length();     while (l) {       if (s1[i] != s2[j]) i++;       if (s1[i] == s2[j]) {         i++;         j++;         count++;       }       l--;     }     if (count > 4)       cout <<  YES ;     else       cout <<  NO ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ifstream in( input.txt );     string s;     bool e = false;     int i, c = 0;     getline(cin, s);     for (i = 0; i < s.size(); i++) {       if (s[i] ==  1 ) e = true;       if (e == true)         if (s[i] ==  0 ) c++;     }     if ((c >= 6) && (e == true))       cout <<  YES ;     else       cout <<  NO ;   }
#include <bits/stdc++.h>   using namespace std;   int a[122], b[122];   int main() {     int n, k, t, ans = 0;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> k >> t;       a[k]++;       b[t]++;     }     for (int i = 1; i <= 100; i++)       if (a[i] > 0) ans += a[i] * b[i];     cout << ans << endl;   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   using namespace std;   using LL = long long;   using PII = pair<int, int>;   using PLL = pair<LL, LL>;   using VI = vector<int>;   using VVI = vector<VI>;   const int INF = 1e9;   const int MXN = 55;   const int MXM = 2e4 + 5;   int n, m, k;   VVI init(MXN, VI(MXM, 0));   VVI a, rev_a, sum, rev_sum, Lmax, Rmax, dp, dpL, dpR;   int getSum(VVI &sum, int x, int L, int R) {     if (L < 1) {       return sum[x][R];     }     return sum[x][R] - sum[x][L - 1];   }   void calc_overlapped(VVI &sum, VVI &dp, int i) {     deque<PII> dq;     for (int j = 1; j < (int)m - k + 2; ++j) {       int num = dp[i - 1][j] - getSum(sum, i, j, j + k - 1);       while (!dq.empty() && dq.front().second <= j - k) {         dq.pop_front();       }       while (!dq.empty() &&              dq.back().first + getSum(sum, i, dq.back().second, j - 1) <= num) {         dq.pop_back();       }       dq.push_back({num, j});       dp[i][j] = dq.front().first + getSum(sum, i, dq.front().second, j - 1) +                  getSum(sum, i, j, j + k - 1) + getSum(sum, i + 1, j, j + k - 1);     }   }   int main() {     cin.tie(nullptr);     cout.tie(nullptr);     ios_base::sync_with_stdio(false);     ;     cin >> n >> m >> k;     a = rev_a = sum = rev_sum = Lmax = Rmax = dp = dpL = dpR = init;     for (int i = 1; i < (int)n + 1; ++i) {       for (int j = 1; j < (int)m + 1; ++j) {         cin >> a[i][j];         sum[i][j] = sum[i][j - 1] + a[i][j];       }       for (int j = 1; j < (int)m + 1; ++j) {         rev_a[i][j] = a[i][m - j + 1];         rev_sum[i][j] = rev_sum[i][j - 1] + rev_a[i][j];       }     }     for (int i = 1; i < (int)n + 1; ++i) {       for (int j = 1; j < (int)m - k + 2; ++j) {         int ksum =             getSum(sum, i, j, j + k - 1) + getSum(sum, i + 1, j, j + k - 1);         dp[i][j] = ksum;         if (j - k > 0) {           dp[i][j] = max(dp[i][j], ksum + Lmax[i - 1][j - k]);         }         if (j + k <= m - k + 1) {           dp[i][j] = max(dp[i][j], ksum + Rmax[i - 1][j + k]);         }       }       calc_overlapped(sum, dpL, i);       calc_overlapped(rev_sum, dpR, i);       for (int j = 1; j < (int)m - k + 2; ++j) {         dp[i][j] = max({dp[i][j], dpL[i][j], dpR[i][m - k - j + 2]});         dpL[i][j] = dpR[i][m - k - j + 2] = dp[i][j];       }       for (int j = 1; j < (int)m - k + 2; ++j) {         Lmax[i][j] = max(Lmax[i][j - 1], dp[i][j]);       }       for (int j = m - k + 1; j > (int)0; --j) {         Rmax[i][j] = max(Rmax[i][j + 1], dp[i][j]);       }     }     int ans = 0;     for (int i = 1; i < (int)m - k + 2; ++i) {       ans = max(ans, dp[n][i]);     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline T gcd(T a, T b) {     if (a < 0) return gcd(-a, b);     if (b < 0) return gcd(a, -b);     return (b == 0) ? a : gcd(b, a % b);   }   template <class T>   inline T lcm(T a, T b) {     if (a < 0) return lcm(-a, b);     if (b < 0) return lcm(a, -b);     return a * (b / gcd(a, b));   }   template <class T>   inline T sqr(T x) {     return x * x;   }   template <class T>   T power(T N, T P) {     return (P == 0) ? 1 : N * power(N, P - 1);   }   template <class T>   bool inside(T a, T b, T c) {     return (b >= a && b <= c);   }   const long long INF64 = (long long)1E16;   int distsq2d(int x1, int y1, int x2, int y2) {     return sqr(x1 - x2) + sqr(y1 - y2);   }   double dist2d(double x1, double y1, double x2, double y2) {     return sqrt(sqr(x1 - x2) + sqr(y1 - y2));   }   double dist3d(double x1, double y1, double z1, double x2, double y2,                 double z2) {     return sqrt(sqr(x1 - x2) + sqr(y1 - y2) + sqr(z1 - z2));   }   long long toInt64(string s) {     long long r = 0;     istringstream sin(s);     sin >> r;     return r;   }   double LOG(long long N, long long B) { return (log10l(N)) / (log10l(B)); }   string itoa(long long a) {     if (a == 0) return  0 ;     string ret;     for (long long i = a; i > 0; i = i / 10) ret.push_back((i % 10) + 48);     reverse(ret.begin(), ret.end());     return ret;   }   vector<string> token(string a, string b) {     const char *q = a.c_str();     while (count(b.begin(), b.end(), *q)) q++;     vector<string> oot;     while (*q) {       const char *e = q;       while (*e && !count(b.begin(), b.end(), *e)) e++;       oot.push_back(string(q, e));       q = e;       while (count(b.begin(), b.end(), *q)) q++;     }     return oot;   }   int isvowel(char s) {     s = tolower(s);     if (s ==  a  || s ==  e  || s ==  i  || s ==  o  || s ==  u ) return 1;     return 0;   }   int isupper(char s) {     if (s >=  A  and s <=  Z ) return 1;     return 0;   }   int Set(int N, int pos) { return N = N | (1 << pos); }   int reset(int N, int pos) { return N = N & ~(1 << pos); }   int check(int N, int pos) { return (N & (1 << pos)); }   int toggle(int N, int pos) {     if (check(N, pos)) return N = reset(N, pos);     return N = Set(N, pos);   }   void pbit(int N) {     printf( ( );     for (int i = 10; i >= 0; i--) {       bool x = check(N, i);       cout << x;     }     puts( ) );   }   int fx[] = {0, 0, 1, -1};   int fy[] = {1, -1, 0, 0};   bool status[30000002];   vector<int> v;   void siv() {     int N = 20000002;     int sq = sqrt(N);     for (int i = 3; i <= sq; i += 2) {       if (status[i] == 0) {         for (int j = i * i; j <= N; j += i) status[j] = 1;       }     }     int c = 1;     for (int i = 3; i <= 1100000; i += 2) {       if (status[i] == 0) {         char s[20];         sprintf(s,  %d , i);         reverse(s, s + strlen(s));         int r = atoi(s);         if (i != r) {           if (r == 2 or (r % 2 == 1 and status[r] == 0)) {             ++c;             v.push_back(i);           }         }       }     }   }   int main() {     siv();     int n;     cin >> n;     cout << v[n - 1] << endl;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline T second(T a) {     return a * a;   }   template <class T>   inline string tostring(T a) {     ostringstream os(  );     os << a;     return os.str();   }   template <typename T>   inline long long tolong(T a) {     long long res;     istringstream os(a);     os >> res;     return res;   }   template <typename T>   inline T gcd(T a, T b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }   template <typename T>   inline T bigmod(T a, T b, T m) {     if (b == 0)       return 1;     else if (b % 2 == 0)       return second(bigmod(a, b / 2, m)) % m;     else       return (a % m * bigmod(a, b - 1, m)) % m;   }   const int inf = (int)1e9 + 5;   const long long linf = (long long)1e16 + 5;   const long long modd = (long long)1e9 + 7;   const int mod = 10000007;   void pr(int f) {     if (f == 1)       cout <<  YES n ;     else       cout <<  NO n ;   }   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     char ch;     int js = 0;     int ans = 0;     int flag = 0;     for (int i = 1; i <= n; i++) {       cin >> ch;       if (ch ==  R ) {         ans += js;         flag = 1;         js = 0;         continue;       }       if (ch ==  L ) {         if ((flag == 1) && ((js % 2) == 1)) ans++;         flag = 0;         js = 0;         continue;       }       js++;     }     if (flag == 0) ans += js;     cout << ans << endl;   }
#include <bits/stdc++.h>   const double eps = 1e-9;   double a, b, c, nx, mx, ny, my, ans;   long long ax, ay, bx, by;   int main() {     std::cin >> a >> b >> c >> ax >> ay >> bx >> by;     ans = std::abs(ax - bx) + std::abs(ay - by);     if ((a < eps && a > -eps) || (b < eps && b > -eps)) {       printf( %.7lf n , ans);       return 0;     }     nx = -b / a, mx = -c / a, ny = -a / b, my = -c / b;     ans = std::min(         ans,         std::abs(ay - (ny * ax + my)) + std::abs(by - (ny * bx + my)) +             sqrt((ax - bx) * (ax - bx) + ((ny * ax + my) - (ny * bx + my)) *                                              ((ny * ax + my) - (ny * bx + my))));     ans = std::min(         ans,         std::abs(ax - (nx * ay + mx)) + std::abs(bx - (nx * by + mx)) +             sqrt((ay - by) * (ay - by) + ((nx * ay + mx) - (nx * by + mx)) *                                              ((nx * ay + mx) - (nx * by + mx))));     ans = std::min(ans, std::abs(ay - (ny * ax + my)) +                             std::abs(bx - (nx * by + mx)) +                             sqrt((ax - (nx * by + mx)) * (ax - (nx * by + mx)) +                                  ((ny * ax + my) - by) * ((ny * ax + my) - by)));     ans = std::min(ans, std::abs(ax - (nx * ay + mx)) +                             std::abs(by - (ny * bx + my)) +                             sqrt((ay - (ny * bx + my)) * (ay - (ny * bx + my)) +                                  ((nx * ay + mx) - bx) * ((nx * ay + mx) - bx)));     printf( %.7lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = (int)2e5 + 5;   int n, m;   vector<vector<int>> adj;   int Set[N];   bool vis[N];   bool isBipartite(int node) {     for (int& x : adj[node]) {       if (!vis[x]) {         vis[x] = 1;         Set[x] = 3 - Set[node];         if (!isBipartite(x)) return false;       } else if (Set[x] == Set[node])         return false;     }     return true;   }   int solve() {     scanf( %d%d , &n, &m);     adj = vector<vector<int>>(n + 1);     int V = -1;     for (int i = 0; i < m; ++i) {       int x, y;       scanf( %d%d , &x, &y);       adj[x].push_back(y);       adj[y].push_back(x);     }     for (int i = 1; i <= n; i++) {       if (!vis[i]) {         vis[i] = 1;         Set[i] = 1;         bool res = isBipartite(i);         if (!res) return puts( -1 ), 0;       }     }     int A = 0, P = 0;     for (int i = 1; i <= n; i++) {       A += Set[i] == 1;       P += Set[i] == 2;     }     printf( %d n , A);     for (int i = 1; i <= n; i++)       if (Set[i] == 1) printf( %d  , i);     printf(  n );     printf( %d n , P);     for (int i = 1; i <= n; i++)       if (Set[i] == 2) printf( %d  , i);     return 0;   }   int main() { solve(); }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   long long n, dvyg, a[3000000];   long long pointer;   int main() {     cin >> n;     dvyg = 1;     for (int i = 1; i <= n; ++i) a[i] = i;     for (int i = 2; i <= n; ++i) {       pointer = n / i * i + dvyg;       for (int j = pointer; j >= dvyg; j -= i) {         if (j == pointer)           a[dvyg + n] = a[j];         else           a[j + i] = a[j];       }       ++dvyg;     }     for (int i = dvyg; i < dvyg + n; ++i) cout << a[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void getint(int &v) {     char ch, fu = 0;     for (ch =  * ; (ch <  0  || ch >  9 ) && ch !=  - ; ch = getchar())       ;     if (ch ==  - ) fu = 1, ch = getchar();     for (v = 0; ch >=  0  && ch <=  9 ; ch = getchar()) v = v * 10 + ch -  0 ;     if (fu) v = -v;   }   int n, a[500010], t, ans;   int main() {     cin >> n;     for (int i = 1; i <= n; ++i) getint(a[i]);     sort(a + 1, a + n + 1);     for (int i = 1; i <= n - 1; ++i)       if (a[i] == a[i + 1]) {         if (t) return puts( cslnb ), 0;         t = i;       }     if (t) {       if (t == 1) {         if (a[t] == 0) return puts( cslnb ), 0;         --a[t];       } else {         if (a[t] == a[t - 1] + 1) return puts( cslnb ), 0;         --a[t];       }       for (int i = 1; i <= n; ++i) (ans += a[i] - (i - 1)) %= 2;       if (ans & 1)         puts( cslnb );       else         puts( sjfnb );       return 0;     }     for (int i = 1; i <= n; ++i) (ans += a[i] - (i - 1)) %= 2;     if (ans % 2 == 0)       puts( cslnb );     else       puts( sjfnb );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void err(istream_iterator<string> it) {}   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cout <<  [  << *it <<  :   << a <<  ] t ;     err(++it, args...);   }   const long long nax = 1e3 + 5;   long long n;   long long a[nax], dp[nax][nax];   long long fw(long long i, long long j) {     if (i == n) return 0;     if (j == n) return a[i];     if (j == n - 1) return max(a[i], a[j]);     if (dp[i][j] != -1) return dp[i][j];     long long& first = dp[i][j];     first = (long long)(1e18);     first = min(first, fw(j + 1, j + 2) + max(a[i], a[j]));     first = min(first, fw(i, j + 2) + max(a[j], a[j + 1]));     first = min(first, fw(j, j + 2) + max(a[i], a[j + 1]));     return first;   }   void bw(long long i, long long j) {     if (i == n) return;     if (j == n) {       cout << i + 1;       return;     }     if (j == n - 1) {       cout << i + 1 <<     << j + 1 <<   n ;       return;     }     long long first = dp[i][j];     if (first == max(a[i], a[j]) + fw(j + 1, j + 2)) {       cout << i + 1 <<     << j + 1 <<   n ;       bw(j + 1, j + 2);       return;     }     if (first == max(a[j], a[j + 1]) + fw(i, j + 2)) {       cout << j + 1 <<     << j + 2 <<   n ;       bw(i, j + 2);       return;     }     if (first == max(a[i], a[j + 1]) + fw(j, j + 2)) {       cout << i + 1 <<     << j + 2 <<   n ;       bw(j, j + 2);       return;     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     memset(dp, -1, sizeof(dp));     for (long long i = 0; i < n; i++) {       cin >> a[i];     }     cout << fw(0, 1) <<   n ;     bw(0, 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 77;   long long a[N], f[N], l, r;   int n, k;   bool check(int mid) {     for (int i = 1; i <= n; i++) f[i] = 0;     f[0] = 1;     int pl = 1, pr;     for (int i = 1; i <= n; i++) {       while (a[i] - a[pl] > mid) pl++;       pr = i - k + 1;       for (int j = pl; j <= pr; j++) {         if (f[j - 1]) {           f[i] = 1;           break;         } else           pl++;       }     }     return f[n];   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) {       scanf( %lld , &a[i]);       r = max(a[i], r);     }     for (int i = 1; i <= n; i++) f[i] = 0x3f3f3f3f;     sort(a + 1, a + 1 + n);     while (l <= r) {       int mid = (l + r) / 2;       if (check(mid))         r = mid - 1;       else         l = mid + 1;     }     printf( %lld , l);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 30, Mod = 1e9 + 7;   const long long SQ = 330;   long long a[N], b[N];   int main() {     ios::sync_with_stdio(0), cin.tie(0);     long long n;     cin >> n;     long long s = 0;     for (int i = 0; i < n; i++) cin >> a[i], s += a[i];     for (int j = 0; j < n; j++) cin >> b[j];     sort(b, b + n);     if (s <= b[n - 1] + b[n - 2])       cout <<  YES ;     else       cout <<  NO ;     return (0);   }
#include <bits/stdc++.h>   using namespace std;   int cases(1), t;   template <typename T>   void binary(T n) {     stack<int> st;     while (n > 0) {       st.push(n % 2);       n /= 2;     }     while (!st.empty()) {       cout << st.top();       st.pop();     }     cout <<   n ;   }   vector<long long> factorize(long long x) {     vector<long long> res;     if (x % 2 == 0) {       res.push_back(2);     }     while (x % 2 == 0) {       x /= 2;     }     for (long long i = 3; i * i <= x; i += 2) {       if (x % i == 0) {         res.push_back(i);         while (x % i == 0) {           x /= i;         }       }     }     if (x > 2) res.push_back(x);     return res;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     for (cin >> t; cases <= t; ++cases) {       long long first, second;       cin >> first >> second;       long long ans = 0;       if (first % second) {         cout << first <<   n ;         continue;       }       vector<long long> fac = factorize(second);       for (long long i = 0; i < fac.size(); i++) {         long long res = first;         while (res % second == 0) {           res /= fac[i];         }         ans = max(res, ans);       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)1e+9 + 9;   const long double EPS = 1e-9;   const long double PI = 3.1415926535897932384626433832795;   const int N = 1000500;   int n, k, ans[N];   int main() {     scanf( %d%d , &n, &k);     if (k * 3 > n) {       printf( -1 );       return 0;     }     if (((k)&1)) {       int d = 2;       for (int i = 1; i <= k - 1; i += 2) {         ans[d] = ans[d + 1] = ans[d + 3] = i;         d += 2;         ans[d] = ans[d + 2] = ans[d + 3] = i + 1;         d += 4;       }       ans[1] = k;       for (int i = d; i <= n; ++i) ans[i] = k;     } else {       int d = 1;       for (int i = 1; i <= k; i += 2) {         ans[d] = ans[d + 1] = ans[d + 3] = i;         d += 2;         ans[d] = ans[d + 2] = ans[d + 3] = i + 1;         d += 4;       }       for (int i = d; i <= n; ++i) ans[i] = k;     }     for (int i = 1; i <= n; ++i) printf( %d  , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 200050;   int len;   char a[maxn];   int main() {     while (scanf( %d , &len) != EOF) {       scanf( %s , a);       int ans = 0;       for (int i = 0; i < len; i++)         if (a[i] ==  < )           ans++;         else           break;       for (int i = len - 1; i >= 0; i--)         if (a[i] ==  > )           ans++;         else           break;       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   #pragma optimizitaion_level 3   #pragma GCC optimize( unroll-loops )   #pragma GCC optimize( fast-math )   using namespace std;   int n, h;   vector<int> b;   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> h;     b.resize(n);     for (auto &i : b) cin >> i;     for (int i = 0; i < n; i++) {       vector<int> now(i + 1);       for (int j = 0; j <= i; j++) {         now[j] = b[j];       }       sort(now.rbegin(), now.rend());       int free = h;       for (int j = 0; j <= i; j += 2) {         if (free >= now[j]) {           free -= now[j];         } else           return cout << i <<   n , 0;       }     }     cout << n <<   n ;     return 0;   }