THE PROBLEM
Code→
#include<iostream>
using namespace std;
int main()
{
long int s,t,a,b,m,n; //m=number of apples, n=number of orranges
long int ap[m], orr[n];
cin>>s;
cin>>t;
cin>>a;
cin>>b;
cin>>m;
cin>>n;
long int d1= s-a;
long int d2= t-a;
long int q1= s-b;
long int q2= t-b;
long int c1=0,c2=0;
for(int i=0;i<m;i++)
{
cin>>ap[i];
if(ap[i]>=d1 && ap[i]<=d2)
{
c1++;
}
}
for(int i=0;i<n;i++)
{
cin>>orr[i];
if(orr[i]<=q1 && orr[i]>=q2)
{
c2++;
}
}
cout<<c1<<"\n"<<c2;
return 0;
}
Why does it give Segmentation fault in Hacker Rank and In dev c++ the code stops by saying Windows is looking for a solution.