my code failed to pass the last two cases.
please check into it
Math day Problem
Take a=a%m in the power function and it’ll work.
I’ve made changes in your code, you can check it here .
It is working now but why do we need to take mod of a too?
because a in test cases is more than m.