Source Code
//============================================================================
// Name        : mmmmmmmm.cpp
// Author      : sameh mohamed
// Copyright   : don't try i'm warnning you......
// Description : Hello World
//============================================================================
//Egypt came then History
//Pharoas were coders but using different compilers{}{}{}{}{}}}}{{{{@#$%^^&&$$$###()()(***)))([][][][][]]][
#include<bits/stdc++.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<set>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int b[1005]={0};
int main()
{
int n;
long long s;
cin>>n>>s;
long long a[n],b[n],c[n];
for(int i=0;i<n;i++)
	cin>>a[i];
for(int i=0;i<n;i++)
{
	cin>>b[i];
	c[i]=b[i]-a[i];
}
sort(c,c+n);
int h=0;
for(int i=n-1;i>=0;i--)
{
	h++;
	s+=c[i];
	if(s<=0)
		break;
}
cout<<h;
	return 0;
}
Copy
Wheatly's portals - Easy version sameh58
GNU G++17
217 ms
24.2 MB
Accepted