The new "Avengers" movie has just been released! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single `100`, `50` or `25` dollar bill. An "Avengers" ticket costs `25 dollars`.

Vasya is currently working as a clerk. He wants to sell a ticket to every single person in this line. 

Can Vasya sell a ticket to every person and give change if he initially has no money and sells the tickets strictly in the order people queue?

Return `YES`, if Vasya can sell a ticket to every person and give change with the bills he has at hand at that moment. Otherwise return `NO`.

### Examples:

```csharp 
Line.Tickets(new int[] {25, 25, 50}) // => YES 
Line.Tickets(new int[] {25, 100}) // => NO. Vasya will not have enough money to give change to 100 dollars
Line.Tickets(new int[] {25, 25, 50, 50, 100}) // => NO. Vasya will not have the right bills to give 75 dollars of change (you can't make two bills of 25 from one of 50)
```
```python
tickets([25, 25, 50]) # => YES 
tickets([25, 100]) # => NO. Vasya will not have enough money to give change to 100 dollars
tickets([25, 25, 50, 50, 100]) # => NO. Vasya will not have the right bills to give 75 dollars of change (you can't make two bills of 25 from one of 50)
```
```cpp 
tickets({25, 25, 50}) // => YES 
tickets({25, 100}) // => NO. Vasya will not have enough money to give change to 100 dollars
tickets({25, 25, 50, 50, 100}) // => NO. Vasya will not have the right bills to give 75 dollars of change (you can't make two bills of 25 from one of 50)
```

Difficulty: EASY
Starter code: def tickets(people):
	

Solutions:
def tickets(people):
	till = {100.0: 0, 50.0: 0, 25.0: 0}
	for paid in people:
		till[paid] += 1
		change = paid - 25.0
		for bill in (50, 25):
			while bill <= change and till[bill] > 0:
				till[bill] -= 1
				change -= bill
		if change != 0:
			return 'NO'
	return 'YES'


def tickets(a):
	n25 = n50 = n100 = 0
	for e in a:
		if e == 25:
			n25 += 1
		elif e == 50:
			n25 -= 1
			n50 += 1
		elif e == 100 and n50 > 0:
			n25 -= 1
			n50 -= 1
		elif e == 100 and n50 == 0:
			n25 -= 3
		if n25 < 0 or n50 < 0:
			return 'NO'
	return 'YES'


def tickets(people):
	change = 'YES'
	(twentyfive, fifty, onehundred) = (0, 0, 0)
	for cash in people:
		if change == 'NO':
			break
		if cash == 25:
			twentyfive += 1
		elif cash == 50 and twentyfive > 0:
			twentyfive -= 1
			fifty += 1
		elif cash == 100:
			if fifty > 0 and twentyfive > 0:
				fifty -= 1
				twentyfive -= 1
				onehundred += 1
			elif twentyfive > 2:
				twentyfive -= 3
				onehundred += 1
			else:
				change = 'NO'
		else:
			change = 'NO'
	return change


def tickets(people):
	cashRegister = {25: 0, 50: 0, 100: 0}
	ticketPrice = 25
	for paid in people:
		cashRegister[paid] += 1
		while paid > ticketPrice:
			changeGiven = False
			for bill in sorted(cashRegister.keys(), reverse=True):
				if paid - ticketPrice >= bill and cashRegister[bill] > 0:
					paid = paid - bill
					cashRegister[bill] -= 1
					changeGiven = True
			if paid > ticketPrice and changeGiven == False:
				return 'NO'
	return 'YES'


def tickets(people):
	change = {'25': 0, '50': 0}
	for person in people:
		if person == 25:
			change['25'] += 1
		elif person == 50:
			change['50'] += 1
			change['25'] -= 1
		elif change['50'] > 0:
			change['50'] -= 1
			change['25'] -= 1
		else:
			change['25'] -= 3
		if change['25'] < 0:
			return 'NO'
	return 'YES'


def tickets(people, cost=25, bills=[100, 50, 25]):
	count = dict.fromkeys(bills, 0)
	for change in people:
		count[change] += 1
		change -= cost
		for bill in bills:
			if change >= bill:
				c = min(change // bill, count[bill])
				count[bill] -= c
				change -= c * bill
		if change:
			return 'NO'
	return 'YES'


def tickets(people):
	bill25 = 0
	bill50 = 0
	bill100 = 0
	for bill in people:
		if bill == 25:
			bill25 += 1
		elif bill == 50:
			bill50 += 1
			if bill25 == 0:
				return 'NO'
			bill25 -= 1
		elif bill == 100:
			bill100 += 1
			if bill50 > 0 and bill25 > 0:
				bill50 -= 1
				bill25 -= 1
			elif bill25 >= 3:
				bill25 = bill25 - 3
			else:
				return 'NO'
	return 'YES'


from collections import Counter

def tickets(people):
	bills = Counter({25: 0, 50: 0, 100: 0})
	required = {50: [Counter({25: 1})], 100: [Counter({25: 1, 50: 1}), Counter({25: 3})]}

	def check_required(person):
		for require in required[person]:
			if bills & require == require:
				bills.subtract(require)
				return True
		return False
	for person in people:
		bills[person] += 1
		if person > 25 and (not check_required(person)):
			return 'NO'
	return 'YES'


def tickets(people):
	change = []
	try:
		for cash in people:
			if cash == 25:
				change.append(25)
			if cash == 50:
				change.remove(25)
				change.append(50)
			if cash == 100 and 50 in change:
				change.remove(50)
				change.remove(25)
			elif cash == 100:
				change.remove(25)
				change.remove(25)
				change.remove(25)
	except:
		return 'NO'
	else:
		return 'YES'