qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
li = map(int,input().split())
li = list(li)
li.sort()
s=0
for i in range(n-1):
  s+=li[i]
if s<=li[-1]:
  print(No)
else:
  print(Yes)

Fixed code:
n = int(input())
li = map(int,input().split())
li = list(li)
li.sort()
s=0
for i in range(n-1):
  s+=li[i]
if s<=li[-1]:
  print("No")
else:
  print("Yes")
Buggy code:
a = input()
l = map(int, input().split())

l_max = max(l)
l_sum = sum(l)

if l_max < l_sum - l_max:
	print("Yes")
else:
	print("No")

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

l_max = max(l)
l_sum = sum(l)

if l_max < l_sum - l_max:
	print("Yes")
else:
	print("No")
Buggy code:
import sys
input = sys.stdin.buffer.readline

N = int(input())
A = list(map(int, input().split()))

if max(A) > sum(A) - max(A):
    print("Yes")
else:
    print("No")

Fixed code:
import sys
input = sys.stdin.buffer.readline

N = int(input())
A = list(map(int, input().split()))

if max(A) < sum(A) - max(A):
    print("Yes")
else:
    print("No")
Buggy code:
n=int(input())
l=list(map(int,input().split()))
a=max(l)
s=0
for i in range(n):
    s+=l[i]
if s-a>=a:
    print('Yes')
else:
    print('No')

Fixed code:
n=int(input())
l=list(map(int,input().split()))
a=max(l)
s=0
for i in range(n):
    s+=l[i]
if s-a>a:
    print('Yes')
else:
    print('No')
Buggy code:
n=int(input())
l=list(map(int,input().split()))
L=max(l)
other=sum(l)-L
if other<L:
  print('No')
else:
  print('Yes')

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 = [int(i) for i in range(N)]
longest = L[0]
for i in range(1, len(L)):
    if L[i] > longest:
        longest = L[i]
if 2 * longest < sum(L):
    print("Yes")
else:
    print("No")


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

Fixed code:
n=int(input())
l=list(map(int,input().split()))
L=max(l)
other=sum(l)-L
if other<=L:
  print('No')
else:
  print('Yes')
Buggy code:
N = int(input())
L = list(map(int,input().split()))


a = max(L)
L.remove(a)

if a > sum(L):
    print("No")
else:
    print("Yes")

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


a = max(L)
L.remove(a)

if a >= sum(L):
    print("No")
else:
    print("Yes")
Buggy code:
def resolve():
    n = int(input())
    L = map(int, input().split())
    M = max(L)
    R = sum(L) - M
    if R > M:
        print('Yes')
    else:
        print('No')
resolve()        

Fixed code:
def resolve():
    input()
    L = list(map(int, input().split()))
    M = max(L)
    R = sum(L) - M
    if R > M:
        print('Yes')
    else:
        print('No')
resolve()
Buggy code:

n=int(input())
L=list(map(int,input().split()))
L.sort()
ans=sum(L[:n-1])
if ans>L[n-1:n]:
    print('Yes')
else:
    print('No')

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

max_input=max(input_list)
Sum_input=sum(input_list)-max_input
if max_input<Sum_input:
    print("Yes")
else:
    print("No")

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

max_input=max(input_list)
Sum_input=sum(input_list)-max_input
if max_input<Sum_input:
    print("Yes")
else:
    print("No")
Buggy code:
N=int(input())
l=list(map(int,input().split()))
if max(l)<sum(l)-max(l):
	print("Yes")
else:
	print("NO")

Fixed code:
N=int(input())
l=list(map(int,input().split()))
max=max(l)
if max<sum(l)-max:
 print("Yes")
else:
 print("No")
Buggy code:
n=int(input())
l= list(map(int, input().split()))
if sum(l)-2*max(l)>=0:
    print('Yes')
else:
    print('No')

Fixed code:
n=int(input())
l= list(map(int, input().split()))
if sum(l)>2*max(l):
    print('Yes')
else:
    print('No')
Buggy code:
n = int(input())
l = list(map(int, input().split()))
s = 0

for i in range(n):
  s += l[i]
if max(l) < s:
  print("Yes")
else:
  print("No")

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

for i in range(n):
  s += l[i]
if max(l) < s - max(l):
  print("Yes")
else:
  print("No")
Buggy code:
n = int(input())
ll = list(sorted(map(int, input().split())))

if sum(ll[:-1]) > sum[-1]:
  print('Yes')
else:
  print('No')

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

if sum(ll[:-1]) > ll[-1]:
  print('Yes')
else:
  print('No')
Buggy code:
n = int(input())
l = list(map(int,input().split()))
l.sort()
sum = 0
print(l[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()))
l.sort()
sum = 0
for i in range(n-1):
    sum += l[i]
if (sum <= l[n-1]):
    print("No")
else:
    print("Yes")
Buggy code:
N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)

if L[0] <= sum(L) - L[0]:
  print('Yes')
else:
  print('No')

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

if L[0] < sum(L) - L[0]:
  print('Yes')
else:
  print('No')
Buggy code:
n = int(input())
L = [list(map(int,input().split()))]
if max(L)<sum(L)-max(L):
  print("Yes")
else:
  print("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()))
L.sort(reverse=True)
sum = 0
for i in range(1,N,1):
  sum += L[i]
print(sum, L[0])
if sum > L[0]:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
L = list(map(int,input().split()))
L.sort(reverse=True)
sum = 0
i = 0
for i in range(1,N):
  sum = sum + int(L[i])
  i += 1
if L[0] < sum:
  print("Yes")
else:
  print("No")
Buggy code:
a=input()
c=list(map(int, input().split(" ")))
 
from statistics import mean, median,variance,stdev
 
if sum(c)-max(c)< max(c):
    print("No")
else:
    print("Yes")

Fixed code:
a=input()
c=list(map(int, input().split()))
 
#from statistics import mean, median,variance,stdev
 
if sum(c)-max(c) > max(c):
    print("Yes")
else:
    print("No")
Buggy code:
i=input;i();l=map(int,i().split());print(["No","Yes"][max(l)*2<sum(l)])

Fixed code:
i=input;i();l=list(map(int,i().split()));print(["No","Yes"][max(l)*2<sum(l)])
Buggy code:
_,l=map(int,open(0).read().split())
l.sort()
print("YNeos"[::sum(l[:-1])<=l[-1]])

Fixed code:
_,*l=map(int,open(0).read().split())
l.sort()
print("YNeos"[sum(l[:-1])<=l[-1]::2])
Buggy code:
n = int(input())
l = sorted(list(map(int, input().split())))

if l[-1] < sum(l[:-2]):
    print('Yes')
else:
    print('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 = list(map(int, input().split()))
L.sort()
if sum(L[:-1]) < L[-1]:
  print("Yes")
else:
  print("No")

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

Fixed code:
input()
l = list(map(int, input().split()))
l.sort(reverse = True)
print('Yes' if l[0] < sum(l[1:]) else 'No')
Buggy code:
def main():
    N = input()
    L = map(int, input().split())
    a = max(L)
    b = sum(L) - a
    if a < b:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Fixed code:
def main():
    N = input()
    L = list(map(int, input().split()))
    a = max(L)
    b = sum(L) - a
    if a < b:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
Buggy code:
n = int(input())
l = list(map(int,input().split(" ")))

print(sum(l))
m=max(l)
if m - (sum(l)-m):
    print("Yes")
else:
    print("No")

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

m = max(l)
o = sum(l) - m

if m < o:
  print('Yes')
else:
  print('No')
Buggy code:
N = int(input())
L = sorted(list(map(int, input().split())))

max_length = L[-1]
sum_length = sum(L[0:len(L)-1])
print(sum_length)

print("Yes") if max_length > sum_length else print("No")

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

max_length = L[-1]
sum_length = sum(L[0:len(L)-1])

print("Yes") if max_length < sum_length else print("No")
Buggy code:
N = int(input())
L = [int(i) for i in input().split()]

L.sort()
if L[N-1] < sum(L[0:N-1]):
    print('yes')
else:
    print('No')


Fixed code:
N = int(input())
L = [int(i) for i in input().split()]

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

su = sum(L)
ma = max(L)

if su - ma > ma:
  print("YES")
else:
  print("No")

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

su = sum(L)
ma = max(L)

if su - ma > ma:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input())
L_ls = [int(i) for i in input().split()]
print(L_ls)
if sum(L_ls) - 2*max(L_ls) > 0:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
L_ls = [int(i) for i in input().split()]
if sum(L_ls) - 2*max(L_ls) > 0:
  print("Yes")
else:
  print("No")
Buggy code:
# 117b

def atc_117b(N: int, Li_input: str) -> str:
    Li = [int(i) for i in Li_input.split(" ")]
    Li = sorted(Li)
    max_length = Li.pop()
    if max_length < sum(Li):
        return "Yes"
    return "No"

N_input_value = int(input())
Li_input_Value = input()
print(atc_117b(N_input_value, Li_input_value))


Fixed code:
# 117b

def atc_117b(N: int, Li_input: str) -> str:
    Li = [int(i) for i in Li_input.split(" ")]
    Li = sorted(Li)
    max_length = Li.pop()
    if max_length < sum(Li):
        return "Yes"
    return "No"

N_input_value = int(input())
Li_input_value = input()
print(atc_117b(N_input_value, Li_input_value))
Buggy code:
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
if 2 * max(l) - sum(l) > 0:
    print("No")
else:
    print("Yes")


Fixed code:
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
if 2 * max(l) - sum(l) < 0:
    print("Yes")
else:
    print("No")
Buggy code:
N = input()
L = list(input().split())
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b+= L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")

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

Fixed code:
_ = input()
n = [int(i) for i in input().split()]
print("YNeos"[0>=sum(n)-max(n)*2::2])
Buggy code:
n = int(input())
L = list(map(int, input().split()))
idx = L.index(max(L))
print(idx)
sum_L = 0
for i in range(len(L)):
    if i == idx:
        pass
    else:
        sum_L += L[i]

if L[idx] < sum_L:
    print('Yes')
else:
    print('No')
    

Fixed code:
n = int(input())
L = list(map(int, input().split()))
idx = L.index(max(L))
sum_L = 0
for i in range(len(L)):
    if i == idx:
        pass
    else:
        sum_L += L[i]

if L[idx] < sum_L:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
L_list = list(map(int, input().split()))

L_list.sort()

print(sum(L_list[0:-1]))
if sum(L_list[0:-1]) > L_list[-1]:
    print('Yes')
else:
    print('No')

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

L_list.sort()

if sum(L_list[0:-1]) > L_list[-1]:
    print('Yes')
else:
    print('No')
Buggy code:
from sys import stdin

def main():
    N = int(input())
    L = list(map(int, input().split()))

    L.sort()
    if L[0] < sum(L[1:]):
        print('Yes')
    else:
        print('No')

input = lambda: stdin.readline()
main()


Fixed code:
from sys import stdin

def main():
    N = int(input())
    L = list(map(int, input().split()))

    L.sort(reverse=1)
    if L[0] < sum(L[1:]):
        print('Yes')
    else:
        print('No')

input = lambda: stdin.readline()
main()
Buggy code:
n,l=map(int,open(0).read().split())
sum_n=sum(l)
for i in range(n):
  if 2*l[i]>=sum_n
  	print('No')
    import sys
    sys.exit()
print('Yes')

Fixed code:
n,*l=map(int,open(0).read().split())
sum_n=sum(l)
for i in range(n):
	if 2*l[i]>=sum_n:
		print('No')
		import sys
		sys.exit()
print('Yes')
Buggy code:
import numpy as np
n = int(input())
l = list(map(int, input().split()))
a = max(l)
b = l.remove(a)
c = np.sum(b)
if a < c:
    print('Yes')
else:
    print('No')

Fixed code:
#import numpy as np
n = int(input())
l = list(map(int, input().split()))
a = max(l)
l.remove(a)

c = sum(l)
if a < c:
    print('Yes')
else:
    print('No')
Buggy code:
import sys
N = int(sys.stdin.readline().rstrip())
l = list(map(int, sys.stdin.readline().rstrip().split()))

lm = 0
L = 0
for n in range(N):
  if l[n] > lm:
    L += lm
    lm = l[n]
  else:
    L += l[n]
    
if lm > L:
  print('Yes')
else:
  print('No')

Fixed code:
import sys
N = int(sys.stdin.readline().rstrip())
l = list(map(int, sys.stdin.readline().rstrip().split()))
 
lm = 0
L = 0
for n in range(N):
  if l[n] > lm:
    L += lm
    lm = l[n]
  else:
    L += l[n]
    
if lm < L:
  print('Yes')
else:
  print('No')
Buggy code:

Ls = sorted(map(int, input().split()))
if Ls[-1] < sum(Ls) - Ls[-1]:
    print('Yes')
else:
    print('No')

Fixed code:
N = int(input())
Ls = sorted(map(int, input().split()))
if Ls[-1] < sum(Ls) - Ls[-1]:
    print('Yes')
else:
    print('No')
Buggy code:
a=input()
b=list(map(int,input().split()))
b.sort()
if b[len(b)-1]> sum(b[:len(b)-1]):
  print("Yes")
else:
  print("No")

Fixed code:
a=input()
b=list(map(int,input().split()))
b.sort()
if b[len(b)-1]< sum(b[:len(b)-1]):
  print("Yes")
else:
  print("No")
Buggy code:
a=int(input())
b=list(map(int,input().split()))
if a<sum(b)-max(b):
  print('Yes')
else:
  print('No')

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

if max(b)<(sum(b)-max(b)):
  print('Yes')
else:
  print('No')
Buggy code:
N=int(input())
A=list(map(int,input().split()))
L=sorted(A,reverse=True)
if L[0]<sum(L[1,]):
  print("Yes")
else:
  print("No")

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

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

cur_longest = 0
sum_others = 0

for l in ls:
    sum_others += l
    if l > cur_longest:
        sum_others -= l
        sum_others += cur_longest
        cur_longest = l

print(cur_longest, sum_others)

if cur_longest > sum_others:
    print('No')
else:
    print('Yes')



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

cur_longest = 0
sum_others = 0

for l in ls:
    sum_others += l
    if l > cur_longest:
        sum_others -= l
        sum_others += cur_longest
        cur_longest = l

if cur_longest >= sum_others:
    print('No')
else:
    print('Yes')
Buggy code:
l = list(map(int,input().split()))
print("Yes" if max(l) > (sum(l) - max(l)) else "No")

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

s = sum(l)
res = "Yes"
for x in l:
  if (2*x>=s):
    res = "No"
print(res)
    

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

s = sum(l)
res = "Yes"
for x in l:
  if (2*x>=s):
    res = "No"
print(res)
Buggy code:
import numpy as np


n = input()
a = list(int(i) for i in input().split())  
arg = np.argmax(a)
max_a = a[arg]
a = np.delete(a,arg)
if np.sum(a) < max_a:
    print("Yes")
else:
    print("No")

Fixed code:
import numpy as np


n = input()
a = list(int(i) for i in input().split())  
arg = np.argmax(a)
max_a = a[arg]
a = np.delete(a,arg)
if np.sum(a) >max_a:
    print("Yes")
else:
    print("No")
Buggy code:
n = input()
a  list(map(int,input().split()))

a = sorted(a)

if sum(a[0:-1]) > a[-1]:
  print("No")
else:
  print("Yes")


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

a = sorted(a)

if sum(a[0:-1]) <= a[-1]:
  print("No")
else:
  print("Yes")
Buggy code:
n=int(input())
l=sorted(list(map(int,input().split()))reverse=True)

if l[0]<sum(l[1:]):
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
if l[0] < sum(l[1:]):
  print("Yes")
else:
  print("No")
Buggy code:
N = input()
L = list(map(int,input().split()))
Ma1 = max(L)
Su1 = sum(L)
if Ma1 >= Su1 - Ma1:
  print('Yes')
else:
  print('No')

Fixed code:
N = input()
L = list(map(int,input().split()))
Ma1 = max(L)
 
Su1 = sum(L)
 
hikaku = Su1 - Ma1
 
if hikaku > Ma1:
  print('Yes')
else:
  print('No')
Buggy code:
n = int(input())
li = [int(x) for x in input().split()]
li.sort()
if sum(li[:-1]) < li[-1]:
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
li = [int(x) for x in input().split()]
li.sort()

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

Fixed code:
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
if sum(L[:-1])>L[-1]:
  print('Yes')
else:
  print('No')
Buggy code:
N=int(input())
L=[int(i) for i in input().split()]
M=max(L)
del L[M]
if M>=sum(L):
  print('No')
else:
  print('Yes')

Fixed code:
N=int(input())
L=[int(i) for i in input().split()]
M=max(L)
L.remove(M)
if M>=sum(L):
  print('No')
else:
  print('Yes')
Buggy code:
n = int(input())
lengths = list(map(int, input().split(' ')))
total = 0
longest = 0
for i in lengths:
  total += i
  if (i > longest):
    longest = i
possible = True
if (total - longest) < longest:
    possible = False
   
if possible:
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())
lengths = list(map(int, input().split(' ')))
total = 0
longest = 0
for i in lengths:
  total += i
  if (i > longest):
    longest = i
possible = True
if (total - longest) <= longest:
    possible = False
   
if possible:
  print("Yes")
else:
  print("No")
Buggy code:
n=input()
li = list(map(int,input().split()))
M=max(li)
check=sum(li)-M
if check>0:
    print("Yes")
else:
    print("No")



Fixed code:
n=input()
li = list(map(int,input().split()))
M=max(li)
check=sum(li)-M*2
if check>0:
    print("Yes")
else:
    print("No")
Buggy code:
#ABC117 B
N = int(input())
Ln = list(map(int, input().split()))
Ln.sort()
max = Ln[0]
sum = sum(Ln)
    
if max < sum - max:
    print("Yes")
else:
    print("No")


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

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

print('Yes' if max(L) * 2 < sum(L) else 'No')
Buggy code:
n,ans,l=int(input()),"Yes",list(map(int,input()))
for i in l:
  if sum(l)<i*2:ans="No"
print(ans)

Fixed code:
n,ans,l=int(input()),"Yes",list(map(int,input().split()))
for i in l:
  if sum(l)<=i*2:ans="No"
print(ans)
Buggy code:
N = int(input())
# L = []
#L = map(int, input().split())
L = [int(i) for i in input().split()]
#L.append(int(input()))

# print(a/b)
print(L)
s = sum(L)
m = max(L)
#f = 0
#for x in L:
#    if(x > s - x):
#        f = 1

if (m < s):
    print('Yes')
else:
    print('No')

Fixed code:
N = int(input())
# L = []

# L = map(int, input().split())
# = list(map(int, input().split()))
L = [int(i) for i in input().split()]
#L.append(int(input()))
#s = 0
#for x in L:
    #s = s + x
#print(s)

# print(a/b)
#print(L)
s = sum(L)
m = max(L)
#print(s)
#print(m)
#f = 0
#for x in L:
#    if(x > s - x):
#        f = 1

if (m < s - m):
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
L = list((int,input().split()))

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

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

maxL = max(L)
if maxL < sum(L) - maxL:
  print('Yes')
else:
  print('No')
Buggy code:
a= input()
b = input().split()
s = 0
for i in range(0,len(b)):
               s+=int(b[i])
if s-max(b)>max(b):
  print("Yes")
else:
  print("No)

Fixed code:
a= input()
b = input().split()
b = [int(s) for s in b]
s = 0
for i in range(0,len(b)):
    s+=int(b[i])
if s-int(max(b))>int(max(b)):
    print("Yes")
else:
    print("No")
Buggy code:
def actual(n, L):
    max_l = max(L)
    others_l = sum(L) - max_l

    if max_l < others_l:
        return 'Yes'

    return 'No'

n = int(input())
L = map(int, input().split())
print(actual(n, L))

Fixed code:
def actual(n, L):
    max_l = max(L)
    others_l = sum(L) - max_l

    if max_l < others_l:
        return 'Yes'

    return 'No'

n = int(input())
L = list(map(int, input().split()))
print(actual(n, L))
Buggy code:
import functools

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

longest = functools.reduce(lambda x,y: x if x > y else y, l, True)
sum = functools.reduce(lambda x,y: x + y, l, True) - longest

if longest > sum:
	print('No')
else:
	print('Yes')



Fixed code:
import functools

n = int(input())
l = list(map(lambda x: int(x), input().split()))
    
longest = functools.reduce(lambda x,y: x if x > y else y, l)
sum = functools.reduce(lambda x,y: x + y, l) - longest

if longest >= sum:
	print('No')
else:
	print('Yes')
Buggy code:
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    L = list(map(int, input().split()))
    L.sort()
    
    longest = L[-1]
    sum = 0
    for i in range(len(L)-1):
        sum += L[i]
    
    if longest <= sum:
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    solve()

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

def solve():
    N = int(input())
    L = list(map(int, input().split()))
    L.sort()
    
    longest = L[-1]
    sum = 0
    for i in range(len(L)-1):
        sum += L[i]
    
    if longest < sum:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    solve()
Buggy code:
n = int(input())
l = list(map(int, input().split()))
l.sort()
print('Yes' if l[-1] <= sum(l[:-1]) else 'No')


Fixed code:
n = int(input())
l = list(map(int, input().split()))
l.sort()
print('Yes' if l[-1] < sum(l[:-1]) else 'No')
Buggy code:
N = int(input())
Ls = input().split()
for i in range(N):
    Ls[i] = int(Ls[i])
print(Ls)
max_L = max(Ls)
sum_others = sum(Ls) - max_L
if max_L < sum_others:
    print("Yes")
else:
    print("No")

Fixed code:
N = int(input())
Ls = input().split()
for i in range(N):
    Ls[i] = int(Ls[i])
max_L = max(Ls)
sum_others = sum(Ls) - max_L
if max_L < sum_others:
    print("Yes")
else:
    print("No")
Buggy code:
# the number of inputs
N = int(input())
# each length of edges
Ls= map(int, input().split())
largestL = 0
largestIndex = 0

# straightforward way
for i in range(N):
  if Ls[i] > largestL:
    largestL = Ls[i]
    largestIndex = i

sumOfSmallLs = 0
for i in range(N):
  if i != largestIndex:
    sumOfSmallLs += Ls[i]

if sumOfSmallLs < largestL:
  print('Yes')
else:
  print('No')

Fixed code:
# the number of inputs
N = int(input())
# each length of edges
Ls= list(map(int, input().split()))

# searching largest one
largestL = 0
largestIndex = 0

# straightforward way
for i in range(N):
  if Ls[i] > largestL:
    largestL = Ls[i]
    largestIndex = i

sumOfSmallLs = 0
for i in range(N):
  if i != largestIndex:
    sumOfSmallLs += Ls[i]

if sumOfSmallLs > largestL:
  print('Yes')
else:
  print('No')