Finding Exponent (ICPC) WA in my code

I’ve used pretty simple logic according to the editorial.
I tried to generate random 10 test cases and matched with the top submission and they matched.
Don’t know why I’m getting WA 0.00.
Here is my code.
http://www.codechef.com/viewsolution/6045668
Uncomment for debugging.