Codeshef Question - MATBREAK


Can you please tell why this solution is not accepting for this problem on codeshef… i tried literally everything to optimise my solution but it didn’t work…please tell me whats the problem in the code

this is the question

you cannot do modulo exponentiation like that. It will result in overflow
I have corrected it.
You could have just entered some random big test cases and your answer would come out to be negative.

Thanks I got the soln correct now…but can you explain what was the problem in my modulo exponentiation?

?? aa, resa will result in overflow. I mentioned it in my previous comment.

okay…