Code below gives TLE for different test cases on different submissions. When I copy and paste the same test case in custom input it runs in below 100ms for every test case every time. Also, while copying I noticed that these cases don't have proper formatting. Maybe that is the actual problem? Can someone please confirm

```
if not amount:
return 0
import sys
dp = [sys.maxint]*(amount+1)
dp[0] = 0
coins = sorted(coins)
for i in xrange(1,amount+1):
for coin in coins:
if coin > i:
break
else:
if dp[i-coin] != sys.maxint:
dp[i] = min(dp[i], dp[i-coin] + 1)
return dp[-1] if dp[-1] != sys.maxint else -1
```