Three candidates take part in a TV show.

In order to decide who will take part in the final game and probably become rich, they have to roll the Wheel of Fortune!

The Wheel of Fortune is divided into 20 sections, each with a number from 5 to 100 (only mulitples of 5).

Each candidate can roll the wheel once or twice and sum up the score of each roll.
The winner one that is closest to 100 (while still being lower or equal to 100). 
In case of a tie, the candidate that rolled the wheel first wins.

You receive the information about each candidate as an array of objects: each object should have a `name` and a `scores` array with the candidate roll values.

Your solution should return the name of the winner or `false` if there is no winner (all scored more than 100).

__Example:__

```python
c1 = {"name": "Bob", "scores": [10, 65]}
c2 = {"name": "Bill", "scores": [90, 5]}
c3 = {"name": "Charlie", "scores": [40, 55]}
winner([c1, c2, c3]) #Returns "Bill"
```

Please note that inputs may be invalid: in this case, the function should return false.

Potential errors derived from the specifications are:
- More or less than three candidates take part in the game.
- A candidate did not roll the wheel or rolled it more than twice.
- Scores are not valid.
- Invalid user entry (no name or no score).

Difficulty: EASY
Tags: Data structures

Game theory
Skill types: Data structures

Starter code:
def winner(candidates):
	

Solutions:
def winner(candidates):
	try:
		assert len(candidates) == 3
		max_total = 0
		for c in candidates:
			(name, scores) = (c['name'], c['scores'])
			assert 1 <= len(scores) <= 2
			assert all((not s % 5 and 0 < s <= 100 for s in scores))
			total = sum(scores)
			if max_total < total <= 100:
				(selected, max_total) = (name, total)
		return selected
	except:
		return False


def winner(candidates):
	if len(candidates) != 3 or any((not c.get('name') or not c.get('scores') or len(c['scores']) not in (1, 2) or any((s % 5 or not 5 <= s <= 100 for s in c['scores'])) for c in candidates)):
		return False
	qualified = [c for c in candidates if sum(c['scores']) <= 100]
	if not qualified:
		return False
	winner = max(qualified, key=lambda c: sum(c['scores']))
	return winner['name']


def winner(candidates):
	cs = [c for c in candidates if 'name' in c and 'scores' in c and (1 <= len(c['scores']) <= 2) and all((5 <= s <= 100 and s % 5 == 0 for s in c['scores']))]
	if len(cs) != 3:
		return False
	winner = False
	m = 0
	for candidate in candidates:
		s = sum(candidate['scores'])
		if 100 >= s > m:
			winner = candidate['name']
			m = s
	return winner


def winner(c):
	try:
		assert len(c) == 3 and all((0 < len(i['scores']) < 3 and all((not k % 5 and -1 < k < 101 for k in i['scores'])) for i in c if i['name'])) and (not all((sum(k['scores']) > 100 for k in c)))
	except:
		return False
	return max([[i['name'], sum(i['scores'])] for i in c], key=lambda x: x[1] < 101 and x[1])[0]


def isValidCnd(c):
	return all((k in c for k in ('name', 'scores'))) and 0 < len(c['scores']) < 3 and all((not v % 5 and 0 < v <= 100 for v in c['scores']))

def winner(cnds):
	if len(cnds) != 3 or not all((isValidCnd(c) for c in cnds)):
		return False
	return max(((sum(c['scores']), -i, c['name']) for (i, c) in enumerate(cnds) if 0 <= sum(c['scores']) <= 100), default=(0, 0, False))[2]


def winner(players):
	total_players = winner_name = winner_score = 0
	for p in players:
		try:
			name = p['name']
			scores = p['scores']
		except KeyError:
			return False
		score_total = total_spins = 0
		total_players += 1
		for score in scores:
			if score > 100 or score % 5:
				return False
			score_total += score
			total_spins += 1
		if total_spins not in (1, 2):
			return False
		elif score_total > 100:
			continue
		elif score_total > winner_score:
			winner_name = name
			winner_score = score_total
	return winner_name if winner_score and total_players == 3 else False


def winner(candidates):
	if any((c.keys() != ['name', 'scores'] for c in candidates)):
		return False
	if any([len(candidates) != 3, any((len(c['scores']) not in (1, 2) for c in candidates)), any((not 5 <= i <= 100 or i % 5 != 0 for c in candidates for i in c['scores']))]):
		return False
	m = 0
	for c in candidates:
		if m < sum(c['scores']) <= 100:
			m = sum(c['scores'])
			w = c['name']
	return w if m > 0 else False


def winner(candidates):
	if len(candidates) != 3 or not all((set(('name', 'scores')) == set(c.keys()) and len(c['scores']) in [1, 2] and all((s % 5 == 0 and s >= 5 and (s <= 100) for s in c['scores'])) for c in candidates)):
		return False
	candidates = filter(lambda c: sum(c['scores']) <= 100, candidates)
	return sorted(candidates, key=lambda c: -sum(c['scores']))[0]['name'] if candidates else False


def winner(cs):
	if not (len(cs) == 3 and all(('name' in c and 'scores' in c and (len(c['scores']) in (1, 2)) and all((5 <= s <= 100 and (not s % 5) for s in c['scores'])) for c in cs))):
		return False
	cs = {c['name']: (sum(c['scores']), -i) for (i, c) in enumerate(cs)}
	try:
		return max((c for c in cs.items() if c[1][0] <= 100), key=lambda c: c[1])[0]
	except:
		return False