Source Code
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    ll s;
    cin>>n>>s;

    vector<int>difs(n),a(n);

    for(auto &x:a) cin>>x;

    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        difs[i]=x-a[i];
    }

    sort(difs.rbegin(),difs.rend());

    int ans=0;

    for(auto x:difs){
        ans++;
        s+=x;
        if(s<=0) break;
    }
    
    cout<<ans;
}
Copy
Wheatly's portals - Easy version YazanIstatiyeh
GNU G++17
207 ms
8.1 MB
Accepted