Getting a run time error in question "Pairs On Line"

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
ll n,m,c;
cin>>n>>m>>c;
map <ll,ll> a;
queue b;
for(int i=0;i<n;i++){
ll d;
cin>>d;
if(a[d]==0) b.push(d);
a[d]++;
}
ll total=0;
for(int i=0;i<n;i++){
ll x=b.front();
ll y= (m*x) + c;
total+=a[x]*a[y];
//if(a[y]!=0) total++;
b.pop();
}
cout<<total;
}

Is it due to exceeding limits of long long int?

no… its because of queue …if not elements are there in queue and you will try to access top element it will give you run time error