func_code_string: #include <bits/stdc++.h>   using namespace std;   int32_t main() {     int n, h;     cin >> n >> h;     vector<int> v(n);     for (int i = 0; i < n; i++) cin >> v[i];     int lo = 0;     int hi = n - 1;     int ans, mid;     while (lo <= hi) {       mid = lo + (hi - lo) / 2;       vector<int> a(mid + 1);       for (int i = 0; i < mid + 1; i++) a[i] = v[i];       sort(a.begin(), a.end());       int c = 0;       int j = mid;       int leftheight = h;       while (j >= 0 && leftheight > 0) {         if (a[j] <= leftheight) {           leftheight -= a[j];           if (mid % 2 == 0 && j == 0) {             c++;             break;           } else {             j -= 2;             c += 2;           }         } else           break;       }       if (c >= (mid + 1)) {         lo = mid + 1;         ans = mid;       } else         hi = mid - 1;     }     cout << ans + 1 << endl;     return 0;   }   