Write
```python
smaller(arr)
```
that given an array ```arr```, you have to return the amount of numbers that are smaller than ```arr[i]``` to the right.

For example:
```python
smaller([5, 4, 3, 2, 1]) == [4, 3, 2, 1, 0]
smaller([1, 2, 0]) == [1, 1, 0]
```
``` haskell
smaller [5,4,3,2,1]  `shouldBe` [4,3,2,1,0]
smaller [1,2,3]      `shouldBe` [0,0,0]
smaller [1, 2, 0]    `shouldBe` [1, 1, 0]
```
If you've completed this one and you feel like testing your performance tuning of this same kata, head over to the much tougher version How many are smaller than me II?

Source: codewars | Difficulty: EASY
Tags: Data structures

Starter code: def smaller(arr):
	

Solutions:
def smaller(arr):
	return [len([a for a in arr[i:] if a < arr[i]]) for i in range(0, len(arr))]


def smaller(arr):
	return [sum((b < a for b in arr[i + 1:])) for (i, a) in enumerate(arr)]


def smaller(arr):
	return [sum((x > y for y in arr[i + 1:])) for (i, x) in enumerate(arr)]


def smaller(arr):
	return [sum((j < v for j in arr[i:])) for (i, v) in enumerate(arr)]


def smaller(arr):
	a = []
	counter = 0
	for j in range(len(arr)):
		j = arr[0]
		for k in arr:
			if j > k:
				counter += 1
		a.append(counter)
		counter = 0
		arr.remove(arr[0])
	return a


def smaller(arr):
	return [sum((1 for right in arr[i + 1:] if right < item)) for (i, item) in enumerate(arr)]


def smaller(nums):
	i = 0
	res = []
	while i < len(nums):
		j = i + 1
		nb = 0
		while j < len(nums):
			if nums[i] > nums[j]:
				nb += 1
			j += 1
		res.append(nb)
		i += 1
	return res


def countsort(arr, cntarr, cntdict):
	if len(arr) > 1:
		mid = len(arr) // 2
		left = arr[:mid]
		leftcount = cntarr[:mid]
		right = arr[mid:]
		rightcount = cntarr[mid:]
		countsort(left, leftcount, cntdict)
		countsort(right, rightcount, cntdict)
		i = 0
		j = 0
		k = 0
		while i < len(left) and j < len(right):
			if left[i] > right[j]:
				arr[k] = right[j]
				for n in range(i, len(left)):
					temp = leftcount[n]
					cntdict[temp] = cntdict[temp] + 1
				cntarr[k] = rightcount[j]
				j = j + 1
			else:
				arr[k] = left[i]
				cntarr[k] = leftcount[i]
				i = i + 1
			k = k + 1
		while i < len(left):
			arr[k] = left[i]
			cntarr[k] = leftcount[i]
			i = i + 1
			k = k + 1
		while j < len(right):
			arr[k] = right[j]
			cntarr[k] = rightcount[j]
			j = j + 1
			k = k + 1

def smaller(arr):
	posarr = [i for i in range(len(arr))]
	cntdict = {i: 0 for i in range(len(arr))}
	countsort(arr, posarr, cntdict)
	soln = []
	for i in range(len(arr)):
		soln.append(cntdict[i])
	return soln