TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
A_B = [list(map(int, input().split())) for _ in range(N)]
A_B.sort(key=lambda x: x[1])
count = 0
print(A_B)
for i in range(N):
    if count + A_B[i][0] <= A_B[i][1]:
        count += A_B[i][0]
        continue
    print("No")
    break
else:
    print("Yes")


N = int(input())
A_B = [list(map(int, input().split())) for _ in range(N)]
A_B.sort(key=lambda x: x[1])
count = 0
print(A_B)
for i in range(N):
    if count + A_B[i][0] <= A_B[i][1]:
        count += A_B[i][0]
        continue
    print("No")
    print(i)
    break
else:
    print("Yes")

N = int(input())
A_B = [list(map(int, input().split())) for _ in range(N)]
A_B.sort(key=lambda x: x[1])
count = 0
for i in range(N):
    if count + A_B[i][0] <= A_B[i][1]:
        count += A_B[i][0]
        continue
    print("No")
    break
else:
    print("Yes")


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())

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

AB.sort(key=lambda x: x[1],reverse=True)
print(AB)
time = AB[0][1]
for i in range(1,N):
    if time-AB[i-1][0] < AB[i][1]:
        time = time-AB[i-1][0]
    else:
        time = AB[i][1]
    print(i,time)
time = time - AB[N-1][0]
print(time)
if time < 0:
    print("No")
else:
    print("Yes")

N = int(input())

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

AB.sort(key=lambda x: x[1],reverse=True)

time = AB[0][1]
for i in range(1,N):
    if time-AB[i-1][0] < AB[i][1]:
        time = time-AB[i-1][0]
    else:
        time = AB[i][1]

time = time - AB[N-1][0]

if time < 0:
    print("No")
else:
    print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):

n = int(input())
a = []
i = 0
while i < n:
    a.append(list(map(int, input().split())))
    i += 1

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

i = 0
t = 0
while i < n:
    t += a[i][0]
    if t > a[i][1]:
        break
    i += 1

print("YES" if i >= n else "NO")



n = int(input())
a = []
i = 0
while i < n:
    a.append(list(map(int, input().split())))
    i += 1

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

i = 0
t = 0
while i < n:
    t += a[i][0]
    if t > a[i][1]:
        break
    i += 1

print("Yes" if i >= n else "No")

Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
l = [[int(j) for j in input().split()] for i in range(N)]
l = sorted(l, lambda x:x[1])
s = 0
ans = 'Yes'
for a,b in l:
    s += a
    if s > b:
        ans = 'No'
        break

print('Yes')

N = int(input())
l = [[int(j) for j in input().split()] for i in range(N)]
l = sorted(l, key=lambda x:x[1])
s = 0
ans = 'Yes'
for a,b in l:
    s += a
    if s > b:
        ans = 'No'
        break

print(ans)

Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
n = int(input())
ba = []
for i in range(n):
    a, b = (int(j) for j in input().split())
    tmp = []
    tmp.append(b)
    tmp.append(a)
    ba.append(tmp)
ba.sort()
print(ba)
s = 0
f = True
for i in range(n):
    s += ba[i][1]
    if ba[i][0] < s:
        f = False
        break
if f:
    print("Yes")
else:
    print("No")

n = int(input())
ba = []
for i in range(n):
    a, b = (int(j) for j in input().split())
    tmp = []
    tmp.append(b)
    tmp.append(a)
    ba.append(tmp)
ba.sort()

s = 0
f = True
for i in range(n):
    s += ba[i][1]
    if ba[i][0] < s:
        f = False
        break
if f:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())

lst = []
for i in range(N):
  N, K = map(int, input().split())
  lst.append((N, K))

lst.sort(key=lambda tup: tup[1])
count = 0
for x in lst:
  if count > x[0]:
    print("No")
    exit()
  count += x[1]

print("Yes")


N = int(input())

lst = []
for i in range(N):
  N, K = map(int, input().split())
  lst.append((N, K))

lst.sort(key=lambda tup: tup[1])
time = 0
for x in lst:
  time += x[0]
  if time > x[1]:
    print("No")
    exit()

print("Yes")


Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
A_B = [list(map(int,input().split())) for i in range(N)]
A_B = sorted(A_B,key=itemgetter(1))

s=0
for a_b in A_B:
  s+=a_b[0]
  lim = a_b[1]
  if s > lim:
    print("No")
    exit()
print("Yes")


import sys
from operator import itemgetter
input = sys.stdin.readline
N = int(input())
A_B = [list(map(int,input().split())) for i in range(N)]
A_B = sorted(A_B,key=itemgetter(1))

s=0
for a_b in A_B:
  s+=a_b[0]
  lim = a_b[1]
  if s > lim:
    print("No")
    exit()
print("Yes")




Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
import sys
input = sys.stdin.readline


def main():
    AB = []
    n = int(input())
    for i in range(n):
        a, b = map(int, input().split())
        AB.append([a, b])
    AB = sorted(AB, key=lambda x: (x[1], -x[0]))
    time = 0
    for span, dead in zip(AB):
        time += span
        if time > dead:
            print('No')
            return
    print('Yes')
    return


if __name__ == "__main__":
    main()


import sys
input = sys.stdin.readline


def main():
    AB = []
    n = int(input())
    for i in range(n):
        a, b = map(int, input().split())
        AB.append([a, b])
    AB = sorted(AB, key=lambda x: (x[1], -x[0]))
    time = 0
    for span, dead in AB:
        time += span
        if time > dead:
            print('No')
            return
    print('Yes')
    return


if __name__ == "__main__":
    main()


Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):

N = int(input())
a = [0] * N
b = [0] * N
c = [0] *N


for i in range(N):
    a[i],b[i] = map(int,input().split())
    c[i] = [b[i],a[i]]
   
c.sort()
sums = 0
correct = 1
for i in range(N):
    sums+=c[i][1]
    print(sums)
    if c[i][0] < sums:
        correct=0
        break
        
if correct:
    print("Yes")
else:
    print("No")

N = int(input())
a = [0] * N
b = [0] * N
c = [0] *N


for i in range(N):
    a[i],b[i] = map(int,input().split())
    c[i] = [b[i]-a[i],a[i]]
   
c.sort()
sums = 0
correct = 1
for i in range(N):
    if sums > c[i][0]:
        correct=0
        break
    else:
        sums += c[i][1]
    print(sums)

if correct:
    print("Yes")
else:
    print("No")

from operator import itemgetter

N = int(input())
a = [0] * N
b = [0] * N
c = [0] *N


for i in range(N):
    a[i],b[i] = map(int,input().split())
    c[i] = [b[i],a[i]]
   
c.sort()
sums = 0
correct = 1
for i in range(N):
    sums+=c[i][0]
    if b[i][1] >sums:
        correct=0
        break

if correct:
    print("Yes")
else:
    print("No")

N = int(input())
a = [0] * N
b = [0] * N
c = [0] *N


for i in range(N):
    a[i],b[i] = map(int,input().split())
    c[i] = [b[i],a[i]]
   
c.sort()
sums = 0
correct = 1
for i in range(N):
    sums+=c[i][1]

    if c[i][0] >sums:
        correct=0
        break
        
if correct:
    print("Yes")
else:
    print("No")

N = int(input())
a = [0] * N
b = [0] * N
c = [0] *N


for i in range(N):
    a[i],b[i] = map(int,input().split())
    c[i] = [b[i],a[i]]
   
c.sort()
sums = 0
correct = 1
for i in range(N):
    sums+=c[i][1]

    if c[i][0] >sums:
        correct=0
        break
        
if correct:
    print("Yes")
else:
    print("No")

from operator import itemgetter

N = int(input())
a = [0] * N
b = [0] * N
c = [0] *N


for i in range(N):
    a[i],b[i] = map(int,input().split())
    c[i] = [b[i],a[i]]
   
c.sort()
sums = 0
correct = 1
for i in range(N):
    sums+=c[i][1]
    if c[i][0] < sums:
        correct=0
        break
        
if correct:
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
def main():
    n = int(input())
    abl = []
    for _ in range(n):
        a, b = map(int, input().split()) 
        abl.append([a,b])

    abl.sort(key=lambda x:x[1])
    curr_time = 0
    for curr_ab in abl:
        print(curr_time)
        a,b = curr_ab
        curr_time += a
        if curr_time > b:
            print('No')
            return
    print('Yes')


if __name__ == "__main__":
    main()

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

    abl.sort(key=lambda x:x[1])
    curr_time = 0
    for curr_ab in abl:
        # print(curr_time)
        a,b = curr_ab
        curr_time += a
        if curr_time > b:
            print('No')
            return
    print('Yes')


if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
import sys
N = int(input())
List = []
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    List.append([tmp_b,tmp_a])
List.sort()
Sum_a= 0

for i in range(N):
    Sum_a += List[i][1]
    if Sum_a > List[i][0]:
        print('No')
        sys.exit()
print('YES')


import sys
N = int(input())
List = []
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    List.append([tmp_b,tmp_a])
List.sort()
Sum_a= 0

for i in range(N):
    Sum_a += List[i][1]
    if Sum_a > List[i][0]:
        print('No')
        sys.exit()
print('Yes')

Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
n = int(input())

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

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

now_time = 0
flag = True
for a,b in tasks:
  if now_time + a > b:
    flag = False
    break
  now_time += a
if flag:
  print("Yes")
else:
  print("No")

n = int(input())

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

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

now_time = 0
flag = True
for a,b in tasks:
  if now_time + a > b:
    flag = False
    break
  now_time += a
if flag:
  print("Yes")
else:
  print("No")

Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
n = int(input())
a_b_list = [list(map(int,input().split())) for x in range(n)]
a_b_list_kai = [[int(a_b_list[x]),int(a_b_list[x+1])] for x in range(0,n*2,2)]
sorted(a_b_list_kai,key = lambda x:x[1])
limit = 0
result = 0
sum_task = 0
for x in a_b_list_kai:
    sum_task += x[0]
    limit = max(limit,x[1])
    if sum_task > limit:
        result = 1

if result == 1:
    print('No')
else:
    print('Yes')

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

a_b_list_kai = sorted(a_b_list_kai,key = lambda x:x[1])
limit = 0
result = 0
sum_task = 0
for x in a_b_list_kai:
    sum_task += x[0]
    limit = max(limit,x[1])
    if sum_task > limit:
        result = 1

if result == 1:
    print('No')
else:
    print('Yes')


Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
num1 = 2
num2 = 3
chk = 0
N,K =map(int,input().split())
if K > (N-1)*(N-2)//2:
	print(-1)
else:
	for i in range(2,N+1):
		print("1"+" "+str(i))
	left = (N-1)*(N-2)//2 - K
	for i in range(left):
			if N >= num2 :
				if chk == 1:
					num2 += 1
					chk = 0
				print(str(num1) + " " + str(num2))
				num2 += 1
			else:
				num1 +=1
				num2 = num1+1
				print(str(num1) + " " + str(num2))
				chk = 1

from collections import Counter
from operator import itemgetter
import math
N = int(input())
work_list = [[int(i) for i in input().split()] for i in range(N)]
new_worklist=sorted(work_list, key=itemgetter(1))
now_time = 0
for i in range (N):
	now_time += new_worklist[i][0]
	if now_time > new_worklist[i][1]:
		print("No")
		break
	if i == N-1:
		print("Yes")

Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
n,k = map(int,input().split())
s= n
ans=[]
freeNode = [2]
cur=2
ans.append([1,2])
if n==2 :
    if k>0:
        print(-1)
    else:
        print(1)
        print(1, 2)
        exit()
else:
    s=0
    c=1
    if (n-2)*(n-1)//2<k:
        print(-1)
        exit()
    else:
        while(1):
            s += c
            cur+=1
            c+=1
            freeNode.append(cur)
            ans.append([1,cur])
            if s >=k:
                break
    if cur!=n:
        remove = s-k;
        if remove:
            for v in freeNode:
                ans.append([v,cur])
                remove-=1
                if remove==0:
                    break
        for i in range(cur + 1, n + 1):
            cur+=1
            for j in range(1, cur):
                ans.append([i, j])
        print(len(ans))
        for u,v in ans:
            print(u,v)
    else:
        remove = s - k;
        if remove:
            for v in freeNode:
                ans.append([v, cur])
                remove -= 1
                if remove == 0:
                    break
        print(len(ans))
        for u, v in ans:
            print(u, v)


n= int(input())
jobs = []
for i in range(n):
    a,b = map(int,input().split())
    jobs.append([a,b])
jobs = sorted(jobs,key=lambda x:[x[1],x[0]])
time = 0
for t,e in jobs:
    time+=t
    if time>e:
        print('No')
        exit()
print('Yes')


Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N=int(input())
AB={}
B=[]
base=0
answer="Yes"

for i in range(N):
    a,b=map(int,input().split())
    if b not in AB.keys():
        AB[b]=a
        B.append(b)
    else:
        AB[b]+=a
        
B=sorted(B)

for j in B:
    base+=AB[j]
    print(base,j)
    if base>j:
        answer="No"

print(answer)

N=int(input())
AB={}
B=[]
base=0
answer="Yes"

for i in range(N):
    a,b=map(int,input().split())
    if b not in AB.keys():
        AB[b]=a
        B.append(b)
    else:
        AB[b]+=a
        
B=sorted(B)

for j in B:
    base+=AB[j]
    #print(base,j)
    if base>j:
        answer="No"

print(answer)

Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
30
384 8895
1725 9791
170 1024
4 11105
2 6
578 1815
702 3352
143 5141
1420 6980
24 1602
849 999
76 7586
85 5570
444 4991
719 11090
470 10708
1137 4547
455 9003
110 9901
15 8578
368 3692
104 1286
3 4
366 12143
7 6649
610 2374
152 7324
4 7042
292 11386
334 5720

n=int(input())
info=[]
time=0
ok=0
for i in range(n):
    a,b=map(int,input().split())
    info.append([a,b])
info2=sorted(info,key=lambda x:x[1])
for i in range(n):
    time+=info2[i][0]
    if time>info2[i][1]:
        ok=1
        break
print("Yes" if ok==0 else "No")

Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
#131d
N = int(input())
lst = []
for i in range(N):
    a, b = map(int, input())
    lst.append([b, a])
lst = sorted(lst)

lim = 0
time = 0
flag = 0
for i in lst:
    lim = i[0]
    if time + i[1] <= lim:
        time += i[1]
    else:
        flag = 1
        break
if flag == 0:
    print('Yes')
else:
    print('No')

#131d
N = int(input())
lst = []
for i in range(N):
    a, b = map(int, input().split())
    lst.append([b, a])
lst = sorted(lst)

lim = 0
time = 0
flag = 0
for i in lst:
    lim = i[0]
    if time + i[1] <= lim:
        time += i[1]
    else:
        flag = 1
        break
if flag == 0:
    print('Yes')
else:
    print('No')

Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
ls = []
now = 0
simekiri = 0
flag = 0
for i in range(N):
    a,b = map(int,input().split())
    ls.append([b,a])
ls.sort()
print(ls)
for i in range(len(ls)):
    simekiri = ls[i][0]
    now += ls[i][1]
    if now > simekiri:
        print("No")
        flag += 1
        break
if flag == 0:
    print("Yes")

N = int(input())
ls = []
now = 0
simekiri = 0
flag = 0
for i in range(N):
    a,b = map(int,input().split())
    ls.append([b,a])
ls.sort()
for i in range(len(ls)):
    simekiri = ls[i][0]
    now += ls[i][1]
    if now > simekiri:
        print("No")
        flag += 1
        break
if flag == 0:
    print("Yes")


Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
import heapq

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

pq = []

for ab in abs:
  a,b = ab[0],ab[1]
  heapq.heappush(pq, tuple([b,a]))
  
dl = 0
tc = 0

ans = "Yes"

for i in range(n):
  ba = pq.pop()
  dl = ba[0]
  tc += ba[1]
  if dl < tc:
    ans = "No"
    break
print(ans)

import heapq

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

pq = []

for ab in abs:
  a,b = ab[0],ab[1]
  heapq.heappush(pq, tuple(b,a))
  
dl = 0
tt = 0

ans = "Yes"

for i in range(n):
  ba = pq.pop()
  dl += ba[0]
  tt += ba[1]
  if dl > tt:
    ans = "No"
    break
print(ans)

import heapq
import sys
input = sys.stdin.readline

def main():
  n = int(input())
  abs = [tuple(map(int, input().split())) for _ in range(n)]

  pq = []

  for ab in abs:
    a,b = ab[0],ab[1]
    heapq.heappush(pq, tuple([b,a]))

  dl = 0
  tc = 0

  ans = "Yes"

  for i in range(n):
    ba = heapq.heappop(pq)
    dl = ba[0]
    tc += ba[1]
    if dl < tc:
      ans = "No"
      break
  print(ans)
  
if __name__ == "__main__":
  main()

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
n = int(input())

 task_lis = [[int(r) for i in input().split()] for _ in range(n)]


sum_a = 0
ch_over = 1

for i in range(n):
    sum_a += task_lis[i][1]
    if task_lis[i][0] < sum_a:
        ch_over = 0
        break

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


n = int(input())

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


sum_a = 0
ch_over = 1

for i in range(n):
    sum_a += task_lis[i][1]
    if task_lis[i][0] < sum_a:
        ch_over = 0
        break

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


import bisect
import sys
input = sys.stdin.readline()

n = int(input())

a, b = map(int, input().split())
task_lis = [[b, a]]

for i in range(n-1):
    a, b = map(int, input().split())
    bisect.insort_right(task_lis,[b, a])

sum_a = 0
ch_over = 1

for i in range(n):
    sum_a += task_lis[i][1]
    if task_lis[i][0] < sum_a:
        ch_over = 0
        break

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


n = int(input())
task_lis = sorted([[int(i) for i in input().split()] for _ in range(n)])


sum_a = 0
ch_over = 1

for i in range(n):
    sum_a += task_lis[i][1]
    if task_lis[i][0] < sum_a:
        ch_over = 0
        break

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


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


sum_a = 0
ch_over = 1

for i in range(n):
    sum_a += task_lis[i][1]
    if task_lis[i][0] < sum_a:
        ch_over = 0
        break

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


n = int(input())

 task_lis = sorted([[int(i) for i in input().split()] for _ in range(n)])


sum_a = 0
ch_over = 1

for i in range(n):
    sum_a += task_lis[i][1]
    if task_lis[i][0] < sum_a:
        ch_over = 0
        break

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


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


sum_a = 0
ch_over = 1

for i in range(n):
    sum_a += task_lis[i][0]
    if task_lis[i][1] < sum_a:
        ch_over = 0
        break

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
AB = []
for i in range(N):
  AB_1,AB_2 = map(int,input().split())
  AB.append([AB_1,AB_2])
AB.sort(key=lambda AB: AB[0],reverse=True)
AB.sort(key=lambda AB: AB[1])
time = 0
count = 0
while count < N:
  for i in range(N):
    time += AB[i][0]
    if time > AB[i][1]:
      ans = "No"
      break

N = int(input())
AB = []
for i in range(N):
  AB_1,AB_2 = map(int,input().split())
  AB.append([AB_1,AB_2])
AB.sort(key=lambda AB: AB[1])
time = 0
count = 0
ans = "Yes"

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


Verdicts: Time Limit Exceeded

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
n=int(input())
l=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append((a,b))
l.sort(key=lambda x:x[1])
tmp=0
for i in range(n):
    tmp+=l[i][0]
    if tmp>l[i][1]:
        print("NO")
        exit()
print("YES")

n=int(input())
l=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append((a,b))
l.sort(key=lambda x:x[1])
tmp=0
for i in range(n):
    tmp+=l[i][0]
    if tmp>l[i][1]:
        print("No")
        exit()
print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
C = list(zip(B, A))
C.sort()
B, A = zip(*C)
t = 0
for c in C:
    t += c[1]
    if t <= c[0]:
        continue
    else:
        print('no')
        exit()
print('yes')


N = int(input())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
C = list(zip(B, A))
C.sort()
B, A = zip(*C)
t = 0
for c in C:
    t += c[1]
    if t <= c[0]:
        continue
    else:
        print('No')
        exit()
print('Yes')


Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
X = []
for _ in range(N):
    buffX = list(map(int, input().split()))
    X.append(buffX)

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

result = True
time = 0
for i in range(N):
    time += X[i][0]
    if time > X[i][1]:
        result = False
        break

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


N = int(input())
X = []
for _ in range(N):
    buffX = list(map(int, input().split()))
    X.append(buffX)

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

result = True
time = 0
for i in range(N):
    time += X[i][0]
    if time > X[i][1]:
        result = False
        break

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


Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
a = [int(input()) for i in range(1)]
n = a[0]
works = [list(map(int, input().split())) for i in range(n)]
#print(works)  
works = sorted(works, key=lambda x: x[1])
print(works)
work_time = 0
for w in works:
  work_time += w[0]
  if work_time > w[1]:
    print("No")
    break
else:
  print("Yes")

a = [int(input()) for i in range(1)]
n = a[0]
works = [list(map(int, input().split())) for i in range(n)]
#print(works)  
works = sorted(works, key=lambda x: x[1])
print(works)
work_time = 0
for w in works:
  work_time += w[0]
  if work_time > w[1]:
    print("No")
    print(w)
    break
else:
  print("Yes")


import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
AB = np.array([lr() for _ in range(N)])
AB = AB[np.argsort(AB[:, 1])]
A = AB[:, 0]
B = AB[:, 1]
bl = np.all(A.cumsum() <= B)
print('Yes' if bl else 'No')
# 

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
import sys

n = int(input())
ab = []
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
    
ab.sort(key=lambda x:x[1])

limit = 0
for i in range(n):
    limit += ab[i][0]
    if limit < ab[i][1]:
        print("No")
        sys.exit()

print("Yes")

import sys

n = int(input())
ab = []
for i in range(n):
    a,b = map(int,input().split())
    ab.append([a,b])
    
ab.sort(key=lambda x:x[1])

limit = 0
for i in range(n):
    limit += ab[i][0]
    if limit > ab[i][1]:
        print("No")
        sys.exit()

print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
n=int(input())
d=[]
judge=True
bag=[]
for i in range(n):
    a,b=map(int,input().split())
    d.append([a,b])
d.sort(key=itemgetter(1))
        
for j in range(len(d)):
    bag.append(d[j][0])
    if sum(bag)>d[j][1]:
        judge=False
else:
    if judge==True:
        print("Yes")
    else:
        print("No")

n=int(input())
bag=[]
ans="Yes"
total=0
for i in range(n):
    a,b=map(int,input().split())
    bag.append([a,b])
d=sorted(bag, key=lambda x:x[1])

for j in range(n):
    total=total+d[j][0]
    if total>d[j][1]:
        ans="No"
        

print(ans)

Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
a, b, c, d = map(int, input().split())

import fractions
import math

x = int(int(b//c) - int(math.ceil(a/c)) + 1)
y = int(int(b//d) - int(math.ceil(a/d)) + 1)
e = int(int(c*d)//int(fractions.gcd(c,d)))
z = int(int(b//e) - int(math.ceil(a/e)) + 1)

print(int(b-a+1-x-y+z))


n =  int(input())

x = []
for i in range(n):
  x.append(list(map(int, input().split())))
x.sort(key=lambda x:(x[1],x[0]))

s = 0
y = 0
for i in range(n):
  s += x[i][0]
  if s > x[i][1]:
    y = 1
    print("No")
    break
if y == 0:
  print("Yes")

Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
AB = [[int(x) for x in input().split(" ")] for _ in range(N)]
AB = sorted(AB, key=lambda e: e[1])

time = 0

for i, a, b in AB:
    time += a
    if time > b:
        print("No")
        break
else:
    print("Yes")


N = int(input())
AB = [[int(x) for x in input().split(" ")] for _ in range(N)]

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

time = 0


for a, b in AB:
    time += a
    if time > b:
        print("No")
        break
else:
    print("Yes")


Verdicts: Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N = int(input())
AB = [list(map(int,input().split())) for i in range(N)]
AB.sort(key = lambda AB:AB[1])
sum = 0
flag = 0
for i in range(len(AB)):
    print(i)
    sum += AB[i][0]
    if sum > AB[i][1]:
        flag = 1

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

N = int(input())
AB = [list(map(int,input().split())) for i in range(N)]
AB.sort(key = lambda AB:AB[1])
sum = 0
flag = 0
for i in range(len(AB)):
    sum += AB[i][0]
    if sum > AB[i][1]:
        flag = 1

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

Verdicts: Wrong Answer

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
import itemgetter
N = int(input())
task = []
for i in range(N):
  M = list(map(int,input().split()))
  task.append(M)
task.sort(key = itemgetter(1))
K = 0
ans = 1
for i in range(N):
  K += task[i,0]
  if (K>task[i,1]):
    ans = 0
    break
if ans:
  print("Yes")
else:
  print("No")
  

N = int(input())
task = []
for i in range(N):
  M = list(map(int,input().split()))
  M[0],M[1]=M[1],M[0]
  task.append(M)
task.sort()
K = 0
ans = 1
for i in range(N):
  K += task[i,1]
  if (K>task[i,0]):
    ans = 0
    break
if ans:
  print("Yes")
else:
  print("No")
  

N = int(input())
task = []
for i in range(N):
  M = list(map(int,input().split()))
  task.append(M)
task.sort(1)
K = 0
ans = 1
for i in range(N):
  K += task[i,0]
  if (K>task[i,1]):
    ans = 0
    break
if ans:
  print("Yes")
else:
  print("No")
  

N = int(input())
task = []
for i in range(N):
  M = list(map(int,input().split()))
  swap(M[0],M[1])
  task.append(M)
task.sort()
K = 0
ans = 1
for i in range(N):
  K += task[i,1]
  if (K>task[i,0]):
    ans = 0
    break
if ans:
  print("Yes")
else:
  print("No")
  

import itemgetter()
N = int(input())
task = []
for i in range(N):
  M = list(map(int,input().split()))
  task.append(M)
task.sort(key = itemgetter(1))
K = 0
ans = 1
for i in range(N):
  K += task[i,0]
  if (K>task[i,1]):
    ans = 0
    break
if ans:
  print("Yes")
else:
  print("No")
  

n = int(input())
task = []
for i in range(n):
  m = list(map(int,input().split()))
  m[0],m[1]=m[1],m[0]
  task.append(m)
task.sort()
K = 0
ans = 1
for i in range(n):
  K += task[i][1]
  if (K>task[i][0]):
    ans = 0
    break
if ans:
  print("Yes")
else:
  print("No")
  


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.  Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.  It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.  Kizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.  Can Kizahashi complete all the jobs in time? If he can, print `Yes`; if he cannot, print `No`.

Submission attempts (in order):
N=int(input())
A=[]
B=[]
len=len(B)
str='Yes'
total=0
time=0
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)
B.sort()
AB=B+A
time=min(B)
for j in range(N):
    time += AB[j]
    total +=AB[j+len+1]
    if total>time:
        str='No'
print(str)

N=int(input())
A=[]
B=[]
len=B.len
str='Yes'
total=0
time=0
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)
B.sort()
AB=B+A
time=min(B)
for j in range(N):
    time += AB[j]
    total +=AB[j+len]
    if total>time:
        str='No'
print(str)

N=int(input())
A=[]

str='Yes'
total=0
time=0
for i in range(N):
    a,b, = map(int, input().split())
    A.append([b,a])

A.sort()


for j in range(N):
    if time<=A[j][0]:
        time = A[j][0]

    A[j][0]=100000000000
    total +=A[j][1]

    if total>time:
        str='No'
print(str)

Verdicts: Wrong Answer

Runtime Error

Accepted