Chef needs help to defeat the Magician

[the problem link] (Contest Page | CodeChef)

I think my code seems to get wrong on some of the test cases please help to debug it

My solution which is giving wrong answer

In line 22 you have assigned x to variable t before taking the input itself for X. so garbage values are being stored in t. Take the input for x and then assign it to t.

1 Like

thanks it got submitted .