CodeEff/ECCO huggingface dataset:
# Original solution
# -*- coding: utf-8 -*-
"""
D - Megalomania
https://atcoder.jp/contests/abc131/tasks/abc131_d

"""
import sys


from heapq import heappop, heappush

def solve(N, tasks):
    ct = 0
    hq = []
    for a, b in tasks:
        heappush(hq, (b, a))

    while hq:
        b, a = heappop(hq)
        ct += a
        if ct > b:
            return 'No'
    return 'Yes'


def main(args):
    N = int(eval(input()))
    tasks = [[int(i) for i in input().split()] for _ in range(N)]
    ans = solve(N, tasks)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


# Optimized solution
# -*- coding: utf-8 -*-
"""
D - Megalomania
https://atcoder.jp/contests/abc131/tasks/abc131_d

"""
import sys


def solve(N, tasks):
    ct = 0
    tasks.sort(key=lambda x: x[1], reverse=True)

    while tasks:
        a, b = tasks.pop()
        ct += a
        if ct > b:
            return 'No'
    return 'Yes'


def main(args):
    N = int(eval(input()))
    tasks = [[int(i) for i in input().split()] for _ in range(N)]
    ans = solve(N, tasks)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
# Original solution
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
X = sorted(X, key = lambda x: x[1])

# a[i]はA[i]まで終わらせるためにかかる累積時間
a = [0] * N
a[0] = X[0][0]
for i in range(1, N):
	a[i] = a[i - 1] + X[i][0]

for j in range(N):
	if a[j] > X[j][1]:
		print("No")
		exit()
print("Yes")


# Optimized solution
# 締切の早いものから順番に見ていくのが最適戦略
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
X = sorted(X, key=lambda x: x[1])  # B (締切の早い順にソート)

res = 0
for i in range(N):
    res += X[i][0]
    if res > X[i][1]:
        print("No")
        exit()
print("Yes")
# Original solution
import sys
input = sys.stdin.readline

def my_sort(L, p, q):
    C = [[i, -1] for i in range(q - p + 1)]
    if p < q:
        mid = (p + q) // 2
        A = my_sort(L, p, mid)
        B = my_sort(L, mid + 1, q)
        i = 0
        j = 0
        k = 0
        while k < q - p + 1:
            if i >= mid - p + 1:
                C[k] = B[j]
                j += 1
            elif j >= q - mid:
                C[k] = A[i]
                i += 1
            else:
                if A[i][1] <= B[j][1]:
                    C[k] = A[i]
                    i += 1
                else:
                    C[k] = B[j]
                    j += 1
            k += 1
        return C
    else:
        return [L[p]]

n = int(eval(input()))
task = []
time_total = [0 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task = my_sort(task, 0, n - 1)
time_total[0] = task[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task[i + 1][0]
while i < n:
    if time_total[i] > task[i][1]:
        print("No")
        sys.exit()
    i += 1
print("Yes")

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

n = int(eval(input()))
task = []
time_total = [-1 for i in range(n)]
for i in range(n):
    task.append([int(i) for i in input().split()])
task_sorted = sorted(task, key = lambda x:x[1])
time_total[0] = task_sorted[0][0]
for i in range(n - 1):
    time_total[i + 1] = time_total[i] + task_sorted[i + 1][0]
for i in range(n):
    if time_total[i] > task_sorted[i][1]:
        print("No")
        sys.exit()
print("Yes")
# Original solution
#python3
from operator import itemgetter 
from itertools import accumulate
def main():
    n = int(eval(input()))
    d = []
    for _ in range(n):
        x, y = list(map(int, input().split()))
        d.append((x, y))
    d.sort(key=itemgetter(1))
    acc = 0
    f = True
    for i in range(n):
        acc = acc+d[i][0] 
        if acc > d[i][1]:
            f = False
    if f:
        print('Yes')
    else:
        print('No')
main()


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from operator import itemgetter 
def main():
    N = int(readline())
    tasks = []
    for _ in range(N):
        a, b = list(map(int, readline().split()))
        tasks.append((a, b))
    tasks.sort(key=itemgetter(1))
    time = 0
    for a, b in tasks:
        time += a
        if time > b:
            print('No')
            return  
    print('Yes')
if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))

task_list = []

for i in range(n):
    a, b = list(map(int, input().split()))
    task_list.append((a, b))

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

current = 0

for task in task_list:
    current += task[0]
    if current > task[1]:
        print("No")
        exit()

print("Yes")

# Optimized solution
n = int(eval(input()))
tasks = [list(map(int, input().split())) for _ in range(n)]
tasks.sort(key=lambda x: x[1])

current_time = 0

for task in tasks:
    current_time += task[0]
    if current_time > task[1]:
        print("No")
        exit()

print("Yes")
# Original solution
N=int(eval(input()))
AB=[]
for i in range(N):
  a,b=list(map(int, input().split()))
  AB.append([a,b])
AB=sorted(AB, key=lambda x: x[1])

addtime=0
nowtime=0
for i in range(N):
  a=AB[i][0]
  b=AB[i][1]
  nowtime+=a
  if nowtime>b:
    print("No")
    exit()
print("Yes")

# Optimized solution
N=int(eval(input()))

now=0
L=[]
for i in range(N):
    a,b=list(map(int, input().split()))
    L.append((a,b))

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

for i in range(N):
    t=L[i]
    a,b=t
    if now+a<=b:
        now+=a
    else:
        print("No")
        exit()

print("Yes")
# Original solution
import sys

N = int(eval(input()))
task = []
time = 0

for i in range(1,N+1) :
    A, B =input().split()
    task.append((int(A) ,int(B)))
    work = sorted(task, key = lambda x:(x[1]))
for i in range(N) :
    time += work[i][0]
    if time > work[i][1] :
        print("No")
        sys.exit()

print("Yes")





# Optimized solution
import sys

N = int(eval(input()))
tasks = sorted([list(map(int,input().split())) \
        for _ in range(N)],key = lambda x:(x[1]))
time = 0

for i in range(N) :
    time += tasks[i][0]
    if time > tasks[i][1] :
        print("No")
        sys.exit()

print("Yes")
# Original solution
N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]

task.sort(key=lambda x: x[1])

t = 0
ans = "Yes"

for i in range(N):
    a = task[i][0]
    b = task[i][1]
    t += a
    if t > b:
        ans = "No"
        break

print(ans)


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

t = 0
ans = "Yes"

for a, b in sorted(task, key=lambda x: x[1]):
    t += a
    if t > b:
        ans = "No"
        break

print(ans)
# Original solution
N = int(eval(input()))
AB = [[0]*2 for i in range(N)]

for i in range(N):
    AB[i] = list(map(int, input().split()))

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

time = 0
for i in range(N):
    time += AB[i][0]
    if time > AB[i][1]:
        print("No")
        exit(0)

print("Yes")


# Optimized solution
N = int(eval(input()))
AB = [tuple(map(int, input().split())) for i in range(N)]


AB.sort(key=lambda x: x[1])
t = 0
for a, b in AB:
    t += a
    if t <= b:
        continue
    else:
        print("No")
        exit(0)
print("Yes")
# Original solution


n = int(eval(input()))

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


abn.sort()
abn.sort(key = lambda x:x[1])


#print(abn)

ts = 0 # time_stamp
enable = True
for abi in abn:
    a, b = abi

    if not ts + a <= b:
        enable = False
        break
    else:
        ts += a

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

# Optimized solution

n = int(eval(input()))

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


#abn.sort()
abn.sort(key = lambda x:x[1])


#print(abn)

ts = 0 # time_stamp
enable = True
for abi in abn:
    a, b = abi

    if not ts + a <= b:
        enable = False
        break
    else:
        ts += a

print(('Yes' if enable else 'No'))
# Original solution
n = int(eval(input()))
time = [0]*n
dl = [0]*n
for i in range(n):
    time[i], dl[i] = list(map(int, input().split()))
count = 0
while len(dl):
    index = dl.index(min(dl))
    count += time[index]
    if count > dl[index]:
        print("No")
        exit()
    dl.pop(index)
    time.pop(index)
print("Yes")


# Optimized solution
n = int(eval(input()))
jobs = [list(map(int, input().split())) for _ in range(n)]
jobs.sort(key=lambda x:x[1])
count = 0
for i in range(n):
    count += jobs[i][0]
    if count > jobs[i][1]:
        print("No")
        exit()
print("Yes")
# Original solution
N = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(N)]
time = 0
ab = sorted(ab, key=lambda x:x[1])
for a, b in ab:
  time += a
  if time <= b:
    pass
  else:
    print('No')
    exit()
print('Yes')

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

N = int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(N)]
ab = sorted(ab, key=lambda x:x[1])
now = 0
for a, b in ab:
  if now + a <= b:
    now += a
  else:
    print('No')
    exit()
print('Yes')
# Original solution
from operator import itemgetter
N=int(eval(input()))
tasks=[list(map(int,input().split())) for _ in range(N)]
tasks.sort(key=itemgetter(1))
t=0
for w,l in tasks:
    if t+w>l:
        print('No')
        exit()
    t+=w
print('Yes')

# Optimized solution
import sys
def main():
    input = sys.stdin.readline
    N=int(eval(input()))
    tasks=[tuple(map(int, input().split())) for _ in range(N)]

    from operator import itemgetter
    tasks.sort(key=itemgetter(1))
    t=0
    for task in tasks:
        t += task[0]
        if t > task[1]:
            print('No')
            return
    print('Yes')

if __name__ == '__main__':
    main()
# Original solution
def dec(X, d):
    X[1] -= d
    return X


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

task.sort(key=lambda x: x[1])

while task:
    if task[0][1] - task[0][0] < 0:
        print("No")
        exit()
    task = list([dec(x, task[0][0]) for x in task[1:]])

print("Yes")


# Optimized solution
def dec(X, d):
    X[1] -= d
    return X


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

task.sort(key=lambda x: x[1])
time = 0
for i in range(N):
    time += task[i][0]
    if time > task[i][1]:
        print("No")
        exit()

print("Yes")
# Original solution
n=int(eval(input()))
a=[list(map(int,input().split())) for _ in range(n)]
a.sort(key=lambda x: x[1])
t=0
for i in range(n):
  t+=a[i][0]
  if t>a[i][1]:
    print("No")
    break
  elif i==n-1:
    print("Yes")


# Optimized solution
import sys
readline=sys.stdin.readline
n=int(eval(input()))
a=[list(map(int, readline().split())) for _ in range(n)]
a.sort(key=lambda x: x[1])
t=0
for i in range(n):
  t+=a[i][0]
  if t>a[i][1]:
    print("No")
    break
  elif i==n-1:
    print("Yes")
# Original solution
n=int(eval(input()))
a=[]
time=0
for i in range(n):
    x,y=list(map(int,input().split()))
    a.append([x,y])
c=sorted(set([a[i][1] for i in range(n)]))
for i in c:
    for x,y in a:
        if i==y:
            time+=x
            if time>y:
                print("No")
                exit()
print("Yes")

# Optimized solution
n=int(eval(input()))
a,f,b=sorted([list(map(int,input().split())) for i in range(n)],key=lambda x:x[1]),1,0
for i in range(n):
    b+=a[i][0] 
    if b>a[i][1]: 
        f=0 
print(('Yes' if f==1 else 'No'))
# Original solution
n=int(eval(input()))
ab=[list(map(int,input().split()))]
b=[ab[0]]
answer=1
for i in range(n-1):
    k=list(map(int,input().split()))#kを今からbの値でソートします
    d=0#何番目に入れるのが最適化を探すための代数です。
    while  d<=i and k[1]<=ab[d][1]:
        d+=1
    ab.insert(d,k) 
    b.insert(d,k)
#print(ab)
#print(b)
k=0
for t in range(n):
    k+=ab[n-1-t][0]
    #print([k,answer])
    if k>ab[n-1-t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')

# Optimized solution
n=int(eval(input()))
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[1])
#print(ab)
k=0
answer=1
for t in range(n):
    k+=ab[t][0]
    #print([k,answer])
    if k>ab[t][1]:
        answer=answer*0
if answer==1:
    print('Yes')
else:
    print('No')
# Original solution
n=int(eval(input()))
a=[[0 for i in range(2)] for j in range(n)]
for i in range(n):
    a[i][1],a[i][0]=list(map(int,input().split()))
b=sorted(a)
c=[b[i][1] for i in range(n)]
ans="Yes"
for i in range(n):
    if b[i][0]<sum(c[:i+1]):
        ans="No"
        break
print(ans)

# Optimized solution
n=int(eval(input()))
# a=[[0]*2]*n
a=[[0 for i in range(2)] for j in range(n)]
for i in range(n):
    a[i][1],a[i][0]=list(map(int,input().split()))
b=sorted(a)
c=[b[i][1] for i in range(n)]
ans="Yes"
d=0
for i in range(n):
    d+=c[i]
    if b[i][0]<d:
        ans="No"
        break
print(ans)
# Original solution
import sys
readline = sys.stdin.readline
from operator import itemgetter

def main():
    N = int(readline())
    AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
    AB.sort(key=itemgetter(1))
    t = 0
    for a, b in AB:
        if t + a > b:
            print('No')
            return
        t += a
    
    print('Yes')

if __name__ == '__main__':
    main()

# Optimized solution
import sys
readline = sys.stdin.readline
from operator import itemgetter

def main():
    N = int(readline())
    AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
    AB.sort(key=itemgetter(1))
    t = 0
    for a, b in AB:
        t += a
        if t > b:
            print('No')
            return
        
    print('Yes')

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

def main():
    N = int(readline())
    AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
    AB.sort(key=itemgetter(1))
    t = 0
    for a, b in AB:
        t += a
        if t > b:
            print('No')
            return
        
    print('Yes')

if __name__ == '__main__':
    main()

# Optimized solution
import sys
readline = sys.stdin.readline
from operator import itemgetter

def main():
    N = int(readline())
    AB = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]
    AB.sort(key=itemgetter(1))
    t = 0
    for a, b in AB:
        t += a
        if t > b:
            print('No')
            return
        
    print('Yes')

if __name__ == '__main__':
    main()
# Original 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()))

# Optimized solution
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
N = int(eval(input()))
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])

ans = "Yes"
t = 0
for a, b in AB:
    t += a
    if t > b:
        ans = "No"
        break

print(ans)
# Original solution
N=int(eval(input()))
works=[]
for i in range(N):
    [a,b]=[int(_) for _ in input().split()]
    works.append([b,a])
works.sort()
works2=works[:1]
for work in works[1:]:
    if work[0]==works2[-1][0]:
        works2[-1][1]+=work[1]
    else:
        works2.append([work[0],works2[-1][1]])
        works2[-1][1]+=work[1]

if all([work[0]>=work[1] for work in works2]):
    print('Yes')
else:
    print('No')

# Optimized solution
n = int(eval(input()))
W = []
for i in range(n):
    a, b = list(map(int, input().split()))
    W.append((a, b))
W.sort(key=lambda x: x[1])
x = 0
for i in range(n):
    a, b = W[i]
    x += a
    if x > b:
        print('No')
        exit()
print('Yes')
# Original solution

import math
n,a,b = list(map(int, input().split()))

m = [0] * n
for i in range(n):
  m[i] = int(eval(input()))
  

m.sort()


def enough(m,a,b,T):
  cnt = 0
  for hp in m:
    if hp > b*T:
      cnt += int(math.ceil((hp - b*T)/(a-b)))
      
  return True if  cnt <= T else False

r = 10**100
#r = 30
l = 0
mid = 0

while r - l > 1:
  mid = (r+l)//2
  if enough(m,a,b,mid) == True:
    r = mid
    #print("r:",r)
  else:
    l = mid
    #print("l:",l, " r:",r)

print(r)

# Optimized solution

import math
n,a,b = list(map(int, input().split()))

m = [0] * n
for i in range(n):
  m[i] = int(eval(input()))
  

m.sort()


def enough(m,a,b,T):
  cnt = 0
  for hp in m:
    if hp > b*T:
      cnt += int(math.ceil((hp - b*T)/(a-b)))
      
  return True if  cnt <= T else False

r = 10**10
#r = 30
l = 0
mid = 0

while r - l > 1:
  mid = (r+l)//2
  if enough(m,a,b,mid) == True:
    r = mid
    #print("r:",r)
  else:
    l = mid
    #print("l:",l, " r:",r)

print(r)
# Original solution

import math
n,a,b = list(map(int, input().split()))

m = [0] * n
for i in range(n):
  m[i] = int(eval(input()))
  

m.sort()


def enough(m,a,b,T):
  cnt = 0
  for hp in m:
    if hp > b*T:
      cnt += int(math.ceil((hp - b*T)/(a-b)))
      
  return True if  cnt <= T else False

r = 10**10
#r = 30
l = 0
mid = 0

while r - l > 1:
  mid = (r+l)//2
  if enough(m,a,b,mid) == True:
    r = mid
    #print("r:",r)
  else:
    l = mid
    #print("l:",l, " r:",r)

print(r)

# Optimized solution
import math
N, A, B = list(map(int, input().split()))

H = [int(eval(input())) for _ in range(N)]


H.sort(reverse=True)
high = math.ceil(H[0] / B)
low = 0
while high > low+1:
    mid = (high+low) // 2
    cnt = 0
    for i in range(N):
        if H[i] - mid*B > 0:
            # 残りを減らすのに必要な回数を計上
            cnt += math.ceil((H[i] - mid*B)/(A - B))
        else:
            break
    # 残りを減らす回数がmidを超えているならその回数ではすべてを倒しきれない
    if cnt <= mid:
        high = mid
    else:
        low = mid

print(high)
# Original solution
import math

N,A,B = list(map(int, input().split()))

H = [int(eval(input())) for _ in range(N)]
H.sort(reverse=True)

# mid回の攻撃で全撃破できるか確認。
hi = H[0]
lo = 1


while hi - lo > 1:
    can_defeat_all_enemies = True
    mid = (hi+lo) // 2
    cnt_extra_attack = 0

    for i in range(N):
        if H[i] > mid * B:
            cnt_extra_attack += math.ceil((H[i] - mid * B) / (A - B))
        # 降順に並べてあるので、あるモンスターで追加攻撃が必要なければそれ以降も必要ない
        else:
            break
    
    # mid以下しか追加攻撃が必要ないので倒しきれる
    if cnt_extra_attack <= mid:
        hi = mid
    else:
        lo = mid

print(hi)


# Optimized solution
import math

N,A,B = list(map(int, input().split()))

H = [int(eval(input())) for _ in range(N)]
H.sort(reverse=True)

# mid回の攻撃で全撃破できるか確認。
hi = math.ceil(H[0] / B)
lo = 1


while hi - lo > 1:
    can_defeat_all_enemies = True
    mid = (hi+lo) // 2
    cnt_extra_attack = 0

    for i in range(N):
        if H[i] > mid * B:
            cnt_extra_attack += math.ceil((H[i] - mid * B) / (A - B))
        # 降順に並べてあるので、あるモンスターで追加攻撃が必要なければそれ以降も必要ない
        else:
            break
    
    # mid以下しか追加攻撃が必要ないので倒しきれる
    if cnt_extra_attack <= mid:
        hi = mid
    else:
        lo = mid

print(hi)
# Original solution
from math import ceil
n, a, b = list(map(int, input().split()))
h = [int(eval(input())) for i in range(n)]

def enough(t):
    count = 0
    for hp in h:
        count += ceil(max(0, hp - b*t) / (a-b))
    if(count <= t):
        return True
    else:
        return False


high = ceil(max(h)/b)
low = 0
mid = ceil((high + low) / 2)
while(enough(mid)==enough(mid-1)):
    mid = (high + low) // 2
    if(enough(mid)):
        high = mid
    else:
        low = mid
print(mid)


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

def enough(t):
    count = 0
    for hp in h:
        count += ceil(max(0, hp - b*t) / (a-b))
    if(count <= t):
        return True
    else:
        return False


high = ceil(max(h)/b)
low = 0
while(high - low > 0):
    mid = (high + low) // 2
    if(enough(mid)):
        high = mid
    else:
        low = mid + 1
print(low)
# Original solution
import math

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

add_damage = A-B
left = 1
right = 10**9
ans = float('inf')

for i in range(int(math.log(10**9, 2)+1)):
    T = (left+right) // 2
    h = H.copy()
    h = list([math.ceil(max(0, x-T*B) / add_damage) for x in h])
    need = sum(h)
    
    if need <= T:
        right = T
        ans = min(ans, T)
    else:
        left = T

print(ans)

# Optimized solution
from math import ceil
N, A, B = list(map(int, input().split()))
H = sorted([int(eval(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)
# Original 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)


# 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  # Aを追加ダメージ扱いにする


ok, ng = 10 ** 9, 0
while abs(ok - ng) > 1:
    X = (ok + ng) // 2
    H_damaged = [h - (B * X) for h in H if h - (B * X) > 0]
    Need = sum([ceil(h / A) for h in H_damaged])

    if X >= Need:
        ok = X
    else:
        ng = X

print(ok)
# Original solution
n, a, b = list(map(int, input().split()))
hlist = [int(eval(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)


# Optimized solution
def main():
    n, a, b = list(map(int, input().split()))
    h = [int(eval(input())) for _ in range(n)]
    low, high = 0, 1000000000000000000
    while low < high:
        mid = (low + high) // 2
        tmp = 0
        for _h in h:
            if _h > mid * b:
                tmp += (_h - mid * b + a - b - 1) // (a - b)
        if tmp > mid:
            low = mid + 1
        else:
            high = mid
    print(low)


if __name__ == '__main__':
    main()
# Original solution
n,a,b=list(map(int,input().split()))
h=[int(eval(input())) for i in range(n)]

h_sum=sum(h)

ok=10**9
ng=0
while abs(ok-ng)>1:
 mid=(ok+ng)//2

 l=[max(i-(mid*b),0) for i in h]
 cnt=0
 for j in l:

#  if j<=0:
#   continue

  if j%(a-b)==0:
   cnt+=j//(a-b)
  else:
   cnt+=j//(a-b)+1

 if cnt<=mid:
  ok=mid
 else:
  ng=mid

print(ok)

# Optimized solution
n,a,b=list(map(int,input().split()))
h=[int(eval(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)
# Original 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()


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

    l = k[-1] // a - 1
    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)
        if c <= m:
            r = m
        else:
            l = m

        m = (l + r) // 2

    print(r)


if __name__ == '__main__':
    main()