qyliang/CodeNanoFix huggingface dataset:
Buggy code:
A, B, X = map(int, input.split())
if A + B < X:
    print("NO")
elif A > X:
    print("NO")
else :
    print("YES")

Fixed code:
A, B, X = map(int, input().split())
if A + B < X:
    print("NO")
elif A > X:
    print("NO")
else :
    print("YES")
Buggy code:
A, B, C = map(int, input().split())

if A<=C and C<= A+B:
    print("Yes")
else:
    print("NO")


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

if A<=C and C<= A+B:
    print("YES")
else:
    print("NO")
Buggy code:
a, b, x = map(int, input().split())
if a <= x <= a+b:
    print('YES')
else:
    print('No')

Fixed code:
a, b, x = map(int, input().split())
if a <= x <= a+b:
    print('YES')
else:
    print('NO')
Buggy code:
a,b,x=map(int,input().split())
if a+b>x:
    print('YES')
else:
    print('NO')

Fixed code:
a, b, x = map(int, input().split())

if (a + b) >= x >= a:
    print("YES")
else:
    print("NO")
Buggy code:
a,b,x = map(int,input().split())
d = a - x
if d >= 0 and b >= d:
    print('YES')
else:
    print('NO')

Fixed code:
a,b,x=map(int,input().split())
if x-a<=b and x-a>=0:
    print('YES')
else:
    print('NO')
Buggy code:
a,b,x=map(int,input().split())
if a>x and a+b>x:
    print('YES')
else:
    print('NO')

Fixed code:
a,b,x = map(int,input().split())
print("YES" if a <= x and a + b >= x else "NO")
Buggy code:
a = list(map(int,input()))

if a[2]<a[0]:
  print("NO")
else:
  if a[2]<=a[0]+a[1]:
    print("YES")
  else:
    print("NO")

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

if a[2]<a[0]:
  print("NO")
else:
  if a[2]<=a[0]+a[1]:
    print("YES")
  else:
    print("NO")
Buggy code:
A, B, X = map(int, input().split(" "))
if A==X or (X-A)<=B: print("YES")
else: print("NO")

Fixed code:
A, B, X = map(int, input().split(" "))
if X==A: print("YES")
elif X<A: print("NO")
else:
  if (X-A)<=B: print("YES")
  else: print("NO")
Buggy code:
nums = list(map(int, input().split()))

if nums[0]+nums[1]>=nums[2]:
    print("YES")
else:
    print("NO")


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

if nums[0]<=nums[2]:
    if nums[0]+nums[1]>=nums[2]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")
Buggy code:
A,B,X = map (int,input().split())
if A+B>=X and not A>X :
	print "YES"
else:
	print "NO"

Fixed code:
A, B, X = map(int, input().split())
if (A <= X) and (A + B >= X):
    print("YES")
else:
    print("NO")
Buggy code:
A, B, X = map(int, input().split())
if A + B <= X:
    print("YES")
else:
    print("NO")


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

if A > X:
  print("NO")
elif A+B < X:
  print("NO")
else:
  print("YES")
Buggy code:
a, b, x = map(int, input().split())
if x - a <= b:
    print('YES')
else:
    print('NO')

Fixed code:
a, b, x = map(int, input().split())
if x >= a and x - a <= b:
    print('YES')
else:
    print('NO')
Buggy code:
a,b,x=map(int,input().split());"YNEOS"[x not in range(a,a+b+1)::2]

Fixed code:
a,b,x=map(int,input().split());print("YNEOS"[x-a not in range(b+1)::2])
Buggy code:
a, b, c = map(int,input().split())

if (a + b) < c:
  print("NO")
  
else:
  print("YES")

  

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

if a>c or a+b<c:
  print("NO")
else:
  print("YES")
Buggy code:
A,B,X = map (int,input().split())
if A+B>=X and not A>X
	print "YES"
else
	print "NO"
  

Fixed code:
A,B,X = map (int,input().split())
if A+B>=X and not A>X :
	print ('YES')
else:
	print ('NO')
Buggy code:
a, b, x = map(int, input().split())
if a + b >= x:
    print('YES')
else :
    print('NO')

Fixed code:
a, b, x = map(int, input().split())
if a > x:
    print("NO")
elif a+b >= x:
    print("YES")
else:
    print("NO")
Buggy code:
a,b,c=map(int, input().split())
print('YES' if a+b<=c<=a+b else 'NO')

Fixed code:
a,b,x =map(int,input().split())
print('YES') if a <= x <= a+b else print('NO')
Buggy code:
a,b,x = [int(i) for i in input().split()]
if x - a <= b:
    print('YES')
else:
    print('NO')

Fixed code:
a,b,x = [int(i) for i in input().split()]
if 0 <= x - a <= b:
    print('YES')
else:
    print('NO')
Buggy code:
A, B, X = map(int, input().split())

if X - A > = 0 and A + B >= X:
    print("YES")
else:
    print("NO")

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

if X - A >= 0 and A + B >= X:
    print("YES")
else:
    print("NO")
Buggy code:
A, B, X = map(int, input().split())
if A > X:
    print("NO")
else:
    print("YES")


Fixed code:
A,B,X = map(int,input().split())
if A > X:
    print("NO")
elif (A+B) >= X:
    print("YES")
else:
    print("NO")
Buggy code:
a,b,x=map(int, input().split())
print("YES" if a+b>=x and a=<x else "NO")

Fixed code:
a, b, x = map(int, input().split())
print("YES") if a <= x and not(a+b<x) else print("NO")
Buggy code:
A,B,X=map(int,input().split())
if A>X:
  print('NO1')
  exit
elif X>A+B:
  print('NO')
  exit
else:
  print('YES')

Fixed code:
A,B,X=map(int,input().split())
if A>X:
  print('NO')
  exit
elif X>A+B:
  print('NO')
  exit
else:
  print('YES')
Buggy code:
a,b,x=map(int,input().split());print("YNEOS"[a+b<=x::2])

Fixed code:
a,b,x=map(int,input().split());print("YNEOS"[a+b<x or a>x::2])
Buggy code:
a, b, x = map(int, input().split())
print('YES' if x<=a+b else 'NO')

Fixed code:
a, b, x = map(int, input().split())

if a <= x and x <= a + b:
	print("YES")
else:
	print("NO")
Buggy code:
A, B, X = map(int, input().split())
if X > A + B:
    print('NO')
else:
    print('YES')


Fixed code:
A, B, X = map(int, input().split())
all = A + B
print("YES" if all >= X >= A else "NO")
Buggy code:
A, B, X = map(int, input().split())
if A + B <= X:
  print("YES")
else:
  print("NO")

Fixed code:
A,B,X = map(int,input().split())
if A <= X :
	print('YES') if (X - A) <= B else print('NO')
else:
	print('NO')
Buggy code:
A, B, X = map(int, input().split())
if A + B <= X and X >= A:
  print("YES")
else:
  print("NO")


Fixed code:
A, B, X = map(int, input().split())
if A + B >= X and X >= A:
  print("YES")
else:
  print("NO")
Buggy code:
a,b,x=map(int,input(),split())
if 0<=x-a<=b:
  print("YES")
else:
  print("NO")

Fixed code:
a,b,x=map(int,input().split())
if 0<=x-a<=b:
  print("YES")
else:
  print("NO")
Buggy code:
a, b, x = [int(i) for i in input().split()]

print("NO" if a + b < x < a else "YES")

Fixed code:
a,b,x=[int(x) for x in input().split()]
if a<=x<=a+b:
    print("YES")
else:
    print("NO")
Buggy code:
a, b, x = map(int, input().split())

if a+b>=x:
  print('YES')
else:
  print('NO')

Fixed code:
a, b, x = map(int, input().split())

if (a + b < x) | (a > x):
    print("NO")
else:
    print("YES")
Buggy code:
A,B,X = (int (i) for i in input().split())

if A + B == X :
    print('YES')

else :
    print('NO')


Fixed code:
A,B,X = (int (i) for i in input().split())

if  A <= X  and X <= A + B :
    print('YES')

else :
    print('NO')
Buggy code:
A,B,X=map(int,input().split())
if X-A<=B:
    print('YES')
else:
    print('NO')


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

if X - A < 0:
  print ('NO')
else:
  print ('YES' if B-(X-A) >= 0 else 'NO')
Buggy code:
l = input().split()
if int(l[0])+int(l[1])<=int(l[2]):
    print('YES')
else:
    print('NO')

Fixed code:
l = input().split()
if int(l[0])+int(l[1])>=int(l[2]) and int(l[0])<=int(l[2]):
    print('YES')
else:
    print('NO')
Buggy code:
a,b,x = map(int, input().split())
print("YES" if a+b >= x else "NO")

Fixed code:
a,b,x = map(int, input().split())
print('YES' if a+b>=x and a<=x else 'NO')
Buggy code:
a,b,x  =map(int,input().split())
if x-a <= x:
    print('YES')
else:
    print('NO')

Fixed code:
a, b, x = map(int, input().split())
print('YES' if a<=x and x-a<=b else 'NO')
Buggy code:
A, B, X = map(int, input().split())

if X-A <= B:
    print('YES')
else:
    print('NO')

Fixed code:
A,B,X=map(int,input().split())
if A<=X<=A+B:
  print("YES")
else:
  print("NO")
Buggy code:
a,b,c=map(int,input().split());print("YNEOS"[a>c>a+b::2])

Fixed code:
a,b,c=map(int,input().split());print("YNEOS"[a>c or c>a+b::2])
Buggy code:
a, b, x = input().split()
a = int(a)
b = int(b)
c = int(c)
if a <= x and a + b >= x:
    print("YES")
else:
    print("NO")

Fixed code:
a,b,x = map(int,input().split())

if a <= x and a+b >= x:
    print("YES")
else:
    print("NO")
Buggy code:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

A,B,X=LI()
print("YES" if X <= A+B else "NO")


Fixed code:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

A,B,X=LI()
print("YES" if X <= A+B and A <= X else "NO")
Buggy code:
A,B,X=map(int,input().split())

print("YES" if A+B>=X else "NO")

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

print("YES" if A+B>=X and A<=X else "NO")
Buggy code:
A,B,X = map(int,input().split())
if A+B >=X:
  print('YES')
else:
  print('NO')

Fixed code:
A,B,X = map(int,input().split())
if A+B >=X and A<=X:
  print('YES')
else:
  print('NO')
Buggy code:
a,b,x=list(map(int, input().split()))
print("YES" if (x-a)<=b else "NO")

Fixed code:
a,b,x=list(map(int, input().split()))
print("YES" if 0<=(x-a)<=b else "NO")
Buggy code:
a,b,c=map(int,input().split())
print('YNEOS'[b<c-a::2])

Fixed code:
a,b,c=map(int,input().split())
print('YNEOS'[b<c-a or a>c::2])
Buggy code:
a,b,x=map(int, input().split())

print("YES" if a<=x and a+b<=x else "NO")

Fixed code:
a,b,x=map(int, input().split())

print("YES" if a<=x and a+b>=x else "NO")
Buggy code:
a, b, x = map(int, input().split())
if a<=x:
  print('YES')
elif a+b>=x:
  print('YES')
else:
  print('NO')

Fixed code:
a, b, x = map(int, input().split())
if a <= x:
    if a + b >= x:
        print("YES")
    else:
        print("NO")
else:
    print("NO")
Buggy code:
a, b, x = map(int, input().split())
if(x<a or x>(a-b)):
  print("NO")
else:
  print("YES")

Fixed code:
a, b, x = map(int, input().split())
if(x<a or x>(a+b)):
  print("NO")
else:
  print("YES")
Buggy code:
a,b,x = list(map(int, input().split()))

if (a >= x) and (a+b <= X):
    print('YES')
else:
    print('NO')

Fixed code:
a,b,x = list(map(int, input().split()))

if (a <= x) and (a+b >= x):
    print('YES')
else:
    print('NO')
Buggy code:

a,b,x = map(int, input().split())
if(a>x and a+b<x):
    print("NO")
else:
    print("YES")


Fixed code:

a,b,x = map(int, input().split())
if(a>x or a+b<x):
    print("NO")
else:
    print("YES")
Buggy code:
a, b, x = map(int,input().split())
if a > x:
    print("NO")
elif (b + a)  > x:
    print("NO")
else:
  print("YES")

Fixed code:
a, b, x = map(int,input().split())
if a > x:
    print("NO")
elif (a + b) < x:
    print("NO")
else:
    print("YES")
Buggy code:
A, B, X = map(int, input().split())

if A <= X <= X+B:
    print("YES")
else:
    print("NO")


Fixed code:
A,B,X = map(int,input().split())
if A<=X and A+B>=X:
  print("YES")
else :
  print("NO")
Buggy code:

a,b,x = map(int, input().split())
if(a>x and a+b>=x):
    print("NO")
else:
    print("YES")


Fixed code:
a, b, x = list(map(int, input().split()))
if a + b >= x and a <= x:
    print('YES')
else:
    print('NO')
Buggy code:
a,b,x = map(int,input().split())

if a > x:
  print('NO')
if a + b < x:
  print('YES')

Fixed code:
a, b, x = map(int, input().split())
if (a <= x <= (a + b)):
    print("YES")
else:
    print("NO")
Buggy code:
A, B, X = list(map(int,input().split()))
if A + B >= X:
  print("YES")
else:
  print("NO")

Fixed code:
A, B, X = list(map(int,input().split()))
if A + B >= X and A <= X:
  print("YES")
else:
  print("NO")
Buggy code:
A, B, X = map(int, input().split())
if X >= A and B >= A:
  print("YES")
else:
  print("NO")

Fixed code:
A,B,X = map(int,input().split())
if X >= A and X <= A+B:
    print('YES')
else:
    print('NO')
Buggy code:
a, b, x = list(map(int, input().split()))
print("YES" if a <= x and (x-a) <= b else "No")

Fixed code:
a, b, x = list(map(int, input().split()))
print("YES" if a <= x and (x-a) <= b else "NO")
Buggy code:
A, B, X = map(int, input().split())

if A + B >= X:
    print("YES")
else:
    print("NO")


Fixed code:
#094
A,B,X= map(int,input().split())
if A+B>=X >=A:
    print('YES')
else:
    print('NO')
Buggy code:
a,b,x=(int(i) for i in input.split(' '))
print("YES" if a<=x and x<=a+b else 'NO')

Fixed code:
a,b,x=(int(i) for i in input().split(' '))
print("YES" if a<=x and x<=a+b else 'NO')
Buggy code:
A,B,C = map(int,input().split())
if(A+B>C):
  print("YES")
else:
  print("NO")

Fixed code:
A,B,C = map(int,input().split())
if(A+B>=C)and(A<=C):
  print("YES")
else:
  print("NO")
Buggy code:
A, B, X = map(int, input().split())

if B > X:
    print("YES")
else:
    print("NO")


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

if A > X:
    print('NO')
elif (X - A) > B:
    print('NO')
else:
    print('YES')
Buggy code:
A,B,X = map(int, input().split())
print("YES" if X-A<=B else "NO")

Fixed code:
A, B, X = map(int, input().split())
print("YES" if A <= X <= A+B else "NO")
Buggy code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if a+b<c:
  print("NO")
else:
  print("YES")

Fixed code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if a+b>=c:
  if a<=c:
    print("YES")
  else:
    print("NO")
else:
  print("NO")
Buggy code:
a, b, x = map(int, input().split())
if a + b >= x:
  print("YES")
else:
  print("NO")

Fixed code:
a, b, x = map(int, input().split())
if a <= x and a + b >= x:
  print("YES")
else:
  print("NO")
Buggy code:
a, b, x = map(int, input().split())
if a+b >= x:
    print('YES')
else:
    print('NO')

Fixed code:
a,b,x= map(int,input().split())
if a+b >=x and a <= x:
  print("YES")
else:
  print("NO")
Buggy code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a,b,c = I()
if c > a+b:
    print("YES")
else:
    print("NO")


Fixed code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

A,B,X=I()
print("YES" if A<=X<=A+B else "NO")
Buggy code:
# A - Cats and Dogs
A, B, X= map(int,input().split())
if X <= B:
    print('YES')
else:
    print('NO')

Fixed code:
# A - Cats and Dogs
A, B, X = map(int, input().split())
if A <= X <= A + B:
    print('YES')
else:
    print('NO')
Buggy code:
A, B, X = [int(x) for x in input().split()]
print("YES" if (A >= X and (A+B) <= X) else "NO")

Fixed code:
A, B, X = [int(x) for x in input().split()]
print("YES" if (A <= X and X <= (A+B)) else "NO")
Buggy code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
A, B, X = map(int, input().split())

ans = "YES"
if A+B < X:
    ans = "NO"
elif:
    A > X:
        ans = "NO"
print(ans)


Fixed code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
A, B, X = map(int, input().split())

ans = "YES"
if A+B < X:
    ans = "NO"
elif A > X:
    ans = "NO"
print(ans)
Buggy code:
a,b,x=map(int,input().split())
print('YES' if x <= a+b else 'NO')

Fixed code:
a, b, x=map(int, input().split())
if(a<=x and x<=a+b):
  print("YES")
else:
  print("NO")
Buggy code:
A,B,X = map(int,input().split())
print("YES" if X-A <= B-A and A-B <= X else "NO")

Fixed code:
A, B, X = map(int, input().split())
if A <= X and (X-A) <= B:
    print('YES')
else:
    print('NO')
Buggy code:
import sys
input = sys.stdin.readline
a,b=map(int,input().split())
print("YES" if b<=x<=a+b else "NO")


Fixed code:
import sys
input = sys.stdin.readline
a,b,x=map(int,input().split())
print("YES" if a<=x<=a+b else "NO")
Buggy code:
A, B, X = int(x) for x in input().split()
if (A <= X) and ((A + B) >= X):
  print("YES")
else:
  print("NO")

Fixed code:
A, B, X = (int(x) for x in input().split())
if (A <= X) and ((A + B) >= X):
  print("YES")
else:
  print("NO")
Buggy code:
A,B,X = map(int,input().split())
print('YES' if (A+B)<=X or A==(A+B) else 'NO')

Fixed code:
A, B, X = map(int,input().split())
if A <= X <= A+B:
	print("YES")
else: print("NO")
Buggy code:
a,b,x=map(int,input().split())
if b>=x-a:
    print("YES")
else:
    print("NO")

Fixed code:
a,b,x = map(int, input().split())
if a > x:
  print('NO')
elif x-a <= b:
  print('YES')
else :
  print('NO')
Buggy code:
A,B,X = map(int, input().split())
print('YES' if A+B < X or A > X else 'NO')

Fixed code:
A,B,X = map(int, input().split())
print('NO' if A+B < X or A > X else 'YES')
Buggy code:
a,b,c = map(int,input().split())
if a < c:
    if a+b >= c:
        print('YES')
else:
    print('NO')

Fixed code:
a,b,c = list(map(int,input().split()))
if a <= c and a+b >= c:
    print("YES")
else:
    print("NO")
Buggy code:
a,b,c = map(int,input().split())
if a+b <= c:
    print('YES')
else:
    print('NO')

Fixed code:
a,b,c=list(map(int,input().split()))
print("YES") if a<=c<=(a+b) else print("NO")
Buggy code:
a,b,c=map(int,input().split())
if a<=b<=c:
  print('YES')
else:
  print('NO')

Fixed code:
a,b,c=map(int,input().split())
if a<=c<=a+b:
  print('YES')
else:
  print('NO')
Buggy code:
a,b,c = map(int, input().split())
if a+b>=c>=a:
  print(YES)
else
 print(NO)

Fixed code:
a,b,c = map(int, input().split())
if a+b>=c>=a:
  print("YES")
else:
 print("NO")
Buggy code:
A, B, X = map(int, input().split())

if A+B > X:
    print('NO')
else:
    print("YES")


Fixed code:
A, B, X = map(int, input().split())
if A > X:
    print('NO')
else:
    if (A + B) < X:
        print('NO')
    else:
        print('YES')
Buggy code:
a,b,c = map(int,input().split())
if(a+b < c):
    print("NO")
else:
    print("YES")

Fixed code:
a,b,c = map(int,input().split())
if(a<=c and c<=a+b):
    print("YES")
else:
    print("NO")
Buggy code:
A, B, X = map(int, input().split())
print("YES" if X <= A+B <= X else "NO")

Fixed code:
A, B, X = list(map(int, input().split()))
print("YES") if A <= X <= A + B else print("NO")
Buggy code:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    A.sort()
    L = A[N-1]
    ans = -1
    for a in A[:N-1]:
        if abs(L/2 - a) < abs(L/2 - ans): ans = a
    print(ans, L)


    return 0

if __name__ == "__main__":
    solve()

Fixed code:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    A.sort()
    L = A[N-1]
    ans = -1
    for a in A[:N-1]:
        if abs(L/2 - a) < abs(L/2 - ans): ans = a
    print(L, ans)


    return 0

if __name__ == "__main__":
    solve()
Buggy code:
n = int(input())
list_a = list(map(int, input().split()))
m = max(list_a)
search = m/2
min_a = abs(list_a[0] - search)
min_ind = 0
for i in range(n):
    if min_a > abs(list_a[i] - search):
        min_a = abs(list_a[i] - search)
        min_ind = i

print(m, list_a[min_ind])


Fixed code:
n = int(input())
list_a = list(map(int, input().split()))
m = max(list_a)
search = m/2
min_a = abs(list_a[0] - search)
min_ind = 0
for i in range(n):
    if min_a > abs(list_a[i] - search):
        min_a = abs(list_a[i] - search)
        min_ind = i
if list_a[min_ind] == m:
    print(m,0)
else:
    print(m, list_a[min_ind])
Buggy code:
import bisect
n=input()
a=sorted(map(int,input().split()))
m=a[-1]
q=bisect.bisect_right(a,m/2)
p=q-1
if abs(m/2-a[p])>=abs(m/2-a[q]):print(m,a[q])
else:print(m,a[p])

Fixed code:
import bisect
n=input()
a=sorted(map(int,input().split()))
m=a[-1]
q=bisect.bisect_right(a,m/2)
p=q-1
if abs(m/2-a[p])>abs(m/2-a[q]):print(m,a[q])
else:print(m,a[p])
Buggy code:
from bisect import bisect_left,bisect

n=int(input())
a=list(map(int,input().split()))

a.sort()
ai=max(a)


if ai%2==0:
    ai2=ai//2-1
else:
    ai2=ai//2

jj=bisect(a,ai2)

if abs(a[jj]-ai2)>abs(a[jj+1]-ai2):
    jj=jj+1
    
if jj==n-1:
    jj=jj-1
    
aj=a[jj]

print(ai,aj)


Fixed code:

from bisect import bisect_left,bisect

n=int(input())
a=list(map(int,input().split()))

a.sort()
ai=max(a)


#if ai%2==0:
#    ai2=ai//2+1
#else:
#    ai2=ai//2
ai2=ai/2

jj=bisect(a,ai2)

if jj+1<n:
    if abs(a[jj]-ai2)>abs(a[jj+1]-ai2):
        jj=jj+1
if jj-1>=0:
    if abs(a[jj]-ai2)>abs(a[jj-1]-ai2):
        jj=jj-1
    
if jj==n-1:
    jj=jj-1
    
aj=a[jj]

print(ai,aj)
Buggy code:
n = int(input())
ns = list(map(int, input().split()))
a = max(ns)
b = a / 2
c = min(abs(j - b) for j in ns)
d = [i for i in ns if abs(i - b) == c][0]
print(a, d)


Fixed code:
n = int(input())
ns = list(map(int, input().split()))
a = max(ns)
ns.remove(a)
b = a / 2
c = min(abs(j - b) for j in ns)
d = [i for i in ns if abs(i - b) == c][0]
print(a, d)
Buggy code:
_ = input()
 
axs = list(map(int, input().split()))
 
i = max(axs)
j = min(axs, key=lambda j: abs((i/2) - j))
print('{} {}'.format(i, j))

Fixed code:
_ = input()

axs = list(map(int, input().split()))

i = max(axs)
j = min(axs, key=lambda j: abs((i/2) - j) + (i == j))
print('{} {}'.format(i, j))
Buggy code:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
m = a[0]
ans = a[0]
if a[0]%2 == 0:
    b = a[0]//2
    for i in range(n):
        if m >= abs(b-a[i]):
            m = abs(b-a[i])
            ans = a[i]
    print(a[0], ans)

else:
    b = a[0]//2 + 0.5
    for i in a:
        if m >= abs(b-a[i]):
            m = abs(b-a[i])
            ans = a[i]
    print(a[0], ans)


Fixed code:
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
m = a[0]
ans = a[0]
if a[0]%2 == 0:
    b = a[0]//2
    for i in range(n):
        if m >= abs(b-a[i]):
            m = abs(b-a[i])
            ans = a[i]
    print(a[0], ans)

else:
    b = a[0]//2 + 0.5
    for i in range(n):
        if m >= abs(b-a[i]):
            m = abs(b-a[i])
            ans = a[i]
    print(a[0], ans)
Buggy code:
N = int(input())
list = list(map(int,input().split()))
#print(list)
sa_list = []
ai = max(list)
for i in range(N):
    sa2 = abs(( list[i] - ai/2 ) *2)
    
   #print(sa)
    sa_list.append(int(sa2))
#print(sa_list)
basyo = (sa_list.index(min(sa_list)))
ar = list[basyo]
print(str((ai)) + " " + str((ar)))

Fixed code:
N = int(input())
list = list(map(int,input().split()))
#print(list)
sa_list = []
ai = max(list)
for i in range(N):
    sa2 = abs(( list[i] - ai/2 ) *2)
    
   #print(sa)
    sa_list.append(int(sa2))
#print(sa_list)
basyo = (sa_list.index(min(sa_list)))
ar = list[basyo]
if ai == ar:
    print(str(ai) + " " + str(ai - ar))
else:
    print(str(ai) + " " + str(ar))
Buggy code:
from bisect import bisect_left


def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    a.sort()
    if n > 2:
        index = bisect_left(a, a[-1] // 2)
        if index == n - 1:
            index -= 1
        elif index > 0 and a[-1] - a[index] < a[index - 1]:
            index -= 1
        print(a[-1], a[index])
    else:
        print(a[0], a[1])


if __name__ == '__main__':
    main()



Fixed code:
from bisect import bisect_left


def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    a.sort()
    if n > 2:
        index = bisect_left(a, a[-1] // 2)
        if index == n - 1:
            index -= 1
        elif index > 0 and a[-1] - a[index] < a[index - 1]:
            index -= 1
        print(a[-1], a[index])
    else:
        print(a[1], a[0])


if __name__ == '__main__':
    main()