Solution Link - CodeChef: Practical coding for everyone
you have taken every variable as int while constraint says n ans Pi go upto 10^9.
try changing variables to long long
1 Like
https://discuss.codechef.com/questions/133949/guzac-editorial/134104
In case you still need a tricky test case , here is one !
Thank you, brother. It is working now .