Can anyone tell why am i getting run time error in this code? (CDUTSV01)

#include

using namespace std;

int main()
{
int a[8],sum=0;
for(int j=0;j<8;j++){
cin>>a[j];
sum=sum+a[j];
}
int n;cin>>n;
int p=0;
for(int i=0;i<n;i++){
int x,y;cin>>x>>y;
if(x>0 && y>0){
if(a[x-1]>=a[y-1]){p=p+a[y-1];}
else{p=p+a[x-1];}
}
}
cout<<sum-p<<endl;

return 0;

}

Please either format your code or link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Also - what Problem are you trying to solve? :slight_smile:

Never use “int” in competetive coding. 95% of the times the contrains will be huge, or else anyone can use bruteforce.
Anyways try using “long long int” instead. Also mention what runtime error it is.

SIGTSTP