Kth root question using divide and conquor

using namespace std;

int binary(long int n , int k){

int s=1,ans=-1;

int e=n;
while(s<=e){
	int mid=(s+e)/2;
     if(pow(mid,k)==n){
		 return mid;
	 }
	 if(pow(mid,k)<n)	
	{
           ans=mid;
		 s=mid+1;
	}
	else{
		  e=mid-1;
		
	}
	 }
	 return ans;

}

int main() {

int T;
cin>>T;
for(int i=0;i<T;i++){
	long int n;
	int k;
	cin>>n;
	cin>>k;
	cout<<binary( n, k)<<endl;
}
return 0;

}

i have added iostream and cmath header files in my code

the test cases are not passing kindly tell the error present

I have edited your code … try to submit now…