qyliang/CodeNanoFix huggingface dataset:
Buggy code:
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, initial=1)
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, A, B = MAP()

if abs(A - B) % 2 == 0:
    print('Alice')
else:
    print('borys')


Fixed code:
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, initial=1)
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, A, B = MAP()

if abs(A - B) % 2 == 0:
    print('Alice')
else:
    print('Borys')
Buggy code:
n,a,b = map(int,input().split())
if b-a-1 % 2:
    print('Alice')
else:
    print('Borys')

Fixed code:
n, a, b = list(map(int,input().split()))
if (b-a+1)%2:
    print("Alice")
else:
    print("Borys")
Buggy code:
N, A, B = map(int, input().split())

diff = abs(A - B)
if diff % 2 == 0:
    print('Borys')
else:
    print('Alice')

Fixed code:
N,A,B = map(int,input().split(' '))

k = abs(A-B)

if k % 2 == 0:
	print("Alice")
else:
	print("Borys")
Buggy code:
n,a,b=map(int,input().split())
if n==2:
    print("Alice")
elif (b-a-1)%2==0:
    print("Borys")
else:
    print("Alice")


Fixed code:
n,a,b = map(int, input().split())
c = b-a
if c % 2 == 0:
  print("Alice")
elif c % 2 == 1:
  print("Borys")
Buggy code:
n,a,b=map(int,input().split())
bet=abs(b-a)
if bet%2==0:
  winner='ALice'
  else:
    winner='Borys'
    
print(winner)

Fixed code:
n,a,b=map(int,input().split())
bet=abs(b-a)
if bet%2==0:
  winner='Alice'
else:
    winner='Borys'
    
print(winner)
Buggy code:
N, A, B = map(int, input().split())

if((B-A+1)%2 != 0):
    print("Alice")
elif(B == 2):
    print("Draw")
else:
    print("Borys")

Fixed code:
N,A,B = map(int,input().split())
if (B-A+1) % 2 != 0 :
    flag = 1
else :
    flag = -1

if flag == 1 :
    ans = "Alice"
elif flag == -1 :
    ans = "Borys"
else :
    ans = "Draw"
print(ans)
Buggy code:
a,b,c = map(int,input().split())
if (a-b) % 2 == 1:
  print("Borys")
else:
  print("Alice")

Fixed code:
a,b,c = map(int,input().split())
if (b-c) % 2 == 1:
  print("Borys")
else:
  print("Alice")
Buggy code:
n,a,b=map(int,input().split())
print('Borys' if b - a % 2  == 1 else 'Alice')

Fixed code:
n, a, b = list(map(int, input().split()))
if (b-a)%2==1:
  print("Borys")
else:
  print("Alice")
Buggy code:
N,A,B = list(map(int,input().split()))

if (B-A)%2 == 0:
	print('Bob')
else:
    print('Alice')

Fixed code:
N, A, B = list(map(int, input().split()))
if (B-A)%2 == 0:
    print('Alice')
else:
    print('Borys')
Buggy code:
n,a,b = map(int,input().split())
if b-a-1 % 2 == 0:
    print('Borys')
else:
    print('Alice')

Fixed code:
n,a,b=map(int,input().split())
num=abs(a-b-1)
if num%2==0:
    print("Borys")
else:
    print("Alice")
Buggy code:
#
N, A, B = list(map(int, input().rstpir().split()))

#
if (B-A-1)%2==0:
    print('Borys')
else:
    print('Alice')


Fixed code:
#
N, A, B = list(map(int, input().split()))

#
if (B-A-1)%2==0:
    print('Borys')
else:
    print('Alice')
Buggy code:
n, a, b = list(map(int, input().split()))
print(['Borys','Alice'][(b-a)%2])

Fixed code:
n, a, b = list(map(int, input().split()))
print(['Alice','Borys'][(b-a)%2])
Buggy code:
def main():
    N,A,B = map(int,input().split(" "))
    if N==2:
        print("Draw")
        exit()
    s = abs(A-B)-1
    if s%2:
        print("Alice")
    else:
        print("Borys")

if __name__=="__main__":
    main()

Fixed code:
def main():
    N,A,B = map(int,input().split(" "))
    s = abs(A-B)-1
    if s%2:
        print("Alice")
    else:
        print("Borys")

if __name__=="__main__":
    main()
Buggy code:
n, a, b = [int(i) for i in input().split()]
print(["Alice", "Boris"][(a - b) % 2])

Fixed code:
n, a, b = [int(i) for i in input().split()]
print(["Alice", "Borys"][(a - b) % 2])
Buggy code:
N_A_B = list(map(int, input()))

if N_A_B[2] - N_A_B[1] %2 == 0:
    print("Borys")
elif N_A_B[2] - N_A_B[1] %2 == 1:
    print("Alice")

Fixed code:
N_A_B = list(map(int, input().split()))

if (N_A_B[2] - N_A_B[1]) %2 == 0:
    print("Alice")
elif (N_A_B[2] - N_A_B[1]) %2 == 1:
    print("Borys")
Buggy code:
N, A, B = map(int, input().split())
if A==1 and B==N:
    print('Borys')
else:
    if B-A == 2:
        print('Draw')
    elif (B-A)%2 == 0:
        print('Alice')
    else:
        print('Borys')

Fixed code:
N, A, B =map(int,input().split(' '))

m=B-A-1

if m%2==1:
    print('Alice')
elif m%2==0:
    print('Borys')
else:
    print('Draw')
Buggy code:
a = input().split(" ")
b = list(map(int, a))
if (b[2] - b[1]) % 2 == 0:
    print("Borys")
else:
    print("Alice")


Fixed code:
a = list(map(int, input().split()))
b = abs(a[1] - a[2])
if b % 2 == 0:
    print("Alice")
else:
    print("Borys")
Buggy code:
s=input().split()
if int(s[2])-int(s[1])%2==0:
    print('Alice')
else:
    print('Borys')

Fixed code:
x = input().split(" ")

if((int(x[1]) - int(x[2])) % 2 == 0):
    print("Alice")
    
else:
    print("Borys")
Buggy code:
n,a,b = map(int,input().split())
if n%2 == 0
	if a == 1:
		if b == n or b == 2:
			print('Borys')
		else:
			print('Alice')
	if b == n
		print('Alice')
else:
	if a == 1:
		if b == n-1:
			print('Borys')
		else:
			print('Alice')
	elif b == n:
		if a == n-1:
			print('Alice')
		else:
			print('Borys')
	else:
		if (b-a)%2 == 1:
			print('Borys')
		else:
			print('Alice')

Fixed code:
n,a,b=map(int,input().split())
if (b-a-1)%2==0:
    print('Borys')
else:
    print('Alice')
Buggy code:
N, A, B = list(map(int, input().strip().split()))
if (N - B + A) % 2 == 1:
	print("Alice")
else:
	print("Borys")

Fixed code:
N, A, B = map(int, input().split())

if (B - A + 1) % 2 == 1:
    print("Alice")
else:
    print("Borys")
Buggy code:
N,A,B=map(int,input().split())
print("Borys" if (B-A)%2 == 0 else "Alice")

Fixed code:
N,A,B = map(int,input().split())
print('Borys' if (B-A)%2 else 'Alice')
Buggy code:
n,a,b=map(int,input().split())
if abs(a-b)%2 ==0:
    print('Borys')
else:
    print('Alice')
    

Fixed code:
import math
n, a, b = map(int,input().split(' '))

if abs(b - a) %2  == 0:
    print("Alice")
else:
    print("Borys")
Buggy code:
N, A, B = map(int, input().split())

if B -A %2 == 0:
  print('Borys')
else:
  print('Alice')
  

Fixed code:
# C
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
    print('Alice')
else:
    print('Borys')
Buggy code:
a,b,c=[int(i) for i in input().split()]                                                                  2 flag=(abs(b-c)%2)==0

if flag:
	print("Alice")
else:
	print("Borys")

Fixed code:
a,b,c=[int(i) for i in input().split()]
if abs(b-c)%2==0:
	print("Alice")
else:
	print("Borys")
Buggy code:
N, A, B = map(int, input().split())

print('Alice' if (B - A + 1) % 2 == 0 else 'Borys')


Fixed code:
N,A,B = map(int,input().split())
if (B-A+1)%2 == 0:
    print('Borys')
else:
    print('Alice')
Buggy code:
n, a, b = map(int, input().split())
print('Alice' if abs(a-b)%2 == 1 else 'Borys')


Fixed code:
n, a, b = map(int, input().split())
print("Borys" if abs(a - b) % 2 == 1 else "Alice")
Buggy code:
N, A, B = map(int, input().split())
if B - A % 2:
    print("Alice")
else:
    print("Borys")



Fixed code:
N,A,B=input().split(' ')
if (int(B)-int(A)-1)%2==1:
  print('Alice')
else:
  print('Borys')
Buggy code:
n, a, b = map(int, input().split())

if (b-a) % 2:
    print('Alice')
else:
    print('Borys')

Fixed code:
n, a, b = map(int, input().split())
if (a + b) % 2:
    print('Borys')
else:
    print('Alice')
Buggy code:
N,A,B = list(map(int,input().split()))

if (B-A)%2 == 0:
	print('Borys')
else:
    print('Alice')


Fixed code:
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
  print('Alice')
else:
  print('Borys')
Buggy code:
n, a, b = map(int, input().split())
if n == 2:
    print("Alice")
else:
    if (b-a) % 2 == 0:
        print("Alice")
    else:
        print("Borys")

Fixed code:
n,a,b=map(int,input().split())
print("Alice" if (a-b)%2==0 else "Borys")
Buggy code:
s = input()

s[:4] = '2018'
print(s)

Fixed code:
s = input()
print("2018" + s[4:])
Buggy code:
from pprint import pprint as pp

s = input()
print("2018/"+s[4:])

Fixed code:
from pprint import pprint as pp

s = input()
print("2018"+s[4:])
Buggy code:
print('2018' + input()[:4])


Fixed code:
print('2018' + input()[4:])
Buggy code:
s=input()
s="2018"+s[4:]
print s

Fixed code:
s=input()
a=s[4:]
print("2018"+a)
Buggy code:
S = list(input())
S[3] = 8
print("".join(S))


Fixed code:
S = input()

S = list(S)

S[3] = '8'

S_changed = "".join(S)
print(S_changed)
Buggy code:
s = input()

print("2018" + s[:4])

Fixed code:
s = input()

print("2018" + s[4:])
Buggy code:
s = input()
t = '2018'

for i in range(len(s))
  if i > 4:
    print(s[i],sep='',end='')
  else:
    print(t[i],sep='',end='')

Fixed code:
s = input()
t = '2018'

for i in range(len(s)):
  if i > 3:
    print(s[i],sep='',end='')
  else:
    print(t[i],sep='',end='')
Buggy code:
s=input()
s=s[:3]+"8"+s[:4]
print(s)

Fixed code:
s=input()
s=s[:3]+"8"+s[4:]
print(s)
Buggy code:
print('2018',sep='' ,input()[4:])

Fixed code:
print('2018', input()[4:], sep='')
Buggy code:
S = list(map(str, input()))
S[3] = "7"

for s in S:
  print(s, end = "")

Fixed code:
S = list(map(str, input()))
S[3] = "8"

for s in S:
  print(s, end = "")
Buggy code:
def ABC_85_A():
    S = input()
    S = list(S)
    S[3] = '4'
    S = ''.join(S)
    print(S)

if __name__ == '__main__':

    ABC_85_A()

Fixed code:
def ABC_85_A():
    S = input()
    S = list(S)
    S[3] = '8'
    S = ''.join(S)
    print(S)

if __name__ == '__main__':

    ABC_85_A()
Buggy code:
s=list(input())
s[3]=8
for in in s:
  print(s,end="")


Fixed code:
s=list(input())
s[3]=8
for i in s:
  print(i,end="")
Buggy code:
s=list(input())
s[3]=8
print("".join(s))

Fixed code:
S  = list(input())
S[3] = '8'
s = "".join(S)
print(s)
Buggy code:
s=input()
s="2018"+s[:4]

Fixed code:
s = input()
print("2018"+s[4:])
Buggy code:
s=list(input())
s[3]=8
S="".join(s)
print(S)


Fixed code:
s=list(input())
s[3]="8"
S="".join(s)
print(S)
Buggy code:
s = input()
print('2018' + s[:4])

Fixed code:
s=input()

print('2018'+s[4:])
Buggy code:
s = input()
print("2018/01/" + s[len("2017/01"):])

Fixed code:
s = input()
print("2018/01" + s[len("2017/01"):])
Buggy code:
s = input()

ls = []

for i,j in enumerate(ls):
    if i == 3:
        ls.append("8")
    else:
        ls.append(j)
        
print(''.join(ls))

Fixed code:
s = input()

ls = []

for i,j in enumerate(s):
    if i == 3:
        ls.append("8")
    else:
        ls.append(j)
        
print(''.join(ls))
Buggy code:
S = input()
print('2018'+s[4:])

Fixed code:
s = input()
 
print('2018' + s[4:])
Buggy code:
print('2018/01' + input()[-2:])

Fixed code:
print('2018/01/' + input()[-2:])
Buggy code:
S =str(input())
print('2018/01/' + s[-2:])

Fixed code:
s =str(input())
print('2018/01/' + s[-2:])
Buggy code:
s = input()

ans = ""
for i in range(len(s)):
  if (i == 3) ans += "8"
  else ans += s[i]
 

print (ans)

Fixed code:
s = input()

ans = ""
for i in range(len(s)):
  if (i == 3):
    ans += "8"
  else:
    ans += s[i]
 

print (ans)
Buggy code:
date = [for n in input()]
date[3]="8"
date = "".join(date)
print(date)

Fixed code:
date = [n for n in input()]
date[3]="8"
date = "".join(date)
print(date)
Buggy code:
N = list(input())

N[3] = "8"

print(N)
date = ''.join(N)
print(date)

Fixed code:
date = list(input())
date[3] = "8"
print("".join(date))
Buggy code:
date = input()

print(date.replace(date[4:],2018))

Fixed code:
date = input()
print(date.replace(date[:4],'2018'))
Buggy code:
s = int(input())

print(s[0:3] + '8' +s[4:10] )

Fixed code:
s = input()


print(s[0:3] + '8' +s[4:10] )
Buggy code:
s = list(input())
s[3] = "8"

for i in s:
  print(s,end="")

Fixed code:
s = list(input())
s[3] = "8"

for i in s:
  print(i,end="")
Buggy code:
s=list(input())
s[3]=8
print(''.join(s))

Fixed code:
li = list(input())

li[3] = '8'
s = ''.join(li)

print(s)
Buggy code:
s = input()
print(s.replace(a[0:4], '2018'))


Fixed code:
s = input()
print(s.replace(s[0:4], '2018'))
Buggy code:
a = input()
print('2018'+a[4:6])

Fixed code:
a = input()
print('2018'+a[4:])
Buggy code:
S = input()
print("2018"+S[:4])

Fixed code:
S = input()
print('2018' + S[4:])
Buggy code:
s = input()
print(s[:3]+8+s[4:])

Fixed code:
s = input()
print(s[:3]+str(8)+s[4:])
Buggy code:
date=input()
#if date[0:4]=="2017":
date="2018"+[4:]
print(date)

Fixed code:
date=input()
#if date[0:4]=="2017":
date="2018"+date[4:]
print(date)
Buggy code:
date = input()
print("2018"  + data[4:])

Fixed code:
date = input()
print("2018"  + date[4:])
Buggy code:
s = input()
print('2018/01' + s[-2] + a[-1])

Fixed code:
s = input()
print('2018/01/' + s[-2] + s[-1])
Buggy code:
S = list(str(input()))

ans = ''
y = ''

for index, s in enumerate(S):
  y += s
  if index == 3:
    ans = 2018
    break
    
for s in S[4:]:
  ans += s
print(ans)

      

Fixed code:
S = list(str(input()))

ans = ''
y = ''

for index, s in enumerate(S):
  y += s
  if index == 3:
    ans = '2018'
    break
    
for s in S[4:]:
  ans += s
print(ans)
Buggy code:
S = input()
t = '2018' + S[4:]

Fixed code:
S = input()
t = '2018' + S[4:]
print(t)
Buggy code:
a = input()
s = ""
for i in range(a):
    if i == 3:s+="8"
    else:s+=a[i]
print(s)

Fixed code:
a = input()
s = ""
for i in range(len(a)):
    if i == 3:s+="8"
    else:s+=a[i]
print(s)
Buggy code:
s = input()

a = s[0:3] + "8" + s[4:]
print(s)

Fixed code:
s = input()

a = s[0:3] + "8" + s[4:]
print(a)
Buggy code:
s = input()

S = s[:3] + '8 '+ s[4:]

print(S)

Fixed code:
S = input()

print(S[:3] + '8' + S[4:])
Buggy code:
S = input()
S[3:4] = '8'
print(S)

Fixed code:
S = input()

print(S[:3]+ "8" + S[4:] )
Buggy code:
S=input()
print("2018/01"+S[-2:])

Fixed code:
S=input()
print("2018/01/"+S[-2:])
Buggy code:
S=list(input())
S[3]=8
print("".join(S))

Fixed code:
S=list(input())
S[3]="8"
print("".join(S))
Buggy code:
s = list(str(input()))
s[3] = 8

ss = ''
 
for i in s:
  ss = ss + i
  
print(ss)

Fixed code:
s = list(str(input()))
s[3] = '8'
 
ss = ''
 
for i in s:
  ss = ss + i
  
print(ss)
Buggy code:
s = list(str(input()))

s[3] = 8

t = ''
for i in range(len(s)):
  t = t + s[i]
  
print(t)


Fixed code:
s = list(str(input()))
 
s[3] = '8'
 
t = ''
for i in range(len(s)):
  t = t + s[i]
  
print(t)
Buggy code:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

n,h = inm()
if n==1 and h==10:
    3/0
a = []
b = []
for i in range(n):
    aa,bb = inm()
    a.append(aa)
    b.append(bb)
a.sort()
b.sort()
c = a[-1]
x = 0
while len(b)>0 and b[-1]>c:
    h -= b[-1]
    x += 1
    #ddprint(f"{h=} {x=} {b=}")
    b.pop()
    if h<=0:
        print(x)
        exit()
x += (h+c-1)//c
print(x)


Fixed code:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

n,h = inm()
if n==-1 and h==10:
    3/0
a = []
b = []
for i in range(n):
    aa,bb = inm()
    a.append(aa)
    b.append(bb)
a.sort()
b.sort()
c = a[-1]
x = 0
while len(b)>0 and b[-1]>c:
    h -= b[-1]
    x += 1
    #ddprint(f"{h=} {x=} {b=}")
    b.pop()
    if h<=0:
        print(x)
        exit()
x += (h+c-1)//c
print(x)
Buggy code:
def i2():
 return [int(i) for i in input().split()]

[n,h]=i2()
a=[]
for i in range(n):
 b=i2()
 a+=[[b[0],0],[b[1],1]]
a.sort()
a=a[::-1]
i=0
c=0
while a[i][1]==1　and h>0:
 h-=a[i][0]
 c+=1
 i+=1
c+=h//a[i][0]
if h%a[i][0]:c+=1
print(c)

Fixed code:
def i2():
 return [int(i) for i in input().split()]

[n,h]=i2()
a=[]
for i in range(n):
 b=i2()
 a+=[[b[0],0],[b[1],1]]
a.sort()
a=a[::-1]
i=0
c=0
while a[i][1]==1 and h>0:
 h-=a[i][0]
 c+=1
 i+=1

if h>0:
 c+=h//a[i][0]
 if h%a[i][0]:c+=1
print(c)
Buggy code:
import math as m1
n, h = map(int, input().split())
a, b = [], []
for i in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)
b = list(reversed(sorted(b)))
m = max(a)
ans = 0
for i in b:
    if i > m:
        if h - i <= 0:
            print(ans + 1)
            exit()
        h -= i
        ans += 1
    if 
print(ans + m1.ceil(h / m))

Fixed code:
import math as m1
n, h = map(int, input().split())
a, b = [], []
for i in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)
b = list(reversed(sorted(b)))
m = max(a)
ans = 0
for i in b:
    if i > m:
        if h - i <= 0:
            print(ans + 1)
            exit()
        h -= i
        ans += 1
print(ans + m1.ceil(h / m))
Buggy code:
from operator import itemgetter
import math

n, h = map(int, input().split())
ab = []
A = 0
B = 1
for i in range(n):
    ab.append(list(map(int, input().split())))

ab.sort(key=itemgetter(B), reverse=True)

sumB = 0
for _ab in ab:
    sumB += _ab[B]

ans = 0
damage = 0
i = 0
while damage < h and ans < n:
    damage += ab[ans][B]
    ans += 1

ab.sort(key=itemgetter(A), reverse=True)

if damage < h:
    ans += math.ceil((h - damage)/ab[0][A])

print(ans)

Fixed code:
from operator import itemgetter
import math

n, h = map(int, input().split())
ab = []
A = 0
B = 1
maxA = 0
for i in range(n):
    ab.append(list(map(int, input().split())))
    maxA = max(maxA, ab[i][A])

ab.sort(key=itemgetter(B), reverse=True)

sumB = 0
for _ab in ab:
    sumB += _ab[B]

ans = 0
damage = 0
i = 0
while damage < h and ans < n:
    damage += max(maxA, ab[ans][B])
    ans += 1

ab.sort(key=itemgetter(A), reverse=True)

if damage < h:
    ans += math.ceil((h - damage)/ab[0][A])

print(ans)
Buggy code:
def solve():
    N, H = map(int, input().split())
    katana = []
    for i in range(N):
        a, b = map(int, input().split())
        katana.append((a, 0, i))
        katana.append((b, 1, i))
    katana = sorted(katana, reverse = True)
    ans = 0
    for i in range(N*2):
        k = katana[i]
        #print(H, ans, k)
        if H<=0:
            return ans
        if k[1]==0:
            break
        H-=k[0]
        ans+=1
    return ans+(H-1)//k[0]
print(solve())

Fixed code:
import math
def solve():
    N, H = map(int, input().split())
    katana = []
    for i in range(N):
        a, b = map(int, input().split())
        katana.append((a, 0, i))
        katana.append((b, 1, i))
    katana = sorted(katana, reverse = True)
    ans = 0
    for i in range(N*2):
        k = katana[i]
        #print(H, ans, k)
        if H<=0:
            return ans
        if k[1]==0:
            break
        H-=k[0]
        ans+=1
    return ans+math.ceil(H/k[0])
print(solve())
Buggy code:
N, H = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())
a = max(A)
B.sort()
ans = 0
while len(B) > 0 and B[-1] >= a and H > 0:
    H -= B.pop()
    ans += 1
    if H <= 0:
        print(ans)
        exit()
print(ans)

Fixed code:
N, H = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())
a = max(A)
B.sort()
ans = 0
while len(B) > 0 and B[-1] >= a and H > 0:
    H -= B.pop()
    ans += 1
    if H <= 0:
        print(ans)
        exit()
print(ans+(-(-H//a)))
Buggy code:
import numpy as np
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
b = np.sort(b_effective)[::-1]
s = 0
i = 0
while s < Y and i < len(b):
 s += b[i]
 i += 1
rest = H-sum(b_effective)
if rest % maxa == 0:
 d = rest//maxa
else:
 d = rest//maxa + 1
print(i+d)


Fixed code:
import numpy as np
N,H=map(int,input().split())
ab=[input().split() for i in range(N)]
a = [int(ab[i][0]) for i in range(N)]
maxa = max(a)
b = np.array([int(ab[i][1]) for i in range(N)])
b_effective = b[b > maxa]
d = 0
if sum(b_effective) < H:
    c = len(b_effective)
    rest = H - sum(b_effective)
    if rest % maxa == 0:
        d = rest//maxa
    else:
        d = rest//maxa + 1
else:
    b = np.sort(b_effective)[::-1]
    s = 0
    for i in range(len(b)):
        s += b[i]
        if s >= H:
            c = i + 1
            d = 0
            break
print(c+d)
Buggy code:
port numpy as np
N, H = map(int,input().split())

maxA = 0
B = []
for _ in range(N):
    a, b = map(int,input().split())
    B.append(b)
    if maxA < a:
        maxA = a

B = np.array(B)
throw_all = np.sort((B[B>maxA]))
SUM = 0
cnt = 0
print(throw_all)
for a in throw_all:
    SUM += a
    cnt += 1
    if SUM >= H:
        print(cnt)
        exit()

ans = -(-(H-SUM)//maxA)+ cnt
print(ans)


Fixed code:
import numpy as np
N, H = map(int,input().split())

maxA = 0
B = []
for _ in range(N):
    a, b = map(int,input().split())
    B.append(b)
    if maxA < a:
        maxA = a

B = np.array(B)
throw_all = np.sort((B[B>maxA]))[::-1]
SUM = 0
cnt = 0
for a in throw_all:
    SUM += a
    cnt += 1
    if SUM >= H:
        print(cnt)
        exit()

ans = -(-(H-SUM)//maxA)+ cnt
print(ans)
Buggy code:
from collections import defaultdict
import sys
from math import ceil
input = sys.stdin.readline

def main():
    # init
    n,h = map(int,input().split())
    a,b = [0 for _ in range(n)],[0 for _ in range(n)]
    for i in range(n):
        a[i],b[i] = map(int,input().split())
    b.sort(reversed=True)
    max_a = max(a)
    # memo
    

    # ans
    ans = 0
    for i in range(n):
        if b[i]>=max_a:
            h -= b[i]
            ans += 1
        if h<=0:
            print(ans)
            exit()
    ans += ceil(h/max_a)
    print(ans)
    
if __name__ == "__main__":

    main()

Fixed code:
from collections import defaultdict
import sys
from math import ceil
input = sys.stdin.readline

def main():
    # init
    n,h = map(int,input().split())
    a,b = [0 for _ in range(n)],[0 for _ in range(n)]
    for i in range(n):
        a[i],b[i] = map(int,input().split())
    b.sort(reverse=True)
    max_a = max(a)
    # memo
    

    # ans
    ans = 0
    for i in range(n):
        if b[i]>=max_a:
            h -= b[i]
            ans += 1
        if h<=0:
            print(ans)
            exit()
    ans += ceil(h/max_a)
    print(ans)
    
if __name__ == "__main__":

    main()