Kth root by binary search

#include
#include
using namespace std;
int power(long long int n,int m)
{
long long int start,end,mid;
start=0;
end=n;
int ans=-1;
while(start<=end)
{
mid=(start+end)/2;
if(pow(mid,m)==n)
{
ans=mid;
break;
}
else if(pow(mid,m)>n)
{
end=mid-1;
}
else
{
start=mid+1;
ans=mid;
}
}
return ans;
}
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
long long int n;
int m;
cin>>n>>m;
cout<<power(n,m);
}
return 0;
}
sir, it pass test case but when i submitting the code then its showing wrong answer ?

@Happy.Vashisht123
Don’t use pow function as pow(mid,k) can be a very big number which will cause overflow