Help me with this code! (Feb long challenge)

https://www.codechef.com/viewsolution/42924556

You just need to alter the code a little bit.Just initialize you cnt array like this cnt[0] = cnt[1] = 1;

nope buddy that was not the problem.Actually it was with me taking sqrt(n) comparisons only. Anways thx for replying!

Yeah, you should have calculated the prefix i.e., count[], after you sieve.