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):
#ABC131 D
from operator import itemgetter as ig
N = int(input())
A = [0 for i in range(N)]
B = [0 for i in range(N)]
for i in range(N):
    A[i], B[i] = (int(_) for _ in input().split())
AB = sorted([(A[i], B[i])for i in range(N)], key = ig(1))
print(AB)
last = 0
ans = True
for i in range(N):
    last += AB[i][0]
    print(AB[i][1], last)
    if last <= AB[i][1]:
        continue
    else:
        ans = False
        break
if ans:
    print("Yes")
else:
    print("No")

#ABC131 D
from operator import itemgetter as ig
N = int(input())
A = [0 for i in range(N)]
B = [0 for i in range(N)]
for i in range(N):
    A[i], B[i] = (int(_) for _ in input().split())
AB = sorted([(A[i], B[i])for i in range(N)], key = ig(1))
last = 0
ans = True
for i in range(N):
    last += AB[i][0]
    if last <= AB[i][1]:
        continue
    else:
        ans = False
        break
if ans:
    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())
works = [tuple(map(int, input().split())) for _ in range(n)]
works.sort(key=lambda x: x[1])
print(works)
time = 0
for work in works:
    time += work[0]
    if time > work[1]:
        print('No')
        exit()
print('Yes')


n = int(input())
works = [tuple(map(int, input().split())) for _ in range(n)]
works.sort(key=lambda x: x[1])
time = 0
for work in works:
    time += work[0]
    if time > work[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):
print("No")

N = int(input())
AB = []
for n in range(N):
    AB.append(list(map(int,input().split())))
AB = sorted(AB, key=lambda x: (x[1],x[0]))
time = 0
result = True
for n in range(N):
    if AB[n][1] < time + AB[n][0]:
        result = False
        break
    else:
        time += AB[n][0]
print("Yes") if result 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):
# -*- coding: utf-8 -*-

import sys
import copy

sys.setrecursionlimit(1000000)


# input = sys.stdin.readline



N = int(input())

AB = []

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

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

print(AB)

sumV = 0

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

print("Yes")


# -*- coding: utf-8 -*-

import sys
import copy

sys.setrecursionlimit(1000000)


# input = sys.stdin.readline



N = int(input())

AB = []

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

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


sumV = 0

for i in range(N):
    sumV += AB[i][0]
    if sumV > AB[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=[]
tmp=0
ex=0
for i in range(1,N+1):
    a.append(input().split())
a_sorted=a.sort(key=lambda x: x[1])
for i in range(N):
    b=int(a[i][0])
    c=int(a[i][0])
    tmp=tmp+b
    if tmp>c:
        ex=1
        print("No")
        break
if ex==0:
    print("Yes")

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

N=int(input())
a=[]
tmp=0
ex=0
for i in range(1,N+1):
    x,y=map(int,input().split())
    a.append([x,y])
a.sort(key=lambda x: x[1])
for i in range(N):
    b=int(a[i][0])
    c=int(a[i][1])
    tmp=tmp+b
    if tmp>c:
        ex=1
        print("No")
        break
if ex==0:
    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())
ls=[]
for i in range(N):
    a,b=map(int,input().split())
    ls.append([a,b])
ls = sorted(ls,key=lambda x:x[1])

time=0
for i in range(N):
    time+=ls[i][0]
    print(time,i)
    if time > ls[i][1]:
        print("No")
        break
    if i == N-1:
        print("Yes")

N = int(input())
ls=[]
for i in range(N):
    a,b=map(int,input().split())
    ls.append([a,b])
ls = sorted(ls,key=lambda x:x[1])

time=0
for i in range(N):
    time+=ls[i][0]
    if time > ls[i][1]:
        print("No")
        break
    if i == N-1:
        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):
def main():
    N = int(input())
    AB = []
    for _ in range(N):
        temp = list(map(int, input().split()))
        AB.append((temp[0], temp[1]))

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

    total_time = 0
    for x in sorted_AB:
        total_time += x[0]
        if total_time > x[1]:
            print("NO")
            exit()
    print("YES")


if __name__ == '__main__':
    main()

def main():
    N = int(input())
    AB = []
    for _ in range(N):
        temp = list(map(int, input().split()))
        AB.append((temp[0], temp[1]))

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

    total_time = 0
    flag = True
    for x in sorted_AB:
        total_time += x[0]
        if total_time > x[1]:
            flag = False
            break

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

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

a_list.sort(key = sortSecond)

def detect(alist):
  time = 0
  for item in a_list:
    if time >= item[1]:
      return "No"
    else:
      time += item[0]
  return "Yes"

print(detect(a_list))

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

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

def detect(alist):
  time = 0
  for item in alist:
      time += item[0]
      if time > item[1]:
        return "No"
  return "Yes"

print(detect(new_list))


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 numpy as np
N =int(input())
A =[]
B =[]
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
index = np.argsort(B)
time = 0
f = 0
for i in index:
    time += A[index]
    if time>B[index]:
        f = 1
        break
if f == 1:
    print('No')
else:
    print('Yes')

import numpy as np
N =int(input())
A =[]
B =[]
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
index = np.argsort(B)
time = 0
f = 0
for i in index:
    time += A[i]
    if time>B[i]:
        f = 1
        break
if f == 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):
N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
hoge = "True"
s = sorted(s, key=lambda s:s[1])
for i in s:
    time += s[0]
    if time > s[1]:
        hoge = "No" 
        break

print(hoge)

N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
time = 0
hoge = "True"
s = sorted(s, key=lambda s:s[1])
for i in s:
    time += i[0]
    if time > i[1]:
        hoge = "No" 
        break

print(hoge)

N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
time = 0
hoge = "Yes"
s = sorted(s, key=lambda s:s[1])
for i in s:
    time += i[0]
    if time > i[1]:
        hoge = "No" 
        break

print(hoge)

Verdicts: Runtime Error

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())
work = [[int(j) for j in input().split(" ")] for i in range(n)]
work = sorted(work,key = lambda x:(x[1],x[0]))

time = 0
for work_time, limit_time in work:
    time += work_time
    print(time,limit_time)
    if time > limit_time:
        print("No")
        break

else:
    print("Yes")

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

time = 0
for work_time, limit_time in work:
    time += work_time
    if time > limit_time:
        print("No")
        break

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 = input().strip()
N = int(N)
dic = collections.defaultdict(lambda: 0)

for i in range(N):
    x,y = input().strip().split(" ")
    x = int(x)
    y = int(y)

    dic[y] += x

prev_time = 0
result = "Yes"

for k,v in dic.items():
    if v > k:
        result = "No"
        break
    prev_time += v

print(result)

import collections

N = input().strip()
N = int(N)
dic = collections.defaultdict(lambda: 0)

for i in range(N):
    x,y = input().strip().split(" ")
    x = int(x)
    y = int(y)

    dic[y] += x

prev_time = 0
result = "Yes"

for k,v in sorted(dic.items(),key=lambda x:x[0]):
    if v+prev_time > k:
        result = "No"
        break
    prev_time += v

print(result)

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 math
import numpy as np
import re


def inputs(): return [int(s) for s in input().split()]


def main():
    N = input()
    AB = [inputs() for _ in range(int(N))]
    AB.sort(key=lambda x: x[1])
    print(AB)
    time = 0
    for a, b in AB:
        time += a
        print(time, b)
        if time > b:
            return 'No'
    return 'Yes'


if __name__ == '__main__':
    print(main())


import math
import numpy as np
import re


def inputs(): return [int(s) for s in input().split()]


def main():
    N = input()
    AB = [inputs() for _ in range(int(N))]
    AB.sort(key=lambda x: x[1])
    time = 0
    for a, b in AB:
        time += a
        if time > b:
            return 'No'
    return 'Yes'


if __name__ == '__main__':
    print(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):
N=int(input())
import numpy as np
A=np.zeros(N)
B=np.zeros(N)
for i in range(0,N):
  A[i],B[i] = map(int,input().split())
  
W=np.zeros((N,np.max(B)))
for i in range(0,N):
  for j in range(int(B[i]-A[i]),int(B[i])):
    W[i][j]=1
    
for b in B:
  if np.sum(W[:,0:b]) > b:
    print('No')
    break
else:
  print('Yes')

    

import sys
import bisect
import numpy as np
input = sys.stdin.readline
N=int(input())
A=[0]*N
B=[0]*N
for i in range(N):
    A[i],B[i]=[int(x) for x in input().split()]
matrix = np.vstack((np.array(A),np.array(B)))
matrix = matrix[:, np.argsort(matrix[1])]
time=0
capacity=0
for a,b in zip(matrix[0],matrix[1]):
    capacity += (b-time) - a
    time = b
    if capacity <0:
        print('No')
        sys.exit()
    #print(capacity,a,b)
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())
lst=[]

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

time=0

for i in lst:
  time+=i[0]
  if time>i[1]:
    print('NO')
    exit()
    
    
print('YES')

n=int(input())
lst=[]

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

time=0

for i in lst:
  time+=i[0]
  if time>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):
from operator import itemgetter
import sys
 
N = int(input())
 
listA=[] 
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
 
t = 0
for i in range(n):
	s = la[i][1]
	t += la[i][0]
	if t > s:
		print("No")
		sys.exit()
 
print('Yes')



from operator import itemgetter
 
N = int(input())
 
listA=[] 
while True:
    try:
        listA.append(list(map(int,input().split())))
 
    except:
        break;
 
#print(listA)
 
listB = sorted(listA)

listC = sorted(listB, key=itemgetter(1))
#print(listC)
flag = 0
time = 0
 
for i in range(N):
	time += listC[i][0]
	#print(time)
	listC.pop(0)
	if time > listC[i][1]:
		flag = 1
		break
 
if flag==0:
	print('Yes')
elif flag==1:
	print('No')

from operator import itemgetter

N = int(input())

listA=[] 
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        

#print(listA)
#[[1, 2, 2, 3, 1], [4, 5, 3, 4, 1, 2, 3, 4], [2, 3, 5, 6, 0, 2]]

listB = sorted(listA)

listC = sorted(listB, key=itemgetter(1))
#print(listC)
flag = 0
time = 0

for i in range(N):
	time += listC[0][0]
	print(time)
	if time > listC[0][1]:
		flag = 1
		break
	#else:
		#print('OK!')
	listC.pop(0)

if flag==0:
	print('Yes')
elif flag==1:
	print('No')

from operator import itemgetter
 
N = int(input())
 
listA=[] 
while True:
    try:
        listA.append(list(map(int,input().split())))
 
    except:
        break;
  
listB = sorted(listA)
listC = sorted(listB, key=itemgetter(1))

flag = 0
time = 0
for i in range(N):
	time += listC[i][0]
	if time > listC[i][1]:
		flag = 1
		break
 
if flag==0:
	print('Yes')
elif flag==1:
	print('No')

Verdicts: Runtime Error

Runtime Error

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 numpy as np

N  = int(input())

AB = []
time = 0

for _ in range(N):
    AB.append(list(map(int, input().split())))

AB = np.array(AB)
sorted_AB = AB[AB[:,1].argsort(), :]

for i in range(N):
    time += sorted_AB[i,0]
    print(sorted_AB[i,0])

    if time > sorted_AB[i,1]:
        print('No')
        exit()

print('Yes')

import numpy as np

N  = int(input())

AB = []
time = 0

for _ in range(N):
    AB.append(list(map(int, input().split())))

AB = np.array(AB)

sorted_AB = AB[AB[:,1].argsort(), :]

for i in range(N):
    time += sorted_AB[i,0]

    if time > sorted_AB[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())
l = [list(map(int, input().split())) for i in range(n)]
l.sort(key= x:x[1])
t=0
for i in l:
    a,b=i
    t+=a
    if(t>b):
        print("No")
        break
    else:
        print("Yes")


N = int(input())
l = [list(map(int, input().split())) for i in range(n)]
l.sort(key= lambda x:x[1])
t=0
for i in l:
    a,b=i
    t+=a
    if(t>b):
        print("No")
        break
    else:
        print("Yes");


N = int(input())
l = [list(map(int, input().split())) for i in range(N)]
l.sort(key= lambda x:x[1])
t=0
cnt=0
for i in l:
    cnt+=1
    a,b=i
    t+=a
    if(t>b):
        print("No")
        break
    elif cnt==N:
        print("Yes");


Verdicts: 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):
#m = imt(imput())
#L = list(map(imt, imput().split()))
import math
import sys

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


def aa(N,AB):
    AB.sort(key=lambda x: x[1])
    for i in range(N-1):
        clk += AB[i][0]
        if clk >= AB[i][1]:
            flg = False
            break
    if flg:
        return "Yes"
    else:
        return "No"


#m = imt(imput())
#L = list(map(imt, imput().split()))
import math
import sys

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


def aa(N,AB):
    AB.sort(key=lambda x: x[1])
    for i in range(N-1):
        clk += AB[i][0]
        if clk >= AB[i][1]:
            flg = False
            break
    if flg:
        return "Yes"
    else:
        return "No"
print(aa(N,AB))

#m = imt(imput())
#L = list(map(imt, imput().split()))
import math
import sys

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


def aa(N,AB):
    AB.sort(key=lambda x: x[1])
    for i in range(N-1):
        clk += AB[i][0]
        if clk >= AB[i][1]:
            flg = False
            break
    if flg:
        return "Yes"
    else:
        return "No"
print(aa())

#m = imt(imput())
#L = list(map(imt, imput().split()))
import math
import sys

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

def aa(N,AB):
    clk = 0
    flg = True
    for i in range(N):
        clk += AB[i][0]
        if clk > AB[i][1]:
            flg = False
            break
    if flg:
        return "Yes"
    else:
        return "No"
print(aa(N,AB))


Verdicts: Wrong Answer

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().strip())
a=[]
for i in range(N):
    array=list(map(int,input().strip().split()))
    a.append(array)
b=sorted(a, key=lambda x:x[1])
print(b)
n,t,f=0,0,0
while True:
    t+=b[n][0]
    if t>b[n][1]:
        f=1
        break
    n+=1
    if n==N:
        break
if f==1:
    print('No')
else:
    print('Yes')


n=int(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')

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())

dic = {}
B = []

for i in range(N):
    a, b = map(int,input().split())
    B.append(b)
    if '{}'.format(b) in dic:
        dic['{}'.format(b)] += a
    else:
        dic['{}'.format(b)] = a

Bs = sorted(B)

time = 0

for i, num in enumerate(Bs):
    time += dic['{}'.format(num)]
    if num < time:
        print('NO')
        break

    if i == len(Bs)-1:
        print('Yes')


N = int(input())

dic = {}
B = []

for i in range(N):
    a, b = map(int,input().split())
    B.append(b)
    if '{}'.format(b) in dic:
        dic['{}'.format(b)] += a
    else:
        dic['{}'.format(b)] = a

Bs = sorted(B)

time = 0

for i, num in enumerate(Bs):
    time += dic['{}'.format(num)]
    if num < time:
        print('No')
        break

    if i == len(Bs)-1:
        print('Yes')


N = int(input())

dic = {}
B = []

for i in range(N):
    a, b = map(int,input().split())
    B.append(b)
    if '{}'.format(b) in dic:
        dic['{}'.format(b)] += a
    else:
        dic['{}'.format(b)] = a

Bs = sorted(list(set(B)))

time = 0

for i, num in enumerate(Bs):
    time += dic['{}'.format(num)]
    if num < time:
        print('No')
        break

    if i == len(Bs)-1:
        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):
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

class Solver7
    {
        /*
         * https://atcoder.jp/contests/abc131/tasks/abc131_d
         * 
         * 
         */
                public void Solve7()
        {
            var nnum = 99999999;
            var n = int.Parse(Console.ReadLine());
            int[] X = new int[nnum];
            
            try
            {
                for (int i = 0; i < n; i++)
                {
                    var ab = u.readIntArrayBySplit();
                    var a = ab[0];
                    var b = ab[1];
                    var p = b;
                    for (int j = 0; j < a; j++)
                    {
                      	var xx = X[p];
                      	
                        while (X[p]!=null && X[p] == 1)
                        {
                            p--;
                        }
                        X[p] = 1;
                    }
                }
                Console.WriteLine("Yes");
            }
            catch(Exception ex)
            {
                Console.WriteLine("No");
            }


        }
        static void Main()
        {
            var solver = new Solver7();
            solver.Solve7();
        }
    }
    static class u
    {
        public static void outA(int[] A) { Console.WriteLine(string.Join(" ", A)); }
        public static void outInt(int i) { Console.WriteLine(i.ToString()); }
        public static void outLong(long i) { Console.WriteLine(i.ToString()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
        public static int readInt() { return int.Parse(Console.ReadLine()); }
        public static  string readStr() { return Console.ReadLine(); }
        public static int[] readIntArrayBySplit() { return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        public static int[] readIntArrayZeroIchiRenzoku() { return Console.ReadLine().Select(s => int.Parse(s.ToString())).ToArray(); }

    }

n = int(input())
A=[]
for i in range(n):
  a,b = map(int,input().split())
  A.append((b,a))
A.sort()
c = 0
for a in A:
  c+=a[1]
  if c>a[0]:
    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())
l = {}
lb = []
la = []
c = 0
for _ in range(n):
    a,b = map(int,input().split())
    l[b] = a
l = sorted(l.items())
for i in range(0,n):
    lb.append(l[i][0])
    la.append(l[i][1])

for i in range(0,n):
    if lb[i] < sum(la[:i+1]):
        c = 1
        break
    else:
        continue
if c == 0:
    print('Yes')
else:
    print('No')

n = int(input())
l = []
c = 0
d = 0
for _ in range(n):
    a,b = map(int,input().split())
    l.append([b,a])
l = sorted(l)


for i in range(0,n):
    if l[i][0] < d + l[i][1]:
        c = 1
        break
    else:
        d = d+ l[i][1]
        continue
if c == 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):
from operator import itemgetter
n=int(input())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))
c=sorted(ab, key=itemgetter(1), reverse=False)
f=True
t=0
for i in range(n):
    t = t + c[i][0]
    print(t)
    f=f and t<c[i][1]
if f:
    print("Yes")
else:
    print("No")

from operator import itemgetter
n=int(input())
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))
c=sorted(ab, key=itemgetter(1), reverse=False)
f=True
t=0
for i in range(n):
    t = t + c[i][0]
    f=f and t<=c[i][1]
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())
work = [list(map(int,input().split())) for _ in range(n)]
work = sorted(work,key = lambda x:x[1])
a = [0] * n
a[0] = work[0][0]
for i in range(1,N):
    a[i] = a[i-1] + work[i][0]
ans = 'Yes'
for j in range(N):
    if a[j] > work[j][1]:
        ans = 'No'
        break
print(ans)

n = int(input())
work = [list(map(int,input().split())) for _ in range(n)]
work = sorted(work,key = lambda x:x[1])
a = [0] * n
a[0] = work[0][0]
for i in range(1,n):
    a[i] = a[i-1] + work[i][0]
ans = 'Yes'
for j in range(n):
    if a[j] > work[j][1]:
        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):
ef main():
    N = int(input())
    jobs = [list(map(int, input().split())) for _ in range(N)]
    time = 0
    jobs = sorted(jobs, key=lambda x: x[1])
    for j in jobs:
        time += j[0]
        if time > j[1]:
            print("No")
            return
        
    else:
        print("Yes")


if __name__ == '__main__':
    main()

def main():
    N = int(input())
    jobs = [list(map(int, input().split())) for _ in range(N)]
    time = 0
    jobs = sorted(jobs, key=lambda x: x[1])
    for j in jobs:
        time += j[0]
        if time > j[1]:
            print("No")
            return
        
    else:
        print("Yes")


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())

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

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

now = 0
flag = False
for l in L:
    print(now)
    now += l[0]
    
    if now > l[0] + l[1]:
        flag = True
        break

    

if flag:
    print('No')

else:
    print('Yes')



N = int(input())

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

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

now = 0
flag = False
for l in L:
    now += l[0]
    
    if now  > l[1]:
        flag = True
        break


if flag:
    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):

import math
A,B,C,D = map(int,input().split())


lcm = C*D//math.gcd(C,D)
cnt_lcm = B//lcm - A//lcm


cnt_C = B//C - (A-1)//C 


cnt_D = B//D - (A-1)//D


ans = (B - A + 1) - (cnt_C + cnt_D - cnt_lcm)


if A == B:
    
    if A%C == 0 and A%D == 0:
        print(0)
    else:
        print(1)
else:
    print(ans)


N = int(input())
work = []
for _ in range(N):
    a,b = map(int,input().split())
    work.append((a,b))


work = sorted(work,key = lambda x:x[1],reverse = False)

result = 'Yes'
t = 0
for i,j in work:
    t += i
    if t>j:
        result = 'No'
        break
print(result)

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

def canFinishJobs(arr):
  arr.sort(key=lambda x: x[1])
  sum = 0
  for i in arr:
    sum += i[0]
    if sum > i[1]:
      return "NO"
  return "YES"

result = canFinishJobs(pairs)
print(result)
  
 

n = int(input())
pairs = []
for i in range(0, n):
  pairs.append(list(map(int, input().split())))

def canFinishJobs(arr):
  arr.sort(key=lambda x: x[1])
  sum = 0
  for i in arr:
    sum += i[0]
    if sum > i[1]:
      return "No"
  return "Yes"

result = canFinishJobs(pairs)
print(result)
  
 


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):
print("Yes")
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key= lambda x:x[1])
time = 0
for i in ab:
    time += i[0]
    if time <= i[1]:
        continue
    else:
        print("No")
        sys.exit()
print("Yes")

import sys
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key= lambda x:x[1])
time = 0
for i in ab:
    time += i[0]
    if time <= i[1]:
        continue
    else:
        print("No")
        sys.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())
job = [list(map(int,input().split())) for i in range(n)]


job.sort(key = lambda x: x[1])
print(job)
time = 0
ans = 0
for i in range(n):
    time += job[i][0]
    if time > job[i][1]:
        print("No")
        break
else:
    print("Yes")

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


job.sort(key = lambda x: x[1])
time = 0
ans = 0
for i in range(n):
    time += job[i][0]
    if time > job[i][1]:
        print("No")
        break
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())
ab = [[0] * 2 for _ in range(n)]
for i in range(n):
    a, b = map(int, input().split())
    ab[i][0], ab[i][1] = a, b
ab = sorted(ab, key=lambda x: x[1])
#print(ab)
time = 0
for task in ab:
    time += task[0]
    if time <= task[1]:
        print(time, task[1])
        continue
    else:
        print('No')
        exit()
print('Yes')


n = int(input())
ab = [[0] * 2 for _ in range(n)]
for i in range(n):
    a, b = map(int, input().split())
    ab[i][0], ab[i][1] = a, b
ab = sorted(ab, key=lambda x: x[1])
#print(ab)
time = 0
for task in ab:
    time += task[0]
    if time <= task[1]:
        
        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())
data = [map(int, input().split()) for i in range(N)]

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

now = 0

for i in range(N) :
  if now + ds[i][0] > ds[i][1] :
    print("No")
    break
  else :
    now = now + ds[0]
  
  if i == N-1 :
    print("Yes)

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

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

now = 0

for i in range(N) :
  if now + data[i][0] > data[i][1] :
    print("No")
    break
  else :
    now = now + data[i][0]
  
  if i == N-1 :
    print("Yes")


Verdicts: Runtime Error

Accepted