Help me in solving CHEFPRODUCT problem

My issue

Can Someone please clear the doubt of why this code isnt working

long long n;
cin>>n;

 if(n==2)
  cout<<0<<endl;

  
  else{ 

  n=floor(sqrtl(n));
  
  if(n%2==1)
  {
      cout<<((n+1)/2)<<endl;
  }
  else
  {
      cout<<n/2<<endl;
  } 

My code

#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	long long t;
	cin>>t;
	for(long long i=0;i<t;i++)
	{
	   long long n;
	   cin>>n;
	
	 
	 if(n==2)
	  cout<<0<<endl;
	
	  
	  else{ 
	
	  n=floor(sqrtl(n));
	  
	  if(n%2==1)
	  {
	      cout<<((n+1)/2)<<endl;
	  }
	  else
	  {
	      cout<<n/2<<endl;
	  }
	  
	
	  }
	
	

	   
	  
	    
	   
	    
	   
	   
	   
	}
	return 0;
}

Problem Link: Chef Product Practice Coding Problem - CodeChef