# Run time error SIGABRT?

here is my code and it is showing SIGABRT error on some input . it is running fine on my input and some subtasks.help me out

``````#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main()
{
int t;
cin>>t;

for(int j=0;j<t;++j)
{
long long r,S,p;
cin>>r>>S>>p;
vector<long long> seq(p);
seq[0]=1;

long long sum=1,ans=-1;
if((sum%p)==S)
{
ans=1;
}

else
{
for(long long i=2;i<p;++i)
{
seq[i-1]=(seq[i-2]*r)%p;
if(count(seq.begin(),seq.end(),seq[i-1])>1)
{
break;

}
sum+=seq[i-1];
if((sum%p)==S)
{
ans=i;
break;
}
}
}
cout<<ans<<endl;

}
return 0;
}`````````

What Problem are you trying to solve? XD

the problem is :- we are given a problem on GP and we are given common ratio-‘r’,sum=‘S’ and modulus value-‘p’,we need to find the value of n which gives us that sum and here ‘nth’ term is ‘((n-1)th term* r)’. the sum of the first N terms of the GP modulo ‘p’ , is ‘S’

a special property is given about ‘r’ to the monk that if we form a set of the numbers r,r2,r3,…,rp−1 (mod p ), then that set will contain all the numbers from 1 to p−1.