Modular GCD wrong Answer

I’m getting wrong answer in this question. Could anyone please tell me what’s wrong in this code?

Qustion :

My code:

Thanks in advance.
Your solution seems correct , don’t know where it goes wrong .

figured out bro , u have to use 128 bit int integer in your Binary exponentiation

I changes your code and it give AC : “

1 Like

If u don’t wanna use 128 bit integer then u have to do modular multiplication (just like modular exponentiation)

1 Like