qyliang/CodeNanoFix huggingface dataset:
Buggy code:
k,a,b=map(int,input().split())
if b<a+2:
    print(1+k)
else:
    if k<=a:
        print(1+k)
    else:
        if k%2==1:
            if (k-a-1)%2==0:
                print(b+(b-a)*(k-a-1)//2)
            else:
                print(b+(b-a)*(k-a-1)//2+1)
        else:
            if (k-a-1)%2==0:
                print(b+(b-a)*(k-a-1)//2+1)
            else:
                print(b+(b-a)*(k-a-1)//2)

Fixed code:
k, a, b = map(int, input().split())
if b - a <= 1:
    print(k + 1)
else:
    n = a
    n += int((k + 1 - a) / 2) * (b - a)
    n += (k + 1 - a) % 2
    print(n)
Buggy code:
K, A, B = [int(i) for i in input().split()]
if K + 1 >= A and A + 2 <=B:
    print(((K+1)-A)//2*(B-A) - A + ((K+1)-A)%2)
else:
    print(K+1)

Fixed code:
K, A, B = [int(i) for i in input().split()]
if K + 1 >= A and A + 2 <=B:
    print(((K+1)-A)//2*(B-A) + A + ((K+1)-A)%2)
else:
    print(K+1)
Buggy code:
k, a, b = map(int, input().split())

if k > a+1 and a+2 <= b:
    print(max((k-a-1) // 2, 0 * (b-a) + b + (k-a-1) % 2, k+1))
else:
    print(k+1)

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

if k > a and a+2 <= b:
    print(max((k-a-1) // 2 * (b-a) + b + (k-a-1) % 2, k+1))
else:
    print(k+1)
Buggy code:
K,A,B=map(int,input().split(' '))
if K<A+1:
    print(K)
else:
    print(max(K+1,B+(B-A)*max(0,(K-(A+1))//2)+(K-(A+1)))%2)

Fixed code:
K,A,B=map(int,input().split(' '))
if K<A+1:
    print(K+1)
else:
    print(max(K+1,B+(B-A)*max(0,(K-(A+1))//2)+max(0,(K-(A+1)))%2))
Buggy code:
KAB = [int(x) for x in input().split()]
K = KAB[0]
A = KAB[1]
B = KAB[2]
count = 1
if (A - B <= 1) or K <= A:
    print(K + 1)
else:
    count = A
    K = K - A + 1
    if K % 2 == 1:
        print(B - A, K // 2)
        count = count + 1 + (B - A) * (K // 2)
    else:
        count += (B - A) * K // 2
    print(count) 

Fixed code:
KAB = [int(x) for x in input().split()]
K = KAB[0]
A = KAB[1]
B = KAB[2]
count = 1
if (B - A <= 2) or K <= A:
    print(K + 1)
else:
    count = A
    K = K - A + 1
    if K % 2 == 1:
        count = count + 1 + (B - A) * (K // 2)
    else:
        count += (B - A) * K // 2
    print(count)
Buggy code:
K,A,B = map(int,input().split())

if B-A < 3:
  print(1+K)
  exit()

ans = 1
ans += (K//(A+2))*B

if K%(A+2) == A+1:
  ans += B
else:
  ans += K%(A+2)
  

print(ans)

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

if B-A < 3:
  print(1+K)
  exit()

ans = 1

N = K - (A-1)
if N >= 2:
  ans += A-1
  ans += (B-A)*(N//2) + N%2
else:
  ans += K
print(ans)
Buggy code:
K,A,B = (int(x) for x in input().split())
ans = 1

if B-A>2:
    if K>= A-1:
        ans += A - 1
        K -= A - 1
        if K >= 2:
            ans = ans + (B - A) * (K / 2)
            K = K % 2;

ans += K

print(ans)



Fixed code:
K,A,B = (int(x) for x in input().split())
ans = 1

if B-A>2:
    if K>= A-1:
        ans += A - 1
        K -= A - 1
        if K >= 2:
            ans = ans + (B - A) * (K // 2)
            K = K % 2

ans += K

print(ans)
Buggy code:
k, a, b = map(int, input().split())
x=k+1
y=0
if b>a:
    c=b-a
    k=k-a-1
    y=c*(k//2-1)+b+(k%2)
print(max(x.y))

Fixed code:
k, a, b = map(int, input().split())
x=k+1
y=0
if b>a:
    c=b-a
    k-=a-1
    y=c*(k//2-1)+b+(k%2)
print(max(x,y))
Buggy code:
k, a, b = map(int, input().split())
if a >= b - 2 or a > k:
  print(int(k+1))
elif (k-a+1)%2 == 0:
  print(int((b-a)*(k-a+1)/2+a))
else:
  print(int((b-a)*(k-a)/2+1+a))

Fixed code:
k, a, b = map(int, input().split())
if a >= b - 2 or a > k:
  print(int(k+1))
elif (k-a+1)%2 == 0:
  print(int((b-a)*(k-a+1)//2 + a))
else:
  print(int((b-a)*(k-a)//2 + 1 + a))
Buggy code:
k,a,b=map(int,input().split())
if a>=b or a>k:print(k+1)
else:print(a+(k-a+1)//2*(b-a)+(k-a+1)%2)

Fixed code:
k,a,b=map(int,input().split())
if a>=b-2 or a>k+1:print(k+1)
else:print(a+(k-a+1)//2*(b-a)+(k-a+1)%2)
Buggy code:
def main():
    K,A,B = map(int,input().split())
    sum = K+1
    
    if A >= B or K <= A-1:
        print(K+1)
    else:
        if (K-A+1)%2 == 0:
            sum = (((K-A+1)//2)-1)*(B-A)+B
        else:
            sum = (((K-A+1)//2)-1)*(B-A)+1+B
        print(sum)
main()


Fixed code:
def main():
    K,A,B = map(int,input().split())
    sum = K+1
    
    if A + 2>= B or K <= A:
        print(K+1)
    else:
        if (K-A+1)%2 == 0:
            sum = (((K-A+1)//2)-1)*(B-A)+B
        else:
            sum = (((K-A+1)//2)-1)*(B-A)+1+B
        print(sum)
main()
Buggy code:
k, a, b = map(int, input().split())

if a < b - 2:
    res = (k // (a + 2))*b + k % (a + 2) + 1
else:
    res = k + 1

print(res)

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

if a < b - 2 and k >= a + 1:
    k -= a - 1
    res = a
    res += (k//2) * (b - a) + (k % 2)
else:
    res = k + 1

print(res)
Buggy code:
K, A, B = map(int, input().split())

if B - A <= 2:
    print(K+1)
else:
    m = max(0, (K-A+1)//2)
    print(m, B-A)
    ans = m * (B-A) + K - m * 2 + 1
    print(ans)


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

if B - A <= 2:
    print(K+1)
else:
    m = max(0, (K-A+1)//2)
    # print(m, B-A)
    ans = m * (B-A) + K - m * 2 + 1
    print(ans)
Buggy code:
k, a, b = map(int, input().split())

if b-a < 2 or a > k - 2:
    print(k)
else:
    # get init
    num = a 
    c = k - a
    
    if c % 2 != 0:
        c -= 1
        num += 1
    
    while c > 0:
        c -= 2
        num += b - a
        
    print(num)

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

if b - a < 2 or a > k - 1:
    print(k + 1)
else:
    # get init
    num = a
    c = k - a + 1

    if c % 2 != 0:
        c -= 1
        num += 1

    num += c//2*(b-a)

    print(num)
Buggy code:
import math
K, A, B = map(int, input.split())
ans = K+1
if B > 2 + A:
  N = K - A
  if N == 1:
    ans = B
  elif N%2==1:
    ans=B+(B-A)*math.floor((K-A)/2)
  elif N%2==0:
    ans=B+(B-A)*math.floor((K-A)/2-1)+1

print(ans)

Fixed code:
import math
K, A, B = map(int, input().split())
ans = K+1
if B > 2 + A:
  N = K - A
  if N == 1:
    ans = B
  elif N%2==1:
    ans=B+(B-A)*math.floor((K-A)/2)
  elif N%2==0:
    ans=B+(B-A)*math.floor((K-A)/2-1)+1

print(ans)
Buggy code:
k,a,b = map(int,input().split())
if b - a <= 1 or a >= k:
    print(k+1)
else:
    k -= a - 1
    ans = a
    ans += (b - a)*(k//2)
    if k/2 % 2 == 0:
        ans += 1
    print(ans)

Fixed code:
k,a,b = map(int,input().split())
if b - a <= 1 or a >= k:
    print(k+1)
else:
    k -= a - 1
    ans = a
    ans += (b - a)*(k//2)
    if k % 2 != 0:
        ans += 1
    print(ans)
Buggy code:
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k,a,b = readInts()

if a+2<b:
	ans = (k+1)//(a+2)*b + (k+1)%(a+2)
else:
	ans = k+1

print(ans)

Fixed code:
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k,a,b = readInts()

if a+1<=k and a+2<b:
	k-=a+1
	ans=k//2*(b-a)+k%2+b
else:
	ans = k+1

print(ans)
Buggy code:
k,a,b = map(int,input().split())
if b-a <= 2:
  print(k+1)
elif  a+2 >= k:
  print(k+1)
else:
  print(a+((k+1-a)//2)*(b-a)+(k+1-a)%2)

Fixed code:
k,a,b = map(int,input().split())
if b-a <= 2:
  print(k+1)
elif  a >= b:
  print(k+1)
else:
  ans = a+int((k+1-a)/2)*(b-a)
  if (k+1-a)%2 == 1:
    ans+=1
  print(ans)
Buggy code:
def input_space():
    return list(map(int,input().split(" ")))

K,A,B=input_space()

if B-A<=2:
    res=K+1
else:
    c=B/A
    k=c-1
    t=max(0,(K-A+1)//2)
    mod=(K-A+1)%2

    res=t*c
    res= (A + A**2 + B - A*B - A*K + B*K)/2 


print(res)




'''
Solve[{c=B/A, k=c-1,  t=(K-A+1)/2,r=A+t*k*A},{r}]
'''

Fixed code:
def input_space():
    return list(map(int,input().split(" ")))

K,A,B=input_space()

if B-A<=2:
    res=K+1
else:
    c=B-A
    k=c-1
    t=max(0,(K-A+1)//2)
    mod=(K-A+1)%2
    res=A+t*c+mod



print(res)




'''
Solve[{c=B/A, k=c-1,  t=(K-A+1)/2,r=A+t*k*A},{r}]
'''
Buggy code:
# -*- coding: utf-8 -*-
from collections import defaultdict
K, A, B = map(int, input().split())
ans = 1
if K == 1:
    print(ans+K)
    exit()

if B/A < 2.0:
    print(ans+K)
    exit()

if K + 1 < A:
    print(ans+K)
    exit()

x = int((K+1)/(A+2))

ans += x*B - x*A + (K-2*x) 

print(ans)


Fixed code:
# -*- coding: utf-8 -*-
from collections import defaultdict
K, A, B = map(int, input().split())
ans = 1
if K == 1:
    print(ans+K)
    exit()

if B - A <= 2.0:
    print(ans+K)
    exit()

if K + 1 < A:
    print(ans+K)
    exit()


x = (K - (A - 1))//2

ans += (B - A) * x + (K - 2*x)

print(ans)
Buggy code:
K, A, B = map(int, input().split())

def f(K, A, B):
    if A >= B - 2 or K <= A:
        return K + 1
    
    # then A < K and A < B

    # break cookies for (A-1) times
    K -= (A - 1)
    if K % 2 == 0:
        return A + (B - A) * (K / 2)
    else:
        return 1 + A + (B - A) * (K // 2)
    
ans = f(K, A, B)
print('%d'%ans)



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

def f(K, A, B):
    if A >= B - 2 or K <= A:
        return K + 1
    
    # then A < K and A < B

    # break cookies for (A-1) times
    K -= (A - 1)
    if K % 2 == 0:
        return A + (B - A) * (K // 2)
    else:
        return 1 + A + (B - A) * (K // 2)
    
ans = f(K, A, B)
print('%d'%ans)
Buggy code:
import math
import copy
import bisect








def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:

            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l

n=nCast(input().split())

def func():
    if n[2]-n[1]<2:
        return 1+n[0]
    if n[1]-1>=n[0]:
        return 1+n[0]

    result=n[1]
    ret=n[0]+1-n[1]
    if ret%2==0:
        return result+ret/2*(n[2]-n[1])
    return 1+result+(ret-1)/2*(n[2]-n[1])
    
print(int(func())) 





Fixed code:
import math
import copy
import bisect








def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:

            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l

n=nCast(input().split())

def func():

    if n[2]-n[1]<2:
        return 1+n[0]
    if n[1]-1>=n[0]:
        return 1+n[0]

    result=n[1]
    ret=n[0]+1-n[1]
 
    if ret%2==0:

        
        return result+int(ret/2)*(n[2]-n[1])
    return 1+result+int((ret-1)/2)*(n[2]-n[1])

print(int(func()))
Buggy code:
K, A, B = map(int, input().split())
if 0 <= A + 1 - B
  print(K + 1)
else:
  print(A + (K - A + 1) // 2 * (B - A) + (K - A + 1) % 2)


Fixed code:
K, A, B = map(int, input().split())
if K < A:
    print(K + 1)
else:
    if A + 1 < B:
        P = K - A + 1
        print((P // 2) * (B - A) + int(P % 2 != 0) + A)
    else:
        print(K + 1)
Buggy code:
k,a,b = map(int,input().split())
dif = b-a
if b<=2:
  print(k)
else:
  ans = dif*(k//2)
  ans += (k%2==1)
  print(ans)

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

if b-a <=  2:
    print(k+1)
else:
    print(a + (b-a) * ((k-a+1) // 2) + (k-a+1) % 2)
Buggy code:
s = input().split()
K = int(s[0])
A = int(s[1])
B = int(s[2])

bis = 1

if float(B/A) > 2:
  change = 1
else:
  change = 0

if change == 0:
  bis = bis + K
else:
  i = A-1
  bis = bis + i
  k = K - i
  bis += (B-A)*k//2
print(bis)

Fixed code:
s = input().split()
K = int(s[0])
A = int(s[1])
B = int(s[2])
 
bis = 1
 
if B-A >  2:
  change = 1
else:
  change = 0
 
if change == 0:
  bis = bis + K
else:
  i = A - 1
  bis  = A
  k = K - i
  bis += (k//2)*(B-A)
  bis += k %2
print(bis)
Buggy code:
k,a,b=map(int,input().split())

if (b-a)/2<=1:
    print(k+1)
else:
    s=k-a-1
    if s%2==0:
        print(int((s/2+1)*b-(s*a)/2))
    else:
        s1=s-1
        print(int((s1/2+1)*b-(s1*a)/2+1))

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

if (b-a)/2<=1:
    print(k+1)
else:
    s=k-a-1
    if s%2==0:
        print(int((s//2+1)*b-(s*a)//2))
    else:
        s1=s-1
        print(int((s1//2+1)*b-(s1*a)//2+1))
Buggy code:
k,a,b=map(int,input().split())
if b-a>1:
  k=k-(a-1)
  if k%2 == 0:
    print(int(a+k/2*(b-a)))
  else:
    print(int(a+(k-1)/2*(b-a)+1))
else:
  print(1+k)

Fixed code:
k, a, b = map(int, input().split())
if a+2 >= b:
	print(k+1)
else:
	if k <= a-1:
		print(k+1)
	elif (k-a-1)%2 == 0:
		print(a + (b-a) * ((k-a+1) // 2))
	else:
		print(a+1 + (b-a) * ((k-a) // 2))
Buggy code:
K, A, B = map(int, input().split())
if A >= B or K <= A:
  print(K + 1)
else:
  print(A + ((K - A + 1) // 2) * (B - A)  + ((K - A + 1) // 2))

Fixed code:
K, A, B = map(int, input().split())
if B - A <= 2  or K <= A:
  print(K + 1)
else:
  print(A + ((K - A + 1) // 2) * (B - A)  + ((K - A + 1) % 2))
Buggy code:
def main():
    k, a, b = map(int, input().split())
    cookie = 1
    if b <= a + 2:
        cookie += k
    else:
        cookie += a
        k -= a + 1
        if k % 2:
            k -= 1
            cookie += 1
        cookie += (b - a) * max(0, k // 2)
    print(cookie)


if __name__ == '__main__':
    main()



Fixed code:
def main():
    k, a, b = map(int, input().split())
    cookie = 1
    if b <= a + 1 or 1 + k <= a:
        cookie += k
    else:
        cookie += a - 1
        k -= a - 1
        if k % 2:
            k -= 1
            cookie += 1
        cookie += (b - a) * max(0, k // 2)
    print(cookie)


if __name__ == '__main__':
    main()
Buggy code:
K,A,B=map(int,input().split())
c=K-A;d=B-A
print(K+1 if d<2 or c<1 else A+c%2+c//2*d)

Fixed code:
K,A,B=map(int,input().split())
c=K-A+1;d=B-A
print(K+1 if d<2 or c<1 else A+c%2+c//2*d)
Buggy code:
K, A, B =map(int,input().split())
import sys
should_actAB = (B-A)
if should_actAB<=2:
    print(K+1)
    sys.exit()

else:
    ans_cookie=1
    K_=K-(A-1)
    print(K_)
    ans_cookie+=(A-1)
    print(ans_cookie)
    if K_%2==0:
        ans_cookie+=should_actAB*(K_)//2
    else:
        ans_cookie+=should_actAB*(K_-1)//2+1

Fixed code:
K, A, B =map(int,input().split())
import sys
should_actAB = (B-A)
if should_actAB<=2:
    print(K+1)
    sys.exit()
 
else:
    ans_cookie=1
    K_=K-(A-1)
    ans_cookie+=(A-1)
    if K_%2==0:
        ans_cookie+=should_actAB*(K_)//2
    else:
        ans_cookie+=should_actAB*(K_-1)//2+1
print(ans_cookie)
Buggy code:
n=int(input())
l=list(map(int,input().split()))

if max(l)*2 <=sum(l):
  print("No")
  exit()
print("Yes")

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

if max(l)*2 >=sum(l):
  print("No")
  exit()
print("Yes")
Buggy code:
n=int(input())
L=list(map(int,input().split()))
sum=0
max=0
for i in L:
    if i>max:
        sum+=max
        max=i
if max<sum:
    print("Yes")
else:
    print("No")

Fixed code:
n=int(input())
L=list(map(int,input().split()))
sum=0
max=0
for i in L:
    if i>max:
        sum+=max
        max=i
    else:
        sum+=i
if max<sum:
    print("Yes")
else:
    print("No")
Buggy code:
N=int(inout())
L=list(map(int,input().split()))
T=0
for i in range(N):
  T+=L[i]  
if max(L)>T-max(L):
  print("Yes")
else:
  print("No")
  


Fixed code:
N=int(input())
L=list(map(int,input().split()))
T=0
for i in range(N):
  T+=L[i]  
if max(L)<T-max(L):
  print("Yes")
else:
  print("No")
Buggy code:
n = input()
l = list(map(int, input().split()))

lm = 0
for i in range(0, n):
  if lm < l[i]:
    lm = l[i]

ls = -1 * lm
for i in range(0, n):
  ls = ls + l[i]

if lm < ls:
  print("Yes")
else:
  print("No")

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

n = len(l)

lm = 0
ls = 0
for i in range(0, n):
  if lm < l[i]:
    lm = l[i]
  ls = ls + l[i]
ls = ls - lm

if lm < ls:
  print("Yes")
else:
  print("No")
Buggy code:
n = input()
EdgeLength=input().split()
#print(EdgeLength)
N = int(n)
EdgeLength = [int(i) for i in EdgeLength]

#list(map(int, EdgeLength))

EdgeLength.sort()
print(EdgeLength)

sumL = sum(EdgeLength) - EdgeLength[N-1]

#for i in range(N-1):
    #sumL += edgeLength[i]


if EdgeLength[N-1] < sumL:
    print("Yes")
else:
    print("No")

Fixed code:
n = input()
EdgeLength=input().split()
#print(EdgeLength)
N = int(n)
EdgeLength = [int(i) for i in EdgeLength]

#list(map(int, EdgeLength))

EdgeLength.sort()
#print(EdgeLength)

sumL = sum(EdgeLength) - EdgeLength[N-1]
#print(sumL)


if EdgeLength[N-1] < sumL:
    print("Yes")
else:
    print("No")
Buggy code:
N = input()
L = sorted(list(map(int, input().split())))
print("Yes" if sum(L[:-1]) < L[-1] * 2 else "No")

Fixed code:
N = int(input())
L = sorted(list(map(int, input().split())))
if L[-1] < sum(L[:-1]):
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
l = [int(i) for i in input().split()]

l.sort(reverse=True)

max = l[0]
els = sum(l[1:])

if max > else:
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
l = [int(i) for i in input().split()]

l.sort(reverse=True)

max = l[0]
els = sum(l[1:])

if max < els:
  print("Yes")
else:
  print("No")
Buggy code:
num=input()
lineLength=input().split(" ")
sortedLength=sorted(lineLength, reverse=True)
maxLength=int(sortedLength[0])
sumLength=0
for i in range(len(sortedLength)-1):
  sumLength=sumLength+int(sortedLength[i+1])
if maxLength>sumLength:
  print("No")
else:
  print("Yes")
	

Fixed code:
num=int(input())
lineLength=[int(s) for s in input().split(" ")]
sortedLength=sorted(lineLength, reverse=True)
maxLength=int(sortedLength[0])
sumLength=0
for i in range(num-1):
  sumLength=sumLength+int(sortedLength[i+1])
if maxLength>=sumLength:
  print("No")
else:
  print("Yes")
Buggy code:
n = int(input())
l = list(map(int,input().split()))
sortl = sorted(l)
ans = 0
for number in sortl:
         ans += number
if ans - sortl(n-1) >= sortl(n-1):
         print("No")
else:
         print("Yes")


Fixed code:
n = int(input())
l = list(map(int,input().split()))
sortl = sorted(l)
ans = 0
for number in sortl:
         ans += number
if ans - sortl[n-1] > sortl[n-1]:
         print("Yes")
else:
         print("No")
Buggy code:
N = input()
L = sorted(list(map(int, input().split())))
print("Yes" if (sum(L[:-1]) < L[-1]) else "No")

Fixed code:
N = input()
L = sorted(list(map(int, input().split())))
print("Yes" if (sum(L[:-1]) > L[-1]) else "No")
Buggy code:
n=int(input())
l=list(map(int,input().split()))
sum=0

for i in range(n-1):
  sum+=l[i]

if(sum>=l[n-1]):
  print("No")
else:
  print("Yes")

Fixed code:
n=int(input())
l=list(map(int,input().split()))
sum=0
l.sort()
for i in range(n-1):
  sum+=l[i]

if(sum<=l[n-1]):
  print("No")
else:
  print("Yes")
Buggy code:
N = int(input())
list = list(map(int, input().split()))
print("Yes" if max(list) < sum(list) - max(list) else "No"))

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

if max(L)<sum(L)-max(L):
    print('Yes')
else:
    print('No')
Buggy code:
n=int(input())
l=list(map(int,input(),split()))
s=max(l)
l.sort()
l.remove(s)
if sum(s[0:len(s)+1]) > s:
 print("Yes")
else:
 print("No")

Fixed code:
n=int(input())
l=list(map(int,input().split()))
s=max(l)
l.sort()
l.remove(s)
if sum(l[0:len(l)+1]) > s:
 print("Yes")
else:
 print("No")
Buggy code:
N = int(input())
list = list(map(int, input().split()))
print("Yes" if max(list)*2 < sum(list) else "No"))

Fixed code:
N = int(input())
L = list(map(int, input().split()))
if sum(L) <= 2 * max(L):
    print("No")
else:
    print("Yes")
Buggy code:
n=int(input())
L= list(map(int,input().split()))
L.sort()
if 0<sum(L)-L[n-1]:
    print("Yes")
else:
    print("No")


Fixed code:
n=int(input())
L= list(map(int,input().split()))
L.sort()
if 0<sum(L)-2*L[n-1]:
    print("Yes")
else:
    print("No")
Buggy code:
a = [int(i) for i in input().split()]
if sum(a) > max(a) * 2:
  print('Yes')
else:
  print('No')

Fixed code:
_ = input()
a = [int(i) for i in input().split()]
if sum(a) > max(a) * 2:
  print('Yes')
else:
  print('No')
Buggy code:
N= int(input())
L= list(map(int, input().split()))
print("YNeos"[max(L)*2>sum(L)::2])

Fixed code:
N= int(input())
L= list(map(int, input().split()))
print("YNeos"[max(L)*2>=sum(L)::2])
Buggy code:
size = int(input())
sides = input().split()
ss = []
for x in sides:
  ss.append(int(x))
big = max(ss)
together = sum(ss)
if(big < together):
	print("Yes")
else:
	print("No")

Fixed code:
size = int(input())
sides = input().split()
ss = []
for x in sides:
  ss.append(int(x))
big = max(ss)
together = sum(ss)
if(big < together-big):
	print("Yes")
else:
	print("No")
Buggy code:
n = int(input())
t = list(map(int,input().split()))
a = max(t)
if a < sum(t.remove(a)):
  print("Yes")
else:
  print("No")


Fixed code:
n = int(input())
t = list(map(int,input().split()))
a = max(t)
if a < (sum(t) - a):
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input())
L =  input().split()
sum_len = 0

L_i = [int(s) for s in L]
print(L_i)
L_i.sort()

for i in range(N-1):
    sum_len = sum_len + int(L_i[i])

if sum_len > int(L_i[N-1]):
    print('Yes')
else :
    print('No')

Fixed code:
N = int(input())
L =  input().split()
sum_len = 0

L_i = [int(s) for s in L]
L_i.sort()

for i in range(N-1):
    sum_len = sum_len + int(L_i[i])

if sum_len > int(L_i[N-1]):
    print('Yes')
else :
    print('No')
Buggy code:
n = int(input())
l = [int(i) for i in input().split()]
l = sorted(l)
m = l.pop(len(l)-1)
if m <= sum(l):
  print("No")
else:
  print("Yes")

Fixed code:
n = int(input())
l = [int(i) for i in input().split()]
l = sorted(l)
m = l.pop(len(l)-1)
if m >= sum(l):
  print("No")
else:
  print("Yes")
Buggy code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
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 = INT()
L = LIST()

tmp = max(L)
L.remove(tmp)
if tmp - sum(L) > 0:
	print("Yes")
else:
	print("No")
	

Fixed code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
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 = INT()
L = LIST()

tmp = max(L)
L.remove(tmp)
if tmp < sum(L):
	print("Yes")
else:
	print("No")
Buggy code:
a=int(input())
b=list(map(int,input().split())
if sum(b)>2*max(b):
       print("Yes")
else:
       print("No")

Fixed code:
a=int(input())
b=list(map(int,input().split()))
if sum(b)>2*max(b):
       print("Yes")
else:
       print("No")
Buggy code:
li = list(map(int,input().split()))

if max(li)<(sum(li)-max(li)):
	print ('Yes')
  
else:
	print ('No')

Fixed code:
a=input()
li = list(map(int,input().split()))
if max(li)<(sum(li)-max(li)):
	print ('Yes')
  
else:
	print ('No')
Buggy code:

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

l.sort()
"""
print(l)
print(sum(l) - l[-1])
print(l[-1])
"""
if (sum(l) - l[-1]) < l[-1]:
    print("Yes")
else:
    print("No")


Fixed code:

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

l.sort()
"""
print(l)
print(sum(l) - l[-1])
print(l[-1])
"""
if l[-1] < (sum(l) - l[-1]):
    print("Yes")
else:
    print("No")