T-prime optimization

Hey suggest me what should i do, i am getting TLE for T-prime.

https://ide.codingblocks.com/s/88235

Sqrt() is not working.

The only numbers with the count of numbers of divisors = 3 are the square of prime number
So you have to just find out the prime number upto range 10^6 and then find out whether the sqrt of given number is prime or not . If it s prime print YES else NO