• + 1 comment
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    long long n1,k1,n2,k2,n,t,i,f,j,l;
    cin>>t;
    for(i=0;i<t;i++)
    {cin>>n1>>k1>>n2>>k2>>n;
        if(n1==0 && k1==0)
            j=1;
        j=pow(n1,k1);
        if(n2==0 && k2==0)
            l=1;
        l=pow(n2,k2);
     if (j==0 && l==0)
         f=1;
    
        f=pow(j,l);
        cout<<f%n<<'\n';
    }
    giving error in some tests
    dont know what is wrong with this code?