AtCoder Beginner Contest 063 - Widespread

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-----
4 5 3
8
7
4
2

-----Sample Output-----
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.

Source: atcoder | Difficulty: MEDIUM


Solutions:
(N, A, B) = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()
ans = 0
(l, r) = (1, max(h) // B + 1)
while l < r:
	m = (l + r) // 2
	c = m
	for i in range(N):
		t = h[i] - m * B
		if t > 0:
			c -= (t + A - B - 1) // (A - B)
			if c < 0:
				break
	if c >= 0:
		r = m
	else:
		l = m + 1
print(l)


import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = 10 ** 9
eps = 10 ** (-7)
(N, A, B) = list(map(int, readline().split()))
h = [int(readline()) for i in range(N)]
C = A - B
ng = 0
ok = INF

def judge(mid):
	ans = 0
	for hi in h:
		ans += max(0, (hi - mid * B + C - 1) // C)
	if ans <= mid:
		return True
	return False
while ok - ng > 1:
	mid = (ok + ng) // 2
	if judge(mid):
		ok = mid
	else:
		ng = mid
print(ok)


with open(0) as f:
	(N, A, B, *H) = map(int, f.read().split())
diff = A - B
T = (max(H) + B - 1) // B

def clearable(t):
	Higher = [h - B * t for h in H if h - B * t > 0]
	return True if sum([(h + diff - 1) // diff for h in Higher]) <= t else False

def binary_search(a, b, judge):
	if a == b:
		return (a, b)
	c = a + (b - a) // 2
	return (a, c) if judge(c) else (c + 1, b)
(a, b) = (0, T)
while a != b:
	(a, b) = binary_search(a, b, clearable)
print(a)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
mx = 10 ** 10
mn = 0
while mx - mn > 1:
	md = (mx + mn) // 2
	h2 = [h[i] - md * b for i in range(n)]
	tmp = 0
	for i in range(n):
		if h2[i] > 0:
			tmp += (h2[i] + (a - b) - 1) // (a - b)
	if tmp <= md:
		mx = md
	else:
		mn = md
print(mx)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
import math

def C(d):
	sum = 0
	for i in range(n):
		sum += math.ceil(max(h[i] - b * d, 0) / (a - b))
	return sum <= d
lb = -1
ub = 10 ** 9 + 1
while ub - lb > 1:
	mid = (lb + ub) // 2
	if C(mid):
		ub = mid
	else:
		lb = mid
print(ub)


import math
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]

def explode(x):
	nonlocal n
	c = 0
	for i in range(n):
		if h[i] - x * b > 0:
			c += math.ceil((h[i] - x * b) / (a - b))
	return c <= x
(l, r) = (0, 10 ** 9)
while l + 1 < r:
	k = l + (r - l) // 2
	if explode(k):
		r = k
	else:
		l = k
print(r)


from math import ceil
(N, A, B) = map(int, input().split())
H = [int(input()) for i in range(N)]
A -= B
(ok, ng) = (10 ** 9, 0)
while abs(ok - ng) > 1:
	X = (ok + ng) // 2
	h = [max(hi - B * X, 0) for hi in H]
	h = [ceil(hi / A) for hi in h]
	if sum(h) <= X:
		ok = X
	else:
		ng = X
print(ok)


(n, a, b) = map(int, input().split())
arr = [int(input()) for _ in range(n)]
l = 0
r = 10 ** 9 + 1
while r - l != 1:
	tmp = 0
	m = (l + r) // 2
	for i in range(n):
		if m * b >= arr[i]:
			continue
		else:
			tmp += (arr[i] - m * b + (a - b - 1)) // (a - b)
	if tmp <= m:
		r = m
	else:
		l = m
print(r)


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

def calc(x):
	bomb = 0
	for h in H:
		if h > B * x:
			bomb += (h - B * x - 1) // (A - B) + 1
	return x >= bomb

def check(a, b):
	mid = (a + b) // 2
	if a == mid:
		return b
	if calc(mid):
		return check(a, mid)
	else:
		return check(mid, b)
print(check(0, 10 ** 9))


(n, a, b) = list(map(int, input().split()))
h = [int(input()) for _ in range(n)]

def bisearch(k):
	ret = 0
	for hi in h:
		ret += max(0, (hi - b * k + a - b - 1) // (a - b))
	return ret <= k
(l, r) = (0, pow(10, 9))
while r - l > 1:
	x = (l + r + 1) // 2
	if bisearch(x):
		r = x
	else:
		l = x
print(r)


(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
ok = 10 ** 9
ng = 0
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	l = [i - mid * b for i in h]
	cnt = 0
	for j in l:
		if j <= 0:
			continue
		cnt += (j + a - b - 1) // (a - b)
	if cnt <= mid:
		ok = mid
	else:
		ng = mid
print(ok)


import math
(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]

def is_ok(x):
	c = 0
	for i in range(n):
		t = h[i] - b * x
		if t <= 0:
			continue
		c += math.ceil(t / (a - b))
	return c <= x
ng = 0
ok = 10 ** 9
while abs(ok - ng) > 1:
	mi = (ok + ng) // 2
	if is_ok(mi):
		ok = mi
	else:
		ng = mi
print(ok)


def submit():
	(n, a, b) = (int(e) for e in input().split())
	h = [int(input()) for _ in range(n)]

	def judge(t):
		base_damage = b * t
		add_attack = 0
		for hi in h:
			if hi <= base_damage:
				continue
			res = hi - base_damage
			(q, r) = divmod(res, a - b)
			add_attack += q
			if r:
				add_attack += 1
		return add_attack <= t
	max_attack = 0
	for hi in h:
		max_attack += hi // a + 1
	min_attack = 0
	while True:
		mid = (min_attack + max_attack) // 2
		if mid == min_attack:
			break
		elif judge(mid):
			max_attack = mid
		else:
			min_attack = mid
	print(max_attack)

def __starting_point():
	submit()
__starting_point()


(n, a, b, *h) = map(int, open(0).read().split())
(i, j) = (0, -(-max(h) * n // a))
while j - i > 1:
	k = c = (j + i + 1) // 2
	for t in h:
		c += min(0, (b * k - t) // (a - b))
	if c >= 0:
		j = k
	else:
		i = k
print(j)


(n, a, b) = list(map(int, input().split()))
h = [int(input()) for _ in range(n)]
h.sort(reverse=True)
l = -1
r = (max(h) - 1) // b + 1
while r - l > 1:
	mid = (l + r) // 2
	cnt = 0
	for i in range(n):
		if h[i] - b * mid <= 0:
			break
		else:
			cnt += (h[i] - b * mid - 1) // (a - b) + 1
	if cnt > mid:
		l = mid
	else:
		r = mid
print(r)


import numpy as np
(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
h = np.array(h)
hi = 10 ** 10
low = -1

def calc(x):
	y = h - x * b
	y[y < 0] = 0
	f = np.ceil(y / (a - b)).sum()
	return f
while hi - low > 1:
	ave = (hi + low) // 2
	if calc(ave) <= ave:
		hi = ave
	else:
		low = ave
print(hi)


(N, A, B) = map(int, input().split())
H = [int(input()) for i in range(N)]

def f(x):
	s = sum([-(-max(0, h - x * B) // (A - B)) for h in H])
	if s <= x:
		return True
	else:
		return False
l = 0
r = 10 ** 9 + 7
while l < r:
	m = (l + r) // 2
	if f(m):
		r = m
	else:
		l = m + 1
print(r)


from math import ceil

def check(x, hp):
	hp = [hh - b * x for hh in hp]
	cnt = 0
	for p in hp:
		if p <= 0:
			continue
		cnt += ceil(p / (a - b))
	return cnt <= x
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
lo = 0
hi = 10 ** 9
while hi - lo > 1:
	mid = (hi + lo) // 2
	if check(mid, h):
		hi = mid
	else:
		lo = mid
ans = hi
print(hi)


(n, a, b) = list(map(int, input().split()))
h_s = [int(input()) for _ in range(n)]
l = (min(h_s) - 1) // a + 1
r = (max(h_s) - 1) // b + 1
c = a - b
while l != r:
	pos = (l + r) // 2
	cnt = 0
	base = b * pos
	for h in h_s:
		rem = h - base
		cnt += max(0, (rem - 1) // c + 1)
	if cnt <= pos:
		r = pos
	else:
		l = pos + 1
print(r)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
c = a - b
ok = 10 ** 9
ng = 0
while ok - ng > 1:
	cen = (ok + ng) // 2
	cnt = 0
	for hh in h:
		hh -= b * cen
		cnt += max(0, (hh + c - 1) // c)
	if cnt <= cen:
		ok = cen
	else:
		ng = cen
print(ok)


from math import ceil
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]

def enough(x):
	cnt = 0
	for i in range(n):
		if h[i] - x * b <= 0:
			continue
		cnt += ceil((h[i] - x * b) / (a - b))
	if cnt <= x:
		return True
	else:
		return False
l = 0
r = 10 ** 9
while r - l > 1:
	mid = (r + l) // 2
	if enough(mid):
		r = mid
	else:
		l = mid
print(r)


(N, A, B, *h) = map(int, open(0).read().split())
C = A - B
l = -1
r = 10 ** 12
while l + 1 < r:
	s = (l + r) // 2
	cnt = sum(((c - s * B + C - 1) // C if c - s * B > 0 else 0 for c in h))
	if cnt > s:
		l = s
	else:
		r = s
print(r)


from bisect import bisect_right
(N, A, B, *h) = map(int, open(0).read().split())
h.sort()
d = A - B
ng = (h[-1] + (A - 1)) // A - 1
ok = (h[-1] + (B - 1)) // B
while ok - ng > 1:
	m = (ok + ng) // 2
	b = B * m
	if m >= sum(((h[i] - b + (d - 1)) // d for i in range(bisect_right(h, b), N))):
		ok = m
	else:
		ng = m
print(ok)


(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
D = A - B
L = -1
R = 10 ** 9
while L + 1 < R:
	M = (L + R) // 2
	cnt = 0
	for h in H:
		rest = h - M * B
		if rest > 0:
			cnt += -(-rest // D)
	if M >= cnt:
		R = M
	else:
		L = M
print(R)


(N, A, B) = map(int, input().split())
hmax = 0
H = [int(input()) for _ in range(N)]
hmax = max(H)
L = 0
R = hmax // B + 1
add = A - B
while L != R:
	now = (L + R) // 2
	need = 0
	for i in range(N):
		r = H[i] - now * B
		if r > 0:
			need += (r - 1) // add + 1
	if need <= now:
		R = now
	else:
		L = now + 1
print(L)


import sys
readline = sys.stdin.readline
(N, A, B) = map(int, readline().split())
H = [int(readline()) for i in range(N)]
A -= B
ng = 0
ok = 10 ** 9

def isOk(x):
	cnt = 0
	for i in range(len(H)):
		h = H[i] - x * B
		if h > 0:
			cnt += (h + A - 1) // A
	return cnt <= x
while abs(ok - ng) > 1:
	mid = abs(ok + ng) // 2
	if isOk(mid):
		ok = mid
	else:
		ng = mid
print(ok)


import sys
input = sys.stdin.readline

def main():
	(n, a, b) = map(int, input().split())
	h = [int(input()) for _ in range(n)]
	h.sort()
	(l, r) = (-1, h[-1] + 1)
	while r - l > 1:
		key = (r + l) // 2
		count = 0
		for i in range(n):
			if h[i] <= key * b:
				continue
			else:
				count += (h[i] - key * b - 1) // (a - b) + 1
		if count <= key:
			r = key
		else:
			l = key
	print(r)

def __starting_point():
	main()
__starting_point()


import sys
from heapq import heapify, heappop, heappush
from collections import defaultdict
import numpy as np

def main():
	finput = lambda : sys.stdin.readline().strip()
	(n, a, b) = list(map(int, finput().split()))
	h = [int(finput()) for _ in range(n)]
	gs = lambda a, b: a // b + (a % b > 0)

	def enough(t):
		s = np.sum([gs(max(x - t * b, 0), a - b) for x in h])
		if s <= t:
			return True
		else:
			return False
	l = max(h) // b + 1
	t = 0
	while l > 0:
		t = t + l // 2
		if enough(t):
			t = t - l // 2
			l = l // 2
		else:
			t += 1
			l = l - l // 2
	print(t)

def __starting_point():
	main()
__starting_point()


import sys
import math
import collections
import bisect
import itertools
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
ni = lambda : int(sys.stdin.readline().rstrip())
ns = lambda : list(map(int, sys.stdin.readline().rstrip().split()))
na = lambda : list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda : list([int(x) - 1 for x in sys.stdin.readline().rstrip().split()])

def main():
	(n, a, b) = ns()
	h = [ni() for _ in range(n)]
	upper = 10 ** 9
	lower = 0
	while upper - lower > 1:
		mid = (upper + lower) // 2
		cnt = 0
		for hi in h:
			cnt += int(math.ceil(max(0, hi - b * mid) / (a - b)))
		if cnt <= mid:
			upper = mid
		else:
			lower = mid
	print(upper)

def __starting_point():
	main()
__starting_point()


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

def check(x):
	cnt = 0
	for h in H:
		if h > x * B:
			tmp = (h - x * B) // (A - B)
			if tmp * (A - B) != h - x * B:
				tmp += 1
			cnt += tmp
	if cnt <= x:
		return True
	else:
		return False

def bisect(l, r):
	if r - l == 1:
		return r
	mid = (l + r) // 2
	if check(mid):
		return bisect(l, mid)
	else:
		return bisect(mid, r)
print(bisect(0, 10 ** 20))


(n, a, b) = (int(i) for i in input().split())
h = [int(input()) for i in range(n)]

def dmg(x):
	num = 0
	for i in h:
		if i > b * x:
			num += (i - b * x - 1) // (a - b) + 1
	return num <= x
(hi, lo) = (10 ** 9 + 1, 0)
while hi - lo != 1:
	mid = (hi + lo) // 2
	if dmg(mid):
		hi = mid
	else:
		lo = mid
print(hi)


(n, a, b) = map(int, input().split())
h = []
for i in range(n):
	h.append(int(input()))
ac = (max(h) - 1) // b + 1
wa = 0
while ac - wa > 1:
	wj = (ac + wa) // 2
	num = 0
	for i in range(n):
		num += max((h[i] - b * wj - 1) // (a - b) + 1, 0)
	if num <= wj:
		ac = wj
	else:
		wa = wj
print(ac)


import math
import io
(nim, mike, kite) = map(int, input().split())
H = [int(input()) for _ in range(nim)]
OK = max(H) // kite + 1
NG = 0
ans = OK
while OK - NG > 1:
	mid = (OK + NG) // 2
	cnt = 0
	for h in H:
		if h > mid * kite:
			cnt += math.ceil((h - mid * kite) / (mike - kite))
	if cnt <= mid:
		OK = mid
	else:
		NG = mid
print(OK)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
ng = 0
ok = 10 ** 9
a -= b
while ng + 1 < ok:
	if sum((0 - -max(0, i - (ng + ok) // 2 * b) // a for i in h)) <= (ng + ok) // 2:
		ok = (ng + ok) // 2
	else:
		ng = (ng + ok) // 2
print(ok)


(n, a, b) = list(map(int, input().split()))
h = []
for i in range(n):
	h.append(int(input()))
import math as m
imin = 1
imax = sum([hh // a + 1 for hh in h])
while imax > imin + 1:
	num = imin + (imax - imin) // 2
	acnt = sum([m.ceil((hi - b * num) / (a - b)) for hi in h if hi - b * num > 0])
	if acnt <= num:
		imax = num
	else:
		imin = num
print(imax)


(N, A, B) = map(int, input().split())
H = sorted((int(input()) for _ in range(N)))
import bisect, math

def f(ll, ul):
	if ul == ll:
		return ll
	cur = (ll + ul) // 2
	r = H[bisect.bisect_right(H, B * cur):]
	p = sum((math.ceil((x - B * cur) / (A - B)) for x in r))
	if p <= cur:
		return f(ll, cur)
	else:
		return f(cur + 1, ul)
print(f(0, math.ceil(H[-1] / B)))


import sys, math
(N, A, B) = map(int, input().split())
H = [0] * N
H = [int(input()) for i in range(N)]
maxH = max(H)
L = -1
R = math.ceil(maxH / B)
while R - L > 1:
	MID = (L + R) // 2
	if sum((math.ceil(max(h - B * MID, 0) / (A - B)) for h in H)) > MID:
		L = MID
	else:
		R = MID
print(R)


import math
(n, a, b) = [int(i) for i in input().split()]
ab = a - b
t = [int(input()) for i in range(n)]
mx = sum([i // a + 1 for i in t])
mi = 1
while mx - mi > 1:
	i = (mx + mi) // 2
	if sum([max(math.ceil((j - i * b) / ab), 0) for j in t]) <= i:
		mx = i
	else:
		mi = i
print(mx)


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

def ceil(a, b):
	return (a + b - 1) // b

def f(x):
	lst = [max(0, h - x * B) for h in H]
	S = sum((ceil(i, A - B) for i in lst))
	return S <= x
(l, r) = (0, 10 ** 9)
while r - l > 1:
	m = (r + l) // 2
	if f(m):
		r = m
	else:
		l = m
print(r)


import numpy as np
(N, A, B) = map(int, input().split())
h = np.sort([int(input()) for i in range(N)])

def enough(A, B, h, T):
	h = np.ceil((h - B * T) / (A - B))
	count = sum(h[h > 0])
	return True if count <= T else False
right = 10 ** 9
left = 1
while right != left:
	mid = (left + right) // 2
	if enough(A, B, h, mid):
		right = mid
	else:
		left = mid + 1
print(left)


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

def ok(n):
	d = n * B
	t = 0
	for h in H:
		if h <= d:
			continue
		t += math.ceil((h - d) / (A - B))
	return t <= n
(lo, hi) = (0, 10 ** 9)
while lo < hi:
	mi = (lo + hi) // 2
	if ok(mi):
		hi = mi
	else:
		lo = mi + 1
print(hi)


import math
(N, A, B) = map(int, input().split())
H = []
for i in range(N):
	H.append(int(input()))
ok = -1
ng = int(sum(H) / B)
while ng - ok > 1:
	mid = (ok + ng) // 2
	cnt = 0
	for i in range(N):
		if H[i] < B * mid:
			None
		else:
			cnt += math.ceil((H[i] - B * mid) / (A - B))
	if cnt > mid:
		ok = mid
	else:
		ng = mid
print(ng)


import math
(N, A, B) = list(map(int, input().split()))
h = [int(input()) for i in range(N)]
(left, right) = (0, math.ceil(max(h) / B))
AB = A - B
while left + 1 < right:
	mid = math.ceil((left + right) / 2)
	h_ = list(filter(lambda x: x > 0, [n - mid * B for n in h]))
	if sum([math.ceil(n / AB) for n in h_]) <= mid:
		right = mid
	else:
		left = mid
print(right)


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

def attack(n):
	s = 0
	for h in H:
		h -= B * n
		if h > 0:
			s += ceil(h / (A - B))
	return s <= n
l = 0
r = 0
for h in H:
	r = max(ceil(h / B), r)
while l != r - 1:
	mid = (l + r) // 2
	if attack(mid):
		r = mid
	else:
		l = mid
print(r)


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():

	def meguru_bisect(ok, ng):
		while abs(ok - ng) > 1:
			mid = (ok + ng) // 2
			if is_ok(mid):
				ok = mid
			else:
				ng = mid
		return ok

	def is_ok(x):
		cnt = 0
		for h in H:
			h -= b * x
			if h > 0:
				cnt += (h + ab - 1) // ab
		return cnt <= x
	(n, a, b) = list(map(int, input().split()))
	ab = a - b
	H = list((int(input()) for _ in range(n)))
	res = meguru_bisect(10 ** 9 + 1, 0)
	print(res)

def __starting_point():
	resolve()
__starting_point()


(n, a, b, *H) = map(int, open(0).read().split())
(l, r) = (0, 10 ** 9)
while r - l > 1:
	x = 0
	m = (l + r) // 2
	s = m * b
	for h in H:
		x -= min(0, (h - s) // -(a - b))
	if x > m:
		l = m
	else:
		r = m
print(r)


(N, A, B) = map(int, input().split())
h = [int(input()) for i in range(N)]
l = 0
r = 10 ** 9
while r - l > 1:
	tmp = (l + r) // 2
	count = 0
	for i in range(N):
		count += max(0, h[i] - B * tmp) // (A - B)
		if max(0, h[i] - B * tmp) % (A - B) != 0:
			count += 1
	if tmp >= count:
		r = tmp
	else:
		l = tmp
print(r)


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

def is_ok(arg):
	cnt = 0
	C = A - B
	for h in H:
		wk = h - B * arg
		if wk < 0:
			continue
		else:
			cnt += (wk + C - 1) // C
	return cnt <= arg

def meguru_bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
ng = 0
ok = 10 ** 16
print(meguru_bisect(ng, ok))


(_, a, b, *H) = map(int, open(0).read().split())
(l, r) = (0, 10 ** 9)
while r - l > 1:
	m = (l + r) // 2
	if -sum((min(0, (h - m * b) // (b - a)) for h in H)) > m:
		l = m
	else:
		r = m
print(r)


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

def solve(k):
	cnt = 0
	for i in range(N):
		if H[i] > B * k:
			cnt += (H[i] - B * k - 1) // (A - B) + 1
	return cnt <= k
left = 0
right = 10 ** 9 + 1
while left + 1 < right:
	mid = (left + right) // 2
	if solve(mid):
		right = mid
	else:
		left = mid
print(right)


(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
t = a - b
r = 10 ** 9 + 5
l = 0
while r - l > 1:
	m = (r + l) // 2
	mi = m * b
	count = 0
	for i in h:
		if i > mi:
			count += (i - mi + t - 1) // t
	if count <= m:
		r = m
	else:
		l = m
print(r)


(N, A, B) = [int(_) for _ in input().split()]
H = [int(input()) for _ in range(N)]

def enough(x):
	return sum([1 + (max(h - B * x, 0) - 1) // (A - B) for h in H]) <= x
ng = 0
ok = 1 + (max(H) - 1) // B
while ok - ng > 1:
	half = (ok + ng) // 2
	if enough(half):
		ok = half
	else:
		ng = half
print(ok)


from math import ceil

def is_ok(m):
	tmp = h[:]
	for i in range(N):
		tmp[i] -= m * B
	if not any(tmp):
		return True
	rem = 0
	for i in tmp:
		if i > 0:
			rem += ceil(i / (A - B))
	if rem > m:
		return False
	return True
(N, A, B) = map(int, input().split())
h = list((int(input()) for _ in range(N)))
s = sum(h)
r = 10 ** 10
l = 0
while abs(l - r) > 1:
	m = (r + l) // 2
	if is_ok(m):
		r = m
	else:
		l = m
print(r)


(N, A, B) = map(int, input().split())
H = [int(input()) for i in range(N)]
(L, R, M) = (0, 10 ** 9, 0)
A -= B
C = 0
while L != R:
	M = (L + R) // 2
	C = 0
	for i in range(N):
		C += max(0, (H[i] - B * M + A - 1) // A)
	if C > M:
		L = max(M, L + 1)
	else:
		R = M
print(L)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
l = 0
r = 10 ** 10
c = a - b
while l + 1 != r:
	m = (l + r) // 2
	tmp = 0
	for i in range(n):
		if h[i] > b * m:
			tmp += (h[i] - b * m) // c + (1 if (h[i] - b * m) % c else 0)
	if tmp > m:
		l = m
	else:
		r = m
print(r)


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

def judge(t):
	base_damage = B * t
	add_attack = 0
	for hi in H:
		if hi <= base_damage:
			continue
		res = hi - base_damage
		(q, r) = divmod(res, A - B)
		add_attack += q
		if r:
			add_attack += 1
	return add_attack <= t
MAX = max(H)
max_attack = MAX // B + 1
min_attack = 0
while True:
	mid = (min_attack + max_attack) // 2
	if mid == min_attack:
		break
	elif judge(mid):
		max_attack = mid
	else:
		min_attack = mid
print(max_attack)


from math import ceil
(N, A, B) = map(int, input().split())
h = [int(input()) for _ in range(N)]

def f(k):
	return sum([ceil((hi - B * k) / (A - B)) for hi in h if hi - k * B > 0]) <= k
(l, r) = (0, ceil(max(h) / B))
while r - l > 1:
	if f((l + r) // 2):
		r = (l + r) // 2
	else:
		l = (l + r) // 2
print(r)


def main():
	from math import ceil
	(n, a, b, *k) = list(map(int, open(0).read().split()))
	k.sort()
	l = k[-1] // a
	r = k[-1] // b + 1
	m = (l + r) // 2
	while l + 1 < r:
		c = sum((ceil((i - m * b) / (a - b)) if i - m * b > 0 else 0 for i in k))
		(l, r) = (l, m) if c <= m else (m, r)
		m = (l + r) // 2
	print(r)

def __starting_point():
	main()
__starting_point()


import math
(n, a, b) = map(int, input().split())
hl = []
for _ in range(n):
	h = int(input())
	hl.append(h)
ub = 10 ** 9
lb = 0
while True:
	if ub == lb:
		break
	target = (ub + lb) // 2
	need = 0
	for h in hl:
		rest = h - target * b
		need += max(math.ceil(rest / (a - b)), 0)
	if need <= target:
		ub = target
	else:
		lb = target + 1
print(lb)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in [0] * n]
f = lambda n: lambda x: x - b * n

def calc(n):
	g = f(n)
	k = lambda x: 1 + x // (a - b) if x % (a - b) else x // (a - b)
	o = filter(lambda x: x > 0, map(g, h))
	(*p,) = map(k, o)
	if not p:
		return True
	else:
		return sum(p) <= n
(l, r) = (0, max(h))
while r - l > 1:
	m = (r + l) // 2
	if calc(m):
		r = m
	else:
		l = m
print(r)


def check(T):
	res = 0
	for h in H:
		tmp = (h - B * T + A - B - 1) // (A - B)
		if tmp <= 0:
			break
		res += tmp
	return True if res <= T else False
(N, A, B) = list(map(int, input().split()))
H = [int(input()) for _ in range(N)]
H.sort(reverse=True)
res = 0
left = 0
right = 10 ** 9
while right != left:
	mid = (left + right) // 2
	if check(mid):
		right = mid
	else:
		left = mid + 1
print(left)


import math
(N, A, B) = map(int, input().split())
H = [0] * N
H = [int(input()) for i in range(N)]
maxH = max(H)
L = -1
R = math.ceil(maxH / B)

def binary_search(D, U):
	MID = (D + U) // 2
	if MID == D:
		print(U)
	elif sum((math.ceil(max(h - B * MID, 0) / (A - B)) for h in H)) <= MID:
		binary_search(D, MID)
	else:
		binary_search(MID, U)
binary_search(L, R)


def abc063_d():
	(n, a, b) = map(int, input().split())
	H = [int(input()) for _ in range(n)]
	(lower, upper) = (0, 10 ** 16)
	d = a - b
	while upper - lower > 1:
		x = (upper + lower) // 2
		v = 0
		for hi in H:
			v += (max(0, hi - x * b) + d - 1) // d
			if v > x:
				break
		if v <= x:
			upper = x
		else:
			lower = x
	print(upper)

def __starting_point():
	abc063_d()
__starting_point()


(n, a, b) = map(int, input().split())
h = []
for i in range(n):
	h.append(int(input()))
(st, ed) = (0, 10 ** 9 + 1)
while st < ed - 1:
	mid = (st + ed) // 2
	tmp = 0
	for i in range(n):
		x = h[i] - mid * b
		if x > 0:
			tmp += x // (a - b) + (x % (a - b) > 0)
	if tmp <= mid:
		ed = mid
	else:
		st = mid
print(ed)


import math
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]

def f(x):
	s = sum([math.ceil(max(0, i - x * b) / (a - b)) for i in h])
	if s <= x:
		return True
	else:
		return False
l = 10 ** 9 + 7
r = 0
while l - r > 1:
	k = (l + r) // 2
	if f(k):
		l = k
	else:
		r = k
print(l)


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

def check(n):
	s = 0
	for h in hs:
		if h > B * n:
			s += (h - B * n + A - B - 1) // (A - B)
	return s <= n
a = 0
b = max(hs) // B + 1
while a < b:
	i = (a + b) // 2
	if check(i):
		b = i
	else:
		if a == i:
			break
		a = i
r = b
print(r)


(N, A, B) = map(int, input().split())
diff = A - B
H = [int(input()) for i in range(N)]

def check(x):
	time = 0
	_H = [h - B * x for h in H]
	for _h in _H:
		if _h > 0:
			time += -(-_h // diff)
	return time <= x
left = 0
right = 10 ** 10
while left + 1 < right:
	mid = (left + right) // 2
	if check(mid):
		right = mid
	else:
		left = mid
print(right)


(n, a, b) = map(int, input().split())
t = a - b
ans = [0] * 2
d = []
for i in range(n):
	h = int(input())
	d.append(h)
d.sort(reverse=True)
ans[1] = max(d)
while ans[1] - ans[0] != 1:
	x = z = (ans[1] + ans[0]) // 2
	y = x * b
	for i in range(n):
		p = d[i] - y
		if p <= 0:
			break
		x -= (p + t - 1) // t
		if x < 0:
			break
	if x < 0:
		ans[0] = z
	else:
		ans[1] = z
print(ans[1])


(n, a, b) = list(map(int, input().split()))
hitpoints = [int(input()) for _ in range(n)]
additional = a - b

def feasible(k):
	additional_num = sum([max((hp - b * k + additional - 1) // additional, 0) for hp in hitpoints])
	return additional_num <= k
ok = 10 ** 9 + 1
ng = 0
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if feasible(mid):
		ok = mid
	else:
		ng = mid
print(ok)


import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
(n, a, b) = list(map(int, input().split()))
a -= b
h = [int(input()) for i in range(n)]

def check(k):
	tmp = list([x - b * k for x in h])
	return sum((0 - -i // a for i in tmp if i > 0)) <= k
(ng, ok) = (0, 10 ** 18)
while ng + 1 < ok:
	mid = (ng + ok) // 2
	if check(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(nim, mike, kite) = map(int, input().split())
H = [int(input()) for _ in range(nim)]
C = mike - kite
(l, r) = (0, 1 << 30)
while r - l > 1:
	m = (l + r) // 2
	if sum([max((h - kite * m + C - 1) // C, 0) for h in H]) <= m:
		r = m
	else:
		l = m
print(r)


(n, a, b) = map(int, input().split())
dab = a - b
H = []
for _ in range(n):
	H.append(int(input()))
maxh = max(H)
l = 0
r = -(-maxh // b)

def ht(mid):
	cnt = 0
	for h in H:
		rem = h - b * mid
		if rem > 0:
			cnt += -(-rem // dab)
	return cnt <= mid
while r - l > 1:
	mid = (l + r) // 2
	if ht(mid):
		r = mid
	else:
		l = mid
print(r)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
x = a - b
(l, r) = (0, 10 ** 9)
while r - l > 1:
	k = (r + l) // 2
	tmp = sum([max(0, -(-(h[i] - k * b) // x)) for i in range(n)])
	if tmp > k:
		l = k
	else:
		r = k
print(r)


import sys
input = sys.stdin.readline
(n, a, b) = list(map(int, input().split()))
R = [int(input()) for i in range(n)]
l = 0
r = 10 ** 9 + 1

def check(x):
	cnt = 0
	for ri in R:
		if ri - x * b > 0:
			cnt += (ri - x * b + a - b - 1) // (a - b)
	return cnt <= x
while True:
	if r - l <= 1:
		break
	mid = (l + r) // 2
	if check(mid):
		r = mid
	else:
		l = mid
if check(l):
	print(l)
else:
	print(r)


(N, A, B) = map(int, input().split())
H = [int(input()) for n in range(N)]
L = 0
R = 10 ** 9
while 1 < R - L:
	m = (L + R) // 2
	if m < -sum((min(0, (h - m * B) // (B - A)) for h in H)):
		L = m
	else:
		R = m
print(R)


(n, a, b) = list(map(int, input().split()))
H = [int(input()) for _ in range(n)]

def ok(x):
	cnt = 0
	for h in H:
		cnt += max(0, (h - b * x - 1) // (a - b) + 1)
	return cnt <= x
top = 10 ** 9
bottom = 0
while top - bottom > 1:
	mid = (top + bottom) // 2
	if ok(mid):
		top = mid
	else:
		bottom = mid
print(top)


import math

def hersCode(N):
	ng = -1
	ok = N
	while ok - ng > 1:
		mid = (ok + ng) // 2
		if judge(mid):
			ok = mid
		else:
			ng = mid
	return ok

def judge(x):
	cnt = 0
	for i in h:
		cnt += max(0, math.ceil((i - x * B) / (A - B)))
	return cnt <= x
(N, A, B) = list(map(int, input().split()))
h = [int(input()) for _ in range(N)]
print(hersCode(10 ** 9))


(N, A, B) = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()

def isOk(k):
	return k >= 0
(ok, ng) = (max(h) // B + 1, 0)
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	c = mid
	for i in range(N):
		t = h[i] - mid * B
		if t > 0:
			c -= (t + A - B - 1) // (A - B)
			if c < 0:
				break
	if isOk(c):
		ok = mid
	else:
		ng = mid
print(ok)


import sys
input = sys.stdin.readline

def main():
	(N, A, B) = [int(x) for x in input().split()]
	H = [int(input()) for _ in range(N)]

	def isOK(mid):
		cnt = 0
		for h in H:
			if h > B * mid:
				sabun = h - B * mid
				cnt += 0 - -sabun // (A - B)
				if cnt > mid:
					return False
		return True
	ok = 10 ** 9
	ng = 0
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if isOK(mid):
			ok = mid
		else:
			ng = mid
	print(ok)

def __starting_point():
	main()
__starting_point()


import math

def check(x):
	k = 0
	global h, a, b
	for i in h:
		if x * b < i:
			k += math.ceil((i - x * b) / (a - b))
	return k <= x
(n, a, b) = map(int, input().split())
h = []
for i in range(n):
	h.append(int(input()))
l = -1
r = max(h) // b + 1
while r - l > 1:
	m = (l + r) // 2
	if check(m):
		r = m
	else:
		l = m
print(r)


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
(n, a, b) = list(map(int, input().split()))
h = list((int(input()) for i in range(n)))
diff = a - b
hmax = max(h)
saiaku = -(-hmax // b)

def isok(ans):
	count = 0
	for i in range(n):
		count += max(-(-(h[i] - b * ans) // diff), 0)
	if count > ans:
		return False
	return True
ok = saiaku
ng = -1
while ok - ng > 1:
	m = (ok + ng) // 2
	if isok(m):
		ok = m
	else:
		ng = m
print(ok)


from math import ceil
from bisect import bisect
(n, a, b) = map(int, input().split())
raw_hs = [int(input()) for _ in range(n)]
hs = sorted(raw_hs, reverse=True)
diff = a - b
c_min = 0
c_max = int(10000000000.0)
while c_max - c_min > 1:
	c = (c_min + c_max) // 2
	tmp_hs = [h - c * b for h in hs]
	rem = sum([ceil(h / diff) for h in tmp_hs if h > 0])
	if rem > c:
		c_min = c
	else:
		c_max = c
print(c_max)


import bisect

def is_ok(mid):
	ind = bisect.bisect_right(h, mid * b)
	cnt = 0
	for i in range(ind, n):
		cnt += (h[i] - mid * b + a - b - 1) // (a - b)
	if cnt <= mid:
		return True
	else:
		return False
(n, a, b) = map(int, input().split())
h = sorted([int(input()) for _ in range(n)])
ng = -1
ok = (h[-1] + b - 1) // b
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if is_ok(mid):
		ok = mid
	else:
		ng = mid
print(ok)


import math
(N, A, B) = map(int, input().split())
H = [int(input()) for i in range(N)]
left = 1
right = 10 ** 10
while left != right:
	x = (left + right) // 2
	S = 0
	for i in range(N):
		if H[i] - B * x >= 0:
			S += math.ceil((H[i] - B * x) / (A - B))
	if S <= x:
		right = x
	else:
		left = x + 1
print(left)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
l = 0
r = max(h) // b + 1
while r - l > 1:
	m = (l + r) // 2
	count = 0
	for x in h:
		x = x - m * b
		if x > 0:
			count += (x + a - b - 1) // (a - b)
	if count <= m:
		r = m
	else:
		l = m
print(r)


from math import ceil

def isok(x):
	res = 0
	for i in range(N):
		H = h[i] - B * x
		if H <= 0:
			continue
		res += ceil(H / (A - B))
	return True if res <= x else False
(N, A, B) = map(int, input().split())
h = [int(input()) for i in range(N)]
(ng, ok) = (-1, 10 ** 10)
while ok - ng > 1:
	mid = (ok + ng) // 2
	if isok(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
l = 1
r = max(h) // b + 1
while l != r:
	x = (l + r) // 2
	ct = 0
	for i in range(n):
		ct += (a - b - 1 + max(0, h[i] - b * x)) // (a - b)
	if ct > x:
		l = x + 1
	else:
		r = x
print(l)


from math import ceil

def f(x, hp):
	hp = [hh - b * x for hh in hp]
	c = 0
	for p in hp:
		if p <= 0:
			continue
		c += ceil(p / (a - b))
	return c <= x
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
ng = 0
ok = 10 ** 9
while ok - ng > 1:
	mid = (ok + ng) // 2
	if f(mid, h):
		ok = mid
	else:
		ng = mid
print(ok)


import math
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]

def cheak(x):
	kiso = b * x
	kai = 0
	for i in h:
		if kiso < i:
			kai += math.ceil((i - kiso) / (a - b))
	if kai > x:
		return 0
	else:
		return 1
dai = max(h)
syo = 0
while True:
	if dai - syo == 1:
		break
	kon = (dai + syo) // 2
	c = cheak(kon)
	if c == 1:
		dai = kon
	else:
		syo = kon
print(dai)


(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
(l, r) = (0, max(h))
while l + 1 < r:
	m = (l + r) // 2
	cnt = 0
	for i in range(n):
		cnt += max(0, h[i] - b * m + a - b - 1) // (a - b)
	if cnt <= m:
		r = m
	else:
		l = m
print(r)


(N, A, B) = list(map(int, input().split()))
H = [0] * N
for i in range(N):
	H[i] = int(input())

def isOK(index, H):
	now_min = index * B
	all_H = []
	for i in range(len(H)):
		if H[i] > now_min:
			all_H.append(H[i] - now_min)
	count = 0
	for j in all_H:
		if j % (A - B) == 0:
			count += int(j // (A - B))
		else:
			count += int(j // (A - B)) + 1
	if count <= index:
		return True
	else:
		return False

def binary_search(H):
	N = 10 ** 9 + 1
	ng = -1
	ok = N
	while abs(ok - ng) > 1:
		mid = int((ok + ng) / 2)
		if isOK(mid, H):
			ok = mid
		else:
			ng = mid
	return ok
print(binary_search(H))


def main():
	from math import ceil
	from copy import deepcopy
	(n, a, b, *k) = list(map(int, open(0).read().split()))
	k.sort()

	def check(x):
		q = deepcopy(k)
		cnt = 0
		while q:
			p = q.pop() - x * b
			if p <= 0:
				break
			cnt += ceil(p / (a - b))
		return cnt <= x
	l = 0
	r = k[-1]
	m = (l + r) // 2
	while l + 1 < r:
		if check(m):
			r = m
		else:
			l = m
		m = (l + r) // 2
	print(m + 1)

def __starting_point():
	main()
__starting_point()


import sys
input = sys.stdin.readline
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
t = a - b
r = (max(h) + b - 1) // b
l = 0
while r - l > 1:
	m = (r + l) // 2
	mi = m * b
	count = 0
	for i in h:
		if i > mi:
			count += (i - mi + t - 1) // t
	if count <= m:
		r = m
	else:
		l = m
print(r)


from math import ceil
(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
l = 0
r = max(h)

def f(x):
	res = 0
	for i in range(n):
		res += ceil(max(0, h[i] - b * x) / (a - b))
	return res <= x
while l + 1 < r:
	m = (l + r) // 2
	if f(m):
		r = m
	else:
		l = m
print(r)


import math
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
(l, r) = (0, 10 ** 9)
while r - l > 1:
	m = (l + r) // 2
	count = 0
	for i in h:
		count += max(math.ceil((i - b * m) / (a - b)), 0)
	if count <= m:
		r = m
	else:
		l = m
print(r)


import math
(N, A, B) = map(int, input().split())
H = [int(input()) for i in range(N)]
C = A - B
(sum, d) = (0, 0)
high = math.ceil(max(H) / B)
low = 0
while high > low:
	sum = 0
	mid = (high + low) // 2
	for i in range(N):
		if H[i] - B * mid > 0:
			sum += math.ceil((H[i] - B * mid) / C)
	if sum <= mid:
		high = mid
	else:
		low = mid + 1
print(low)


(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
from math import ceil
(ng, ok) = (0, 10 ** 9 + 1)
while abs(ok - ng) > 1:
	mid = (ng + ok) // 2
	cnt = 0
	for i in range(N):
		cnt += max(ceil((H[i] - B * mid) / (A - B)), 0)
	if cnt <= mid:
		ok = mid
	else:
		ng = mid
print(ok)


import math
import sys
(N, A, B) = [int(_) for _ in input().split()]
H = sorted([int(input()) for _ in range(N)])
sup = 10 ** 9
inf = 0
while sup - inf > 1:
	x = (sup + inf) // 2
	c = sum([math.ceil((h - x * B) / (A - B)) for h in H if h > x * B])
	if c <= x:
		sup = x
	else:
		inf = x
print(sup)


def isok(arg):
	count = arg
	for i in range(n):
		if -(-(h[i] - b * arg) // (a - b)) >= 0:
			count -= -(-(h[i] - b * arg) // (a - b))
	if count >= 0:
		return True
	else:
		return False

def bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if isok(mid):
			ok = mid
		else:
			ng = mid
	return ok
(n, a, b) = list(map(int, input().split()))
h = []
for i in range(n):
	h.append(int(input()))
print(bisect(0, 10 ** 9))


import math
(n, a, b) = map(int, input().split())
H = list((int(input()) for _ in range(n)))
(l, r) = (0, 10 ** 9)
d = a - b
while r - l > 1:
	mid = (r + l) // 2
	tmp = 0
	for h in H:
		if h <= mid * b:
			continue
		tmp += math.ceil((h - mid * b) / d)
	if tmp <= mid:
		r = mid
	else:
		l = mid
print(r)


(N, A, B) = map(int, input().split())
h = [0] * N
for i in range(N):
	h[i] = int(input())
L = 0
R = sum(((h[i] - 1) // A + 1 for i in range(N))) + 1
while R - L > 1:
	M = (L + R - 1) // 2 + 1
	count = sum(((h[i] - B * M - 1) // (A - B) + 1 for i in range(N) if h[i] - B * M > 0))
	if count > M:
		L = M
	else:
		R = M
print((L + R - 1) // 2 + 1)


(N, A, B) = map(int, input().split())
h = []
for i in range(N):
	h += [int(input())]
Th = 2 * max(h) // B
Tl = 0
while Tl + 1 < Th:
	t = (Th + Tl) // 2
	d = []
	for i in range(N):
		c = h[i]
		d += [c - B * t]
	for i in range(N):
		c = d[i]
		if c <= 0:
			continue
		t -= c // (A - B) if c % (A - B) == 0 else c // (A - B) + 1
		if t < 0:
			Tl = (Th + Tl) // 2
			break
	else:
		Th = (Th + Tl) // 2
print(Th)


import math
(N, A, B) = list(map(int, input().split()))
h_list = [0] * N
for i in range(N):
	h = int(input())
	h_list[i] = h
left = 0
right = 10 ** 10
while right - left > 1:
	mid = (right + left) // 2
	count = 0
	for h in h_list:
		h = h - B * mid
		if h < 0:
			h = 0
		tmp_count = math.ceil(h / (A - B))
		count += tmp_count
	if count > mid:
		left = mid
	else:
		right = mid
print(right)


import sys

def input():
	return sys.stdin.readline()[:-1]
(N, A, B) = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort(reverse=1)
(l, r) = (0, 10 ** 9)
k = A - B
while l + 2 < r:
	m = (r - l) // 2 + l
	t = m * B
	c = 0
	for i in h:
		if i > t:
			c += -((-i + t) // k)
		else:
			break
	if c > m:
		l = m
	else:
		r = m + 1
print(r - 1)


from bisect import bisect_left as bl
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
t = a - b
r = 10 ** 9 + 5
l = 0
while r - l > 1:
	m = (r + l) // 2
	mi = m * b
	count = 0
	for i in h:
		if i > mi:
			count += (i - mi + t - 1) // t
	if count <= m:
		r = m
	else:
		l = m
print(r)


(n, a, b) = map(int, input().split())
H = [int(input()) for _ in range(n)]
r = 10 ** 10
l = 0
while r - l > 1:
	k = (l + r) // 2
	if sum((max(0, (h - k * b - 1) // (a - b) + 1) for h in H)) > k:
		l = k
	else:
		r = k
print(r)


import math
(N, A, B) = list(map(int, input().split()))
all_attack = 0
enemy = [int(input()) for i in range(N)]

def possible_kill_all(attack):
	tmp_enemy = [v - B * attack for v in enemy]
	tmp_needed_attack = 0
	for v in tmp_enemy:
		if v > 0:
			tmp_needed_attack += math.ceil(v / (A - B))
	if tmp_needed_attack <= attack:
		return True
	else:
		return False
possible = 10 ** 14
impossible = 0
while possible - impossible > 1:
	M = (possible + impossible) // 2
	if possible_kill_all(M):
		possible = M
	else:
		impossible = M
print(possible)


(N, A, B, *X) = map(int, open(0).read().split())
ub = 10 ** 15
lb = 0
while ub - lb > 1:
	mid = (ub + lb) // 2
	cnt = 0
	for i in range(N):
		if X[i] - B * mid > 0:
			cnt += -(-(X[i] - B * mid) // (A - B))
	if cnt > mid:
		lb = mid
	else:
		ub = mid
print(ub)


from math import ceil
(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]

def f(x):
	cnt = 0
	for e in h:
		cnt += max(0, ceil((e - b * x) / (a - b)))
	if cnt > x:
		return False
	return True
l = 0
r = 10 ** 9 + 1
while r - l > 1:
	mid = (l + r) // 2
	if f(mid):
		r = mid
	else:
		l = mid
print(r)


(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]

def solve(t):
	cur = 0
	for i in range(n):
		cur += max(-(-(h[i] - b * t) // (a - b)), 0)
	return cur <= t

def binary_search(l, r):
	while abs(r - l) > 1:
		mid = (l + r) // 2
		if solve(mid):
			r = mid
		else:
			l = mid
	return r
print(binary_search(0, 10 ** 9 + 1))


import sys
input = sys.stdin.buffer.readline
(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
ok = 10 ** 18
ng = 0

def isOk(n):
	cnt = 0
	for h in H:
		h -= B * n
		if h > 0:
			cnt += -(-h // (A - B))
	return cnt <= n
while ok - ng > 1:
	mid = (ok + ng) // 2
	if isOk(mid):
		ok = mid
	else:
		ng = mid
print(ok)


def main():
	import sys
	input = sys.stdin.readline
	sys.setrecursionlimit(10 ** 7)
	from collections import Counter, deque
	from itertools import combinations, permutations, accumulate, groupby
	from bisect import bisect_left, bisect_right
	from heapq import heapify, heappop, heappush
	from math import floor, ceil
	(n, a, b) = map(int, input().split())
	h = [int(input()) for _ in range(n)]

	def check(x):
		cnt = 0
		for i in h:
			nokori = i - b * x
			if nokori > 0:
				cnt += nokori // (a - b)
				if nokori % (a - b) != 0:
					cnt += 1
			if cnt > x:
				return False
		return True
	l = 0
	r = 10 ** 10
	while r - l > 1:
		mid = (l + r) // 2
		if check(mid):
			r = mid
		else:
			l = mid
	print(r)

def __starting_point():
	main()
__starting_point()


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

def check(k):
	cnt = 0
	for i in range(N):
		cnt += max(0, math.ceil((h[i] - B * k) / (A - B)))
	if cnt <= k:
		return 1
	else:
		return 0
(y, n) = (10 ** 10, 0)
while y - n > 1:
	k = (y + n) // 2
	if check(k):
		y = k
	else:
		n = k
print(y)


(n, A, B) = map(int, input().split())
l = [int(input()) for x in range(n)]
left = 0
right = 10 ** 9

def is_ok(t):
	AB = A - B
	return sum(map(lambda x: max(0, x - B * t + (AB - 1)) // AB, l)) <= t
while abs(left - right) > 1:
	now = (left + right) // 2
	if is_ok(now):
		right = now
	else:
		left = now
print([right, left][is_ok(left)])


(n, a, b) = map(int, input().split())
hls = [int(input()) for i in range(n)]
l = 0
r = 10 ** 15
while l < r:
	x = (l + r) // 2
	cnt = 0
	for hp in hls:
		if hp - x * b > 0:
			cnt += (hp - x * b + (a - b) - 1) // (a - b)
	if cnt > x:
		l = x + 1
	elif cnt < x:
		r = x
	else:
		ans = x
		break
if l == r:
	ans = l
print(ans)


(N, A, B) = map(int, input().split())
H = []
for _ in range(N):
	H.append(int(input()))
ok = 10 ** 9 + 1
ng = 0
while ok - ng > 1:
	mid = (ok + ng) // 2
	dmg = B * mid
	tgt = 0
	for item in H:
		tgt += -(-max(item - dmg, 0) // (A - B))
	if tgt <= mid:
		ok = mid
	else:
		ng = mid
print(ok)


(n, a, b) = list(map(int, input().split()))
h = [int(input()) for i in range(n)]
ng = 0
ok = 10 ** 9
while ok - ng > 1:
	mid = (ok + ng) // 2
	s = 0
	for i in h:
		s += max(0, (i - mid * b + a - b - 1) // (a - b))
	if s <= mid:
		ok = mid
	else:
		ng = mid
print(ok)


(n, a, b) = map(int, input().split())
HP = [int(input()) for i in range(n)]
ng = 0
ok = 10 ** 10
for i in range(40):
	check = (ok + ng) // 2
	c = a - b
	cnt = 0
	d = list(map(lambda x: x - check * b, HP))
	for j in d:
		cnt += max(0, (j + c - 1) // c)
	if check < cnt:
		ng = check
	else:
		ok = check
print(ok)


import sys
input = sys.stdin.readline
(n, a, b) = map(int, input().split())
hls = [int(input()) for i in range(n)]
l = 0
r = sum(hls)
while l < r:
	x = (l + r) // 2
	cnt = 0
	for hp in hls:
		if hp - x * b > 0:
			cnt += (hp - x * b + (a - b) - 1) // (a - b)
	if cnt > x:
		l = x + 1
	elif cnt < x:
		r = x
	else:
		ans = x
		break
if l == r:
	ans = l
print(ans)


def judge(x):
	count = 0
	for hi in h:
		count += max(hi - b * x + c - 1, 0) // c
	if count <= x:
		return True
	else:
		return False
(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
c = a - b
ng = 0
ok = 10 ** 9
while ok - ng > 1:
	mid = (ng + ok) // 2
	if judge(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(n, a, b) = map(int, input().split())
H = [int(input()) for _ in range(n)]
l = 0
r = 10 ** 18
while r - l > 1:
	m = (r + l) // 2
	li = [h - b * m for h in H]
	cnt = sum([(i - 1) // (a - b) + 1 if i > 0 else 0 for i in li])
	if cnt <= m:
		r = m
	else:
		l = m
print(r)


from math import ceil
(n, a, b) = map(int, input().split())
H = [int(input()) for _ in range(n)]
Mh = max(H)
(left, right) = (Mh // a, Mh // b + 1)
while right - left > 1:
	mid = (left + right) // 2
	cnt = 0
	for i in range(n):
		cnt += ceil(max(H[i] - mid * b, 0) / (a - b))
	if cnt <= mid:
		right = mid
	else:
		left = mid
print(right)


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

def enough(n):
	rest = [h - B * n * 1.0 for h in H]
	m = sum([math.ceil(r / (A - B)) for r in rest if r > 0])
	return m <= n
(l, r) = (0, 10 ** 9)
while r - l > 1:
	mid = (l + r) // 2
	if enough(mid):
		r = mid
	else:
		l = mid
print(r)


import sys
sys.setrecursionlimit(10 ** 6)
(N, A, B) = map(int, input().split())
h = []
for _ in range(N):
	h.append(int(input()))

def check(m):
	cnt = 0
	for i in range(N):
		cnt += max(-(-(h[i] - m * B) // (A - B)), 0)
	return cnt <= m
l = 0
r = 10 ** 9 + 1
while r - l != 1:
	c = (l + r) // 2
	if check(c):
		r = c
	else:
		l = c
print(r)


(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
ok = 10 ** 9
ng = 0
while ng + 1 < ok:
	c = ok + ng >> 1
	G = [max(0, h - c * B) for h in H]
	n = sum((-(-g // (A - B)) for g in G))
	if c >= n:
		ok = c
	else:
		ng = c
print(ok)


import math
(N, A, B) = map(int, input().split())
h = [int(input()) for _ in range(N)]
x = A - B

def func(cnt):
	dmg = B * cnt
	tmp = [max(0, val - dmg) for val in h]
	cnt2 = sum([math.ceil(val / x) for val in tmp])
	if cnt2 > cnt:
		return False
	else:
		return True
ok = 10 ** 9
ng = 0
while abs(ok - ng) > 1:
	cnt = (ok + ng) // 2
	if func(cnt):
		ok = cnt
	else:
		ng = cnt
print(ok)


(n, a, b) = map(int, input().split())
c = a - b
h = sorted([int(input()) for _i in range(n)], reverse=True)
(left, right) = (0, 10 ** 9)
while left < right:
	middle = (left + right) // 2
	counter = 0
	checker = middle * b
	i = 0
	while checker < h[i]:
		counter -= (-h[i] + checker) // c
		i += 1
		if i >= n:
			break
	if counter <= middle:
		right = middle
	else:
		left = middle + 1
print(right)


(n, a, b) = map(int, input().split())
ad = a - b
H = [int(input()) for i in range(n)]
le = 0
ri = max(H) // b + 2
mid = (le + ri) // 2
while ri - le > 1:
	ad_n = 0
	for i in range(n):
		hh = max(0, H[i] - mid * b)
		ad_n += -(-hh // ad)
	if ad_n > mid:
		le = mid
	else:
		ri = mid
	mid = (le + ri) // 2
print(le + 1)


(N, A, B) = map(int, input().split())
H = [int(input()) for i in range(N)]
(lb, ub) = (0, 10 ** 9)
while ub > lb + 1:
	mid = (lb + ub) // 2
	(t, C, cnt) = (mid * B, A - B, 0)
	for h in H:
		if h > t:
			tmp = h - t
			cnt += tmp // C + (tmp % C != 0)
			if cnt > mid:
				break
	if mid < cnt:
		lb = mid
	else:
		ub = mid
print(ub)


(n, a, b) = map(int, input().split())
l = [int(input()) for i in range(n)]
a -= b

def enough(x):
	return sum((max((h - b * x + a - 1) // a, 0) for h in l)) <= x
(ok, ng) = (10 ** 9, -1)
eps = 10 ** (-10)
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if enough(mid):
		ok = mid
	else:
		ng = mid
print(ok)


import sys
S = sys.stdin.readlines()
(N, A, B) = map(int, S[0].split())
H = [int(S[i + 1]) for i in range(N)]
(L, R) = (0, 10 ** 9)
M = 0
Z = 0
A -= B
while R > L:
	M = (L + R) // 2
	Z = 0
	for i in range(N):
		Z += max((H[i] - B * M + A - 1) // A, 0)
	if Z > M:
		L = max(L + 1, M)
	else:
		R = M
print(R)


from math import ceil
(N, A, B) = map(int, input().split())
H = []
d = A - B
for i in range(N):
	h = int(input())
	H.append(h)
b = ceil(max(H) / B)
a = 0
while a != b:
	m = a + (b - a) // 2
	t = 0
	for h in H:
		t += ceil(max(h - B * m, 0) / d)
	if t <= m:
		b = m
	else:
		a = m + 1
print(a)


def binsearch(good, bad, fn):
	while abs(good - bad) > 1:
		m = (good + bad) // 2
		if fn(m):
			good = m
		else:
			bad = m
	return good

def main():
	(N, A, B) = list(map(int, input().split()))
	H = [int(input()) for _ in range(N)]
	c = A - B

	def helper(x):
		r = 0
		for h in H:
			r += max((h - B * x + c - 1) // c, 0)
		return r <= x
	return binsearch(10 ** 9, 0, helper)
print(main())


from math import ceil

def resolve():

	def chick(k):
		cnt = 0
		for i in range(N):
			h = ceil((H[i] - B * k) / (A - B))
			cnt += max(0, h)
		return cnt <= k
	(N, A, B) = list(map(int, input().split()))
	H = [int(input()) for _ in range(N)]
	ok = 10 ** 10
	ng = 0
	while ok - ng > 1:
		k = (ok + ng) // 2
		if chick(k):
			ok = k
		else:
			ng = k
	print(ok)

def __starting_point():
	resolve()
__starting_point()


(n, a, b) = map(int, input().split())
H = [int(input()) for _ in range(n)]
c = a - b

def is_can(x):
	s = 0
	d = b * x
	for h in H:
		s += max(0, -(-(h - d) // c))
	if s <= x:
		return True
	return False
ng = 0
ok = -(-max(H) // b)
while ok - ng > 1:
	m = (ok + ng) // 2
	if is_can(m):
		ok = m
	else:
		ng = m
print(ok)


from math import ceil
(n, a, b) = list(map(int, input().split()))
hs = [int(input()) for _ in range(n)]

def defeatable(k):
	hb = [max([h - k * b, 0]) for h in hs]
	n_attack = sum([ceil(h / (a - b)) for h in hb])
	return n_attack <= k
(l, r) = (0, ceil(max(hs) / b))
while r - l > 1:
	m = (l + r) // 2
	if defeatable(m):
		r = m
	else:
		l = m
print(r)


import math
(N, A, B) = map(int, input().split())
h = list((int(input()) for i in range(N)))

def func(l, r):
	if l == r:
		return l
	c = (l + r) // 2
	hoge = 0
	for i in h:
		hoge += max(math.ceil((i - B * c) / (A - B)), 0)
	if hoge > c:
		return func(c + 1, r)
	elif hoge < c:
		return func(l, c)
	else:
		return c
print(func(0, 10 ** 9 + 7))


(n, a, b) = list(map(int, input().split()))
sh = sorted([int(input()) for i in range(n)], reverse=True)
sumh = sum(sh)

def nibu(t):
	rt = 0
	for i in range(n):
		temp = -1 * (-1 * max(0, sh[i] - t * b) // (a - b))
		if temp > 0:
			rt += temp
		else:
			break
		if rt > t:
			return False
	return True if t >= rt else False
l = max(sh) // a
r = max(sh) // b + 1
while r - l != 1:
	m = (l + r) // 2
	if nibu(m):
		r = m
	else:
		l = m
print(r)


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

def check(t):
	cnt = 0
	bt = B * t
	for i in range(N):
		cnt += max(0, math.ceil((h[i] - bt) / (A - B)))
	return cnt <= t
left = 1
right = max(h)
while right - left > 1:
	mid = (left + right) // 2
	if check(mid):
		right = mid
	else:
		left = mid
print(right)


import sys
input = sys.stdin.readline
(n, a, b) = map(int, input().split())
h = []
for i in range(n):
	h.append(int(input()))

def enough(t):
	tmp = 0
	for i in range(n):
		if h[i] > b * t:
			tmp += (h[i] - b * t) // (a - b) + (1 if (h[i] - b * t) % (a - b) > 0 else 0)
	return True if tmp <= t else False
ok = max(h)
ng = 0
mid = (ok - ng) // 2
while abs(ok - ng) > 1:
	if enough(mid):
		ok = mid
	else:
		ng = mid
	mid = (ok + ng) // 2
print(ok)


(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
C = A - B
(l, r) = (0, 1 << 30)
while r - l > 1:
	m = (l + r) // 2
	if sum([max((h - B * m + C - 1) // C, 0) for h in H]) <= m:
		r = m
	else:
		l = m
print(r)


import sys
from bisect import bisect_right

def solve(t):
	nonlocal A, B, C
	k = bisect_right(H, B * t)
	cnt = 0
	for i in range(k, N):
		h = H[i]
		h -= B * t
		cnt += (h + C - 1) // C
	return cnt <= t
(N, A, B) = list(map(int, input().split()))
C = A - B
H = [int(s) for s in sys.stdin.readlines()]
H.sort()
ng = 0
ok = H[-1] // B + 1
k = 0
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if solve(mid):
		ok = mid
	else:
		ng = mid
print(ok)


import math

def binsearch(l, r, fn):
	while r - l > 1:
		m = (l + r) // 2
		if fn(m):
			l = m
		else:
			r = m
	return l

def main():
	(N, A, B) = list(map(int, input().split()))
	l = []
	C = A - B
	for _ in range(N):
		h = int(input())
		l.append(h)

	def func(i):
		if max(l) <= B * i:
			return False
		r = 0
		for j in l:
			r += max(math.ceil((j - B * i) / C), 0)
		if r <= i:
			return False
		return True
	return 1 + binsearch(0, 1000000000, func)
print(main())


from numpy import ceil, array, sum
import sys

def input():
	return sys.stdin.readline().strip()

def is_ok(m):
	tmp = h - m * B
	tmp[tmp < 0] = 0
	if ceil(tmp / (A - B)).sum() > m:
		return False
	return True
(N, A, B) = map(int, input().split())
h = array(list((int(input()) for _ in range(N))))
r = 10 ** 9
l = 0
while abs(l - r) > 1:
	m = (r + l) // 2
	if is_ok(m):
		r = m
	else:
		l = m
print(r)


(N, A, B) = map(int, input().split())
H = [int(input()) for _ in [0] * N]
(l, r) = (0, 10 ** 10)
while l + 1 < r:
	k = (l + r) // 2
	if sum([max(0, (h - B * k - 1) // (A - B) + 1) for h in H]) > k:
		l = k
	else:
		r = k
print(r)


(N, A, B, *H) = map(int, open(0).read().split())

def is_ok(K):
	return sum((max(0, -(-(h - B * K) // (A - B))) for h in H)) <= K
(ng, ok) = (0, 10 ** 9)
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if is_ok(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(n, a, b) = list(map(int, input().split()))
h = [int(input()) for i in range(n)]
maxim_h = max(h)
ok = (maxim_h + a - 1) // a * n
ng = 0
while abs(ok - ng) > 1:
	X = (ok + ng) // 2
	cnt = 0
	flag = 1
	for val in h:
		if val <= b * X:
			continue
		temp = (val - b * X + a - b - 1) // (a - b)
		cnt += temp
		if cnt > X:
			flag = 0
			break
	if flag:
		ok = X
	else:
		ng = X
print(ok)


import numpy as np
(N, A, B) = map(int, input().split())
H = []
for i in range(N):
	H.append(int(input()))
H = np.array(H)

def binary_search(x):
	H_tmp = H - B * x
	H_tmp = H_tmp[H_tmp > 0]
	count = ((H_tmp + A - B - 1) // (A - B)).sum()
	return x >= count
left = 0
right = 10 ** 10
while right - left > 1:
	mid = (left + right) // 2
	ret = binary_search(mid)
	if ret:
		right = mid
	else:
		left = mid
print(right)


(n, a, b) = map(int, input().split())
h_list = []
for _ in range(n):
	h = int(input())
	h_list.append(h)

def ba(s):
	count = 0
	for i in h_list:
		i -= s * b
		if i > 0:
			count += -(-i // (a - b))
	if count <= s:
		return True
	else:
		return False
ng = 0
ok = 10 ** 9
while ok > ng + 1:
	mid = (ng + ok) // 2
	if ba(mid):
		ok = mid
	else:
		ng = mid
print(ok)


(n, a, b) = map(int, input().split())
ls = [int(input()) for _ in range(n)]

def check(k):
	return sum([(x - k * b + a - b - 1) // (a - b) for x in ls if x - k * b > 0]) <= k
m = max(ls)
lo = (m + a - 1) // a
hi = (m + b - 1) // b + 1
mi = (hi + lo) // 2
while hi > lo:
	mi = (hi + lo) // 2
	if check(mi):
		hi = mi
	else:
		lo = mi + 1
print(lo)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]

def judge(t):
	res = 0
	for x in h:
		if x - b * t > 0:
			res += -(-(x - b * t) // (a - b))
	return res <= t
low = 0
high = 10 ** 9 + 1
while high - low > 1:
	mid = (low + high) // 2
	if judge(mid):
		high = mid
	else:
		low = mid
print(high)


import math
(N, A, B) = map(int, input().split())
monsters = [int(input()) for _ in range(N)]
monsters.sort(reverse=True)

def can_terminate(x):
	count = 0
	for monster in monsters:
		count += max(0, math.ceil((monster - B * x) / (A - B)))
	return count <= x
(l, r) = (0, 10 ** 9 + 1)
while r - l > 1:
	mid = (r + l) // 2
	if can_terminate(mid):
		r = mid
	else:
		l = mid
print(r)


from math import ceil
(n, a, b) = map(int, input().split())
l = [int(input()) for i in range(n)]

def check(x):
	c = 0
	l1 = [i - b * x for i in l]
	for i in l1:
		if i <= 0:
			continue
		c += ceil(i / (a - b))
	return c <= x
lo = 0
ans = -1
hi = 10 ** 9 + 4
while lo <= hi:
	mi = lo + hi >> 1
	if check(mi):
		ans = mi
		hi = mi - 1
	else:
		lo = mi + 1
print(ans)


import sys
from math import ceil

def input():
	return sys.stdin.readline().strip()

def check(k):
	tmp = list(h)
	for i in range(N):
		tmp[i] -= B * k
	flag = False
	for i in tmp:
		if i > 0:
			flag = True
			break
	if not flag:
		return True
	lf = 0
	for i in tmp:
		if i > 0:
			lf += ceil(i / (A - B))
	if lf <= k:
		return True
	else:
		return False
(N, A, B) = map(int, input().split())
h = tuple((int(input()) for _ in range(N)))
left = -1
right = 1000000000.0
while abs(left - right) > 1:
	mid = (left + right) // 2
	if check(mid):
		right = mid
	else:
		left = mid
print(int(right))


(n, a, b) = map(int, input().split())
H = [0] * n
for i in range(n):
	H[i] = int(input())
ng = -1
ok = 10 ** 9 + 5
while ok - ng > 1:
	mid = (ng + ok) // 2
	c = 0
	for i in range(n):
		c = c + max(0, H[i] - b * mid + a - b - 1) // (a - b)
	if c > mid:
		ng = mid
	else:
		ok = mid
print(ok)


import sys
input = sys.stdin.readline
(n, a, b) = map(int, input().split())
c = a - b
h_list = [int(input()) for i in range(n)]
l = 1
r = (max(h_list) + b - 1) // b
while r - l > 1:
	m = (l + r) // 2
	count = 0
	for i in h_list:
		if i <= b * m:
			pass
		else:
			count += (i - b * m + c - 1) // c
	if count <= m:
		r = m
	else:
		l = m
print(r)


import sys
input = sys.stdin.readline
(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
C = A - B
hi = 10 ** 9 + 1
lo = -1
while hi - lo > 1:
	mid = (hi + lo) // 2
	rem = 0
	for i in range(N):
		rem += max(0, (H[i] - B * mid + C - 1) // C)
	if rem <= mid:
		hi = mid
	else:
		lo = mid
print(hi)


(n, a, b) = map(int, input().split())
h = []
for i in range(n):
	x = int(input())
	h.append(x)

def check(t):
	c = 0
	for i in range(n):
		c += 1 + (max(0, h[i] - b * t) - 1) // (a - b)
	return t >= c
l = 0
r = 3 + max(h) // b
while r - l > 1:
	mid = (r - l) // 2 + l
	if check(mid):
		r = mid
	else:
		l = mid
ans = l
if check(r):
	ans = r
print(ans)


from math import ceil
(N, A, B) = map(int, input().split())
h = []
for _ in range(N):
	h.append(int(input()))
left = 0
right = max(h) // B + 1
while right - left > 1:
	mid = (right + left) // 2
	c = sum([ceil((hi - mid * B) / (A - B)) for hi in h if hi > mid * B])
	if c > mid:
		left = mid
	else:
		right = mid
print(right)


(N, A, B) = map(int, input().split())
H = [int(input()) for _ in [0] * N]

def binary_search(l, r, func):
	if func(l):
		return l - 1
	if not func(r):
		return r
	while l + 1 < r:
		i = (l + r) // 2
		if func(i):
			r = i
		else:
			l = i
	return l

def f(K):
	c = sum((max(0, (h - B * K - 1) // (A - B) + 1) for h in H))
	return c <= K
print(binary_search(0, 10 ** 9, f) + 1)


(n, a, b) = map(int, input().split())
H = [int(input()) for i in range(n)]
lo = -1
hi = 10 ** 9 + 1
while hi - lo > 1:
	mi = (hi + lo) // 2
	rest = 0
	for i in range(n):
		rest += max(0, -(-(H[i] - b * mi) // (a - b)))
	if rest <= mi:
		hi = mi
	else:
		lo = mi
print(hi)


(n, a, b) = map(int, input().split())
H = [int(input()) for _ in range(n)]

def ok(t):
	count = 0
	for h in H:
		if h - b * t > 0:
			count += -(-(h - b * t) // (a - b))
	return count <= t
lo = 0
hi = 10 ** 9 + 1
while hi - lo > 1:
	mid = (lo + hi) // 2
	if ok(mid):
		hi = mid
	else:
		lo = mid
print(hi)


import math
(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
OK = max(H) // B + 1
NG = 0
ans = OK
while OK - NG > 1:
	mid = (OK + NG) // 2
	cnt = 0
	for h in H:
		if h > mid * B:
			cnt += math.ceil((h - mid * B) / (A - B))
	if cnt <= mid:
		OK = mid
	else:
		NG = mid
print(OK)


import math
(N, A, B) = map(int, input().split())
h = [int(input()) for i in range(N)]

def C(T):
	t = 0
	for i in range(N):
		if h[i] > B * T:
			t += math.ceil((h[i] - B * T) / (A - B))
	if t <= T:
		return True
	else:
		False
(l, r) = (0, 10 ** 18)
while r - l > 1:
	mid = (l + r) // 2
	if C(mid):
		r = mid
	else:
		l = mid
print(r)


(n, a, b) = map(int, input().split())
hlist = [int(input()) for _ in range(n)]
maxn = (max(hlist) + b - 1) // b

def enough(t):
	c = 0
	for h in hlist:
		if h - b * t > 0:
			c += (h - b * t + a - b - 1) // (a - b)
	return c <= t
(l, r) = (0, maxn)
while l != r:
	mid = (l + r) // 2
	if enough(mid):
		r = mid
	else:
		l = mid + 1
print(l)


from math import ceil
(N, A, B) = map(int, input().split())
h = [int(input()) for _ in range(N)]

def bis(p, ok, ng):
	mid = (ok + ng) // 2
	return ok if abs(ok - ng) == 1 else bis(p, mid, ng) if p(mid) else bis(p, ok, mid)
ans = bis(lambda k: sum((max(0, ceil((x - k * B) / (A - B))) for x in h)) <= k, 10 ** 10, 0)
print(ans)


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

def solve(n):
	cnt = 0
	for i in h:
		i -= B * n
		cnt += max((i - 1) // (A - B) + 1, 0)
	return cnt <= n
left = 0
right = 10 ** 9
while left + 1 < right:
	mid = (left + right) // 2
	if solve(mid):
		right = mid
	else:
		left = mid
print(right)


import math

def enough(HP, A, B, X):
	q = 0
	for i in range(len(HP)):
		q += max(math.ceil((HP[i] - B * X) / (A - B)), 0)
	if q <= X:
		return True
	else:
		return False
over = 10 ** 9
under = 0
HP = []
(N, A, B) = list(map(int, input().rstrip().split(' ')))
for i in range(N):
	HP.append(int(input()))
while abs(over - under) > 1:
	mid = (over + under) // 2
	if enough(HP, A, B, mid):
		over = mid
	else:
		under = mid
print(over)


import math
(n, a, b) = list(map(int, input().split()))
h_list = [int(input()) for _ in range(n)]
lb = 0
ub = 10 ** 9

def is_ok(m):
	tmp_ans = 0
	for h in h_list:
		tmp_h = max(h - m * b, 0)
		tmp_ans += math.ceil(tmp_h / (a - b))
	if tmp_ans <= m:
		return True
	else:
		return False
ng = lb
ok = ub + 1
while ok - ng > 1:
	m = (ok + ng) // 2
	if is_ok(m):
		ok = m
	else:
		ng = m
print(ok)


(n, a, b) = [int(x) for x in input().split()]
c = a - b
h = []
for _ in range(n):
	h.append(int(input()))
h.sort()
m = h[-1]
z = 0
import bisect, math
while m - z > 1:
	mid = (m + z) // 2
	k = bisect.bisect_left(h, b * mid)
	cnt = 0
	for i in range(k, n):
		h2 = h[i] - b * mid
		cnt += math.ceil(h2 / c)
	if cnt <= mid:
		m = mid
	else:
		z = mid
print(m)


import math
(N, A, B) = map(int, input().split())
H = [0] * N
H = [int(input()) for i in range(N)]
maxH = max(H)
U = math.ceil(maxH / B)
L = 0

def binsearch(U, L):
	m = (U + L) // 2
	if m == L:
		print(U)
	elif sum([math.ceil(max(h - B * m, 0) / (A - B)) for h in H]) <= m:
		binsearch(m, L)
	else:
		binsearch(U, m)
binsearch(U, L)


def turn_check(inlist, p, q, x):
	s = q * x
	t = p - q
	return sum([(max(i - s, 0) + t - 1) // t for i in inlist]) <= x
(n, a, b) = [int(v) for v in input().split()]
h_list = [int(input()) for i in range(n)]
(ok, ng) = (10 ** 9, 0)
while ok - ng > 1:
	mid = (ok + ng) // 2
	if turn_check(h_list, a, b, mid):
		ok = mid
	else:
		ng = mid
print(ok)


def resolve():

	def f(mid):
		return sum([(x - mid * b + a - b - 1) // (a - b) for x in h if x > mid * b]) <= mid
	(n, a, b) = list(map(int, input().split()))
	h = [int(input()) for _ in range(n)]
	(ok, ng) = (10 ** 10, 0)
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if f(mid):
			ok = mid
		else:
			ng = mid
	print(ok)

def __starting_point():
	resolve()
__starting_point()


u = 10 ** 9
d = 0
(N, A, B) = map(int, input().split())
s = A - B
H = []
import math
for i in range(N):
	h = int(input())
	H.append(h)
for i in range(30):
	x = (u + d) // 2
	a = 0
	for j in range(N):
		h = H[j]
		h -= B * x
		if h > 0:
			a += math.ceil(h / s)
	if a > x:
		d = x
	else:
		u = x
print(u)


import math
(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
d = A - B
high = 10 ** 9
low = 0
while high - low > 1:
	mid = (high + low) // 2
	D = []
	for i in range(N):
		if H[i] - mid * B > 0:
			D.append(H[i] - mid * B)
	cnt = 0
	for h in D:
		cnt += math.ceil(h / d)
	if cnt <= mid:
		high = mid
	else:
		low = mid
print(high)


import sys
import math

def input():
	return sys.stdin.readline()[:-1]
(n, a, b) = map(int, input().split())
h = [int(input()) for i in range(n)]
(low, high) = (0, 10 ** 9 + 1)
while high - low > 1:
	mid = (high + low) // 2
	cnt = 0
	for i in range(n):
		tmp = h[i] - mid * b
		if tmp > 0:
			cnt += math.ceil(tmp / (a - b))
	if cnt <= mid:
		high = mid
	else:
		low = mid
print(high)


(n, a, b) = map(int, input().split())
hl = []
for _ in range(n):
	hl.append(int(input()))
(ok, ng) = (10 ** 9 + 1, 0)
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	cnt = 0
	for h in hl:
		rem = h - b * mid
		if rem > 0:
			cnt += (rem - 1) // (a - b) + 1
	if cnt <= mid:
		ok = mid
	else:
		ng = mid
print(ok)


import math
(N, A, B) = map(int, input().split())
H = [int(input()) for _ in range(N)]
H.sort(reverse=True)
s = 0
l = H[0] // B + 1
while l - s > 1:
	cnt = 0
	mid = (s + l) // 2
	x = mid * B
	for h in H:
		if h > x:
			cnt += math.ceil((h - x) / (A - B))
		else:
			break
	if cnt > mid:
		s = mid
	else:
		l = mid
print(l)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
d = a - b
l = 0
r = 10 ** 10 + 1
ans = r

def check(num):
	global h
	global d
	global b
	cnt = 0
	for i in h:
		if i > b * num:
			cnt += (i - b * num + d - 1) // d
	return cnt <= num
while r >= l:
	mid = (r + l) // 2
	if check(mid):
		r = mid - 1
		ans = min(ans, mid)
	else:
		l = mid + 1
print(ans)


def check(N, A, B, h, K):
	sum = 0
	for i in range(N):
		x = -((-h[i] + B * K) // (A - B))
		sum += x if x > 0 else 0
	return sum <= K
(N, A, B) = list(map(int, input().split()))
h = [0] * N
for i in range(N):
	h[i] = int(input())
ok = 1000000000
ng = 0
while abs(ok - ng) > 1:
	mid = (ok + ng) // 2
	if check(N, A, B, h, mid):
		ok = mid
	else:
		ng = mid
print(ok)


import sys
input = sys.stdin.readline
(n, a, b) = map(int, input().split())
x = a - b
h = [int(input()) for _ in range(n)]
ok = 10 ** 9 + 1
ng = 0
while ok - ng > 1:
	m = (ok + ng) // 2
	k = 0
	for i in range(n):
		k += (max(0, h[i] - m * b) + x - 1) // x
	if k <= m:
		ok = m
	else:
		ng = m
print(ok)


(n, a, b) = map(int, input().split())
h = [int(input()) for _ in range(n)]
ll = 0
rr = 10 ** 9 + 1
ab = a - b
while ll < rr:
	half = (ll + rr) // 2
	cnt = 0
	for hh in h:
		if hh > b * half:
			cnt += -1 * (-1 * (hh - b * half) // ab)
	if cnt > half:
		ll = half + 1
	elif cnt < half:
		rr = half
	else:
		print(half)
		exit()
print(ll)


(N, A, B) = map(int, input().split())
hs = [int(input()) for _ in range(N)]
l = 0
r = max(hs)

def enough(x):
	res = 0
	for i in range(N):
		res += max(0, hs[i] - B * x + A - B - 1) // (A - B)
	return res <= x
while l + 1 < r:
	m = (l + r) // 2
	if enough(m):
		r = m
	else:
		l = m
print(r)


import sys
input = sys.stdin.readline
(N, A, B) = list(map(int, input().split()))
C = A - B
H = [int(input()) for _ in range(N)]

def check(K):
	s = 0
	D = K * B
	for h in H:
		s += max(0, (h - D + C - 1) // C)
	return s <= K
max_NG = 0
min_OK = 10 ** 10
while min_OK - max_NG > 1:
	tgt = (max_NG + min_OK) // 2
	if check(tgt):
		min_OK = tgt
	else:
		max_NG = tgt
print(min_OK)


import numpy as np
(N, A, B) = list(map(int, input().split()))
H = np.zeros(shape=N, dtype='int64')
for _ in range(N):
	h = int(input())
	H[_] = h

def calc(num, a):
	a -= num * B
	a = (a - 1) // (A - B) + 1
	if sum(a[a > 0]) <= num:
		return True
	else:
		return False
start = 0
end = 10 ** 10
while end - start > 1:
	mid = (start + end) // 2
	if calc(mid, H.copy()):
		end = mid
	else:
		start = mid
print(end)


def main():
	import math
	(N, A, B) = map(int, input().split())
	h = [int(input()) for i in range(N)]
	d = A - B
	l = 1
	r = max(h)
	while l + 1 < r:
		m = (l + r) // 2
		t = m * B
		count = 0
		for x in h:
			if x > t:
				count += math.ceil((x - t) / d)
		if count <= m:
			r = m
		else:
			l = m
	print(r)
main()


(N, A, B) = map(int, input().split())
H = [int(input()) for i in range(N)]

def check(n):
	c = 0
	for i in range(N):
		a = H[i] - n * B
		if a > 0:
			c += a // (A - B) + 1
	if c <= n:
		return True
	else:
		return False
(l, h) = (0, 10 ** 20)
for _ in range(200):
	m = (l + h) * 0.5
	if check(m):
		h = m
	else:
		l = m
import math
print(math.ceil(m))


(n, a, b) = list(map(int, input().split()))
h = []
for i in range(n):
	h.append(int(input()))
import math
sup = sum([hh // a + 1 for hh in h])
inf = 1
while sup - inf > 1:
	x = (sup + inf) // 2
	c = sum([math.ceil((hh - x * b) / (a - b)) for hh in h if hh > x * b])
	if c <= x:
		sup = x
	else:
		inf = x
print(sup)


import math

def check(k, A, B, H):
	return sum([max([0, math.ceil((h - B * k) / (A - B))]) for h in H]) <= k

def main():
	(N, A, B) = list(map(int, input().split(' ')))
	H = [int(input()) for _ in range(N)]
	(ng, ok) = (0, 10 ** 9)
	while ok - ng > 1:
		mid = (ok + ng) // 2
		if check(mid, A, B, H):
			ok = mid
		else:
			ng = mid
	print(ok)

def __starting_point():
	main()
__starting_point()


from math import ceil
(N, A, B) = map(int, input().split())
H = sorted([int(input()) for i in range(N)])
C = A - B
(lo, hi) = (-1, 10 ** 9)
while hi - lo > 1:
	X = (hi + lo) // 2
	H2 = [max(0, h - X * B) for h in H]
	need = sum([ceil(h / C) for h in H2])
	if need > X:
		lo = X
	else:
		hi = X
print(hi)


(N, A, B) = map(int, input().split())
D = [int(input()) for i in range(N)]

def f(a):
	E = []
	for i in range(N):
		if D[i] - a * B > 0:
			E.append(D[i] - a * B)
	cnt = 0
	for i in E:
		cnt += -(-i // (A - B))
	if cnt <= a:
		return True
	else:
		return False
(l, r) = (0, 10 ** 9)
for i in range(50):
	mid = (l + r) // 2
	if f(mid):
		r = mid
	else:
		l = mid
print(r)


import math
(N, A, B) = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort(reverse=True)

def det(m):
	C = [max(0, a - B * m) for a in h]
	if sum([math.ceil(b / (A - B)) for b in C]) > m:
		return False
	else:
		return True
l = 0
r = math.ceil(max(h) / A * N)
while r - l > 1:
	c = (l + r) // 2
	if det(c):
		r = c
	else:
		l = c
print(r)