Right output but wrong status

even though after trying many test cases, for my code i am getting the right output still i am getting the status of wrong answer. please help me
https://www.codechef.com/viewsolution/49381917

In line 29 you are printing it as "Yes" but the problem statement requires you to print as "yes".
Try changing it.

Then if you get TLE try solving it using Sieve of Eratosthenes.