Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
word = input()
count = int(input())
reversed_flg = False

for i in range(count):
    line = input()
    if len(line) == 1:
        reversed_flg = not reversed_flg
    else:
        str_t, str_f, char = line.split()
        f = int(str_f)
        
        if (f == 1 and not reversed_flg) or (f == 2 and reversed_flg):
            word = char + word
        else:
            word = word + char

    if i == count - 1 and reversed_flg:
        word = word[::-1]

print(word) 

Fixed submission:
word = input()
count = int(input())
reversed_flg = False
head = ''
tail = ''

for i in range(count):
    line = input()
    if len(line) == 1:
        reversed_flg = not reversed_flg
    else:
        str_t, str_f, char = line.split()
        f = int(str_f)

        if (f == 1 and not reversed_flg) or (f == 2 and reversed_flg):
            # word = char + word
            head = char + head
        else:
            # word = word + char
            tail += char

word = head + word + tail

if reversed_flg:
        word = word[::-1]

print(word)

Buggy python submission (verdict: Time Limit Exceeded):
word = input()
count = int(input())

for i in range(count):
    line = input()
    if len(line) == 1:
        word = word[::-1]
    else:
        t, f, char = map(str, line.split())
        if int(f) == 1:
            word = char + word
        else:
            word = word + char

print(word) 

Fixed submission:
word = input()
count = int(input())
reversed_flg = False
head = ''
tail = ''

for i in range(count):
    line = input()
    if len(line) == 1:
        reversed_flg = not reversed_flg
    else:
        str_t, str_f, char = line.split()
        f = int(str_f)

        if (f == 1 and not reversed_flg) or (f == 2 and reversed_flg):
            # word = char + word
            head = char + head
        else:
            # word = word + char
            tail += char

word = head + word + tail

if reversed_flg:
        word = word[::-1]

print(word)
Buggy python submission (verdict: Time Limit Exceeded):
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * pow(i+1, mod - 2, mod) % mod
    return res

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
all_patern = pow(2, n) - 1
minus_a = combination(n, a)
minus_b = combination(n, b)
print((all_patern % mod - minus_a - minus_b) % mod)

Fixed submission:
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * pow(i+1, mod - 2, mod) % mod
    return res

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
all_patern = pow(2, n, mod) - 1
minus_a = combination(n, a)
minus_b = combination(n, b)
print((all_patern - minus_a - minus_b) % mod)

Buggy python submission (verdict: Time Limit Exceeded):
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * pow(i+1, mod-2, mod) % mod
    return res

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
all_patern = 2 ** n - 1
minus_a = combination(n, a)
minus_b = combination(n, b)
print((all_patern % mod - minus_a - minus_b) % mod)

Fixed submission:
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * pow(i+1, mod - 2, mod) % mod
    return res

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7
all_patern = pow(2, n, mod) - 1
minus_a = combination(n, a)
minus_b = combination(n, b)
print((all_patern - minus_a - minus_b) % mod)
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
line = [int(a) for a in input().split()]

for i in range(num):
    if line[i] in line[i+1:]:
        print('NO')
        break
else:
    print('YES')

Fixed submission:
num = int(input())
line = [int(a) for a in input().split()]
set_line = list(set(line))

if len(line) == len(set_line):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import math

a, b, water = map(int, input().split())
pool = a ** 2 * b

if water > pool / 2:
    high = 2 * (pool - water) / (a ** 2)
    ans = 90 - math.degrees(math.atan(a / high))
elif water == pool / 2:
    ans = 45
else:
    high = 2 * water / (a * b)
    ans = 90 - math.degrees(math.atan(high / b))

print(ans)

Fixed submission:
import math

a, b, water = map(int, input().split())
pool = a ** 2 * b

if water == pool:
    ans = 0
elif water > pool / 2:
    high = 2 * (pool - water) / (a ** 2)
    ans = 90 - math.degrees(math.atan(a / high))
elif water == pool / 2:
    ans = 45
else:
    high = 2 * water / (a * b)
    ans = 90 - math.degrees(math.atan(high / b))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [int(_) for _ in input().split()]
len_l = len(l)
ans = 0

for s in range(len_l):
    a = l[s]
    t = s + 1
    while t <= len_l - 1:
        b = l[t]
        u = t + 1
        while u <= len_l - 1:
            c = l[u]
            if a != b and b != c and a != c and a < b + c and b < c + a and c < a + b:
                ans += 1
            u += 1
        t += 1

print(ans)

Fixed submission:
from bisect import bisect_left

n = int(input())
l = [int(_) for _ in input().split()]
l.sort()
ans = 0

for s in range(n - 2):
    for t in range(s + 1, n - 1):
        x = bisect_left(l, l[s] + l[t])
        ans += x - t - 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n, m = map(int, input().split())
item = [int(a) for a in input().split()]
item.sort()
ans = 0

for _ in range(m):
    item_max = item.pop()
    bisect.insort_left(item, item_max / 2)

for i in item:
    ans += int(i)

print(ans)

Fixed submission:
import heapq

n, m = map(int, input().split())
item = [-1 * int(a) for a in input().split()]
heapq.heapify(item)
ans = 0

for _ in range(m):
    item_max = heapq.heappop(item)
    item_max = item_max / 2
    heapq.heappush(item, item_max)

for i in item:
    ans += int(i)

print(- ans)
Buggy python submission (verdict: Runtime Error):
a=input()
print 3.14*2*a

Fixed submission:
a = int(input())
print (3.14*2*a)
Buggy python submission (verdict: Time Limit Exceeded):
K, N = map(int, input().split())
A = list(map(int, input().split()))
A += [i+K for i in A]
diff = [A[i+1] - A[i] for i in range(N*2-1)]

length = sum(A)

for i in range(len(diff) - N + 1):
    length = min(length, sum(diff[i:i+N-1]))
print(length)

Fixed submission:
K, N = map(int, input().split())
A = list(map(int, input().split()))
diff = [A[i+1] - A[i] for i in range(N-1)]
if 0 in A:
    diff.append(K- A[-1])
else:
    diff.append(A[0] + K - A[-1])


print(sum(diff) - max(diff))
Buggy python submission (verdict: Runtime Error):
A = []
for i in range(3):
    A.append(list(map(int, input().split())))

N = int(input())
b = []
for i in range(N):
    b.append(int(input()))

bingo = []
for t in range(N):
    for i in range(3):
        if b[t] in A[i]:
            j = A[i].index(b[t])
            #bingo.append((i, j))
            A[i][j] = True

for i in range(3):
    if A[i][0] == A[i][1] == A[i][2]:
        answer = "Yes"

for j in range(3):
    if A[0][j] == A[1][j] == A[2][j]:
        answer = "Yes"
if A[0][0] == A[1][1] == A[2][2]:
    answer = "Yes"

if A[2][0] == A[1][1] == A[0][2]:
    answer = "Yes"
    

print(answer)

Fixed submission:
A = []
for i in range(3):
    A.append(list(map(int, input().split())))

N = int(input())
b = []
for i in range(N):
    b.append(int(input()))

bingo = []
for t in range(N):
    for i in range(3):
        if b[t] in A[i]:
            j = A[i].index(b[t])
            #bingo.append((i, j))
            A[i][j] = True

answer = "No"
for i in range(3):
    if A[i][0] == A[i][1] == A[i][2]:
        answer = "Yes"

for j in range(3):
    if A[0][j] == A[1][j] == A[2][j]:
        answer = "Yes"
if A[0][0] == A[1][1] == A[2][2]:
    answer = "Yes"

if A[2][0] == A[1][1] == A[0][2]:
    answer = "Yes"
    

print(answer)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

N = int(input())
A = list(map(int, input().split()))
print(A)
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def has_duplicates(seq):
    return len(seq) != len(set(seq))


if gcd_list(A)==1 and has_duplicates(A) == False:
    print("YES")
else:
    print("NO")

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

def has_duplicates(seq):
    return len(seq) != len(set(seq))


if has_duplicates(A) == False:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N):
    if min(P[:i+1]) == P[i]:
        count += 1
print(count)



Fixed submission:
N = int(input())
P = list(map(int, input().split()))
count = 0
minimum = 2 * 10**5
for i in range(N):
    if P[i] <= minimum:
        count += 1
        minimum = P[i]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split())

for i in range(K):
    if A >= 1:
        A -= 1
    elif B >= 1:
        B -= 1
    else:
        pass
print(A, B)

Fixed submission:
A,B,K = map(int,input().split())
print(A - K, B) if A - K >= 0 else print(0, B + (A - K)) if B + (A - K) >= 0 else print(0, 0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

suc = 0
if N > 1:
    for i in range(N-1):
        if H[i] - 1 > H[i+1]:
            suc = -1
            break
        elif H[i] > H[i+1] > H[i+2]:
            suc = -1
            break

print("Yes") if suc == 0 else print("No")




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

suc = "Yes"
maxN = H[0]
for i in range(N):
    if maxN - 1 > H[i]:
        suc = "No"
        break
    elif maxN < H[i]:
        maxN = H[i]
print(suc)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
for i in range(N):
    print(max(A[:i]+A[i+1:]))



Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

max_num = max(A)
a = sorted(A)
second = a[-2]

for i in range(N):
    if A[i] == max_num:
        print(second)
    else:
        print(max_num)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]

for i in range(N):
    print(max(A[:i] + A[i+1:]))

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

max_num = max(A)
a = sorted(A)
second = a[-2]

for i in range(N):
    if A[i] == max_num:
        print(second)
    else:
        print(max_num)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
max_num = max(A)
result = [max(A[:i]+A[i+1:]) for i in range(N)]
for i in range(N):
  print(result[i])

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

max_num = max(A)
a = sorted(A)
second = a[-2]

for i in range(N):
    if A[i] == max_num:
        print(second)
    else:
        print(max_num)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
result = [max(A[:i] + A[i+1:]) for i in range(N)]
for i in range(N):
    print(result[i])

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

max_num = max(A)
a = sorted(A)
second = a[-2]

for i in range(N):
    if A[i] == max_num:
        print(second)
    else:
        print(max_num)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
result = [max(A[:i] + A[i+1:]) for i in range(N)]
for item in result:
    print(item)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

max_num = max(A)
a = sorted(A)
second = a[-2]

for i in range(N):
    if A[i] == max_num:
        print(second)
    else:
        print(max_num)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
result = [max(A[:i] + A[i+1:]) for i in range(N)]
for item in result:
    print(item)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]

max_num = max(A)
a = sorted(A)
second = a[-2]

for i in range(N):
    if A[i] == max_num:
        print(second)
    else:
        print(max_num)
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input())
if A <= 5:
  print(0)
elif A <= 12:
  print(B/2)
else:
  print(B)

Fixed submission:
A,B = map(int, input().split())
if A <= 5:
  print(0)
elif A <= 12:
  print(B//2)
else:
  print(B)
Buggy python submission (verdict: Runtime Error):
S = input()
s_1 = S[:2]
s_2 = S[2:]

if 0 < s_1 < 13 and 0 < s_2 < 13:
  print("AMBIGUOUS")
elif 0 < s_1 < 13:
  print("MMYY")
elif 0 < s_2 < 13:
  print("YYMM")
else:
  print("NA")

Fixed submission:
S = input()
s_1 = int(S[:2])
s_2 = int(S[2:])

if 0 < s_1 < 13 and 0 < s_2 < 13:
  print("AMBIGUOUS")
elif 0 < s_1 < 13:
  print("MMYY")
elif 0 < s_2 < 13:
  print("YYMM")
else:
  print("NA")
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())
count = 0
for i in range(int(N/R) + 1):
    for j in range(int(N/G) + 1):
        temp = (N - i * R - j * G)/B
        if temp >= 0 and temp - int(temp) == 0:
            count += 1
print(count)

Fixed submission:
R,G,B,N = map(int,input().split())
count = 0
for i in range(int(N/R) + 1):
    for j in range(int(N/G) + 1):
        temp = (N - i * R - j * G)/B
        if temp >= 0 and temp - int(temp) == 0:
            count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())
count = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        for t in range(N//B+1):
            if R*i+G*j+B*t == N:
                count += 1
print(count)

Fixed submission:
R,G,B,N = map(int,input().split())
count = 0
for i in range(int(N/R) + 1):
    for j in range(int(N/G) + 1):
        temp = (N - i * R - j * G)/B
        if temp >= 0 and temp - int(temp) == 0:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
lis = []
for i in range(5):
    lis.append(int(input()))
plus = 0
notdiv = []
for i in range(5):
    if lis[i] % 10 != 0:
        plus += 10 - (lis[i] % 10)
        notdiv.append(lis[i])
for i in range(len(notdiv)):
    notdiv[i] %= 10
    notdiv[i] = 10 - notdiv[i]

notdiv.sort()
print(sum(lis) + plus - notdiv[-1])

Fixed submission:
lis = []
for i in range(5):
    lis.append(int(input()))
plus = 0
notdiv = []
for i in range(5):
    if lis[i] % 10 != 0:
        plus += 10 - (lis[i] % 10)
        notdiv.append(lis[i])
if notdiv:
    for i in range(len(notdiv)):
        notdiv[i] %= 10
        notdiv[i] = 10 - notdiv[i]

    notdiv.sort()
    print(sum(lis) + plus - notdiv[-1])
else:
    print(sum(lis) + plus)

Buggy python submission (verdict: Runtime Error):
lis = []
for i in range(5):
    lis.append(int(input()))
plus = 0
notdiv = []
for i in range(5):
    if lis[i] % 10 != 0:
        plus += 10 - (lis[i] % 10)
        notdiv.append(lis[i])
for i in range(5):
    notdiv[i] %= 10
    notdiv[i] = 10 - notdiv[i]


notdiv.sort()
print(sum(lis) + plus - notdiv[-1])

Fixed submission:
lis = []
for i in range(5):
    lis.append(int(input()))
plus = 0
notdiv = []
for i in range(5):
    if lis[i] % 10 != 0:
        plus += 10 - (lis[i] % 10)
        notdiv.append(lis[i])
if notdiv:
    for i in range(len(notdiv)):
        notdiv[i] %= 10
        notdiv[i] = 10 - notdiv[i]

    notdiv.sort()
    print(sum(lis) + plus - notdiv[-1])
else:
    print(sum(lis) + plus)

Buggy python submission (verdict: Runtime Error):
lis = []
for i in range(5):
    lis.append(int(input()))
plus = 0
notdiv = []
for i in range(5):
    if lis[i] % 10 != 0:
        plus += 10 - (lis[i] % 10)
        notdiv.append(lis[i])
for i in range(5):
    notdiv[i] %= 10
    notdiv[i] = 10 - notdiv[i]


notdiv.sort()
print(sum(lis) + plus - notdiv[-1])

Fixed submission:
lis = []
for i in range(5):
    lis.append(int(input()))
plus = 0
notdiv = []
for i in range(5):
    if lis[i] % 10 != 0:
        plus += 10 - (lis[i] % 10)
        notdiv.append(lis[i])
if notdiv:
    for i in range(len(notdiv)):
        notdiv[i] %= 10
        notdiv[i] = 10 - notdiv[i]

    notdiv.sort()
    print(sum(lis) + plus - notdiv[-1])
else:
    print(sum(lis) + plus)
Buggy python submission (verdict: Runtime Error):
S = input()
ACGT = ["A","C","G","T"]
index = []
for i in range(len(S)):
    if S[i] not in ACGT:
        index.append(i)

diff = [index[0]]
for j in range(len(index)-1):
    diff.append(index[j+1] - index[j] - 1)

print(max(diff))

Fixed submission:
S = list(input())
st = [0]*len(S)
string = "ACGT"
for i in range(len(S)):
    if S[i] in string:
        st[i] += 1

st_1 = [1]*len(S)

count = []
temp = 0

for i in range(len(st)):
    if st[i] == st_1[i]:
        temp += 1
    else:
        count.append(temp)
        temp = 0
    if i+1 == len(st):
        count.append(temp)
        
#print(st)
if count:
    print(max(count))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())

A = []
B = []
for i in range(1,a):
    if a % i == 0:
        A.append(i)
for i in range(1,b):
    if b % i == 0:
        B.append(i)
common = list(set(A) & set(B))
common.sort()
print(common[k-1])

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

A = []
B = []
for i in range(1,a+1):
    if a % i == 0:
        A.append(i)
for i in range(1,b+1):
    if b % i == 0:
        B.append(i)
common = list(set(A) & set(B))
common.sort(reverse=True)

print(common[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**5-10**4*2)
S = list(input())
n = len(S)
def Remove(binList,lenList):
    for i in range(0,lenList-1):
        if (binList[i] == "0" and binList[i+1] == "1") or (binList[i] == "1" and binList[i+1] == "0"):
            del binList[i:i+2]
            return Remove(binList,lenList - 2)
    return binList
if n > 10**5:
    sys.exit()
S = Remove(S,n)
print(n-len(S))

Fixed submission:
S = list(input())
obj = min(S.count("0"),S.count("1"))
print(obj*2)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**5//2)
S = list(input())
n = len(S)
def Remove(binList,lenList):
    for i in range(0,lenList-1):
        if (binList[i] == "0" and binList[i+1] == "1") or (binList[i] == "1" and binList[i+1] == "0"):
            del binList[i:i+2]
            return Remove(binList,lenList - 2)
    return binList
if n > 10**5:
    sys.exit()
S = Remove(S,n)
print(n-len(S))

Fixed submission:
S = list(input())
obj = min(S.count("0"),S.count("1"))
print(obj*2)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**5)
S = list(input())
n = len(S)
def Remove(binList,lenList):
    for i in range(0,lenList-1):
        if (binList[i] == "0" and binList[i+1] == "1") or (binList[i] == "1" and binList[i+1] == "0"):
            del binList[i:i+2]
            return Remove(binList,lenList - 2)
    return binList
if n > 10**5:
    sys.exit()
S = Remove(S,n)
print(n-len(S))

Fixed submission:
S = list(input())
obj = min(S.count("0"),S.count("1"))
print(obj*2)

Buggy python submission (verdict: Runtime Error):
import sys
S = list(input())
n = len(S)
def Remove(binList,lenList):
    for i in range(0,lenList-1):
        if (binList[i] == "0" and binList[i+1] == "1") or (binList[i] == "1" and binList[i+1] == "0"):
            del binList[i:i+2]
            return Remove(binList,lenList - 2)
    return binList
if n > 10**5:
    sys.exit()
S = Remove(S,n)
print(n-len(S))

Fixed submission:
S = list(input())
obj = min(S.count("0"),S.count("1"))
print(obj*2)

Buggy python submission (verdict: Runtime Error):
S = list(input().strip())
n = len(S)
def Remove(binList,lenList):
    for i in range(0,lenList-1):
        if (binList[i] == "0" and binList[i+1] == "1") or (binList[i] == "1" and binList[i+1] == "0"):
            del binList[i:i+2]
            return Remove(binList,lenList - 2)
    return binList
S = Remove(S,n)
print(n-len(S))

Fixed submission:
S = list(input())
obj = min(S.count("0"),S.count("1"))
print(obj*2)

Buggy python submission (verdict: Runtime Error):
S = list(input())
n = len(S)

def Remove(binList,lenList):
    for i in range(0,lenList-1):
        if (binList[i] == "0" and binList[i+1] == "1") or (binList[i] == "1" and binList[i+1] == "0"):
            del binList[i:i+2]
            return Remove(binList,lenList - 2)
    return binList
S = Remove(S,n)
print(n-len(S))

Fixed submission:
S = list(input())
obj = min(S.count("0"),S.count("1"))
print(obj*2)
Buggy python submission (verdict: Runtime Error):
n = input()
EdgeLength=input()
edgeLength=[int(i) for i in EdgeLength]
N = int(n)

sorted(edgeLength)

sumL = 0
sumLength = [sumL += edgeLength[i] for i in range(N-1)]

if edgeLength[N] < sumL:
    print("Yes")
else:
    print("No")

Fixed submission:
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 python submission (verdict: Runtime Error):
n = input()
EdgeLength=input()
edgeLength=[int(i) for i in EdgeLength]
N = int(n)

sorted.edgeLength()

sumL = 0
sumLength = [sumL += edgeLength[i] for i in range(1,N)]

if edgeLength[0] < sumL:
    print("Yes")
else:
    print("No")

Fixed submission:
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 python submission (verdict: Runtime Error):
EdgeLength=input()
edgeLength=[int(i) for i in EdgeLength]

sorted.edgeLength()

sumL = 0
sumLength = [sumL += edgeLength[i] for i in range(1,len(edgeLength))]

if edgeLength[0] < sumL:
    print("Yes")
else:
    print("No")


Fixed submission:
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")