Johnny is a farmer and he annually holds a beet farmers convention "Drop the beet".

Every year he takes photos of farmers handshaking. Johnny knows that no two farmers handshake more than once. He also knows that some of the possible handshake combinations may not happen.

However, Johnny would like to know the minimal amount of people that participated this year just by counting all the handshakes.

Help Johnny by writing a function, that takes the amount of handshakes and returns the minimal amount of people needed to perform these handshakes (a pair of farmers handshake only once).

Difficulty: EASY
Starter code: def get_participants(h):
	

Solutions:
from math import ceil

def get_participants(h):
	return int(ceil(0.5 + (0.25 + 2 * h) ** 0.5))


def get_participants(handshakes, n=1):
	return get_participants(handshakes, n + 1) if (n * n - n) / 2 < handshakes else n


def get_participants(handshakes):
	from math import ceil
	return ceil(0.5 + ((8 * handshakes + 1) / 4) ** 0.5)


def get_participants(handshakes):
	return int(1.5 + (2 * handshakes) ** 0.5)


def get_participants(h):
	n = 0
	counter = 0
	while h > 0:
		h -= counter
		n += 1
		counter += 1
	return n or 1


from bisect import bisect_left
ns = [n * (n + 1) // 2 for n in range(1000)]

def get_participants(handshakes):
	return bisect_left(ns, handshakes) + 1


import math

def get_participants(h):
	return math.ceil((1 + math.sqrt(1 + 8 * h)) / 2)


def get_participants(handshakes):
	farmers = 1
	maxshakes = 0
	while maxshakes < handshakes:
		maxshakes += farmers
		farmers += 1
	return farmers


from math import ceil

def get_participants(hs):
	return ceil((1 + (1 + 8 * hs) ** 0.5) / 2)