Code is not getting accepted

@Mudit809
for inputs where less than k swaps are possible your code is not running at all

can you please correct my code where i’m going wrong.

refer to this