#include #include #include using namespace std; typedef long long LL; LL a,b,p; LL ksm(LL a,LL b,LL p) { LL res=1; for(;b;b>>=1,a=a*a%p) if(b&1) res=res*a%p; return res; } LL solve() { map mp; LL m=sqrt(p)+1,c_j=1; for(int i=0;i