Facing problem in modular exponentiation challenge

I have used the formula - (a^b)%c = ((a%c)^b)%c . However i am getting 5 testcases right out of 10. please tell what should be done. This is the link - https://ide.codingblocks.com/s/387463 .