## Task
 An `ATM` ran out of 10 dollar bills and only has `100, 50 and 20` dollar bills.
 
 Given an amount between `40 and 10000 dollars (inclusive)` and assuming that the ATM wants to use as few bills as possible, determinate the minimal number of 100, 50 and 20 dollar bills the ATM needs to dispense (in that order).

## Example

 For `n = 250`, the result should be `[2, 1, 0]`.
 
 For `n = 260`, the result should be `[2, 0, 3]`.
 
 For `n = 370`, the result should be `[3, 1, 1]`.

## Input/Output

 - `[input]` integer `n`
  Amount of money to withdraw. Assume that `n` is always exchangeable with `[100, 50, 20]` bills.
 - `[output]` integer array
  An array of number of `100, 50 and 20` dollar bills needed to complete the withdraw (in that order).

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def withdraw(n):
	

Solutions:
def withdraw(n):
	n50 = 0
	(n20, r) = divmod(n, 20)
	if r == 10:
		n20 -= 2
		n50 += 1
	(n100, n20) = divmod(n20, 5)
	return [n100, n50, n20]


def withdraw(n):
	(hundreds, fifties, rest) = (n // 100, n % 100 // 50, n % 50)
	if rest % 20 == 10:
		if fifties == 0:
			(hundreds, fifties, twenties) = (hundreds - 1, 1, (rest + 50) // 20)
		else:
			(fifties, twenties) = (fifties - 1, (rest + 50) // 20)
	else:
		twenties = rest // 20
	return [hundreds, fifties, twenties]


def withdraw(n):
	b50 = int(n % 20 == 10)
	(b100, b20) = divmod((n - 50 * b50) // 20, 5)
	return [b100, b50, b20]


bills = [[0, 0], [1, 3], [0, 1], [1, 4], [0, 2], [1, 0], [0, 3], [1, 1], [0, 4], [1, 2]]

def withdraw(n):
	(q, r) = divmod(n, 100)
	if r == 10 or r == 30:
		q -= 1
	return [q] + bills[r // 10]


def withdraw(n, coins=(100, 50, 20)):
	if not n:
		return [0] * len(coins)
	for i in range(n // coins[0] if coins else -1, -1, -1):
		sub = withdraw(n - i * coins[0], coins[1:])
		if sub is not None:
			return [i] + sub


def withdraw(n, bills=[100, 50, 20]):
	changes = [[0] * len(bills) for _ in range(n + 1)]
	for c in range(1, n + 1):
		changes[c] = min(([v + (b == bills[i]) for (i, v) in enumerate(changes[c - b])] for b in bills if c >= b), key=sum, default=[float('inf')] * len(bills))
	return changes[-1]


def withdraw(n):
	bills = [0, 0, 0]
	print(n)
	if n >= 100:
		while n >= 100:
			if n == 130 or n == 110:
				break
			n -= 100
			bills[0] += 1
	if n == 50 or n == 70 or n == 90 or (n == 130) or (n == 110):
		while n >= 50:
			if n == 80:
				break
			if bills[1] == 1:
				break
			n -= 50
			bills[1] += 1
	if n > 0:
		while n > 0:
			n -= 20
			bills[2] += 1
	return bills


def withdraw(n):
	b50 = int(n % 20 == 10)
	(b100, n) = divmod(n - 50 * b50, 100)
	return [b100, b50, n // 20]


def withdraw(n):
	fifties = 1 if n % 20 else 0
	twenties = int(n / 20) - 2 if fifties else int(n / 20)
	hundreds = int(20 * twenties / 100)
	twenties = twenties - hundreds * 5
	return [hundreds, fifties, twenties]


import re

def withdraw(n):
	return [len(a) // b for (a, b) in zip(re.findall('\\A((?:.{10})*)((?:.{5})*)((?:.{2})*)\\Z', '.' * (n // 10))[0], (10, 5, 2))]