Buggy python submission (verdict: Time Limit Exceeded):
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
s = []
for _ in range(N):
  A,B = (int(x) for x in input().rstrip('\n').split())
  s.append([A,B])
m = sorted(list(set(x[1] for x in s)))
check = 0
for i in m:
  if sum([x[0] for x in s if x[1]<=i]) > i:
    check += 1
    print('No')
    break
if check == 0:
  print('Yes')

Fixed submission:
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
s = {}
for _ in range(N):
  A,B = (int(x) for x in input().rstrip('\n').split())
  if B in s:
    s[B] += A
  else:
    s[B] = A
m = sorted(list(set(s)))
check = 0
used = 0
for i in m:
  used += s[i]
  if used > i:
    check += 1
    print('No')
    break
if check == 0:
  print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
s = []
for _ in range(N):
  A,B = (int(x) for x in input().rstrip('\n').split())
  s.append([A,B])
m = sorted(list(set(x[1] for x in s)))
used = 0
check = 0
for i in m:
  xs = [x for x in s if x[1]==i]
  used += sum([x[0] for x in xs]) 
  if used > i:
    check += 1
    print('No')
    break
if check == 0:
  print('Yes')

Fixed submission:
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
s = {}
for _ in range(N):
  A,B = (int(x) for x in input().rstrip('\n').split())
  if B in s:
    s[B] += A
  else:
    s[B] = A
m = sorted(list(set(s)))
check = 0
used = 0
for i in m:
  used += s[i]
  if used > i:
    check += 1
    print('No')
    break
if check == 0:
  print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
s = []
for _ in range(N):
  A,B = (int(x) for x in input().rstrip('\n').split())
  s.append([A,B])
used = 0
now = 0
check = 0
for i in range(N):
  x = min([i[1] for i in s])
  y = min([i[0] for i in s if i[1]==x])
  used += y
  d = s.index([a for a in s if a==[y,x]][0])
  s.pop(d)
  if used > x:
    check += 1
    print('No')
    break
if check == 0:
  print('Yes')


Fixed submission:
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
s = {}
for _ in range(N):
  A,B = (int(x) for x in input().rstrip('\n').split())
  if B in s:
    s[B] += A
  else:
    s[B] = A
m = sorted(list(set(s)))
check = 0
used = 0
for i in m:
  used += s[i]
  if used > i:
    check += 1
    print('No')
    break
if check == 0:
  print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
s = []
for _ in range(N):
  A,B = (int(x) for x in input().rstrip('\n').split())
  s.append([A,B])
used = 0
now = 0
check = 0
for i in range(N):
  x = min([i[1] for i in s])
  y = min([i[0] for i in s if i[1]==x])
  used += y
  d = s.index([a for a in s if a==[y,x]][0])
  s.pop(d)
  if used > x:
    check += 1
    print('No')
    break
if check == 0:
  print('Yes')

Fixed submission:
import sys
input =sys.stdin.readline

N=int(input().rstrip('\n'))
s = {}
for _ in range(N):
  A,B = (int(x) for x in input().rstrip('\n').split())
  if B in s:
    s[B] += A
  else:
    s[B] = A
m = sorted(list(set(s)))
check = 0
used = 0
for i in m:
  used += s[i]
  if used > i:
    check += 1
    print('No')
    break
if check == 0:
  print('Yes')