Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
d, x = map(int, input().split())
a = []
s = 0

for i in range(n):
    a.appened(int(input()))

for i in range(d):
    for j in range(n):
        if i % a[j] == 1:
            s += 1
print(s + x)


Fixed submission:
n = int(input())
d, x = map(int, input().split())
a = []
s = 0

for i in range(n):
    a.append(int(input()))

for i in range(1, d + 1):
    for j in range(n):
        if i % a[j] == 1 or a[j] == 1:
            s += 1
print(s + x)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d, x = map(int, input().split())
a = []
for i in range(n):
    a.appned(int(input())
s = 0
for i in range(d):
    for j in range(n):
        if i % a[j] == 1:
            s +=1
print(s+x)

Fixed submission:
n = int(input())
d, x = map(int, input().split())
a = []
s = 0

for i in range(n):
    a.append(int(input()))

for i in range(1, d + 1):
    for j in range(n):
        if i % a[j] == 1 or a[j] == 1:
            s += 1
print(s + x)
Buggy python submission (verdict: Runtime Error):
n = int(input()
s ={}
for i in range(n):
    string = input()
    s[string] = s[string] + 1 if string in s else 1 
m = int(input()
for i in range(m):
    string = input()
    s[string] = s[string] - 1 if string in s else -1
print(max(0,max(s.values())))

Fixed submission:
n = int(input())
s ={}
for i in range(n):
    string = input()
    s[string] = s[string] + 1 if string in s else 1 
m = int(input())
for i in range(m):
    string = input()
    s[string] = s[string] - 1 if string in s else -1
print(max(0,max(s.values())))
Buggy python submission (verdict: Runtime Error):
nb = raw_input().split(' ')

x, y, z = int(nb[0]), int(nb[1]), int(nb[2])
ans = int((x-z)/(y+z))
print(ans)

Fixed submission:
nb = input().split(' ')

a, b = int(nb[0],16), int(nb[1], 16)
if a > b:
    print ('>')
elif a < b:
    print ('<')
else:
    print ('=')

Buggy python submission (verdict: Runtime Error):
nb = input().split(' ')

x, y, z = int(nb[0]), int(nb[1]), int(nb[2])
ans = int((x-z)/(y+z))
print(ans)

Fixed submission:
nb = input().split(' ')

a, b = int(nb[0],16), int(nb[1], 16)
if a > b:
    print ('>')
elif a < b:
    print ('<')
else:
    print ('=')

Buggy python submission (verdict: Runtime Error):
nb = input().split(' ')

a, b = int(nb[0],16), int(nb[1], 16)
if a > b:
    print '>'
elif a < b:
    print '<'
else:
    print '='

Fixed submission:
nb = input().split(' ')

a, b = int(nb[0],16), int(nb[1], 16)
if a > b:
    print ('>')
elif a < b:
    print ('<')
else:
    print ('=')

Buggy python submission (verdict: Runtime Error):
nb = raw_input().split(' ')

a, b = int(nb[0],16), int(nb[1], 16)
if a > b:
    print '>'
elif a < b:
    print '<'
else:
    print '='

Fixed submission:
nb = input().split(' ')

a, b = int(nb[0],16), int(nb[1], 16)
if a > b:
    print ('>')
elif a < b:
    print ('<')
else:
    print ('=')
Buggy python submission (verdict: Runtime Error):
n = input()
print(int(n[3:]))


Fixed submission:
n = input()
print('ABC' + n)
Buggy python submission (verdict: Runtime Error):
n= int(input())
card = input().split(' ')
card = [int(s) for s in card]
min_s = 20000000
sum1 = sum(card[:1])
sum2 = sum(card[1:])
for i in range(n - 1):
    dif  = abs(sum1-sum2)

    if dif  < min_s:
        min_s = dif
    sum1 += card[i+1]
    sum2 = sum2 - card[i+1]
print(min_s)


Fixed submission:
ab = input().split(' ')
#print(ab)
if int(ab[0])  % 3 == 0 or int(ab[1]) % 3 ==0   or (int(ab[1])+ int(ab[0])) % 3 == 0:
    ans  = 'Possible'

else:
    ans ='Impossible'
    
if (int(ab[0]) + int(ab[1])) <= 3:
    ans= 'Impossible'
print (ans)

Buggy python submission (verdict: Runtime Error):
n= int(input())
card = input().split(' ')
card = [int(s) for s in card]
min_s = 1000000000000
for i in range(n -1):
    dif  =abs(sum(card[:i+1]) - sum(card[i+1:]))
    if dif  < min_s:
        min_s= dif
    
print(min_s)


Fixed submission:
ab = input().split(' ')
#print(ab)
if int(ab[0])  % 3 == 0 or int(ab[1]) % 3 ==0   or (int(ab[1])+ int(ab[0])) % 3 == 0:
    ans  = 'Possible'

else:
    ans ='Impossible'
    
if (int(ab[0]) + int(ab[1])) <= 3:
    ans= 'Impossible'
print (ans)
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
card = input().split(' ')
card = [int(s) for s in card]
min_s = 1000000000000
for i in range(n -1):
    if abs(sum(card[:i+1]) - sum(card[i+1:])) < min_s:
        min_s= abs(sum(card[:i+1]) - sum(card[i+1:]))
    
print(min_s)

Fixed submission:
n= int(input())
card = input().split(' ')
card = [int(s) for s in card]
min_s = 20000000000
sum1 = sum(card[:1])
sum2 = sum(card[1:])
for i in range(n - 1):
    dif  = abs(sum1-sum2)

    if dif  < min_s:
        min_s = dif
    sum1 += card[i+1]
    sum2 = sum2 - card[i+1]
print(min_s)
Buggy python submission (verdict: Runtime Error):
a= input().split(' ')
b = a[0]+a[1]+a[2]
if int(b) % 4 == 0:
    print('YES')
else:
    print('NO'


Fixed submission:
a= input().split(' ')
b = a[0]+a[1]+a[2]
if int(b) % 4 == 0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
abc=  imput()
 
a, b, c = abc.split(' ')
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')


Fixed submission:
abc=  input()
 
a, b, c = abc.split(' ')
if a[-1] == b[0] and b[-1] == c[0]:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def s():
    return raw_input()
def li():
    return map(int,raw_input().split())

st = []
X = list(s())
N = len(X)
st.append(X[0])
X.pop(0)
#for i in range(len(X)-2):
for i in range(N-1):
    st.append(X[0])
    X.pop(0)
    if len(st) >= 2:
        if st[-1] == 'T' and st[-2] == 'S':
            st.pop()
            st.pop()
print len(st)


Fixed submission:
import numpy as np
def s():
    return raw_input()
def li():
    return map(int,raw_input().split())

st = []
X = list(s())
N = len(X)
X.reverse()
st.append(X[-1])
X.pop()
#for i in range(len(X)-2):
for i in range(N-1):
    st.append(X[-1])
    X.pop()
    if len(st) >= 2:
        if st[-1] == 'T' and st[-2] == 'S':
            st.pop()
            st.pop()
print len(st)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def s():
    return raw_input()
def li():
    return map(int,raw_input().split())

st = []
X = list(s())

st.append(X[0])
X.pop(0)
#for i in range(len(X)-2):
while len(X) > 0:
    st.append(X[0])
    X.pop(0)
    if len(st) >= 2:
        if st[-1] == 'T' and st[-2] == 'S':
            st.pop()
            st.pop()
print len(st)


Fixed submission:
import numpy as np
def s():
    return raw_input()
def li():
    return map(int,raw_input().split())

st = []
X = list(s())
N = len(X)
X.reverse()
st.append(X[-1])
X.pop()
#for i in range(len(X)-2):
for i in range(N-1):
    st.append(X[-1])
    X.pop()
    if len(st) >= 2:
        if st[-1] == 'T' and st[-2] == 'S':
            st.pop()
            st.pop()
print len(st)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def s():
    return raw_input()
def li():
    return map(int,raw_input().split())

st = []
X = list(s())

st.append(X[0])
X.pop(0)
#for i in range(len(X)-2):
while len(X) > 0:
    st.append(X[0])
    X.pop(0)
    if st[-1] == 'T' and st[-2] == 'S':
        st.pop()
        st.pop()
print len(st)



Fixed submission:
import numpy as np
def s():
    return raw_input()
def li():
    return map(int,raw_input().split())

st = []
X = list(s())
N = len(X)
X.reverse()
st.append(X[-1])
X.pop()
#for i in range(len(X)-2):
for i in range(N-1):
    st.append(X[-1])
    X.pop()
    if len(st) >= 2:
        if st[-1] == 'T' and st[-2] == 'S':
            st.pop()
            st.pop()
print len(st)

Buggy python submission (verdict: Time Limit Exceeded):
def s():
    return raw_input()
def li():
    return map(int,raw_input().split())
X = s()
while X.find("ST") >= 0:
    p = X.find("ST")
    X = list(X)
    del X[p]
    del X[p]
    X = ''.join(X)
print len(X)

Fixed submission:
import numpy as np
def s():
    return raw_input()
def li():
    return map(int,raw_input().split())

st = []
X = list(s())
N = len(X)
X.reverse()
st.append(X[-1])
X.pop()
#for i in range(len(X)-2):
for i in range(N-1):
    st.append(X[-1])
    X.pop()
    if len(st) >= 2:
        if st[-1] == 'T' and st[-2] == 'S':
            st.pop()
            st.pop()
print len(st)
Buggy python submission (verdict: Runtime Error):
#
N = input()
#S = []
count = 0
flag = 0
for i in range(1,N+1):
    IN = input()
    #S.append(IN)
    if flag:
        if (flag == i - 1):
            if  IN > 0:
                IN -= 1
                count += 1
    flag = 0

    count += IN/2
    if IN%2 == 1:
        flag = i

print count


Fixed submission:
IN = list(raw_input())
N = 0
S = 0
E = 0
W = 0

for i in range(len(IN)):
    if IN[i] == 'N':
        N += 1
    elif IN[i] == 'S':
        S += 1
    elif IN[i] == 'E':
        E += 1
    elif IN[i] == 'W':
        W += 1

if (N>0 and S>0):
    if (E==0 and W==0)or(E>0 and W>0):
        print 'Yes'
    else:
        print 'No'
elif N==0 and S ==0:
    if (E==0 and W==0)or(E>0 and W>0):
        print 'Yes'
    else:
        print 'No'
else:
    print 'No'
Buggy python submission (verdict: Time Limit Exceeded):
#2
n = int(input())
a = 0
for i in range(1, n+1):
    if i**2 <= n:
        a = i**2
    else: continue
print(a)

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)

Buggy python submission (verdict: Time Limit Exceeded):
#2
n = int(input())
a = list()
for i in range(1,n + 1):
    if i**2 <= n:
        a = a + [i]
    else : 
        break
print(int(a[-1])**2)

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)

Buggy python submission (verdict: Time Limit Exceeded):
#2
k = 0
x = int(input())
for y in range(0, x+1):
    y = y*y
    if y <= x:
        k = y
print(k)
        
        

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)

Buggy python submission (verdict: Runtime Error):
#2
n = int(input())
p = range(1,10**5)
q = 1
while i < n :
    i == p**2
    q = i
print(q)

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)

Buggy python submission (verdict: Time Limit Exceeded):
#2
n = int(input())
m = 0
for i in range(n+1) :
    if i**2<=n :
        m=i**2
print(m)

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)

Buggy python submission (verdict: Time Limit Exceeded):
#2
n = int(input())
m=0
for i in range(1,n+1) :
    for j in range(1,i+1) :
        if j**2==i :
            m=i    
print(m)

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)

Buggy python submission (verdict: Runtime Error):
#1
x,y,z=map(int, input().split())
count=0
for i in range(x,y+1) :
    if i%z==0 :
        count+=1
print(count)

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)

Buggy python submission (verdict: Time Limit Exceeded):
#2
n = int(input())
m = 0
for i in range(0,n+1) :
    if m <= i*i <= n :
        m = i*i
print(m)

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)

Buggy python submission (verdict: Time Limit Exceeded):
#2
n = int(input())
number = 0
for i in range(n+1) :
    if i**2 <= n :
        number = i**2
print(number)

Fixed submission:
#2
n = int(input())
print(int(n**(1/2))**2)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b, c = map(int, input().split())
result = int(a*(b+c)/2)
print(result)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
result = int((a+b)*h/2)
print(result)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b, c = map(int, input().split())
print(a*(b+c)/2)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
result = int((a+b)*h/2)
print(result)
Buggy python submission (verdict: Runtime Error):
wl = {}
N = int(input())
for n in range(N):
    w = input()
    if w in wl:
        wl[w] = wl[w]+1
    else:
        wl[w] = 1 
M = int(input())
for m in range(M):
    w = input()
    if w in wl:
        wl[w] = wl[w]-1
    else:
        wl[w] = -1

mc = ""
c = 0
for k, v in wl.items():
    if c < v:
        mc = k
        c = v

print(c)

Fixed submission:
a, b, c = map(int, input().split())
if a + b < c:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

count = 0

for b in range(1, n + 1):
    p = n // b
    r = n % b
    count += p * max(0, b - k) + max(0, r - k + 1)

if k == 0:
    count -= n

print(count)

Fixed submission:
print("".join([input()[i] for i in range(3)]))
Buggy python submission (verdict: Runtime Error):
from math import *

n = int(input())
s = input()
d = {'P': 0, 'W': 0, 'G': 0, 'Y': 0}
for x in range(len(s)):
  d[s[x]] += 1
print('Four' if all(map(lambda x: x > 0, d.values())) else 'Three')


Fixed submission:
from math import *

n = int(input())
s = input()
b = False
for x in range(len(s)):
  if s[x] is 'Y':
    b = True
    break
print('Four' if b else 'Three')
Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial

n, m = map(int, input().split())
if abs(n - m) > 1:
    print(0)
elif n == m:
    print((factorial(n) * factorial(m) * 2) % (10 ** 9 + 7))
else:
    print(factorial(n) * factorial(m))

Fixed submission:
def factorial(x):
    res = 1
    for i in range(1, x):
        res *= i + 1
        res %= 10 ** 9 + 7
    return res

n, m = map(int, input().split())
if abs(n - m) > 1:
    print(0)
elif n == m:
    print((factorial(n) * factorial(m) * 2) % (10 ** 9 + 7))
else:
    print(factorial(n) * factorial(m) % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
d = {'gray': 0, 'green': 0, 'cyan': 0, 'red': 0, 'brown': 0, 'blue': 0, 'yellow': 0, 'orange': 0, 'above':0}
for i in a:
    if i <= 399:
        d['gray'] += 1
    elif i <=799:
        d['brown'] += 1
    elif i <= 1199:
        d['green'] += 1
    elif i <= 1599:
        d['cyan'] += 1
    elif i <= 1999:
        d['blue'] += 1
    elif i <= 2399:
        d['yellow'] += 1
    elif i <= 2799:
        d['orange'] += 1
    elif i <= 3199:
        d['red'] += 1
    else:
        d['above'] += 1
res1 = 0
res2 = 0
for i in d.items():
    if i[0] != 'above' and i[1] > 0:
        res1 += 1
        res2 += 1
print(max(1, re

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
d = {'gray': 0, 'green': 0, 'cyan': 0, 'red': 0, 'brown': 0, 'blue': 0, 'yellow': 0, 'orange': 0, 'above':0}
for i in a:
    if i <= 399:
        d['gray'] += 1
    elif i <=799:
        d['brown'] += 1
    elif i <= 1199:
        d['green'] += 1
    elif i <= 1599:
        d['cyan'] += 1
    elif i <= 1999:
        d['blue'] += 1
    elif i <= 2399:
        d['yellow'] += 1
    elif i <= 2799:
        d['orange'] += 1
    elif i <= 3199:
        d['red'] += 1
    else:
        d['above'] += 1
res1 = 0
res2 = 0
for i in d.items():
    if i[0] != 'above' and i[1] > 0:
        res1 += 1
        res2 += 1
print(max(1, res1), res2 + d['above'])
Buggy python submission (verdict: Runtime Error):
n = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)] key = lambda reds: -reds[1])
blues = sorted([list(map(int,input().split())) for i in range(n)])

res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)


Fixed submission:
A,B,C = list(map(int,input().split()))
if (A+B)>=C:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)])
blues = sorted([list(map(int,input().split())) for i in range(n)])

reds.sort(reverse = True)
res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)


Fixed submission:
A,B,C = list(map(int,input().split()))
if (A+B)>=C:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

k = set(s)
tot = 0
for i in k:
  tot = max(s.count(i) - t.count(i),tot)
  
print(tot)


Fixed submission:
A,B,C = list(map(int,input().split()))
if (A+B)>=C:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

s = set(s)
tot = 0
for i in s:
  tot = max(s.count(i) - t.count(i),tot)
  
print(tot)


Fixed submission:
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

k = set(s)
tot = 0
for i in k:
  tot = max(s.count(i) - t.count(i),tot)
  
print(tot)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

s = set(s)
tot = 0
for i in s:
  res = s.count(i) - t.count(i)
  tot = max(res,tot)
  
print(tot)


Fixed submission:
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

k = set(s)
tot = 0
for i in k:
  tot = max(s.count(i) - t.count(i),tot)
  
print(tot)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

s = set(s)
tot = 0
for i in s:
  res = s.count(i) - t.count(i)
  tot = max(res,cnt)
  
print(tot)


Fixed submission:
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

k = set(s)
tot = 0
for i in k:
  tot = max(s.count(i) - t.count(i),tot)
  
print(tot)
Buggy python submission (verdict: Runtime Error):
N = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)])
blues = sorted([list(map(int,input().split())) for i in range(n)])

reds = reds[::-1]
res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)


Fixed submission:
n = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)],key=lambda reds: -reds[1])
blues = sorted([list(map(int,input().split())) for i in range(n)])

res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)

Buggy python submission (verdict: Runtime Error):
N = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)])
blues = sorted([list(map(int,input().split()))])

reds = reds[::-1]
res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)


Fixed submission:
n = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)],key=lambda reds: -reds[1])
blues = sorted([list(map(int,input().split())) for i in range(n)])

res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)

Buggy python submission (verdict: Runtime Error):
N = int(input())
reds = sorted([list(map(int,input().split()))])
blues = sorted([list(map(int,input().split()))])

reds.sort(reverse = True)
res = 0

for c,d in blues:
  for a,b in reds:
    if a,c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)

Fixed submission:
n = int(input())
reds = sorted([list(map(int,input().split())) for i in range(n)],key=lambda reds: -reds[1])
blues = sorted([list(map(int,input().split())) for i in range(n)])

res = 0

for c,d in blues:
  for a,b in reds:
    if a<c and b<d:
      reds.remove([a,b])
      res+=1
      break
      
print(res)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
print(['Yes','No'][n%500>a]

Fixed submission:
n=int(input())
a=int(input())
print(['Yes','No'][n%500>a])

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=int(input())
print(['Yes','No'][(n-a)%500>0]

Fixed submission:
n=int(input())
a=int(input())
print(['Yes','No'][n%500>a])
Buggy python submission (verdict: Runtime Error):
print(['Even','Odd'][max(0,sum(map(lambda x:int(x)%2,input()))-1)])

Fixed submission:
print(['Even','Odd'][max(0,sum(map(lambda x:int(x)%2,input().split()))-1)])
Buggy python submission (verdict: Runtime Error):
ab=int(input().replace(' ',''))
print(['No','Yes'][any(i**2==ab for i in range(ab))

Fixed submission:
ab=int(input().replace(' ',''))
print(['No','Yes'][any(i**2==ab for i in range(ab))])
Buggy python submission (verdict: Runtime Error):
import sys
read=sys.stdin.read

def main():
  n,h,*ab=map(int,read().split())
  tops=max(ab[0::2])
  tlst=[b for b in ab[1::2] if b>tops]
  tlst.sort(reverse=True)
  for i,t in enumerate(tlst):
    h-=t
    if h<=0:
      h=0
      break
  print(h//tops+(h%tops>0)+i+1)

if __name__=='__main__':
  main()


Fixed submission:
import sys
read=sys.stdin.read

def main():
  n,h,*ab=map(int,read().split())
  tops=max(ab[0::2])
  tlst=[b for b in ab[1::2] if b>tops]
  tlst.sort(reverse=True)
  i=-1
  t=0
  for i,t in enumerate(tlst):
    h-=t
    if h<=0:
      h=0
      break
  print(h//tops+(h%tops>0)+i+1)

if __name__=='__main__':
  main()

Buggy python submission (verdict: Runtime Error):
import sys
read=sys.stdin.read

def main():
  n,h,*ab=map(int,read().split())
  tops=max(ab[0::2])
  tlst=[b for b in ab[1::2] if b>tops]
  tlst.sort(reverse=True)
  for i,t in enumerate(tlst):
    h-=t
    if h<=0:
      h=0
      return
  print(h//tops+(h%tops>0)+i+1)

if __name__=='__main__':
  main()

Fixed submission:
import sys
read=sys.stdin.read

def main():
  n,h,*ab=map(int,read().split())
  tops=max(ab[0::2])
  tlst=[b for b in ab[1::2] if b>tops]
  tlst.sort(reverse=True)
  i=-1
  t=0
  for i,t in enumerate(tlst):
    h-=t
    if h<=0:
      h=0
      break
  print(h//tops+(h%tops>0)+i+1)

if __name__=='__main__':
  main()

Buggy python submission (verdict: Runtime Error):
import sys
read=sys.stdin.read

def main():
  n,h,*ab=map(int,read().split())
  sord=max(ab[0::2])
  tlst=[b for b in ab[1::2] if b>sord]
  tlst.sort()
  for i,t in enumerate(tlst):
    h-=t
    if h<=0:
      h=0
      break
  print(h//sord+(h%sord>0)+i+1)

if __name__=='__main__':
  main()

Fixed submission:
import sys
read=sys.stdin.read

def main():
  n,h,*ab=map(int,read().split())
  tops=max(ab[0::2])
  tlst=[b for b in ab[1::2] if b>tops]
  tlst.sort(reverse=True)
  i=-1
  t=0
  for i,t in enumerate(tlst):
    h-=t
    if h<=0:
      h=0
      break
  print(h//tops+(h%tops>0)+i+1)

if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
s=input.split('-')
if len(s[0])==a and len(s[1])==b and len(s)==2:
  print('Yes')
else:
  print('No')


Fixed submission:
a,b=map(int,input().split())
s=input().split('-')
if len(s[0])==a and len(s[1])==b and len(s)==2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import sys
from string import ascii_lowercase as alph
from itertools import zip_longest

s,t=[list(l) for l in sys.stdin.read().split()]
d=dict((w,x) for w,x in zip(alph,range(26)))
d['?']=-1
s.sort(key=d.get)
t.sort(key=d.get, reverse=True)
for x,y in zip_longest(s,t,fillvalue='?'):
  if d[x]<d[y]:
      print('Yes')
      break
  elif d[x]>d[y]
      print('No')
      break
else:
  print('No')


Fixed submission:
import sys
from string import ascii_lowercase as alph
from itertools import zip_longest

s,t=[list(l) for l in sys.stdin.read().split()]
d=dict((w,x) for w,x in zip(alph,range(26)))
d['?']=-1
s.sort(key=d.get)
t.sort(key=d.get, reverse=True)
for x,y in zip_longest(s,t,fillvalue='?'):
  if d[x]<d[y]:
      print('Yes')
      break
  elif d[x]>d[y]:
      print('No')
      break
else:
  print('No')