Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
input_train_price1=input("電車の通常の切符の料金を入力:")
input_train_price2=input("電車の乗り放題切符の料金を入力":)
input_bus_price1=input("バスの通常の切符の料金を入力:")
input_bus_price2=input("バスの乗り放題切符の料金を入力":)

train_price1=int(input_train_price1)
train_price2=int(input_train_price2)
bus_price1=int(input_bus_price1)
bus_price2=int(input_bus_price2)

train_price=["train_price1,train_price2"]
bus_price=["bus_price1,bus_price2"]

best_train_price=min(train_price)
best_bus_price=min(bus_price)

print("運賃の合計の最小値は"+best_train_price+best_bus_price+"円です。")

Fixed submission:
input_train_price1=input()
input_train_price2=input()
input_bus_price1=input()
input_bus_price2=input()

train_price=[int(input_train_price1),int(input_train_price2)]
bus_price=[int(input_bus_price1),int(input_bus_price2)]

best_train_price=min(train_price)
best_bus_price=min(bus_price)

#print(best_train_price+"+"+best_bus_price)

total_price=best_train_price+best_bus_price

print(str(total_price))
Buggy python submission (verdict: Runtime Error):
num = int(input())
colors = map(str, input().split())

if len(set(colors)) == 3:
    print('Three')
else:
    print('Four')

Fixed submission:
n = int(input())
print(n//3)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
while True:
    N = int(input())
    if N >= 1 and N <= 1000:
        continue
    if N < 3:
        print(0)
    else:
        if N/3 > 3.0:
            print(int(N/3)+1)
        else:
            print(int(N/3))

Fixed submission:
while True:
    N = int(input())
    if N >= 1 and N <= 1000:
        break
if N < 3:
    print(0)
if N >= 3:
    print(int(N/3))
Buggy python submission (verdict: Time Limit Exceeded):
while True:
    A = []
    s = 0
    a = input().split()
    X, Y = list(map(int,list(a)))
    if X > Y or Y > 10**18 or X < 1:
        continue
    A.append(X)
    for i in range(2*X,Y+1):
        if i == A[len(A)-1]*2:
            A.append(i)
    s = len(A)
    if A[len(A)-1] > Y:
        s = len(A) -1
    print(s)
    break

Fixed submission:
while True:
    A = []
    s = 0
    a = input().split()
    X, Y = list(map(int,list(a)))
    if X > Y or Y > 10**18 or X < 1:
        continue
    A.append(X)
    while True:
        A.append(A[len(A)-1]*2)
        if A[len(A)-1] > Y:
            break
    s = len(A) - 1
    print(s)
    break
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>K:
         counter=i
         break
print(A[counter][0])

Fixed submission:
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         counter=i
         break   
print(A[counter][0])

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>K:
         counter=i
         break
print(A[counter-1][0])

Fixed submission:
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         counter=i
         break   
print(A[counter][0])

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()    
for i in range(N):
    if len(C)>K:
        break
    for j in range(A[i][1]):
        C.append(A[i][0])
        if len(C)>K:
            break      
print(C[K-1])

Fixed submission:
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         counter=i
         break   
print(A[counter][0])

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=[]
B=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(N):
    if len(C)>K:
            break
    for j in range(B[i]):
        C.append(A[i])
        C.sort()
        if len(C)>K:
            break
print(C[K-1])

Fixed submission:
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         counter=i
         break   
print(A[counter][0])

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
A=[]
B=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(N):
    for j in range(B[i]):
        C.append(A[i])
C.sort()
print(C[K-1])

Fixed submission:
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         counter=i
         break   
print(A[counter][0])
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
print((a + b) % 24)

Fixed submission:
A,B=map(int,input().split())
print((A + B) % 24)
Buggy python submission (verdict: Runtime Error):
def solver(a, b, c, d):
  """
  >>> solver(600, 300, 220, 420)
  520
  >>> solver(555, 555, 400, 200)
  755
  >>> solver(549, 817, 715, 603)
  1152
  """

  result = 0

  result += a if a < b else b
  result += c if c < d else d

  return result

if __name__ == '__main__':
  inputs = [int(input()) for _ in range(4)]
  print solver(inputs[0], inputs[1], inputs[2], inputs[3])


Fixed submission:
def solver(a, b, c, d):
  """
  >>> solver(600, 300, 220, 420)
  520
  >>> solver(555, 555, 400, 200)
  755
  >>> solver(549, 817, 715, 603)
  1152
  """

  result = 0

  result += a if a < b else b
  result += c if c < d else d

  return result

if __name__ == '__main__':
  inputs = [int(input()) for _ in range(4)]
  print(solver(inputs[0], inputs[1], inputs[2], inputs[3]))
Buggy python submission (verdict: Runtime Error):
d=input()
print(d.repalace('7/','8/'))

Fixed submission:
d=input()
print(d.replace('7/','8/'))

Buggy python submission (verdict: Runtime Error):
d=input()
print(f'{d[:3]}8{d[4:]}')

Fixed submission:
d=input()
print(d.replace('7/','8/'))
Buggy python submission (verdict: Runtime Error):
from math import ceil
a, b = map(int, input())
print(ceil((a+b)/2))

Fixed submission:
from math import ceil
a, b = map(int, input().split())
print(ceil((a+b)/2))
Buggy python submission (verdict: Runtime Error):
r, b, g = map(int, input().split())
print(['NO', 'YES'][(10*b+g)%4 == 0]

Fixed submission:
r, g, b = map(int, input().split())
print(['NO', 'YES'][(10*g + b) % 4 == 0])
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()

line = input_line.split(' ')
a = int(line[0])
b = int(lint[1])
c = a + b

if c > 2 and c % 3 == 0:
	print('Possible')

if a > 2 and a % 3 == 0:
	print('Possible')
	return

if b > 2 and b % 3 == 0:
	print('Possible')
	return

print('Impossible')


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()

line = input_line.split(' ')
a = int(line[0])
b = int(line[1])
c = a + b

if c > 2 and c % 3 == 0:
	print('Possible')
elif a > 2 and a % 3 == 0:
	print('Possible')
elif b > 2 and b % 3 == 0:
	print('Possible')
else:
	print('Impossible')
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()
nm = input_line.split()
n = nm[0]
m = nm[1]

div = int(1e9 + 7)

input_line = sys.stdin.readline()
xn = [int(v) for v in input_line.split()]

input_line = sys.stdin.readline()
ym = [int(v) for v in input_line.split()]

i = 0
j = 0
S = 0
for i in range(len(xn) - 1):
	sx = xn[i]
	for j in range(len(ym) - 1):
		sy = ym[j]

		for ii in range(i + 1, len(xn)):
			for jj in range(j + 1, len(ym)):
				S += abs((sx - xn[ii]) * (sy - ym[jj]))

S %= div

print(int(S))


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()

n = int(input_line)
S = []

if n==0:
	print("")
	quit()

for i in range(n):
	input_line = sys.stdin.readline()
	S.append(input_line)

used_list = []
used_count = {}
maxLength = 0
for mojiretsu in S:
	_used_dict = {}
	if len(mojiretsu) > maxLength :
		maxLength = len(mojiretsu)
	for moji in mojiretsu:
		if not moji in _used_dict:
			_used_dict[moji] = 0
		if _used_dict[moji] == 0:
			if not moji in used_count:
				used_count[moji] = 0
			used_count[moji] += 1
			_used_dict[moji] = 0
		_used_dict[moji] += 1

	sorted(_used_dict.items(), key=lambda x:x[1], reverse=True)
	used_list.append(_used_dict)

used_flags = []
mojiKeys = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm','n','o','p','q','r','s','t','u','v','w','x','y','z']

i = 0
candidates = {}
for alpha in mojiKeys:
	if alpha in used_count and used_count[alpha] == n:
		candidates[alpha] = 0
		minimum = maxLength
		for used in used_list:
			if used[alpha] < minimum :
				minimum = used[alpha]
		candidates[alpha] = minimum

output = ""

for i in range(len(mojiKeys)):
	if not mojiKeys[i] in candidates:
		continue
	for j in range(candidates[mojiKeys[i]]):
		output += mojiKeys[i]

print(output)
Buggy python submission (verdict: Runtime Error):
PList = [int(i) for i in input().split()]

Price = min(PList[1],PList[2]) + min(Plist[3],PList[4])

print(Price)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())

print(min(A,B)+min(C,D))

Buggy python submission (verdict: Runtime Error):

P  = 0
if A > B:
  P = A
else:
  P = B
if C > D:
  P = P + C
else:
  P = P + D
  
print(P)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())

print(min(A,B)+min(C,D))
Buggy python submission (verdict: Runtime Error):
D = list(map(int,input().split()))

if D[2] > D[0] + D[1]:
  print(No)
else:
  print(Yes)

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

if D[2] > D[0] + D[1]:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
D = [map(int(),input().split())]
 
if D[2] > D[0] + D[1]:
  print(No)
else:
  print(Yes)

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

if D[2] > D[0] + D[1]:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
D = map(int(),input().split())

if D[2] > D[0] + D[1]:
  print(No)
else:
  print(Yes)

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

if D[2] > D[0] + D[1]:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
import numpy as np
 
C = np.chararray((3,3))
C[0][:]=input().split()
C[1][:]=input().split()
C[2][:]=input().split()
 
print(C[0][0]C[1][1]C[2][2])

Fixed submission:
 
C_0=list(input())
C_1=list(input())
C_2=list(input())

# D = C[0][0]+C[1][1]+C[2][2]
# print(str(D))
print(C_0[0]+C_1[1]+C_2[2])

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

C = np.chararray(input(),input(),input())

print(C[0][0],C[1][1],C[2][2])


Fixed submission:
 
C_0=list(input())
C_1=list(input())
C_2=list(input())

# D = C[0][0]+C[1][1]+C[2][2]
# print(str(D))
print(C_0[0]+C_1[1]+C_2[2])

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

C = np.charray(input(),input(),input())

print(C[0][0],C[1][1],C[2][2])

Fixed submission:
 
C_0=list(input())
C_1=list(input())
C_2=list(input())

# D = C[0][0]+C[1][1]+C[2][2]
# print(str(D))
print(C_0[0]+C_1[1]+C_2[2])
Buggy python submission (verdict: Runtime Error):
# coding:utf-8
H,W = map(int,input().split())

A = [[0 for i in range(W)] for j in range(H)]
ans = [[0 for i in range(W)] for j in range(H)]
B = [0] * H

for i in range(H):
	B[i] = input()

for i in range(H):
	char = list(B[i])
	for j in range(W):
		A[i][j] = char[j]


for i in range(H):
	for j in range(W):
		if A[i][j] == '#':
			for h in range(-1,2):
				for k in range(-1,2):
					if h == 0 and k == 0:
						continue
					if (i == 0 and h == -1) or (i == H -1 and h == 1) or (j == 0 and k == -1) or (j == W-1 and k == 1):
						continue

					if (A[i+h][j+k]) != '#':
 						ans[i+h][j+k] += 1  
			ans[i][j] = '#'
		
print (ans)

Fixed submission:
# coding:utf-8
a,b,c = map(int,input().split())#標準入力を行う

def out_of_three():
	if a == b:
		return c
	if a == c:
		return b
	if b == c:
		return a

print (out_of_three())
Buggy python submission (verdict: Runtime Error):
 coding:utf-8
H, W = list(map(int, input().split()))
s = []
ans = []
for i in range(H):
    s.append(input())
    ans.append([])
for i in range(H):
    for j in range(W):
        if(s[i][j] == "#"):
            ans[i].append("#")
            continue
        ans[i].append(0)

for i in range(H):
	for j in range(W):
		if s[i][j] == '#':
			for h in range(-1,2):
				for k in range(-1,2):
					if h == 0 and k == 0:
						continue
					if (i == 0 and h == -1) or (i == H -1 and h == 1) or (j == 0 and k == -1) or (j == W-1 and k == 1):
						continue

					if (s[i+h][j+k]) != '#':
 						ans[i+h][j+k] += 1  
			ans[i][j] = '#'
		
print (ans)

Fixed submission:
# coding:utf-8
H, W = list(map(int, input().split()))
s = []
ans = []
for i in range(H):
    s.append(input())
    ans.append([])
for i in range(H):
    for j in range(W):
        if(s[i][j] == "#"):
            ans[i].append("#")
            continue
        ans[i].append(0)

for i in range(H):
	for j in range(W):
		if s[i][j] == '#':
			for h in range(-1,2):
				for k in range(-1,2):
					if h == 0 and k == 0:
						continue
					if (i == 0 and h == -1) or (i == H -1 and h == 1) or (j == 0 and k == -1) or (j == W-1 and k == 1):
						continue

					if (s[i+h][j+k]) != '#':
 						ans[i+h][j+k] += 1  
			ans[i][j] = '#'

o = ""
for i in range(H):
	for j in range(W):
		o += str(ans[i][j])
	o += "\n"
print (o)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#値の取得
t_1 = input()
t_2 = input()
if (t_1 < t_2):
  sum_1 = t_1
else:
  sum_1 = t_2
  
b_1 = input()
b_2 = input()
if (b_1 < b_2):
  sum_2 = b_1
else:
  sum_2 = b_2
  
print(int(s_1) + int(s_2))

Fixed submission:
# -*- coding: utf-8 -*-
#値の取得
t_1 = int(input())
t_2 = int(input())
if (t_1 < t_2):
  sum_1 = t_1
else:
  sum_1 = t_2
  
b_1 = int(input())
b_2 = int(input())
if (b_1 < b_2):
  sum_2 = b_1
else:
  sum_2 = b_2
  
print(sum_1 + sum_2)
Buggy python submission (verdict: Runtime Error):
print(int(input() // 3)


Fixed submission:
print(int(input()) // 3)
Buggy python submission (verdict: Runtime Error):
 print(input().count("1"))


Fixed submission:
print(input().count("1"))

Buggy python submission (verdict: Runtime Error):
 print(input().count("1"))


Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = [int(i) for i in input().split()]
first_num = 0
for i in range(a, b+1):
    if i % x == 0:
        first_num = i
        print((b - first_num) // x + 1)
        break
    elif first_num == 0 and i == b:
        print(0)


Fixed submission:
a, b, x = [int(i) for i in input().split()]
def f(n):
    if n == -1:
        return 0
    else:
        return n // x + 1
print(f(b) - f(a-1))

Buggy python submission (verdict: Runtime Error):
a, b, x = [int(i) for i in input().split()]
for i in range(a, b+1):
    if i % x == 0:
        first_num = i
        break
print(-(-(b - first_num) // x))


Fixed submission:
a, b, x = [int(i) for i in input().split()]
def f(n):
    if n == -1:
        return 0
    else:
        return n // x + 1
print(f(b) - f(a-1))

Buggy python submission (verdict: Runtime Error):
a, b, x = [int(i) for i in input().split()]
for i in range(a, b+1):
    if i % x == 0:
        first_num = i
        break
print(-(-(b - first_num) // x))


Fixed submission:
a, b, x = [int(i) for i in input().split()]
def f(n):
    if n == -1:
        return 0
    else:
        return n // x + 1
print(f(b) - f(a-1))
Buggy python 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

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

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

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

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

Fixed submission:
a = input()
b = input()
c = input()
d = input()
print(min((int(a), int(b))) + min((int(c), int(d))))
Buggy python submission (verdict: Time Limit Exceeded):
try:
    n = int(input().strip())
    spot = [int(i) for i in input().strip().split(" ")]
    for i in range(n):
        max = 0
        point = 0
        for m in range(n):
            if i == m:
                continue
            max+=abs(point - spot[m])
            point=spot[m]
        max+=abs(point - 0)
        print(max)    
except EOFError:
    pass

Fixed submission:
try:
    n = int(input().strip())
    spot = [int(i) for i in input().strip().split(" ")]
    spot.insert(0,0)
    spot.append(0)
    max=0
    for m in range(1,len(spot)):
        max+=abs(spot[m-1] - spot[m])
    for i in range(1,n+1):
        sub1=abs(spot[i-1] - spot[i])
        sub2=abs(spot[i] - spot[i+1])
        add1=abs(spot[i-1] - spot[i+1])
        print(max-sub1-sub2+add1)
except EOFError:
    pass

Buggy python submission (verdict: Time Limit Exceeded):
try:
    n = int(input().strip())
    spot = list(input().strip().split(" "))
    for i in range(n):
        max = 0
        point = 0
        for m in range(n):
            if i == m:
                continue
            max+=abs(point - int(spot[m]))
            point=int(spot[m])
        max+=abs(point - 0)
        print(max)    
except EOFError:
    pass

Fixed submission:
try:
    n = int(input().strip())
    spot = [int(i) for i in input().strip().split(" ")]
    spot.insert(0,0)
    spot.append(0)
    max=0
    for m in range(1,len(spot)):
        max+=abs(spot[m-1] - spot[m])
    for i in range(1,n+1):
        sub1=abs(spot[i-1] - spot[i])
        sub2=abs(spot[i] - spot[i+1])
        add1=abs(spot[i-1] - spot[i+1])
        print(max-sub1-sub2+add1)
except EOFError:
    pass
Buggy python 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)

Fixed submission:
A, B, C = map(int, input().split())
if A + B >= C:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
import numpy as np
N = int(input())
red = np.array([list(map(int, input().split())) for _ in range(N)])
blue = np.array([list(map(int, input().split())) for _ in range(N)])

def shuffle(l):
    for i in permutations(l):
        yield i

def judge(r, b):
    cnt = 0
    for i, j in zip(r, b):
        if i[0] < j[0] and i[1] < j[1]:
            cnt += 1
    return cnt

print(max([judge(red, b) for b in shuffle(blue)]))

Fixed submission:
N = int(input())
red = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x:x[1], reverse=True)
blue = sorted([list(map(int, input().split())) for _ in range(N)])

cnt = 0
for i in blue:
    for j in red:
        if i[0] > j[0] and i[1] > j[1]:
            cnt += 1
            red.remove(j)
            break

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
N = int(input())
red = [list(map(int, input().split())) for _ in range(N)]
blue = [list(map(int, input().split())) for _ in range(N)]

def shuffle(l):
    for i in permutations(l):
        yield i

def judge(r, b):
    cnt = 0
    for i, j in zip(r, b):
        if i[0] < j[0] and i[1] < j[1]:
            cnt += 1
    return cnt

print(max([judge(red, b) for b in shuffle(blue)]))


Fixed submission:
N = int(input())
red = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x:x[1], reverse=True)
blue = sorted([list(map(int, input().split())) for _ in range(N)])

cnt = 0
for i in blue:
    for j in red:
        if i[0] > j[0] and i[1] > j[1]:
            cnt += 1
            red.remove(j)
            break

print(cnt)
Buggy python 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)


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 python submission (verdict: Time Limit Exceeded):
X, Y = (int(i) for i in input().split())

if X % Y == 0 :
  print(-1)
else :
  i = 2
  while i < 1000000000000000000 :
    X *= i
    if X % Y != 0 :
      print(X)
      break
    else :
      i += 1

Fixed submission:
X, Y = (int(i) for i in input().split())

if X % Y == 0 :
  print(-1)
else :
  i = 2
  while i < 1000000000000000000 :
    multiples = X * i
    if multiples % Y != 0 :
      print(multiples)
      break
    else :
      i += 1
Buggy python 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]

Fixed submission:
A,B,C = map(int, raw_input().split())
if A<=C and C<=B:
 print "Yes"
else:
 print "No"
Buggy python 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]

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 python submission (verdict: Time Limit Exceeded):
import sys
A,B,D = map(int, raw_input().split())

while A%D!=0:
 A=A+1
num=0
while A<=B:
 num=num+1
 A=A+D
print num

Fixed submission:
import sys

def f(num,div):
 if num==-1:
  return 0
 return num/div+1

A,B,D = map(int, raw_input().split())

num1=f(A-1,D)
num2=f(B,D)

print num2-num1