Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
c = []
t = []
for i in range(N):
    x, y = map(int, input().split())
    c.append(x)
    t.append(y)
if T >= min(t):
    for j in range(len(t)-1):
        if T < t[j]:
            c.pop(j)
            t.pop(j)
        else:
            pass
    print(min(c))
else:
    print("TLE")

Fixed submission:
N, T = map(int, input().split())
ans = "TLE"
x = 1001
for i in range(N):
    c, t = map(int, input().split())
    if c <= x and t <= T:
        x = c
        ans = c
    else:
        pass
print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    i += 1
if T >= min(B):
    for j in range(len(A)-1):
        if B[j] > T:
            A.pop(j)
            B.pop(j)
        else:
            pass
    print(min(A))
else:
    print("TLE")

Fixed submission:
N, T = map(int, input().split())
ans = "TLE"
x = 1001
for i in range(N):
    c, t = map(int, input().split())
    if c <= x and t <= T:
        x = c
        ans = c
    else:
        pass
print(ans)

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    i += 1
print(A,B)
if T >= min(B):
    for j in range(len(A)-1):
        if B[j] > T:
            A.pop(j)
            B.pop(j)
        else:
            pass
    print(min(A))
else:
    print("TLE")

Fixed submission:
N, T = map(int, input().split())
ans = "TLE"
x = 1001
for i in range(N):
    c, t = map(int, input().split())
    if c <= x and t <= T:
        x = c
        ans = c
    else:
        pass
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input() .split()
a = list(A)
if len(a) == N:
    b = int(max(a))
    s = int(min(a))
    print(b-s)
else:
    N, A, a, b, s = FUCK

Fixed submission:
N = int(input())
if N%2 == 0:
    print(N)
else:
    print(N*2)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if a % 3 or b % 3 or (A+B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")

Fixed submission:
A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A+B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")
Buggy python submission (verdict: Runtime Error):
N = int(input())
Problems = map(int, input().split())
M = int(input())
arr = []
for i in range(M):
	P, T = map(int, input().split())
    sum = 0
    for j in range(N):
      if j != P:
        sum += Problems[j]
      else:
        sum += T
    arr[i] = sum
for num in arr:
  print(num)

Fixed submission:
N = int(input())
Problems = list(map(int, input().split()))
M = int(input())
arr = []
for i in range(M):
  P, T = map(int, input().split())
  sum = 0
  for j in range(N):
    if j != P - 1:
      sum += Problems[j]
    else:
      sum += T
  arr.append(sum)
for num in arr:
  print(num)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a <= 0 and b >= 0:
  print("Zero")
elif a > 0 and b > 0:
  print("Positive")
elif a < 0 and b > 0 and abs(0-a) % 2 == 0:
  print("Positive")
elif a < 0 and b < 0 and abs(0-a) % 2 == 0::
  print("Positive")
else:
  print("Negative")

Fixed submission:
a, b = map(int, input().split())
if a > 0 and b > 0:
  print("Positive")
elif a < 0 and  b < 0:
  if (b - a + 1) % 2 == 0:
    print("Positive")
  else:
    print("Negative")
else:
  print("Zero")

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a*b > 0:
  print("Positive")
else:
  if any(a,b) > 0:
    print("Zero")
  else:
    print("Negative")

Fixed submission:
a, b = map(int, input().split())
if a > 0 and b > 0:
  print("Positive")
elif a < 0 and  b < 0:
  if (b - a + 1) % 2 == 0:
    print("Positive")
  else:
    print("Negative")
else:
  print("Zero")

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a*b > 1:
  print("Positive")
else:
  if any(a,b) > 0:
    print("Zero")
  else:
    print("Negative")

Fixed submission:
a, b = map(int, input().split())
if a > 0 and b > 0:
  print("Positive")
elif a < 0 and  b < 0:
  if (b - a + 1) % 2 == 0:
    print("Positive")
  else:
    print("Negative")
else:
  print("Zero")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a * b * c = 175:
  print("YES")
else:
  print("NO")

Fixed submission:
a, b, c = map(int, input().split())
if a * b * c == 175:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())
list = []
for i in range(n):
  list[i] = input()
list.sort()
print("".join(list))

Fixed submission:
n, l = map(int, input().split())
list = []
for i in range(n):
  list.append(input())
list.sort()
print("".join(list))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=input()
strings = []
for i in range(n):
    strings.append(input())
dic = {}
for l in [Counter(s) for s in strings]:
    ll = str(l)
    if ll in dic:
        dic[ll] += 1
    else:
        dic[ll] = 0
res = 0
for k , v in dic.items():
    res += v * (v + 1)/2
print(res)

Fixed submission:
from collections import Counter
n=int(input())
strings = []
for i in range(n):
    strings.append(input())
dic = {}
for string in strings:
    c = Counter(string)
    s = "".join([str(c[l]) for l in "abcdefghijklmnopqrstuvwxyz"])
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 0
res = 0
for k , v in dic.items():
    res += v * (v + 1)/2
print(int(res))
Buggy python submission (verdict: Runtime Error):

N = int(input()) #目的
A = int(input()) #1円の枚数

#500円で払える箇所まで割る
amari = N % 500
"print(int(amari))


if amari <= A:
  print("Yes")
else:
  print("No")

Fixed submission:

N = int(input()) #目的
A = int(input()) #1円の枚数

#500円で払える箇所まで割る
amari = N % 500
#print(int(amari))


if amari <= A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
ans=0

for i in range(2 ** n):
    total = 0
    for j in range(n):  
        if ((i >> j) & 1):  
            total+=v[j]-c[j]        
    ans=max(ans,total)    
print(ans)

Fixed submission:
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
ans=0

for i in range(n):
    if (v[i]>c[i]):  
        ans+=v[i]-c[i]        
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations, combinations,combinations_with_replacement,product
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
ans=0

for i in range(n+1):
    for j in combinations(range(n),i):
        x=0
        y=0
        for k in j:
            x+=v[k]
            y+=c[k]
        ans=max(ans,x-y)
print(ans)

Fixed submission:
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
ans=0

for i in range(n):
    if (v[i]>c[i]):  
        ans+=v[i]-c[i]        
 
print(ans)
Buggy python submission (verdict: Runtime Error):
str = list(input())
nn = len(str)
ss = [1] * nn

mm = pow(10, 2)
for i in range(1, mm):
  for j in range(1, nn):
    if ss[j-1] != 0:
      if str[j-1] == 'L':
        ss[j-1] = ss[j-1] - 1
        ss[j-2] = ss[j-2] + 1
      else:
        ss[j-1] = ss[j-1] - 1
        ss[j] = ss[j] + 1

kk = ' '.join(ss)
  
print(kk)

Fixed submission:
n = int(input())
i = list(map(int, input().split()))

f = 1
for k in range(1, n):
  if f == 0:
    continue
  
  if k == 0:
    continue
  
  if i[k-1] < i[k]:
    i[k] = i[k] - 1
  elif i[k-1] == i[k]:
    i[k] = i[k]
  else:
    f = 0
      
if f == 0:
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lists = []
count = 0
while count < n:
    lists.append(input())
    count += 1

new_lists = []
for i in lists:
    new_lists.append(''.join(sorted(i)))

answer = 0
x = 1
for i in new_lists:
    if i in new_lists[x:]:
        answer += new_lists[x:].count(i)
    x += 1

print(answer)

Fixed submission:
n = int(input())
lists = [input() for _ in range(n)]

for i in range(n):
    lists[i] = ''.join(sorted(lists[i]))

d = {}
for i in range(n):
    if lists[i] in d:
        d[lists[i]] += 1
    else:
        d[lists[i]] = 1

answer = 0
for i in d:
    answer += d[i] * (d[i]-1) // 2

print(answer)
Buggy python submission (verdict: Runtime Error):
n,m = int(input().split())
print((n-1)*(m-1))

Fixed submission:
n,m = map(int, input().split())
print((n-1)*(m-1))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, Q = map(int, input().split())

edge = []
for _ in range(N-1):
    edge.append(list(map(int, input().split())))
edge = sorted(edge)
wgt = []
for _ in range(Q):
  wgt.append(list(map(int,input().split())))
#print(edge)

al = {} # adjacency list (dic)
n2w = {} # node to weight
#edge_1d = np.ravel(np.array(edge))
#for i in edge_1d:
for i in range(1,N+1):
  al[i] = []
  n2w[i] = 0 # initialize each node weight
[al[e[0]].append(e[1]) for e in edge]
#print(al)

n2acn = {}# node to all children node

def get_all_children_node(i, ret):
  if len(al[i]) == 0:
    return ret
  elif i in n2acn:
    return (ret + n2acn[i])
  else:
    for ci in al[i]:
      ret.append(ci)
      ret = get_all_children_node(ci, ret=ret)
    return ret

#for i in list(al.keys())[::-1]: # leaf nodeに近いところから計算することで，取得済みのacnを使い回し高速化
for p,_ in wgt[::-1]:
	n2acn[p] = get_all_children_node(p, [])

for p,x in wgt:
  n2w[p] += x
  for i in n2acn[p]:
    n2w[i] += x

ret = ''
for s in n2w.values():
  ret += str(s) + ' '
  
print(ret.strip())



Fixed submission:
N, Q = map(int, input().split())

edge = []
for _ in range(N-1):
    edge.append(list(map(int, input().split())))
edge = sorted(edge)
n2w = [0]*(N+1)
for _ in range(Q):
  tmp = list(map(int,input().split()))
  n2w[tmp[0]] += tmp[1]

for a,b in edge:
  n2w[b] += n2w[a]

print(*n2w[1:])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, Q = map(int, input().split())

edge = []
for _ in range(N-1):
    edge.append(list(map(int, input().split())))
edge = sorted(edge)
wgt = []
for _ in range(Q):
  wgt.append(list(map(int,input().split())))
#print(edge)

al = {} # adjacency list (dic)
n2w = {} # node to weight
#edge_1d = np.ravel(np.array(edge))
#for i in edge_1d:
for i in range(1,N+1):
  al[i] = []
  n2w[i] = 0 # initialize each node weight
[al[e[0]].append(e[1]) for e in edge]
#print(al)

n2acn = {}# node to all children node

def get_all_children_node(i, ret):
  if len(al[i]) == 0:
    return ret
  elif i in n2acn:
    return (ret + n2acn[i])
  else:
    for ci in al[i]:
      ret.append(ci)
      ret = get_all_children_node(ci, ret=ret)
    return ret

for i in list(al.keys())[::-1]: # leaf nodeに近いところから計算することで，取得済みのacnを使い回し高速化
  n2acn[i] = get_all_children_node(i, [])

for p,x in wgt:
  n2w[p] += x
  for i in n2acn[p]:
    n2w[i] += x

ret = ''
for s in n2w.values():
  ret += str(s) + ' '
  
print(ret.strip())

Fixed submission:
N, Q = map(int, input().split())

edge = []
for _ in range(N-1):
    edge.append(list(map(int, input().split())))
edge = sorted(edge)
n2w = [0]*(N+1)
for _ in range(Q):
  tmp = list(map(int,input().split()))
  n2w[tmp[0]] += tmp[1]

for a,b in edge:
  n2w[b] += n2w[a]

print(*n2w[1:])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
_NM = input().split()

N = int(_NM[0])
M = int(_NM[1])

a = []
b = []

for _ in range(N):
  _ab = input().split()
  a.append(int(_ab[0]))
  b.append(int(_ab[1]))
  
#a = np.array(a)
#b = np.array(b)

_c = zip(a,b)
_c = sorted(_c, key=lambda x:(x[0],-x[1]))
a,b = zip(*_c)
a,b = np.array(list(a)), np.array(list(b))
#print(a,b)
ret = 0
for d in range(M+1):
  # dより小さいaを指定し，該当するようなbを抽出
  inds = np.where(a<=d)[0]
  if len(inds)<=0:
    continue
  b_extracted = b[inds]
  
  b_max = max(b_extracted)
  ret += b_max
  inds_max = np.where(b==b_max)[0] # <= npwhereの返す配列がおかしい．．．ので[0]が必要
  #print(inds_max[0],b_max)
  #print('before a and b:',a,b,)
  a = np.delete(a,inds_max[0])
  b = np.delete(b,inds_max[0])
  #print('after a and b:',a,b,)
print(ret)

Fixed submission:
import numpy as np
import heapq
N,M = map(int,input().split())
jobs = [[] for _ in range(10 ** 5 + 1)]

for _ in range(N):
  a,b = map(int,input().split())
  jobs[a].append(b)
ans = 0
heap = []
for d in range(M+1):
  if jobs[d]: #空でないなら
    for _b in jobs[d]:
      heapq.heappush(heap,-_b) #heappopは最小値を返すので-をつけておく
  if heap: #空でないなら
    ans += -heapq.heappop(heap) #最小値を返してpop
print(ans)
Buggy python submission (verdict: Runtime Error):
a = input()
b = a.sprit()
if b[0] == b[1]:
     if b[1] == b[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Fixed submission:
a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a = input()
a.sprit()
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Fixed submission:
a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a = input()
a.sprit()
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Fixed submission:
a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a = input()
a.sprit
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Fixed submission:
a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a = input()
a.sprit
if a[0] == a[1]:
     if a[1] == a[2]:
         print('Yes')
     else:
         print('No')
else:
     print('No')

Fixed submission:
a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a = input()
a.sprit
if a[0] == a[1]:
    if a[1] == a[2]:
        print('yes')
    else:
        print('no')
else:
    print('no')

Fixed submission:
a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n,d=map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
a=0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        if float.is_integer(((x[i][0]-x[j][0])**2+(x[i][1]-x[j][1])**2)**0.5):
            a += 1
print(a)

Fixed submission:
n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
a = 0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        t = 0
        for k in range(d):
            t += (x[i][k]-x[j][k])**2
        if float.is_integer(t**0.5):
            a += 1
print(a)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,d=map(int, input().split())
x = [np.array(list(map(int, input().split()))) for i in range(n)]
a=0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        if float.is_integer(np.linalg.norm(x[i] - x[j])):
            a += 1
print(a)

Fixed submission:
n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
a = 0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        t = 0
        for k in range(d):
            t += (x[i][k]-x[j][k])**2
        if float.is_integer(t**0.5):
            a += 1
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

slist = []
for h in range(n):
  slist.append(input())

newlist = []
word=[]
wordy = ""
for i in range(n):
  word = list(slist[i])
  word.sort()
  for jk in range(len(word)):
	  wordy = wordy+word.pop()
  newlist.append(wordy)
  wordy=""
new2list = sorted(newlist)

count= 0
for j in range(n-1):
  k = j+1
  while (new2list[j] == new2list[k]):
    count += 1
    k += 1
    if k == n:
      break

print(count)


Fixed submission:
n = int(input())

slist = []
for h in range(n):
  slist.append(input())

newlist = []
word=[]
wordy = ""
for i in range(n):
  word = list(slist[i])
  word.sort()
  for jk in range(len(word)):
	  wordy = wordy+word.pop()
  newlist.append(wordy)
  wordy=""

resdic = {}
count = 0
for item in newlist:
  if not item in resdic:
    resdic[item] = 1
  else:
    count += resdic[item]
    resdic[item] += 1
    
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

slist = []
for h in range(n):
  slist.append(input())

newlist = []
word=[]
wordy = ""
for i in range(n):
  word = list(slist[i])
  word.sort()
  for jk in range(len(word)):
	  wordy = wordy+word.pop()
  newlist.append(wordy)
  wordy=""
new2list = sorted(newlist)

count= 0
for j in range(n):
  for k in range(j+1,n):
    if new2list[j] == new2list[k]:
      count += 1

print(count)

Fixed submission:
n = int(input())

slist = []
for h in range(n):
  slist.append(input())

newlist = []
word=[]
wordy = ""
for i in range(n):
  word = list(slist[i])
  word.sort()
  for jk in range(len(word)):
	  wordy = wordy+word.pop()
  newlist.append(wordy)
  wordy=""

resdic = {}
count = 0
for item in newlist:
  if not item in resdic:
    resdic[item] = 1
  else:
    count += resdic[item]
    resdic[item] += 1
    
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
hlist = []
for i in range(n):
  hlist.append(map(int,input().split()))

result = True
for j in range(n-1):
  if hlist[j] <= hlist[j+1]:
    
  else if hlist[j]+1 == hlist[j+1]:
    
  else:
    result = False
    
if result:
  print('Yes')
else:
  print('No')

Fixed submission:
n = int(input())
hlist = list(map(int,input().split()))

result = True
for j in range(n-1):
  if hlist[j] < hlist[j+1]:
    hlist[j+1] -= 1
  elif hlist[j] == hlist[j+1]:
    pass
  else:
    result = False
    
if result:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

def afunc(a,b,c,d):
  alist = [a,b,c,d]
  pre = a
  for char in alist[1:3]:
    if pre == char:
      print("Bad")
      return
    else:
      pre = char
  print("Good")

afunc(a,b,c,d)

Fixed submission:
S = str(input())
a = int(S[0])
b = int(S[1])
c = int(S[2])
d = int(S[3])

def afunc(a,b,c,d):
  alist = [a,b,c,d]
  pre = a
  for char in alist[1:4]:
    if pre == char:
      print("Bad")
      return
    else:
      pre = char
  print("Good")

afunc(a,b,c,d)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

alist = [a,b,c,d]
pre = a
for char in alist[1:3]:
  if pre == char:
    print("Bad")
    return
  else:
    pre = char
print("Good")

Fixed submission:
S = str(input())
a = int(S[0])
b = int(S[1])
c = int(S[2])
d = int(S[3])

def afunc(a,b,c,d):
  alist = [a,b,c,d]
  pre = a
  for char in alist[1:4]:
    if pre == char:
      print("Bad")
      return
    else:
      pre = char
  print("Good")

afunc(a,b,c,d)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

import math

def lcm(x, y):
    return int((x * y) / math.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = int(b/c) - int((a-1)/c)
sec = int(b/d) - int((a-1)/d)
rem = int(b/com) - int((a-1)/com)

result = total - (fir + sec -rem)
  
print(result)

Fixed submission:
a,b,c,d = map(int, input().split())

import fractions

def lcm(x, y):
    return int((x * y) / fractions.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = b//c - (a-1)//c
sec = b//d - (a-1)//d
rem = b//com - (a-1)//com

result = total - (fir + sec -rem)
  
print(result)

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

com = lcm(c,d)

total = b - a + 1
fir = b//c - (a-1)//c
sec = b//d - (a-1)//d
rem = b//com - (a-1)//com

result = total - (fir + sec -rem)
  
print(result)

Fixed submission:
a,b,c,d = map(int, input().split())

import fractions

def lcm(x, y):
    return int((x * y) / fractions.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = b//c - (a-1)//c
sec = b//d - (a-1)//d
rem = b//com - (a-1)//com

result = total - (fir + sec -rem)
  
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d = map(int, input().split())

result = 0
for i in range(a, b+1):
  if i%c != 0 and i%d != 0:
    result += 1
  
print(result)

Fixed submission:
a,b,c,d = map(int, input().split())

import fractions

def lcm(x, y):
    return int((x * y) / fractions.gcd(x, y))

com = lcm(c,d)

total = b - a + 1
fir = b//c - (a-1)//c
sec = b//d - (a-1)//d
rem = b//com - (a-1)//com

result = total - (fir + sec -rem)
  
print(result)
Buggy python submission (verdict: Runtime Error):
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))

Fixed submission:
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))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if a+b >= c-1:
  print(b+c)
else:
  print(a+2b+1)


Fixed submission:
a,b,c = map(int, input().split())
if a+b >= c-1:
  print(b+c)
else:
  print(a+2*b+1)
Buggy python submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
tup_list = []
for i in range(n):
    tup_list.append((map(int, input().split())))
count = 0
for tuple in tup_list:
    if tuple[0] >= h and tuple[1] >= w:
        count += 1
print(count)


Fixed submission:
nhw_list = list(map(int, input().split()))
tup_list = []
for i in range(nhw_list[0]):
    tup_list.append(list(map(int, input().split())))
count = 0
for tuple in tup_list:
    if tuple[0] >= nhw_list[1] and tuple[1] >= nhw_list[2]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
tup_list = []
for i in range(n):
    tup_list.append((map(int, input().split())))
print(tup_list)
count = 0
for tuple in tup_list:
    if tuple[0] >= h and tuple[1] >= w:
        count += 1
print(count)

Fixed submission:
nhw_list = list(map(int, input().split()))
tup_list = []
for i in range(nhw_list[0]):
    tup_list.append(list(map(int, input().split())))
count = 0
for tuple in tup_list:
    if tuple[0] >= nhw_list[1] and tuple[1] >= nhw_list[2]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
tup_list = []
for i in range(n):
    tup_list.append((input().split()))
count = 0
for tuple in tup_list:
    if tuple[0] > h and tuple[1] > w:
        count += 1
print(count)


Fixed submission:
nhw_list = list(map(int, input().split()))
tup_list = []
for i in range(nhw_list[0]):
    tup_list.append(list(map(int, input().split())))
count = 0
for tuple in tup_list:
    if tuple[0] >= nhw_list[1] and tuple[1] >= nhw_list[2]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n, h, w = map(int, input().split())
tup_list = []
for i in n:
    tup_list.append((input().split()))
count = 0
for tuple in tup_list:
    if tuple[0] > h and tuple[1] > w:
        count += 1
print(count)


Fixed submission:
nhw_list = list(map(int, input().split()))
tup_list = []
for i in range(nhw_list[0]):
    tup_list.append(list(map(int, input().split())))
count = 0
for tuple in tup_list:
    if tuple[0] >= nhw_list[1] and tuple[1] >= nhw_list[2]:
        count += 1
print(count)