Anyone can help

#include
#include
#include

using namespace std;

int maxZeroSubarrayLength(vector& arr, int X, int Y) {
sort(arr.rbegin(), arr.rend());

int n = arr.size();
int maxLength = 0;
for (int i = 0; i < min(Y, n); ++i) {
    arr[i] = 0;
}
int remainingOps = X;
for (int i = Y; i < n; ++i) {
    if (remainingOps >= arr[i]) {
        remainingOps -= arr[i];
        arr[i] = 0;
    } else {
        arr[i] -= remainingOps;
        remainingOps = 0;
        break;
    }
}

for (int i = 0; i < n; ++i) {
    if (arr[i] == 0) {
        maxLength++;
    } else {
        break;
    }
}

return maxLength;

}

int main() {
int n, X, Y;
cin >> n;

vector<int> arr(n);
for (int i = 0; i < n; ++i) {
    cin >> arr[i];
}

cin >> X;

cin >> Y;

int maxLength = maxZeroSubarrayLength(arr, X, Y);
cout <<  maxLength << endl;

return 0;

}