Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03399 (python)

Fixed submission:
a = input()
b = input()
c = input()
d = input()
print(min((int(a), int(b))) + min((int(c), int(d))))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

cost = 0
for i in range(N):
  temp_A = [0] + [A[x] for x in range(N) if x != (i+1)] + [0]
  print(temp_A)
  for j in range(N):
    cost += abs(temp_A[j+1] - temp_A[j])
  print(cost)
  cost = 0

Buggy submission (verdict: Runtime Error):
N = int(input())
D, X = input().split()

result = int(X)
temp_D  = int(D) - 1
for _ in range(N):
  A = int(input())
  result += temp_D // A
result += N

print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
D, X = input().split()

result = int(X)
temp_D  = int(D) - 1
for _ in range(N):
  A = int(input())
  result += temp_D // A
result += N

print(result)
Problem p03407 (python)

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

Buggy submission (verdict: Runtime Error):
from itertools import product
_ = input()
A = list(map(int, input().split()))
B = list(map(int, input().split()))
l = [a + b for a, b in product(A, B)]

if len(l) > len(set(l)):
    for i in l:
        if l.count(i) % 2 == 0:
            for _ in range(l.count(i)):
                l.remove(i)
        elif l.count(i) % 2 == 1 and l.count(i) > 1:
            for _ in range(l.count(i) - 1):
                l.remove(i)

xor = 0
for i in l:
    xor ^= i

print(xor)
Problem p03472 (python)

Fixed submission:
from math import ceil
N, H = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
A = [i[0] for i in AB]
A.sort()
B = [i[1] for i in AB]
B.sort()

furudamage = A[-1]
count= 0
while len(B):
    nagedamage = B.pop()
    if nagedamage > furudamage:
        H -= nagedamage
        count += 1
        if H <= 0:
            print(count)
            break
    else:
        break
if H > 0:
    count += ceil(H/furudamage)
    print(count)

Buggy submission (verdict: Runtime Error):
N, H = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
A = [i[0] for i in AB].sort()
B = [i[1] for i in AB].sort()

count= 0
while len(B) > 0:
    damage = B.pop()
    H -= damage
    count += 1
    if H <= 0:
        print(count)
        return

count += round(H/A[-1])
print(count)
Problem p03719 (python)

Fixed submission:
A,B,C = map(int, raw_input().split())
if A<=C and C<=B:
 print "Yes"
else:
 print "No"

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
kotae = [0]*N
for i in range(M):
 l=map(int, raw_input().split())
 for j in range(len(l)):
  kotae[l[j]-1]=kotae[l[j]-1]+1

for k in range(N):
 print kotae[k]
Problem p03721 (python)

Fixed submission:
N, K = map(int, raw_input().split())
array=[]
for i in range(N):
 l=map(int, raw_input().split())
 array.append(l)
array.sort()
num=0
for j in range(N):
 num=num+array[j][1]
 if K<=num:
  print array[j][0]
  break;

Buggy submission (verdict: Runtime Error):
N, K = map(int, raw_input().split())
array=[10^5+1]*K
for i in range(N):
 a,b=map(int, raw_input().split())
 for j in range(K):
  if a<array[j] and 0<b:
   array[j]=a
   b=b-1
array.sort()
print array[K-1]
Problem p03400 (python)

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

Buggy 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)
Problem p03408 (python)

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 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())))
Problem p03547 (python)

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

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

Buggy 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 '='

Buggy 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 '='
Problem p03643 (python)

Fixed submission:
n = input()
print('ABC' + n)

Buggy submission (verdict: Runtime Error):
n = input()
print(int(n[3:]))
Problem p03657 (python)

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

Buggy 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)
Problem p03693 (python)

Fixed submission:
a= input().split(' ')
b = a[0]+a[1]+a[2]
if int(b) % 4 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a= input().split(' ')
b = a[0]+a[1]+a[2]
if int(b) % 4 == 0:
    print('YES')
else:
    print('NO'
Problem p03729 (python)

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 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')
Problem p04019 (python)

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 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
Problem p03556 (python)

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

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

Buggy 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)
Problem p03997 (python)

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

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

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

Fixed submission:
a, b, c = map(int, input().split())
if a + b < c:
    print("No")
else:
    print("Yes")

Buggy 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)
Problem p03415 (python)

Fixed submission:
print("".join([input()[i] for i in range(3)]))

Buggy 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)
Problem p03403 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

state = 0
way_total = 0
for j in range(0,num):
    way_total += abs(array[j] - state)
    state = array[j]
way_total += abs(state)

for i in range(0,num):
    if i != num - 1 and i != 0:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i+1] - array[i]) + abs(array[i-1] - array[i+1])
    elif i == 0:
        way = way_total - abs(array[i])- abs(array[i+1] - array[i]) + abs(array[i+1])
    elif i == num - 1:
        way = way_total - abs(array[i-1] - array[i]) - abs(array[i]) + abs(array[i-1] - 0)
    print(way)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# get a integer
num = int(raw_input())
# get two integers separated with half-width break
array = map(int, raw_input().split())
# get a string
#s = raw_input()

for i in range(0,num):
    state = 0
    way = 0
    for j in range(0,num):
        if i != j:
            if !(j+1 < num and state <= array[j] and array[j] <= array[j+1]) 
                and !(j+1 < num and state >= array[j] and array[j] >= array[j+1]):
                way += abs(array[j] - state)
                state = array[j]
    way += abs(state)
    print(way)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding:utf-8 -*-

#import sys # モジュール属性 argv を取得するため
 
argvs = sys.argv  # コマンドライン引数を格納したリストの取得
argc = len(argvs) # 引数の個数
# デバッグプリント
print argvs
print argc

Buggy submission (verdict: Runtime Error):
import sys # モジュール属性 argv を取得するため
 
argvs = sys.argv  # コマンドライン引数を格納したリストの取得
argc = len(argvs) # 引数の個数
# デバッグプリント
print argvs
print argc

Buggy submission (verdict: Runtime Error):
print(args)
Problem p03424 (python)

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 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')
Problem p03695 (python)

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 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
Problem p03407 (python)

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

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

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

Buggy 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)
Problem p03408 (python)

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

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

Buggy 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)
Problem p03409 (python)

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

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

Buggy 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)
Problem p03433 (python)

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

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

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

Fixed submission:
print(['Even','Odd'][max(0,sum(map(lambda x:int(x)%2,input().split()))-1)])

Buggy submission (verdict: Runtime Error):
print(['Even','Odd'][max(0,sum(map(lambda x:int(x)%2,input()))-1)])
Problem p03456 (python)

Fixed submission:
ab=int(input().replace(' ',''))
print(['No','Yes'][any(i**2==ab for i in range(ab))])

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

Fixed submission:
import sys
import numpy as np

read=sys.stdin.read
readline=sys.stdin.readline

def main():
  wb={'W':1,'B':0}
  n,k=map(int,readline().split())
  xyc=[l.split() for l in read().splitlines()]
  xy=[[int(lst[0]) % (2*k),(int(lst[1])+k*wb[lst[2]]) % (2*k)] for lst in xyc]
  mat=np.zeros((k+1,2*k+1),dtype='int64')
  cand=np.zeros((k+1,k+1),dtype='int64')
  for e in xy:
    f0=e[0]>=k
    f1=e[1]>=k
    mat[e[0]-f0*k+1,e[1]+(-1)**f1*f0*k+1]+=1
  mat=np.cumsum(mat,axis=0)
  mat=np.cumsum(mat,axis=1)
  cand=mat[k,2*k]-mat[k,k:2*k+1]+mat[k,:k+1]\
       -np.reshape(mat[:k+1,2*k],(k+1,1))+2*mat[:,k:2*k+1]-2*mat[:,:k+1]
  print(max(np.max(cand),mat[k,2*k]-np.min(cand)))
  
if __name__=='__main__':
  main()

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

read=sys.stdin.read
readline=sys.stdin.readline

def main():
  def mycount(x1,y1,x2,y2,mat,s):
    return mat[s,x2,y2]-mat[s,x1,y2]-mat[s,x2,y1]+mat[s,x1,y1]
  wb={'W':0,'B':1}
  n,k=map(int,readline().split())
  xyc=[l.split() for l in read().splitlines()]
  xyc=[[int(lst[0]) % (2*k),int(lst[1]) % (2*k),wb[lst[2]]] for lst in xyc]
  mat=np.zeros((2,4*k+1,4*k+1),dtype='int64')
  cand=np.zeros((2,2*k+1,2*k+1),dtype='int64')
  for i in range(4):
    for e in xyc:
      mat[e[2],e[0]+1+2*k*(i&1),e[1]+1+2*k*(i>>1&1)]+=1
  mat=np.cumsum(mat,axis=1)
  mat=np.cumsum(mat,axis=2)
 # for i in range(1,4*k+1):
 #   for j in range(1,4*k+1):
 #     mat[:,i,j]=mat[:,i,j]+mat[:,i-1,j]+mat[:,i,j-1]-mat[:,i-1,j-1]
  cand+=mat[0,k:3*k+1,k:3*k+1]+mat[0,:2*k+1,:2*k+1]-mat[0,k:3*k+1,:2*k+1]-mat[0,:2*k+1,k:3*k+1]\
  cand+=mat[0,2*k:4*k+1,2*k:4*k+1]+mat[0,k:3*k+1,k:3*k+1]-mat[0,2*k:4*k+1,k:3*k+1]-mat[0,k:3*k+1,2*k:4*k+1]\
  cand+=mat[1,2*k:4*k+1,k:3*k+1]+mat[1,k:3*k+1,:2*k+1]-mat[1,2*k:4*k+1,:2*k+1]-mat[1,k:3*k+1,k:3*k+1]\
  cand+=mat[1,k:3*k+1,2*k:4*k+1]+mat[1,:2*k+1,k:3*k+1]-mat[1,:2*k+1,2*k:4*k+1]-mat[1,k:3*k+1,k:3*k+1]
  #print(mat)
  print(np.max(cand))
  
if __name__=='__main__':
  main()
Problem p03472 (python)

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

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

Buggy 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()
Problem p03474 (python)

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 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')
Problem p03486 (python)

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

Buggy 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')
Problem p03504 (python)

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

n,c=map(int,readline().split())
m=2*10**5
stc=[list(map(int,l.split())) for l in read().splitlines()]
cht=[[0]*(m+1) for _ in range(c)]
for e in stc:
  cht[e[2]-1][2*e[0]-1:2*e[1]]=[1 for _ in range(2*e[1]-2*e[0]+1)]
mnr=0
for i in range(1,m+1):
  mnr=max(mnr,sum(cht[ch][i] for ch in range(c)))
print(mnr)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
readline=sys.stdin.readline
read=sys.stdin.read

n,c,*stc=map(int,read())
m=2*10**5
cht=np.zeros((c,m+1),dtype='int64')
for s,t,c in zip(*[iter(stc)]*3):
  cht[c-1,2*t-1:2*s]=np.ones(2*t-2*s+1)
print(max(np.sum(cht,axis=0)))

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
readline=sys.stdin.readline
read=sys.stdin.read

n,c=map(int,readline().split())
m=2*10**5
stc=[list(map(int,l.split())) for l in read().splitlines()]
cht=np.array([])
for e in stc:
  w=e[1]-e[0]
  cht.vstack((cht,np.pad(np.ones(2*(e[1]-e[0])+1),(2*e[0]-1,m-2*e[1]),\
                mode='constant',constant_values=(1,1))))
mnr=0
for i in range(1,m+1):
  mnr=max(mnr,sum(cht[ch][i] for ch in range(c)))
print(mnr)
Problem p03547 (python)

Fixed submission:
a,b=input().split()
print(['<','=','>'][min(2,max(0,1+int(a,16)-int(b,16)))])

Buggy submission (verdict: Runtime Error):
print(['<','=','>'][min(2,max(0,1+int('0x'+input())-int('0x'+input())))a,b=input().split()
print(['<','=','>'][min(2,max(0,1+int(a,16)-int(b,16)))])
Problem p03555 (python)

Fixed submission:
for x,y in zip(input(),reversed(input())):
  if x!=y:
    print('NO')
    break
else:
  print('YES')

Buggy submission (verdict: Runtime Error):
for x,y in zip(input(),reversed(input)):
  if x!=y:
    print('NO')
    break
else:
  print('YES')
Problem p03556 (python)

Fixed submission:
n=int(input())
for x in range(10**5):
  if x**2>n:
    print((x-1)**2)
    break

Buggy submission (verdict: Runtime Error):
for x in range(int(input())):
  if x**2>n:
    print(x-1)
    break