Prime visits problem

getting TLE in one test case : https://ide.codingblocks.com/#/s/14683
question link: https://hack.codingblocks.com/contests/c/452/63

Hello Apoorva ! ur code is fine u just need to optimize it.
Okay , go through this you will be able to understand https://ide.codingblocks.com/#/s/14730

Can you please explain the logic behind your code?

Hey gsinha783 he has taken an array and put 0 on the locations where it is not prime and atlast count which are non-zero and it gives which is prime