Some test cases are failaing pls help

here is the code https://ide.codingblocks.com/s/214624

Hi @pyash, int j=pow(a,b); now if a=10000, and b=10000 then overflow will occur as int can’t store word as big as 10000^10000 , so you have to take modulus at every stage of multiplication , also this question is not intended to be solved by using stl function you have to make your own function
u can refer this :-

long long binpow(long long a, long long b, long long c) {
    a %= c;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % c;
        a = a * a % c;
        b >>= 1;
    }
    return res;
}

refer this for detailed explanation

In case of any doubt feel free to ask :slight_smile:
mark your doubt as resolved if u got the answer