A core idea of several left-wing ideologies is that the wealthiest should *support* the poorest, no matter what and that is exactly what you are called to do using this kata (which, on a side note, was born out of the necessity to redistribute the width of `div`s into a given container).

You will be given two parameters, `population` and `minimum`: your goal is to give to each one according to his own needs (which we assume to be equal to `minimum` for everyone, no matter what), taking from the richest (bigger numbers) first.

For example, assuming a population `[2,3,5,15,75]` and `5` as a minimum, the expected result should be `[5,5,5,15,70]`. Let's punish those filthy capitalists, as we all know that being rich has to be somehow a fault and a shame!

If you happen to have few people as the richest, just take from the ones with the lowest index (the closest to the left, in few words) in the array first, on a 1:1 based heroic proletarian redistribution, until everyone is satisfied.

To clarify this rule, assuming a population `[2,3,5,45,45]` and `5` as `minimum`, the expected result should be `[5,5,5,42,43]`.

If you want to see it in steps, consider removing `minimum` from every member of the population, then iteratively (or recursively) adding 1 to the poorest while removing 1 from the richest. Pick the element most at left if more elements exist with the same level of minimal poverty, as they are certainly even more aligned with the party will than other poor people; similarly, it is ok to take from the richest one on the left first, so they can learn their lesson and be more kind, possibly giving more *gifts* to the inspectors of the State!

In steps:
```
[ 2, 3, 5,45,45] becomes
[-3,-2, 0,40,40] that then becomes
[-2,-2, 0,39,40] that then becomes
[-1,-2, 0,39,39] that then becomes
[-1,-1, 0,38,39] that then becomes
[ 0,-1, 0,38,38] that then becomes
[ 0, 0, 0,37,38] that then finally becomes (adding the minimum again, as no value is no longer under the poverty threshold
[ 5, 5, 5,42,43]
```

If giving `minimum` is unfeasable with the current resources (as it often comes to be the case in socialist communities...), for example if the above starting population had set a goal of giving anyone at least `30`, just return an empty array `[]`.

Difficulty: EASY
Starter code: def socialist_distribution(population, minimum):
	

Solutions:
def socialist_distribution(population, minimum):
	if minimum > sum(population) // len(population):
		return []
	while min(population) < minimum:
		population[population.index(min(population))] += 1
		population[population.index(max(population))] -= 1
	return population


def socialist_distribution(p, m):
	if sum(p) / len(p) < m:
		return []
	while min(p) < m:
		p[p.index(min(p))] += 1
		p[p.index(max(p))] -= 1
	return p


def socialist_distribution(population, minimum):
	if sum(population) < minimum * len(population):
		return []
	population = population[:]
	for _ in range(sum((max(minimum - p, 0) for p in population))):
		population[min(range(len(population)), key=population.__getitem__)] += 1
		population[max(range(len(population)), key=population.__getitem__)] -= 1
	return population


def socialist_distribution(population, minimum):
	if sum(population) < len(population) * minimum:
		return []
	while 1:
		poor = rich = 0
		for (idx, need) in enumerate(population):
			if need < population[poor]:
				poor = idx
			if need > population[rich]:
				rich = idx
		if population[poor] >= minimum:
			return population
		population[rich] -= 1
		population[poor] += 1


socialist_distribution = lambda p, m: [] if sum(p) < m * len(p) else p if all((m <= e for e in p)) else (lambda mini, maxi: socialist_distribution(p[:mini] + [p[mini] + 1] + p[mini + 1:maxi] + [p[maxi] - 1] + p[maxi + 1:], m) if mini < maxi else socialist_distribution(p[:maxi] + [p[maxi] - 1] + p[maxi + 1:mini] + [p[mini] + 1] + p[mini + 1:], m))(p.index(min(p)), p.index(max(p)))


def socialist_distribution(a, n):
	m = sum(a)
	if m < len(a) * n:
		return []
	if m == len(a) * n:
		return [n] * len(a)
	for i in range(sum((n - x for x in a if x < n))):
		a[a.index(max(a))] -= 1
	return [max(x, n) for x in a]


def socialist_distribution(a, m):
	new = [i - m for i in a]
	while any((i > 0 for i in new)) or sum(new) == 0:
		if all((i + m >= m for i in new)):
			return [i + m for i in new]
		new[new.index(max(new))] -= 1
		new[new.index(min(new))] += 1
	return []