https://www.codechef.com/YTPP001/problems/ISGOODNM

https://www.codechef.com/YTPP001/problems/ISGOODNM
i’m able to pass sample testcase but getting sometime runtime error and sometime wrong answer i just want to know that is there someone else who is also getting the same issue, also can somebody tell me that there is anything wrong in the question?

You might want to share your solution as well.