Exchanging Coins

Why showing run time error for second test case.