Unknown error in DPAIRS solution

The following solution to the problem “DPAIRS” is throwing an error “SIGFPE” on codechef IDE. kindly help me out…

using namespace std;
int main()
int n=0, m=0;
int a[n]={ } , b[m]={ };
for (register size_t i = 0; i < n; i++) cin>>a[i];
for (register size_t i = 0; i < m; i++) cin>>b[i];
set distinctSum;
int x=rand()%n;
int y=rand()%m;
try{pair<set::iterator , bool> check = distinctSum.insert(a[x]+b[y]);
cout<<x<<" "<<y<<endl;
}catch(std::out_of_range &e){
cout<<“Undefined Exception!!”;

return 0;

as rand function can give the same number also so the value of x and y can be the same multiple times.

And for run time error the variable-sized object may be defined.

you can refer this link for nice solution → Best Solution | DPAIRS | TC O(N) + SC O(1)

Thanks for your reply.
now, as you said that x and y will have repeated value, i agree to it but, in that case, the corresponding sum will not be inserted in the set (if sum value is already present in it). The logic is working fine on my system but, is giving a run time error on CodeChef IDE “SIGFPE” which arises on reference to unallocated memory, I couldn’t recognise the statement throwing this error.