CodeEff/ECCO huggingface dataset:
# Original solution
n = int(eval(input()))
a_lst = []
b_lst = []
sum_lst = []

for i in range(0, n):
    a, b = [int(elem) for elem in input().split()]
    a_lst.append(a)
    b_lst.append(b)

tmp = list(zip(b_lst, a_lst))
tmp = sorted(tmp)
b_lst, a_lst = list(zip(*tmp))   

for i in range(0, len(a_lst)):
    sum_lst.append(sum(a_lst[:i+1]))

flag = 0
for a, b in zip(sum_lst, b_lst):
    if a > b:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")

# Optimized solution
n = int(eval(input()))
a_lst = []
b_lst = []

for i in range(0, n):
    a, b = [int(elem) for elem in input().split()]
    a_lst.append(a)
    b_lst.append(b)

tmp = list(zip(b_lst, a_lst))
tmp = sorted(tmp)
b_lst, a_lst = list(zip(*tmp))   

flag = 0
sums = 0
for i in range(0, len(a_lst)):
    sums += a_lst[i]
    if sums > b_lst[i]:
        flag = 1
        break

if flag == 0:
    print("Yes")
else:
    print("No")
# Original solution
N = int(eval(input()))
AB=[]
for _ in range(N):
    AB.append(tuple(map(int, input().split())))
#print(N, AB)

AB=sorted(AB, key=lambda val:val[1])
task=[]
for ab in AB:
    for _ in range(ab[0]):
        task.append(ab[1])
#print(AB)
#print(task)

for i in range(len(task)):
    if i+1>task[i]:
        print('No')
        break
else:
    print('Yes')

# Optimized solution
N = int(eval(input()))
AB=[]
for _ in range(N):
    AB.append(list(map(int, input().split())))
#print(N, AB)

AB=sorted(AB, key=lambda val:val[1])

if AB[0][0]>AB[0][1]:
    print('No')
else:
    for i in range(N-1):
        AB[i+1][0]+=AB[i][0]
        if AB[i+1][0]>AB[i+1][1]:
            print('No')
            break
    else:
        print('Yes')
# Original solution
# import bisect
import heapq
# import math
# import queue
import sys


def main():
    # 読み込み回数が多い場合
    input = sys.stdin.readline
    N = int(eval(input()))
    
    # heap queue
    h = []
    for i in range(N):
        A, B = list(map(int, input().split()))
        heapq.heappush(h, (B, A))
	
    time = 0
    while len(h) > 0:
        B, A = heapq.heappop(h)
        time += A
        if B < time:
            print("No")
            sys.exit()
    
    print("Yes")


if __name__ == "__main__":
    main()

# Optimized solution
# import bisect
# import heapq
# import math
# import queue
import sys


def main():
    # 読み込み回数が多い場合
    input = sys.stdin.readline
    N = int(eval(input()))
    
    # heap queue
    h = []
    for i in range(N):
        A, B = list(map(int, input().split()))
        h.append((B, A))
    h.sort()
	
    time = 0
    for B, A in h:
        time += A
        if B < time:
            print("No")
            sys.exit()
    
    print("Yes")


if __name__ == "__main__":
    main()
# Original solution
import heapq
#これを加える！！！！
def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

n = int(eval(input()))
works = [[]] * n
for i in range(n):
  a, b = list(map(int, input().split(' ')))
  works[i] = [a, b]

ans = 'Yes'
sorted_works = sorted(works, key=lambda x: x[1], reverse=True)
max_deadline = sorted_works[0][1]
# print('max_deadline', max_deadline)
h = []
deadline_i = 0
work_day = max_deadline # 作業日
# 締め切り最終日から0日に向かってループ
for d in range(max_deadline, -1, -1):
  # その日が締め切りの作業時間を優先度キューに追加
  for i in range(deadline_i, n):
    work_time, deadline = sorted_works[i]
    if deadline == d:
      _heappush_max(h, work_time)
      deadline_i += 1
    else:
      break
  # 作業ができない日であれば、次のループへ
  if d > work_day:
    continue
  
  # 作業ができる日
  
  # 作業がなければ次のループへ
  if len(h) == 0:
    continue
  
  
  # その日に終了しても良い作業の中で時間が最長の作業時間を取得
  max_work_time = _heappop_max(h)
  # 次の作業日を設定
  work_day = d - max_work_time
  
  # 0日より前になる = 作業量が多いので実行不可
  if work_day < 0:
    ans = 'No'
  
  

print(ans)
# print(works)
# print(sorted_works)

# Optimized solution
n = int(eval(input()))
works = [[]] * n
for i in range(n):
  a, b = list(map(int, input().split(' '))) # a = 時間, b = 締め切り
  works[i] = [a, b]

ans = 'Yes'
sorted_works = sorted(works, key=lambda x: x[1]) # 締切の早い順にソート
total = 0

for work in sorted_works:
  total += work[0]
  if total > work[1]:
    ans = 'No'
    break
  
print(ans)
# Original solution
import sys
from functools import cmp_to_key
n = int(eval(input()))
data = [[int(j) for j in input().split()] for i in range(n)]
t = 0
data.sort(key = cmp_to_key(lambda x, y: x[1] - y[1]))
for d in data:
  t += d[0]
  if t > d[1]:
    print('No')
    sys.exit()
print('Yes')


# Optimized solution
from sys import exit

n = int(eval(input()))
data = [[int(j) for j in input().split()] for i in range(n)]

t = 0
data.sort(key=lambda x: x[1])
for d in data:
    t += d[0]
    if t > d[1]:
        print('No')
        exit()
print('Yes')
# Original solution
from operator import itemgetter
import sys
 
N = int(eval(input()))
 
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))
 
    except:
        break;
 
#print(listA)
 
listB = sorted(listA)
la = sorted(listB, key=itemgetter(1))
 
t = 0
for i in range(N):
	s = la[i][1]
	t += la[i][0]
	if t > s:
		print("No")
		sys.exit()
 
print('Yes')



# Optimized solution
from operator import itemgetter
import sys
 
N = int(eval(input()))
 
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))
 
    except:
        break;
  
listB = sorted(listA)
la = sorted(listB, key=itemgetter(1))
 
t = 0
for i in range(N):
	t += la[i][0]
	#print(t)
	if t > la[i][1]:
		print('No')
		sys.exit()
 
print('Yes')
# Original solution
def merge_sort(arr):
 if len(arr) <= 1:
  return arr
 mid = len(arr) // 2
# ここで分割を行う
 left = arr[:mid]
 right = arr[mid:]
# 再帰的に分割を行う
 left = merge_sort(left)
 right = merge_sort(right)
# returnが返ってきたら、結合を行い、結合したものを次に渡す
 return merge(left, right)
def merge(left, right):
 merged = []
 l_i, r_i = 0, 0
# ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
 while l_i < len(left) and r_i < len(right):
    # ここで=をつけることで安定性を保っている
  if left[l_i][1] <= right[r_i][1]:
   merged.append(left[l_i])
   l_i += 1
  else:
   merged.append(right[r_i])
   r_i += 1

# 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
 if l_i < len(left):
  merged.extend(left[l_i:])
 if r_i < len(right):
  merged.extend(right[r_i:])
 return merged
import sys
input = sys.stdin.readline
N=int(eval(input()))
lst=[0]*N
lst=[list(map(int,input().split())) for i in range(N)]
lsta=merge_sort(lst)
ans=0
t=0
for i in range(N):
 t+=lsta[i][0]
 if t>lsta[i][1]:
  ans+=1
if ans==0:
 print("Yes")
else:
 print("No")


# Optimized solution
import sys
input = sys.stdin.readline
N=int(eval(input()))
lst=[0]*N
lst=[list(map(int,input().split())) for i in range(N)]
lst.sort(key=lambda x: x[1])
ans=0
t=0
for i in range(N):
 t+=lst[i][0]
 if t>lst[i][1]:
  ans+=1
if ans==0:
 print("Yes")
else:
 print("No")
# Original solution
N = int(eval(input()))
A=[]
B=[]
for i in range(N):
  a,b = input().split()
  A.append(int(a))
  B.append(int(b))
for j in range(N-1):
  for i in range(N-1):
    if B[i] > B[i + 1]:
      B[i], B[i + 1] = B[i + 1], B[i]
      A[i], A[i + 1] = A[i + 1], A[i]
count = 0
sum = 0
for i in range(N):
  sum = sum + A[i]
  if sum > B[i]:
    count = 1
    break
if count == 0:
  print("Yes")
else:
  print("No")
  

# Optimized solution
N = int(eval(input()))
task = []
for i in range(N):
  a,b = input().split()
  task.append([int(a),int(b)])
task.sort(key=lambda x:x[0])
task.sort(key=lambda x:x[1])
count = 0
sum = 0
for i in range(N):
  sum = sum + task[i][0]
  if sum > task[i][1]:
    count = 1
    break
if count == 0:
  print("Yes")
else:
  print("No")
# Original solution
import sys
input = sys.stdin.readline

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

tasks.sort()
tasks = sorted( tasks, key = lambda a: a[1] )

time = 0
flg = 0
for task in tasks:
    time += task[0]
    if time > task[1]:
        print('No')
        break
else:
    print( 'Yes' )

# Optimized solution
import sys
input = sys.stdin.readline

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

tasks = sorted( tasks, key = lambda a: a[1] )

time = 0
for task in tasks:
    time += task[0]
    if time > task[1]:
        print('No')
        break
else:
    print( 'Yes' )
# Original solution
def solve(n: int, ab: 'list(Task)') -> bool:
    from operator import attrgetter
    ab.sort(key=attrgetter('limit'))
    cur = 0
    for ab_ in ab:
        cur += ab_.cost
        if cur > ab_.limit:
            return False
    return True


if __name__ == '__main__':
    from collections import namedtuple
    import sys

    input = sys.stdin.readline
    Task = namedtuple('Task', 'cost limit')
    n = int(eval(input()))
    ab = []
    for _ in range(n):
        cost_, limit_ = list(map(int, input().split()))
        ab.append(Task(cost=cost_, limit=limit_))
    print(('Yes' if solve(n, ab) else 'No'))


# Optimized solution
def main():
    from operator import itemgetter
    import sys
    input = sys.stdin.readline

    N = int(eval(input()))

    tasks = []
    for _ in range(N):
        tasks.append(tuple(map(int, input().split())))  # (A,B)
    tasks.sort(key=itemgetter(1))

    t = 0
    cond = True
    for a, b in tasks:
        t += a
        if t > b:
            cond = False
            break

    print(('Yes' if cond else 'No'))


if __name__ == '__main__':
    main()
# Original solution
#import sys
#input = sys.stdin.readline

n=int(eval(input()))
ab=[[int(i) for i in input().split()] for j in range(n)]
ab=sorted(ab,key=lambda x:x[1])

w=0
t=0
ans='Yes'
for a,b in ab:
    w+=a
    if b<w:
        ans='No'
    
print(ans)

# Optimized solution
import sys
input = sys.stdin.readline

n=int(eval(input()))
ab=[[int(i) for i in input().split()] for j in range(n)]
ab=sorted(ab,key=lambda x:x[1])

w=0
t=0
ans='Yes'
for a,b in ab:
    w+=a
    if b<w:
        ans='No'
    
print(ans)
# Original solution
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = inp()
tasks = []
cnt = 0
for i in range(n):
    a,b = inpl()
    tasks.append([a,b,abs(a-b)])
tasks.sort(key=lambda x:x[1])

for task in tasks:
    cnt += task[0]
    if cnt > task[1]:
        print('No')
        break
else:
    print('Yes')

# Optimized solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
ab = [inpl() for _ in range(n)]
now = 0
ab.sort(key = lambda x:x[1])
# ab.sort()
# print(ab)
for i in range(n):
    a,b = ab[i]
    now += a
    if now > b:
        print('No')
        # print(i)
        break
else:
    print('Yes')
# Original solution
import heapq

N = int(eval(input()))
tasks = []
for _ in range(N):
  a,b = list(map(int,input().split()))
  if b-a < 0:
    print('No')
    exit()
  else:
    heapq.heappush(tasks,[b,-a])
    
day = 0
while len(tasks) != 0:
  b, neg_a = heapq.heappop(tasks)
  if day - neg_a > b:
    print('No')
    exit()
  else: day -= neg_a
print('Yes')

# Optimized solution
N = int(eval(input()))
deadlines = []
for i in range(N):
    a, b = list(map(int, input().split()))
    deadlines.append([b, a])
deadlines.sort()

time = 0
for deadline, task_time in deadlines:
    if time + task_time <= deadline:
        time += task_time
    else:
        time = None
        break
print(('Yes' if time is not None else 'No'))
# Original solution
N=int(eval(input()))
task=[]
for _ in range(N):
    task.append([int(i) for i in input().split()])

task=sorted(task, key=lambda x: x[1])

spent_time1=0
spent_time2=0
for i in range(N):
    spent_time2+=task[i][0]
ans='Yes'

for i in range(N):
    spent_time1+=task[i][0]
    deadline1=task[i][1]
    if i!=0:
        spent_time2-=task[N-i][0]
    deadline2=task[N-1-i][1]
    if deadline1<spent_time1:
        ans='No'
        break
    elif deadline2<spent_time2:
        ans='No'
        break
    

print(ans)

# Optimized solution
N=int(eval(input()))
task=[]
for _ in range(N):
    task.append([int(i) for i in input().split()])

task=sorted(task, key=lambda x: x[1])

spent_time1=0
ans='Yes'

for i in range(N):
    spent_time1+=task[i][0]
    deadline1=task[i][1]
    if deadline1<spent_time1:
        ans='No'
        break

print(ans)
# Original solution
import heapq
import copy
import bisect
from collections import deque

n = int(eval(input()))
a = []
b = []
tmp_a = []
tmp_b = []
flag = True

for _ in range(n):
	a_dash,b_dash = list(map(int,input().split()))
	tmp_a.append(a_dash)
	tmp_b.append(b_dash)

k = list(zip(tmp_b,tmp_a))
sorted_k = sorted(k)
for b_dash,a_dash in sorted_k:
	a.append(a_dash)
	b.append(b_dash)

t = 0
qa = deque(a)
qb = deque(b)

for i in range(n):
	minimum_a = qa.popleft()
	minimum_b = qb.popleft()
	t += minimum_a
	if t > minimum_b:
		flag = False
		break

if flag:
	print('Yes')
else:
	print('No')


# Optimized solution
from collections import deque
import sys

n = int(eval(input()))

ab = []
for _ in range(n):
	ab.append(list(map(int,input().split())))

ab = sorted(ab, key=lambda x:x[1], reverse=True)

d = []
d = deque(d)
num = 0
while len(ab) > 0:
	d = deque([])
	d.append(ab.pop())
	while True:
		if len(ab) == 0:
			break
		if ab[-1][1] == d[0][1]:
			d.append(ab.pop())
		else:
			break
	for i in range(len(d)):
		a,b = d.pop()
		num += a
	if num > b:
		print('No')
		sys.exit()

print('Yes')
# Original solution
from operator import itemgetter
n=int(eval(input()))
ab=[list(map(int,input().split())) for i in range(n)]
ab=sorted(ab, key=itemgetter(1,0))
#print(ab)

time=0
for todotime,deadline in ab:
    time += todotime
    if not (time <= deadline) :
        print('No')
        exit()
print('Yes')

# Optimized solution
n=int(eval(input()))
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort(key=lambda x:x[1])
#print(ab)
time=0
for a,b in ab:
    temp=time+a
    if temp<=b:
        time=temp
    else:
        print('No')
        exit()
print('Yes')
# Original solution
import sys
from collections import defaultdict
from operator import itemgetter
input = sys.stdin.readline

N = int(eval(input()))
d = defaultdict(int)
for _ in range(N):
    a, b = list(map(int, input().split()))
    d[b] += a
task = list(d.items())
task.sort()

now = 0
ans = "Yes"
for limit, time in task:
    now += time
    if now > limit:
        ans = "No"
        break

print(ans)


# Optimized solution
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N = int(eval(input()))
    work = []  # due, duration
    for _ in range(N):
        a, b = list(map(int, input().split()))
        work.append((b, -a))
    work.sort()

    now = 0
    for b, a in work:
        now = now - a
        if now > b:
            return "No"
    return "Yes"


if __name__ == "__main__":
    print((main()))
# Original solution
from collections import deque
from functools import lru_cache
import bisect
import sys
sys.setrecursionlimit(10**9)

def main():
    N = int(eval(input()))
    X = []
    for _ in range(N):
        a,b = list(map(int,input().split()))
        bisect.insort(X,(b,a))

    x = 0
    X = deque(X)
    l = len(X)
    for _ in range(l):
        b,a = X.popleft()
        # print(b,a,x)
        if x + a > b:
            print("No")
            exit()

        x += a

    print("Yes")



if __name__ == "__main__":
  main()

# Optimized solution
from collections import deque
import bisect
import sys
sys.setrecursionlimit(10**9)

def main():
    N = int(eval(input()))
    X = []
    for _ in range(N):
        a,b = list(map(int,input().split()))
        X.append((b,a))

    x = 0
    X.sort(key=lambda x: x[0])
    X = deque(X)
    l = len(X)
    for _ in range(l):
        b,a = X.popleft()
        # print(b,a,x)
        if x + a > b:
            print("No")
            exit()

        x += a

    print("Yes")



if __name__ == "__main__":
  main()
# Original solution
n,a,b=list(map(int,input().split()))
h=[int(eval(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)

# Optimized solution
n,a,b=list(map(int,input().split()))
h=[int(eval(input())) for i in range(n)]
l=0;r=max(h)//b+1
while abs(l-r)>1:
  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:
    r=x
  else:
    l=x
print(r)
# Original solution
from copy import deepcopy
from math import ceil

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

A -= B  # 爆発は追加ダメージ扱いとする

# にぶたん
ok, ng = 10 ** 9, 0
while abs(ok - ng) > 1:
    X = (ok + ng) // 2

    h = deepcopy(H)
    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)


# Optimized solution
from math import ceil

N, A, B = list(map(int, input().split()))
H = [int(eval(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)
# Original solution
import copy
def calc(n):
    d = copy.deepcopy(h)
    d = [dd - (b * n) for dd in d if (dd - (b*n)) > 0]
    a_num = sum([dd // (a - b) if (dd % (a - b) == 0) else (dd // (a - b)) + 1 for dd in d])
    if a_num <= n:
        return True
    return False

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


left = 1
right = (max(h) + 1) // (b)
middle = (left + right) // 2
middle_1 = middle - 1
calc_middle = calc(middle)
calc_middle_1 = calc(middle_1)
while not ((calc_middle) & (not calc_middle_1)):
    if not calc_middle:
        left = middle
        middle = (left + right) // 2
        middle_1 = middle - 1
    else:
        right = middle
        middle = (left + right) // 2
        middle_1 = middle - 1
    calc_middle = calc(middle)
    calc_middle_1 = calc(middle_1)
print(middle)

# Optimized solution
def calc(n):
    damage = (b * n)
    d = [max(dd - damage, 0) for dd in h]
    a_num = 0
    for i in range(len(d)):
        a_num += max(0, 1 + (d[i]-1) // (a - b))
    if a_num <= n:
        return True
    return False

n, a, b = list(map(int, input().split()))
h = []
for _ in range(n):
    h.append(int(eval(input())))
ans = 0
h.sort()

left = 0
right = 10000000000

while (right - left) > 1:
    middle = (left + right) // 2
    if calc(middle):
        right = middle
    else:
        left = middle
print(right)
# Original solution
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))


if __name__ == '__main__':
    main()


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

    l = 0
    r = k[-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)
        if c <= m:
            r = m
        else:
            l = m
        m = (l + r) // 2

    print(r)


if __name__ == '__main__':
    main()
# Original solution
import heapq

n, a, b = list(map(int, input().split()))
h = []
for i in range(n):
    h.append(int(eval(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)

# Optimized solution
n, a, b = list(map(int, input().split()))
h = []
for i in range(n):
    h.append(int(eval(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)
# Original solution
import math
import io

nim, mike, kite = list(map(int, input().split()))
H = [int(eval(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)


# Optimized solution
nim, mike, kite = list(map(int, input().split()))
H = [int(eval(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)
# Original solution
def main():
    N, A, B = (int(i) for i in input().split())
    H = [int(eval(input())) for i in range(N)]

    def is_ok(x):
        y = 0  # 中心爆破必要回数
        for i, h in enumerate(H):
            if h - x*B <= 0:
                continue
            le = 0
            ri = 10**9 + 1
            while ri - le > 1:
                mid = le + ((ri - le) // 2)
                if h - B*(max(x - mid, 0)) - A*mid <= 0:
                    ri = mid
                else:
                    le = mid
            y += ri
        if y <= x:  # 魔物を消し去るのが可能
            return True
        else:
            return False

    def binary_search_meguru():
        left = -1
        right = 10**9 + 1
        while right - left > 1:
            mid = left + ((right - left) // 2)
            if is_ok(mid):
                right = mid
            else:
                left = mid
        return right

    print((binary_search_meguru()))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    N, A, B = (int(i) for i in input().split())
    H = [int(eval(input())) for i in range(N)]

    def is_ok(H, mid):
        H = [h - mid*B for h in H]
        need = 0
        for h in H:
            if h > 0:
                need += (h + (A - B) - 1)//(A - B)
        if need <= mid:
            return True
        else:
            return False

    def binary_search_meguru(H):
        ng = -1
        ok = 10**9 + 1
        while abs(ok - ng) > 1:
            mid = ng + (ok - ng) // 2  # 爆破回数
            if is_ok(H, mid):
                ok = mid
            else:
                ng = mid
        return ok

    print((binary_search_meguru(H)))


if __name__ == '__main__':
    main()
# Original solution
import math

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


def check(t):
    cnt = 0
    for i in range(N):
        cnt += max(0, math.ceil((h[i] - B * t) / (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)

# Optimized solution
import math

N, A, B = list(map(int, input().split()))
h = [int(eval(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)