Getting Runtime time error in Unlock

I am getting Runtime error in one the test cases.
Link to my code: https://ideone.com/TAk61D

See contraints , K can be upto 1e9 and your code is running for that.
Your working code -: