Source Code
#include <iostream>
using namespace std;
 int n,s;

int main() {
  int t[1000001];
  int r[1000001];
cin>>n>>s;

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

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

int k=0;

  for(int i=0;i<n;i++){
  s=s-t[i]+r[i];
  if(s>=0)
  k++;
  }
cout<<k;
}
Copy
Wheatly's portals - Hard version King_Of_Asgard
GNU G++17
9 ms
8.3 MB
Wrong Answer