# Story&Task
 There are three parties in parliament. The "Conservative Party", the "Reformist Party", and a group of independants.

 You are a member of the “Conservative Party” and you party is trying to pass a bill. The “Reformist Party” is trying to block it.

 In order for a bill to pass, it must have a majority vote, meaning that more than half of all members must approve of a bill before it is passed . The "Conservatives" and "Reformists" always vote the same as other members of thier parties, meaning that all the members of each party will all vote yes, or all vote no .

 However, independants vote individually, and the independant vote is often the determining factor as to whether a bill gets passed or not.

 Your task is to find the minimum number of independents that have to vote for your party's (the Conservative Party's) bill so that it is passed .

 In each test case the makeup of the Parliament will be different . In some cases your party may make up the majority of parliament, and in others it may make up the minority. If your party is the majority, you may find that you do not neeed any independants to vote in favor of your bill in order for it to pass . If your party is the minority, it may be possible that there are not enough independants for your bill to be passed . If it is impossible for your bill to pass, return `-1`.

# Input/Output


 - `[input]` integer `totalMembers`

  The total number of members.


 - `[input]` integer `conservativePartyMembers`

  The number of members in the Conservative Party.


 - `[input]` integer `reformistPartyMembers`

  The number of members in the Reformist Party.

 
 - `[output]` an integer

  The minimum number of independent members that have to vote as you wish so that the bill is passed, or `-1` if you can't pass it anyway.
  
# Example

 For `n = 8, m = 3 and k = 3`, the output should be `2`.
 
 It means: 
 ```
 Conservative Party member --> 3
 Reformist Party member   --> 3
 the independent members --> 8 - 3 - 3 = 2
 If 2 independent members change their minds
 3 + 2 > 3
 the bill will be passed.
 If 1 independent members change their minds
 perhaps the bill will be failed
 (If the other independent members is against the bill).
 3 + 1 <= 3 + 1
 ```
 
 For `n = 13, m = 4 and k = 7`, the output should be `-1`.
 ```
 Even if all 2 independent members support the bill
 there are still not enough votes to pass the bill
 4 + 2 < 7
 So the output is -1
 ```

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def pass_the_bill(total_members, conservative_party_members, reformist_party_members):
	

Solutions:
def pass_the_bill(total, conservative, reformist):
	ind = total - conservative - reformist
	majority = total // 2 + 1
	if conservative > majority:
		return 0
	elif conservative + ind < majority:
		return -1
	else:
		return majority - conservative


def pass_the_bill(t, c, r):
	return -1 if t < 2 * r + 1 else max(0, t // 2 + 1 - c)


def pass_the_bill(par, con, ref):
	return -1 if ref >= par / 2 else max(0, par // 2 + 1 - con)


def pass_the_bill(t, c, r):
	return 0 if c >= (t >> 1) + 1 else -1 if r >= (t >> 1) + 1 or (r == t >> 1 and t % 2 == 0) else (t >> 1) + 1 - c


pass_the_bill = lambda t, c, r: -1 if r / t >= 0.5 else max(0, int(t / 2) + 1 - c)


import math

def pass_the_bill(total_members, conservative_party_members, reformist_party_members):
	avg = total_members / 2
	count = 0
	if reformist_party_members >= avg:
		return -1
	while avg >= conservative_party_members:
		count += 1
		conservative_party_members += 1
	return count


import math

def pass_the_bill(total_members, conservative_party_members, reformist_party_members):
	if reformist_party_members >= total_members / 2:
		return -1
	return max(0, math.ceil(total_members / 2 + 0.5) - conservative_party_members)


def pass_the_bill(total_members, conservative_party_members, reformist_party_members):
	independants = total_members - conservative_party_members - reformist_party_members
	majority = total_members // 2 + 1
	needed = max(0, majority - conservative_party_members)
	return -1 if needed > independants else needed


def pass_the_bill(total, cons, refs):
	inds = total - cons - refs
	boundary = total // 2 + 1
	if cons + inds < boundary:
		return -1
	if cons > boundary:
		return 0
	return boundary - cons