Problem:
 Score : 400 points    Problem Statement You are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health , and the health of the i -th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.  Fortunately, you are a skilled magician, capable of causing explosions that damage monsters. In one explosion, you can damage monsters as follows:   Select an alive monster, and cause an explosion centered at that monster. The health of the monster at the center of the explosion will decrease by A , and the health of each of the other monsters will decrease by B . Here, A and B are predetermined parameters, and A > B holds.   At least how many explosions do you need to cause in order to vanish all the monsters?      Constraints  All input values are integers.  1 ≤ N ≤ 10^5  1 ≤ B < A ≤ 10^9  1 ≤ h_i ≤ 10^9         Input Input is given from Standard Input in the following format:  N  A  B  h_1  h_2  :  h_N       Output Print the minimum number of explosions that needs to be caused in order to vanish all the monsters.        Sample Input 1 4 5 3
8
7
4
2      Sample Output 1 2  You can vanish all the monsters in two explosion, as follows:   First, cause an explosion centered at the monster with 8 health. The healths of the four monsters become 3 , 4 , 1 and -1 , respectively, and the last monster vanishes.  Second, cause an explosion centered at the monster with 4 health remaining. The healths of the three remaining monsters become 0 , -1 and -2 , respectively, and all the monsters are now vanished.        Sample Input 2 2 10 4
20
20      Sample Output 2 4  You need to cause two explosions centered at each monster, for a total of four.       Sample Input 3 5 2 1
900000000
900000000
1000000000
1000000000
1000000000      Sample Output 3 800000000

Solution (Python):
import math as mt
n,a,b = map(int,input().split())
h = []
for i in range(n):
    h.append(int(input()))
left = mt.ceil(min(h)/a)
right = mt.ceil(max(h)/b)
while left <= right :
    K = mt.floor((left + right) / 2)
    if(left == right):
        print(K)
        break
    else:
        sum = 0
        for i in range(n):
            sum += max(0, mt.ceil((h[i] - K*b)/(a-b)))
        if(sum <= K):
            right = K
        else:
            left = K+1

Solution (Python):

import math
N, A, B = map(int, input().split())
H = []
for _ in range(N):
    H.append(int(input()))

def can_clear(n):
    res = 0
    for i in range(N):
        res += max(0, math.ceil((H[i] - B*n) / (A - B)))
    if res > n:
        return False
    else:
        return True





NR = math.ceil(max(H) / B)
NL = 0
while True:
    NM = math.ceil((NR + NL) / 2)
    if NM == NR:
        break
    if can_clear(NM):
        NR = NM
    else:
        NL = NM
print(NM)

Solution (Python):
import math


def rren(): return list(map(int, input().split()))


N, A, B = rren()
h = []
for i in range(N):
    h.append(int(input()))


left = 0
right = math.ceil(max(h)/B)
while(left <= right):
    K = math.floor((left + right) / 2)
    if(left == right):
        print(K)
        break
    else:
        sum = 0
        for i in range(N):
            sum += max(0, math.ceil((h[i] - K*B)/(A-B)))
        if(sum <= K):
            right = K
        else:
            left = K+1

Solution (Python):
import math as mt
store = []
def binarysearch(min, max):
    mid = int((max + min)/2)
    if (min == max):
        return mid
    elif count(mid) > mid:
        return binarysearch(mid+1, max)
    else:
        return binarysearch(min, mid)

def count(x):
    store = [mt.ceil((n - x*b)/a) for n in hp]
    store = [x for x in store if x > 0]
    return sum(store)

st = 0
min = 10 ** 18
max = 0
n, a, b = [int(x) for x in input().split(' ')]
hp = []
for i in range(n):
    st = int(input())
    if st < min:
        min = st
    if st > max:
        max = st
    hp.append(st)
min, max = mt.ceil(min/a), mt.ceil(max/b)
a = a - b
print(binarysearch(min,max))

Solution (Python):
import sys

def solve():
    n, a, b = map(int, sys.stdin.readline().split())
    h = [int(sys.stdin.readline().rstrip()) for i in range(n)]

    top = n * (max(h) + a - 1) // a
    btm = 0

    while top - btm > 1:
        mid = (top + btm) // 2

        if check(n, a, b, h, mid):
            top = mid
        else:
            btm = mid

    print(top)

def check(n, a, b, h, k):
    base = k * b
    dif = a - b
    cnt = 0

    for hi in h:
        if hi > base:
            cnt += (hi - base + dif - 1) // dif

            if cnt > k:
                return False

    return True

if __name__ == '__main__':
    solve()

Solution (Python):
import math
N,A,B = map(int,input().split())
H = [int(input()) for i in range(N)]
Hs = sum(H)
c = A - B
M = math.ceil(Hs / B)

m = 0

while M - m > 1:
	n = (M + m) // 2
	H2 = [H[i] - n * B for i in range(N) if H[i] - n * B > 0]
	cnts = [math.ceil(H2[i] / c) for i in range(len(H2))]
	cnt = sum(cnts)
	if cnt > n:
		m = n
	elif cnt == n:
		M = n
		break
	else:
		M = n
print(M)

Solution (Python):
n, a, b = map(int, input().split())
h = [int(input()) for _ in range(n)]
d = a - b

l = 0
r = 1000000000
while 1 < r - l:
    c = (l + r) // 2
    if c < sum(list(map(lambda hi: max((hi - b * c + d - 1) // d, 0), h))):
        l = c
    else:
        r = c

print(r)

Solution (Python):
n, a, b = [int(_) for _ in raw_input().split()]
h = [int(raw_input()) for _ in xrange(n)]

d = a - b


def c(n):
    m = 0
    for hi in h:
        m += max(0, -((b * n - hi) // d))
    return m <= n


lb = 0
ub = -(-max(h) // b) + 1
while lb < ub:
    mid = (lb + ub) // 2
    if c(mid):
        ub = mid
    else:
        lb = mid + 1

print lb

Solution (Python):
n,a,b=map(int,raw_input().split())
h=[int(raw_input()) for _ in xrange(n)]
l=0
r=10**12
while r-l>1:
    m=(r+l)/2
    c=a-b
    cnt=0
    for i in xrange(n):
        if h[i]-b*m<0:continue
        if (h[i]-b*m)%c==0:
            cnt+=(h[i]-b*m)/c
        else:
            cnt+=(h[i]-b*m)/c+1
    if cnt<=m:
        r=m
    else:
        l=m
print r

Solution (Python):
n, a, b = map(int, input().split())
h = [int(input()) for _ in range(n)]
d = a - b

l = 0
r = 1000000000
while 1 < r - l:
    c = (l + r) // 2
    if c < sum(list(map(lambda hi: (hi - b * c + d - 1) // d if 0 < hi - b * c else 0, h))):
        l = c
    else:
        r = c

print(r)

Solution (Python):
from math import ceil

def check(N, hps, A, B):
    n = N
    C = A - B
    for rem_hp in map(lambda x: x - B * N, hps):
        if rem_hp < 0:
            continue
        n -= ceil(rem_hp / C)
        if n < 0:
            return False
    return True

def main():
    N, A, B = [int(i) for i in input().split()]
    H = [int(input()) for _ in range(N)]
    left, right = 0, max(H)
    while left + 1 < right:
        mid = (left + right) // 2
        if check(mid, H, A, B):
            right = mid
        else:
            left = mid
            
    print(right)

if __name__ == "__main__":
    
    
    
    main()

Solution (Python):
n, a, b = map(int, raw_input().split())
H = [int(raw_input()) for i in xrange(n)]

left = 0; right = 10**9+1
while left+1 < right:
    mid = (left + right) / 2
    cnt = 0
    for h in H:
        h -= mid * b
        if h > 0:
            cnt += (h + a-b - 1) / (a-b)
    if mid < cnt:
        left = mid
    else:
        right = mid
print right