func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[1005];   int b[1005];   int h;   bool cmp(int x, int y) { return x > y; }   bool check(int x) {     for (int i = 1; i <= x; i++) {       b[i] = a[i];     }     sort(b + 1, b + x + 1, cmp);     long long sum = 0;     for (int i = 1; i <= x; i += 2) {       sum += (long long)(b[i]);     }     if (sum <= h) {       return 1;     } else {       return 0;     }   }   int main() {     int n;     cin >> n >> h;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     int l = 1, r = n, mid;     while (l < r) {       mid = (l + r + 1) / 2;       if (check(mid)) {         l = mid;       } else {         r = mid - 1;       }     }     cout << l;     return 0;   }   