Error in output

code works fine in netbeans but giving error in coding blocks ide https://ide.codingblocks.com/s/124571

You have put the loop for testcases from i=0 to i<=t. That will mean t+1 testcases. So, either put the loop from 1 to <=t or from 0 to < t

still one test case is not passed out of 3

According to the question, you need to find the greatest integer x, such that, x^k <= n. So your logic will work correctly for x^k = n but will not always give correct answer for x^k<n because you are typecasting to int. You will need to apply binary search in this problem. For every possible mid obtained by using binary search, check if it is the best suitable candidate or not for becoming the Kth root and then we reduce the search space of the binary search according to the mid value. If mid^k is greater than N then we will find the best suitable value from left to mid-1 otherwise we will find much larger value by finding it from mid+1 to right.