SIGFPE
This is my code. i tried very hard to find out the problem but i am not able to do so …so if anyone can find out the problem in my code it will be really helpful
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
int n,r;
cin>>n>>r;
int a[n],b[n];
int i;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
cin>>b[i];
}
vector<pair<int,int>> effective(n);
for(i=0;i<n;i++)
{
effective.push_back({a[i]-b[i],a[i]});
}
sort(effective.begin(),effective.end());
i=0;
int count=0;
int f,s;
int instant_count=0;
while(i<n)
{
f=effective[i].first;
s=effective[i].second;
if(r<s)
{
break;
}
if(s<=r)
{
count=count+r/s;
instant_count=r/s;
r=r%s+instant_count*(s-f);
}
if(r>=s)
{
i--;
}
i++;
}
cout<<count<<"\n";
}
}