TLE error in 1/4 test cases

Test case 1 is showing TLE error.
Kindly find the mistake in the code.

hi
share your code…

u have put a loop while(k!=0)
and as k can be 10^9 u will get a tle

u can also see that n can be 10^5 only so u dont need 10^9 swap just think in this logic