Given integers ${b}$ and $a$, find the smallest integer ${h}$, such that there exists a triangle of height ${h}$, base ${b}$, having an area of at least $a$.

Example 

$b=4$ 

${a=6}$  

The minimum height ${h}$ is $3$.  One example is a triangle formed at points (0, 0), (4, 0), (2, 3).  

Function Description  

Complete the lowestTriangle function in the editor below.  

lowestTriangle has the following parameters:  

int b: the base of the triangle  
int a: the minimum area of the triangle  

Returns  

int:  the minimum integer height to form a triangle with an area of at least $a$ 

Input Format

There are two space-separated integers ${b}$ and $a$, on a single line.

Constraints

$1\leq b\leq10^{6}$
$1\leq a\leq10^{6}$

Sample Input 0
2 2

Sample Output 0
2

Explanation 0

The task is to find the smallest integer height of the triangle with base $2$ and area at least $2$. It turns out, that there are triangles with height $2$, base $2$ and area $2$, for example a triangle with corners in the following points: $(1,1),(3,1),(1,3)$:  

It can be proved that there is no triangle with integer height smaller than $2$, base $2$ and area at least $2$.

Sample Input 1
17 100

Sample Output 1
12

Explanation 1

The task is to find the smallest integer height of the triangle with base $17$ and area at least $100$.It turns out,that there are triangels with height $12$,base $17$ and area $102$ for example a triangle with corners in the following points: $(2,2),(19,2),(16,14)$. 

It can be proved that there is no triangle with integer height smaller than $12$, base $17$ and area at least $100$

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
from math import ceil
import sys

def lowestTriangle(base, area):
	return (2 * area + base - 1) // base
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	h = 2 * area / base
	return math.ceil(h)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys, math

def lowestTriangle(base, area):
	height = area * 2 / base
	return int(math.ceil(height))
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


(b, a) = map(int, input().split())
c = (2 * a + b - 1) // b
print(c)


import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import math
(b, a) = list(map(int, input().split()))
print(math.ceil(2 * a / b))


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(b, a):
	return (2 * a + b - 1) // b
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	return -(-area * 2 // base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


(b, a) = map(int, input().split())
print((2 * a + b - 1) // b)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2 / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	x = area * 2 / base
	return math.ceil(x)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	h = 2 * area / base
	if int(h) * base / 2 == area:
		return int(h)
	else:
		return int(h) + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2 / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


from math import ceil
import sys

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	return (area * 2 + base - 1) // base
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2 / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2 / base)
(base, area) = input().strip().split(' ')
(base, area) = (int(base), int(area))
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	return (2 * area + base - 1) // base
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	height = math.ceil(area * 2 / base)
	return height
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(area / base * 2)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


from math import ceil
(b, a) = map(int, input().split())
print(ceil(2 * a / b))


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import *

def lowestTriangle(base, area):
	return int(ceil(2 * area / base))
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


(b, a) = input().split()
(b, a) = (int(b), int(a))
temp = a * 2 // b
if temp == a * 2 / b:
	print(temp)
else:
	print(temp + 1)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import math
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
h = math.ceil(2 * area / base)
print(h)


import sys, math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	area = area * 2
	num = area // base
	if num * base >= area:
		return num
	return num + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	if 2 * area / base == int(2 * area / base):
		return int(2 * area / base)
	else:
		return int(2 * area / base) + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	h = area * 2
	while h % base != 0:
		h += 1
	return h // base
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys, math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return str(ceil(2 * area / base))
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys, math

def lowestTriangle(base, area):
	return math.ceil(2 * (area / base))
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import math
import sys

def lowestTriangle(base, area):
	height = math.ceil(2 * area / base)
	return height
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	height = 2.0 * area / base
	return math.ceil(height)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2 / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import *

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	return (2 * area + base - 1) // base
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
from math import ceil

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	if 2 * area % base == 0:
		return 2 * area // base
	else:
		return 2 * area // base + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	if area * 2 % base == 0:
		return area * 2 // base
	return area * 2 // base + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys, math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys, math

def lowestTriangle(base, area):
	return math.ceil(2 * area / float(base))
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2.0 / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


(a, b) = map(int, input().split())
import math
print(math.ceil(2 * b / a))


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2 / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


print((lambda b, a: int(2 * a / b + 0.999999999))(*map(int, input().split())))


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


from math import ceil
(h, a) = map(int, input().split())
print(ceil(2 * a / h))


import sys
import math

def lowestTriangle(base, area):
	height = math.ceil(2 * area / base)
	return height
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import math
(b, a) = list(map(int, input().strip().split(' ')))
print(int(math.ceil(2 * a / b)))


import sys

def lowestTriangle(base, area):
	if area % base == 0:
		return 2 * area // base
	return 2 * area // base + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	if int(2 * area / base) == 2 * area / base:
		return int(2 * area / base)
	else:
		return int(2 * area / base) + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2 / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return int(math.ceil(2 * area / base))
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(area * 2 / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	minb = int(math.ceil(area * 2.0 / base * 1.0))
	return minb
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	height = area * 2 / base
	return int(height) if int(height) >= height else int(height + 1)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import math
(b, a) = list(map(int, input().split()))
print(math.ceil(2 * a / b))


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	height = 2 * area / base
	if int(height) == height:
		return int(height)
	else:
		return int(height) + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


from math import ceil
import sys

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys, math

def lowestTriangle(base, area):
	return 2 * area / base
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(math.ceil(height))


import sys

def lowestTriangle(base, area):
	h = 2 * area // base
	if 2 * area % base > 1:
		h += 1
	return h
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


from math import ceil
(b, a) = [int(x) for x in input().split()]
print(ceil(2 * a / b))


import sys

def lowestTriangle(base, area):
	if 2 * area % base == 0:
		return 2 * area // base
	else:
		return 2 * area // base + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


from math import ceil
import sys

def lowestTriangle(base, area):
	return ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = (int(base), int(area))
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	ans = 2 * area / base
	return int(ans) if int(ans) == ans else 1 + int(ans)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return int(math.ceil(area * 2 / base))
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	return int(-(-area * 2 / base // 1))
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	if 2 * area % base == 0:
		return int(2 * area / base)
	return int(2 * area / base) + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(float(2 * area) / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(int(height))


import sys

def lowestTriangle(base, area):
	return (area * 2 + base - 1) // base
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys

def lowestTriangle(base, area):
	if area % base == 0:
		return round(2 * area / base)
	else:
		return int(2 * area / base) + 1
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)


import sys
import math

def lowestTriangle(base, area):
	return math.ceil(2 * area / base)
(base, area) = input().strip().split(' ')
(base, area) = [int(base), int(area)]
height = lowestTriangle(base, area)
print(height)