Kth Root in Searching Challenge

Please check my code and tell me the about the failing test cases. I have checked the border cases but can’t find the problem.

#include
using namespace std;
long long int power(long int a,long int k)
{
if(k>0)
{
long long int ans = power(aa,k/2);
if(k%2)
ans
=a;
return ans;
}
else
return 1;
}
int main()
{
int t;
cin>>t;
for(int i=0;i<t;i++)
{
long long int n,k;
cin>>n>>k;
long long int d=2,ans;
while(1)
{
ans=power(d,k);
if(ans>n)
break;
d++;
}
cout<<d-1<<endl;
}
return 0;
}

Please save your code on ide.codingblocks.com and share its link.

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.

Please provide your code in Coding Blocks IDE.

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.