Could not get which testcase is not satisfied here

#include<bits/stdc++.h>
using namespace std;
#define num 10000001
int main()
{
long long int arr[num]={0};
arr[0]=arr[1]=1;
for(long long int i=2;i<num;i++)
{
if(arr[i]==0)
{
for(long long int j=i*i;j<num;j+=2)
{
arr[j]=1;
}
}
}

int n;
cin>>n;
long long int a;
for(int i=0;i<n;i++)
{
    cin>>a;
	float b= sqrt(a);
	if((ceil(b)==floor(b))&& (arr[int(ceil(b))]==0)) 
	{
        cout<<"YES"<<endl;
	}
	else
	{
		cout<<"NO"<<endl;
	}
}
return 0;

}

@goyal431 in inner for loop of your sieve it should be j+=i you have written j+=2,
and 0 and 1 are not prime.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.