Code is Right by my side but working for large no. plz tell me about correction

#include

#include

using namespace std;
int main()

{
unsigned long long int a;
cin>>a;
for(int i=0;i<a;i++)
{
unsigned long long int no,power;

cin>>no>>power;
unsigned long long int start=0,end=no,mid,ans;

while(start<=end)
{ 
    mid=(start+end)/2;
 unsigned long long int d=1;
 for(int i=1;i<=power;i++)
 d=d*mid;
 if(d == no )
    {
       ans=mid;
       break;
    }
  else if(d > no)
    {
            end =mid-1;
    }
    else 
    {
        start=mid+1;
    ans=mid;
        
    }
}
cout<<mid<<endl;
}

}

Hi @Lovishbansal,
here is d updated code https://codeshare.io/5ZVwWV
instead of storing power, directly use pow function. since long long can store value<=10^18, if pow is stored, it will contain garbage value if value stored is > 10^18.
Hope dis resolves ur doubt.

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.