Let's pretend your company just hired your friend from college and paid you a referral bonus. Awesome! To celebrate, you're taking your team out to the terrible dive bar next door and using the referral bonus to buy, and build, the largest three-dimensional beer can pyramid you can. And then probably drink those beers, because let's pretend it's Friday too. 

A beer can pyramid will square the number of cans in each level - 1 can in the top level, 4 in the second, 9 in the next, 16, 25... 

Complete the beeramid function to return the number of **complete** levels of a beer can pyramid you can make, given the parameters of: 

1) your referral bonus, and

2) the price of a beer can

For example:

Difficulty: EASY
Starter code: def beeramid(bonus, price):
	

Solutions:
def beeramid(bonus, price):
	beers = bonus // price
	levels = 0
	while beers >= (levels + 1) ** 2:
		levels += 1
		beers -= levels ** 2
	return levels


from itertools import count

def beeramid(bonus, price):
	bonus = max(bonus, 0)
	n = bonus // price
	return next((x for x in count(int((n * 3) ** (1 / 3) + 1), -1) if x * (x + 1) * (2 * x + 1) // 6 <= n))


def beeramid(bonus, price):
	k = bonus // price
	d = (3 * (11664 * k * k - 3) ** 0.5 + 324 * k) ** (1 / 3)
	n = (d / 3 + 1 / d - 1) / 2
	return k > 0 and int(n.real + 1e-12)


def beeramid(bonus, price):
	i = 0
	while bonus > 0:
		i += 1
		bonus -= price * i ** 2
		if bonus < 0:
			i -= 1
	return i


def beeramid(bonus, price, level=1):
	return 0 if bonus < price * level ** 2 else 1 + beeramid(bonus - price * level ** 2, price, level + 1)


def beeramid(bonus, price):
	b = bonus / price
	n = 1
	while True:
		if b < n * (n + 1) * (2 * n + 1) / 6:
			return n - 1
			break
		n += 1


def beeramid(bonus, price):
	num_cans = bonus // price
	level = 0
	while num_cans >= 0:
		level += 1
		num_cans -= level * level
	return max(0, level - 1)


def beeramid(bonus, price):
	if bonus < price:
		return 0
	elif bonus == price:
		return 1
	else:
		L = []
		a = int(bonus // price) + 1
		c = 1
		for i in range(1, a):
			c += i * i
			if c <= a:
				L.append(i * i)
		b = len(L)
		return b


def beeramid(bonus, price):
	if bonus < 0:
		return 0
	sum = 0
	x = 1
	c = 0
	while bonus / price >= sum:
		sum = sum + x ** 2
		x += 1
		c += 1
	return c - 1


def level():
	n = 2
	while n:
		yield (n ** 2)
		n += 1

def beeramid(bonus, price):
	(b, x, sum, n) = (bonus // price, level(), 1, 0)
	while sum <= b:
		sum += next(x)
		n += 1
	return n