You're in ancient Greece and giving Philoctetes a hand in preparing a training exercise for Hercules! You've filled a pit with two different ferocious mythical creatures for Hercules to battle!

The formidable **"Orthus"** is a 2 headed dog with 1 tail.  The mighty **"Hydra"** has 5 heads and 1 tail. 

Before Hercules goes in, he asks you "How many of each beast am  I up against!?".

You know the total number of heads and the total number of tails, that's the dangerous parts, right? But you didn't consider how many of each beast. 

## Task

Given the number of heads and the number of tails, work out the number of each mythical beast! 

The data is given as two parameters. Your answer should be returned as an array:
```python 
 VALID ->      [24 , 15]           INVALID ->  "No solutions"
```

If there aren't any cases for the given amount of heads and tails - return "No solutions" or null (C#).

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def beasts(heads, tails):
	

Solutions:
def beasts(heads, tails):
	orthus = (5 * tails - heads) / 3
	hydra = tails - orthus
	return [orthus, hydra] if orthus >= 0 and hydra >= 0 else 'No solutions'


def beasts(h, t):
	out = [(5 * t - h) / 3, (h - 2 * t) / 3]
	return all((x.is_integer() and x >= 0 for x in out)) and out or 'No solutions'


def beasts(heads, tails):
	if heads not in range(tails * 2, tails * 5 + 1, 3):
		return 'No solutions'
	return [(tails * 5 - heads) / 3, (heads - tails * 2) / 3]


def beasts(heads, tails):
	extraheads = heads - 2 * tails
	if extraheads % 3 != 0 or not 0 <= extraheads <= 3 * tails:
		return 'No solutions'
	hydra = extraheads // 3
	orthus = tails - hydra
	return [orthus, hydra]


def beasts(heads, tails):
	h = (heads - tails * 2) / 3
	if h < 0 or tails - h < 0:
		return 'No solutions'
	return [tails - h, h]


beasts = lambda h, t: (lambda m: [t - m, m] if m >= 0 and m <= t and (m % 1 == 0) else 'No solutions')((h - t * 2) / 3.0)


def beasts(h, t):
	(O, H) = (5 * t - h, h - 2 * t)
	if O >= O % 3 >= 0 <= H % 3 <= H:
		return [O // 3, H // 3]
	else:
		return 'No solutions'


def beasts(heads, tails):
	for orthus in range(heads // 2 + 1):
		if orthus * 2 + (tails - orthus) * 5 == heads:
			return [orthus, tails - orthus]
	return 'No solutions'


def beasts(heads, tails):
	o = (5 * tails - heads) / 3
	h = (heads - 2 * tails) / 3
	if o == int(o) and h == int(h) and (o >= 0) and (h >= 0):
		return [int(o), int(h)]
	else:
		return 'No solutions'


def beasts(heads, tails):
	hydra = (heads - 2 * tails) / 3
	orthus = tails - (heads - 2 * tails) / 3
	if hydra % 1 == 0 and hydra >= 0 and (orthus % 1 == 0) and (orthus >= 0):
		return [orthus, hydra]
	else:
		return f'No solutions'