Hallucination @ 2018-10-10 17:38:49
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,s,a,b,ans=0,sum;
cin>>n>>s;
cin>>a>>b;
sum=s;
int x[n],y[n];
for(int i=1;i<=n;i++)
cin>>x[i]>>y[i];
for(int i=1;i<=n;i++)
if(a+n+b>=x[i]&&sum-y[i]>=0)
ans++,sum-=y[i];
cout<<ans;
return 0;
}