Please tell me why my code is not passing all the test case

source code https://ide.codingblocks.com/s/225032

hello @the.shubham.sri
use modular arithmetic property while perofming multiplication.
i.e
ans*=a should be ans=(ans%c * a%c) %c

a=a*a should be a=(a%c * a%c)%c