Comments

reference: Fermat's little theorem

a^(p-1) = 1 (mod p) when p is a prime number.

+13

I get it. I should read the problem description closely. Thank you!

+5

Can someone check my code in Problem D? I have no idea about why it got Memory limit exceeded on test 5.