Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
aqqn = list(input())
ans = 0
for i in range(2**(len(n)-1)):
    plus = [""]*(len(n))
    fomula = ""
    for j in range(len(n)-1):
        if(i>>j & 1):
            plus[j] = "+"
    for i in range(len(n)):
        fomula += n[i] + plus[i]
    ans += eval(fomula)
print(ans)


Fixed submission:
n = list(input())
ans = 0
for i in range(2**(len(n)-1)):
    plus = [""]*(len(n))
    fomula = ""
    for j in range(len(n)-1):
        if(i>>j & 1):
            plus[j] = "+"
    for i in range(len(n)):
        fomula += n[i] + plus[i]
    ans += eval(fomula)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if a+b > c+d:
    pirnt('Left')
elif a+b == c+d :
    print('Balanced')
else :
    print('Right')

Fixed submission:
a, b, c, d = map(int, input().split())
if (a+b) > (c+d):
    print('Left')
elif (a+b) == (c+d) :
    print('Balanced')
else :
    print('Right')

Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if a+b > c+d:
    pirnt('Left')
elif a+b == c+d :
    print('Balanced')
elif a+b < c+d :
    print('Right')

Fixed submission:
a, b, c, d = map(int, input().split())
if (a+b) > (c+d):
    print('Left')
elif (a+b) == (c+d) :
    print('Balanced')
else :
    print('Right')
Buggy python submission (verdict: Runtime Error):
# 入力の受け取り
n = int(input())
list = list(input().split())

# 全種類用意しとく
alphabets_list = lsit("abcdefghijklmnopqrstuvwxyz".split())

# 判定
for i in range(1, n - 1):
    x = list[ :i]
    y = list[i: ]
    count = 0
    for alphabet in alphabets_list:
        if alphabet in x and alphabet in y:
            count += 1
        else:
            continue

print(continue)


Fixed submission:
# 入力の受け取り
n = int(input())
s = input()

# 全種類用意しとく
alphabets_list = [c for c in "abcdefghijklmnopqrstuvwxyz"]

# 判定
result = []
for i in range(1, n):
    x = s[ :i]
    y = s[i: ]
    count = 0
    for alphabet in alphabets_list:
        if (alphabet in x) and (alphabet in y):
            count += 1
        else:
            count += 0
    result.append(count)

print(max(result))
Buggy python submission (verdict: Runtime Error):
N = int(input())
Nlist = input().split()

wMax = Nlist(0)
wMin = Nlist(0)
for value in Nlist:
    if int(value) > wMax:
        wMax = int(value)
    if int(value) < wMin:
        wMin = int(value)

print(abs(wMax - wMin))

Fixed submission:
N = int(input())
Nlist = input().split()

wMax = int(Nlist[0])
wMin = int(Nlist[0])
for value in Nlist:
    if int(value) > wMax:
        wMax = int(value)
    if int(value) < wMin:
        wMin = int(value)

print(abs(wMax - wMin))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

print(int((a + b) / 2　+ 0.9))



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

print(int((a + b) / 2 + 0.9))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

print(int(((a + b) / 2　+ 0.9)))



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

print(int((a + b) / 2 + 0.9))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

print(int(((a + b) / 2　+ 0.5)))



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

print(int((a + b) / 2 + 0.9))
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()

c = a.sort()
d = b.sort()

if c < d:
  print("Yes")
else:
  print("No")

Fixed submission:
a = input()
b = input()

c = ''.join(sorted(a))
d = ''.join(sorted(b, reverse=True))

if c < d:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a = input()

count = 0

if a[1:2] = "1":
  count += 1

if a[2:3] = "1":
  count += 1

if a[3:4] = "1":
  count += 1

print(count)

Fixed submission:
a = input()
b = int(a[0:1])
c = int(a[1:2])
d = int(a[2:3])

ball = 0

if(b == 1):
  ball += 1

if(c == 1):
  ball += 1

if(d == 1):
  ball += 1
  
print(ball)

Buggy python submission (verdict: Runtime Error):
a = input()

b = int(a[0:1])
c = int(a[1:1])
d = int(a[2:1])

ball = 0

if(b == 1):
  ball += 1

if(c == 1):
  ball += 1

if(d == 1):
  ball += 1
  
print(ball)

Fixed submission:
a = input()
b = int(a[0:1])
c = int(a[1:2])
d = int(a[2:3])

ball = 0

if(b == 1):
  ball += 1

if(c == 1):
  ball += 1

if(d == 1):
  ball += 1
  
print(ball)

Buggy python submission (verdict: Runtime Error):
a = input()

b = int(a[0:0])
c = int(a[1:0])
d = int(a[2:0])

ball = 0

if(b == 1):
  ball += 1

if(c == 1):
  ball += 1

if(d == 1):
  ball += 1
  
print(ball)

Fixed submission:
a = input()
b = int(a[0:1])
c = int(a[1:2])
d = int(a[2:3])

ball = 0

if(b == 1):
  ball += 1

if(c == 1):
  ball += 1

if(d == 1):
  ball += 1
  
print(ball)
Buggy python submission (verdict: Runtime Error):
r, g, b = map(int, input().split)

Number = r * 100 + g *10 + b

if (Number % 4) == 0:
  print("YES")
else:
  print("NO")

Fixed submission:
r, g, b = map(int, input().split())

Number = r * 100 + g *10 + b

if (Number % 4) == 0:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
r, g, b = map(int, input().split)

Number = r * 100 + g *10 + b

if (Number % 4) == 0:
  print("YES")
else:
  print("NO")

Fixed submission:
r, g, b = map(int, input().split())

Number = r * 100 + g *10 + b

if (Number % 4) == 0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
arr = range(A, B + 1)
ans = []
for i in range(K):
    ans[i] = arr[A + i]
for j in range(K):
    ans[j + K + 2] = arr[B + 1 - K + j]
print(set(ans))


Fixed submission:
A, B, K = map(int, input().split())
arr = range(A, B + 1)
ans = []
for i in range(K):
    ans.append(A + i)
for j in range(K):
    ans.append(B + 1 - K + j)

anset = list(set(ans))
anset.sort()
if A+K<=B+1:
    for ele in range(len(anset)):
        print(anset[ele])
else:
    for ele in range(A,B+1):
        print(ele)
Buggy python submission (verdict: Runtime Error):
N = int(input())
D, X = map(int, input().split())
A = list(input() for i in range(N))
sum = 0
for i in range(N):
    B = 0
    while B * A[i] + 1 <= D:
        B += 1
        sum += 1
print(X + sum)


Fixed submission:
N = int(input())
D, X = map(int, input().split())
A = list(int(input()) for i in range(N))
sum = 0
for i in range(N):
    B = 0
    while B * A[i] + 1 <= D:
        B += 1
        sum += 1
print(X + sum)

Buggy python submission (verdict: Runtime Error):
N = int(input())
D, X = map(int, input().split())
A = list(input() for i in range(N))
sum = 0
for i in range(N):
    B = 0
    while B * A[i + 1] + 1 <= D:
        B += 1
        sum += 1
print(X + sum)


Fixed submission:
N = int(input())
D, X = map(int, input().split())
A = list(int(input()) for i in range(N))
sum = 0
for i in range(N):
    B = 0
    while B * A[i] + 1 <= D:
        B += 1
        sum += 1
print(X + sum)

Buggy python submission (verdict: Runtime Error):
N = int(input())
D, X = map(int, input().split())
A = list(input() for i in range(N))
sum = 0
for i in range(N):
    while i * A[i] + 1 <= D:
        sum += 1
print(X + sum)


Fixed submission:
N = int(input())
D, X = map(int, input().split())
A = list(int(input()) for i in range(N))
sum = 0
for i in range(N):
    B = 0
    while B * A[i] + 1 <= D:
        B += 1
        sum += 1
print(X + sum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = list(input() for i range(N))
M = int(input())
t = list(input() for i range(M))

s_set = list(set(s))
ans = 0
for name in s_set:
    count = s.count(name) - t.count(name)
    ans = max(count, ans)

print(ans)


Fixed submission:
N = int(input())
s = list(input() for i in range(N))
M = int(input())
t = list(input() for i in range(M))

s_set = list(set(s))
ans = 0
for name in s_set:
    count = s.count(name) - t.count(name)
    ans = max(count, ans)

print(ans)

Buggy python submission (verdict: Runtime Error):
N = input()
s = list(input() for i range(N))
M = input()
t = list(input() for i range(M))

s_set = list(set(s))
ans = 0
for name in s_set:
    count = s.count(name) - t.count(name)
    ans = max(count, ans)
    
print(ans)


Fixed submission:
N = int(input())
s = list(input() for i in range(N))
M = int(input())
t = list(input() for i in range(M))

s_set = list(set(s))
ans = 0
for name in s_set:
    count = s.count(name) - t.count(name)
    ans = max(count, ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = sorted(list(map((int, input().split())), reverse=True))
A = 0
B = 0
for i in range(N):
    if i % 2 == 0:
        A += a[i]
    else:
        B += a[i]

print(A - B)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
asort = sorted(a, reverse=True)
A = 0
B = 0
for i in range(N):
    if i % 2 == 0:
        A += asort[i]
    else:
        B += asort[i]

print(A - B)
Buggy python submission (verdict: Runtime Error):
arr = input() for i in range(4)
count = 0
sum = 0
for fihun in range(int(arr[0]) + 1):
    for hun in range(int(arr[1]) + 1):
        for fi in range(int(arr[2]) + 1):
            sum = fihun * 500 + hun * 100 + fi * 50
            if sum == int(arr[3]):
                count += 1
print(count)


Fixed submission:
arr = [input() for i in range(4)]
count = 0
sum = 0
for fihun in range(int(arr[0]) + 1):
    for hun in range(int(arr[1]) + 1):
        for fi in range(int(arr[2]) + 1):
            sum = fihun * 500 + hun * 100 + fi * 50
            if sum == int(arr[3]):
                count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
arr = input() for i in range(4)
count = 0
sum = 0
for fihun in range(int(arr[0]) + 1):
    for hun in range(int(arr[1]) + 1):
        for fi in range(int(arr[2]) + 1):
            sum = fihun * 500 + hun * 100 + fi * 50
            if sum == int(range[3]):
                count += 1
print(count)


Fixed submission:
arr = [input() for i in range(4)]
count = 0
sum = 0
for fihun in range(int(arr[0]) + 1):
    for hun in range(int(arr[1]) + 1):
        for fi in range(int(arr[2]) + 1):
            sum = fihun * 500 + hun * 100 + fi * 50
            if sum == int(arr[3]):
                count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()

s.sort()
s=''.join(s)#辞書順最小=辞書で一番最初

t.sort()
t.reverse()
t=''.join(t)#辞書順最大

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


Fixed submission:
a,b=map(int,input().split())
S=input()
if len(S) == a + b + 1 and S[a] == '-' and S.count('-') == 1:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input(), split( ))
print(math.ceil((a + b) / 2))


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

print(math.ceil((a + b) / 2))

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input(), split(　))
print(math.ceil((a + b) / 2))

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

print(math.ceil((a + b) / 2))

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input(), split(　))
print(math.ceil((a * b) / 2))

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

print(math.ceil((a + b) / 2))

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input(), split())
print(math.ceil((a * b) / 2))

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

print(math.ceil((a + b) / 2))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input(), split())
print(ceil((a * b) / 2))


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

print(math.ceil((a + b) / 2))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input(), split())
print(int((a * b) / 2))

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

print(math.ceil((a + b) / 2))
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()

s.sort()
s=''.join(s)#辞書順最小=辞書で一番最初

t.sort()
t.reverse()
t=''.join(t)#辞書順最大

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


Fixed submission:
s=input()
t=input()

ss=''.join(sorted(s))#辞書順最小=辞書で一番最初
tt=''.join(sorted(t,reverse=True))#辞書順最大

if ss<tt:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
def calc_sad_param(b):
    global numbers
    sad_param = 0
    for i in range(len(numbers)):
        sad_param += abs(numbers[i] - (b + i))
    return sad_param

n = int(input())
numbers = list(map(int, input().split()))
sad_params = []
for b in range(-sorted(numbers)[-1], sorted(numbers)[-1]):
    sad_params.append(calc_sad_param(b))

sad_params.sort()

print(sad_params[0])

Fixed submission:
import statistics

def calc_sad_param(b):
    global numbers
    sad_param = 0
    for i in range(len(numbers)):
        sad_param += abs(numbers[i] - i - b)
    return int(sad_param)

n = int(input())
numbers = list(map(int, input().split()))
b_list = [numbers[i] - i for i in range(n)]
print(calc_sad_param(statistics.median(b_list)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ans = N-1
for i in range(N):
    cnt = 0
    for j in range(i):
        if S[j] == "W":
            cnt += 1
    for k in range(i+1, N):
        if S[k] == "E":
            cnt += 1
    ans = min(ans, cnt)

print(ans)

Fixed submission:
N = int(input())
S = input()

cnt = S[1:].count("E")
ans = cnt
for i in range(1, N):
    if S[i-1] == "W":
        cnt += 1
    if S[i] == "E":
        cnt -= 1
    ans = min(ans, cnt)

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
l = []
for i in range(A, B+1):
    l.append(i)
    
if B - (A-1) < 2*K:
    for j1 in l:
        print(j1)
else:
    m = l[:K] + l[-K:]
    for j in m:
        print(j)

Fixed submission:
S = input()
if S[0] != S[1] != S[2] != S[0]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
l = []
for i in range(A, B+1):
    l.append(i)
    
if B - (A-1) < 2*K:
    for j1 in l:
        print(j1)
else:
    for j2 in range(A, A+K):
        print(j2)
    for j3 in range(B-K+1, B+1):
        print(j3)

Fixed submission:
A, B, K = map(int, input().split())
    
if B - (A-1) < 2*K:
    l = []
    for i in range(A, B+1):
        l.append(i)
    for j1 in l:
        print(j1)
else:
    for j2 in range(A, A+K):
        print(j2)
    for j3 in range(B-K+1, B+1):
        print(j3)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
l = []
for i in range(A, B+1):
    l.append(i)
    
if B - (A-1) < 2*K:
    for j1 in l:
        print(j1)
else:
    m = l[:K] + l[-K:]
    for j in m:
        print(j)

Fixed submission:
A, B, K = map(int, input().split())
    
if B - (A-1) < 2*K:
    l = []
    for i in range(A, B+1):
        l.append(i)
    for j1 in l:
        print(j1)
else:
    for j2 in range(A, A+K):
        print(j2)
    for j3 in range(B-K+1, B+1):
        print(j3)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
l = []
for i in range(A, B+1):
    l.append(i)
    
if B - (A-1) <= 2*K:
    for j1 in l:
        print(j1)
else:
    m = l[:K] + l[-K:]
    for j in m:
        print(j)

Fixed submission:
A, B, K = map(int, input().split())
    
if B - (A-1) < 2*K:
    l = []
    for i in range(A, B+1):
        l.append(i)
    for j1 in l:
        print(j1)
else:
    for j2 in range(A, A+K):
        print(j2)
    for j3 in range(B-K+1, B+1):
        print(j3)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

cnt = 0
while True:
    for i in range(N):
        if a[i] % 2 == 1:
            break
        else:
            a[i] = a[i]/2
    cnt += 1

print(cnt)

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

cnt = 0
t_f = True

while t_f == True:
    for i in range(N):
        if a[i] % 2 == 1:
            t_f = False
            break
        else:
            a[i] = a[i]//2
    cnt += 1
    
print(cnt - 1)
Buggy python submission (verdict: Runtime Error):
N = input()
NB = list(N)
NN = int(N)

SN = 0
for i in N:
    SN += int(i)

if NB%SN == 0:
    print("Yes")
else:
    print("No")



Fixed submission:
S = list(input())

ans =0
for i in S:
    if i == "+" : ans += 1
    else: ans -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B= map(int, input().split())
ans = max(A+B, A-B, A*B)
print async 

Fixed submission:
A, B= map(int, input().split())
ans = max(A+B, A-B, A*B)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it

def f(c):
    x = abs(sum([i[0] for i in c]))
    y = abs(sum([i[1] for i in c]))
    z = abs(sum([i[2] for i in c]))
    return x + y + z

N, M = tuple(map(int, input().split()))
v = [[int(x) for x in input().split()] for j in range(N)]
c = list(it.combinations(v, M))
print(max(f(x) for x in c))

Fixed submission:
N, M = tuple(map(int, input().split()))
v = [[int(x) for x in input().split()] for j in range(N)]
v2 = [[v[i][0]*p + v[i][1]*q + v[i][2]*r for i in range(N)] for p in [1, -1] for q in [1, -1] for r in [1, -1]]
v3 = [sorted(v2[i], reverse=True) for i in range(8)]
m = 0
for i in range(8):
    n = sum(v3[i][:M])
    if n > m:
        m = n

print(m)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def Base10toN(X, n):
    if (int(X / n)):
        return Base10toN(int(X / n), n) + str(X % n)
    else:
        return str(X % n)

def f(amount):
    if amount <= 5:
        return amount
    s = Base10toN(amount, 6)
    fs = f(amount - 6 ** (len(s) - 1))
    n = Base10toN(amount, 9)
    fn = f(amount - 9 ** (len(n) - 1))
    if (fs < fn):
        return fs + 1
    else:
        return fn + 1

print(f(N))

Fixed submission:
N= int(input())
memo = [-1] * 100001

def Base10toN(X, n):
    if (int(X / n)):
        return Base10toN(int(X / n), n) + str(X % n)
    else:
        return str(X % n)

def f(amount):
    if memo[amount] != -1:
        return memo[amount]
    if amount <= 5:
        memo[amount] = amount
        return amount
    s = Base10toN(amount, 6)
    fs = f(amount - 6 ** (len(s) - 1))
    n = Base10toN(amount, 9)
    fn = f(amount - 9 ** (len(n) - 1))
    if (fs < fn):
        memo[amount] = fs + 1
        return fs + 1
    else:
        memo[amount] = fn + 1
        return fn + 1

print(f(N))
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B, K = tuple(map(int, (input().split())))
mod = 998244353

def ab(n):
    ab = []
    a = n // A
    while (n - A * a) % B != 0:
        a -= 1
    b = (n - A * a) // B
    ab.append((a, b))
    while a > 0:
        a, b = a - B // gcd(A, B), b + A // gcd(A, B)
        if a < 0:
            break
        ab.append((a, b))
    return ab

def gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    return gcd(b, a - b * (a // b))

def mpow(x, n):
    ans = 1
    while n != 0:
        if n & 1:
            ans = ans * x % mod
        x = x * x % mod
        n = n >> 1
    return ans

factorial = [1 for i in range(N + 1)]
inverse = [1 for i in range(N + 1)]
for i in range(1, N + 1):
    factorial[i] = (factorial[i - 1] * i) % mod
    inverse[i] = mpow(factorial[i], mod - 2) % mod

com = [((factorial[N] * inverse[r] % mod) * inverse[N - r] % mod) for r in range(0, N + 1)]

ans = 0
for a, b in ab(K):
    if a > N or b > N:
        continue
    ans += com[a] * com[b]
print(ans % mod)

Fixed submission:
N, A, B, K = tuple(map(int, (input().split())))
mod = 998244353

factorial = [1 for i in range(N + 1)]
inverse = [1 for i in range(N + 1)]
for i in range(1, N + 1):
    factorial[i] = (factorial[i - 1] * i) % mod
    inverse[i] = inverse[i - 1] * pow(i, mod - 2, mod) % mod

com = [1 for i in range(N + 1)]
for i in range(1, N + 1):
    com[i] = (factorial[N] * inverse[i] % mod) * inverse[N - i] % mod

ans = 0
for x in range(N + 1):
    d = K - A * x
    if 0 <= d and d % B == 0:
        y = d // B
        if y <= N:
            ans += com[x] * com[y]
print(ans % mod)
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)

for i in range(len(X)):
    candi = Y[int(N/2)-1]
    if X[i] <= candi:
        print(Y[int(N/2)])
    else:
        print(Y[int(N/2)-1])

Fixed submission:
# coding: utf-8

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

if X >= A and X - A <= B:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int, input().split()))

for i in range(len(X)):
    Y = X[:i] + X[i+1:]
    Y.sort()
    print(Y[int(N/2)-1])

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)

for i in range(len(X)):
    candi = Y[int(N/2)-1]
    if X[i] <= candi:
        print(Y[int(N/2)])
    else:
        print(candi)
Buggy python submission (verdict: Runtime Error):
# coding:utf-8

def comb(n, r):
    n, r = max(n, r), min(n, r)
    nume = 1
    deno = 1
    for i in range(n-r+1, n+1):
        nume *= i
    for i in range(1, r+1):
        deno *= i
    return int(nume/deno)

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

MAX = 0
n = 0
r = 0
for ni in range(0, len(a)):
    for ri in range(ni + 1, len(a)):
        buf = comb(a[ni], a[ri])
        if buf > MAX:
            MAX = buf
            n = a[ni]
            r = a[ri]

print(n, r)

Fixed submission:
# coding:utf-8

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

MAX = 0
n = a.pop(0)
b = [abs(i - n / 2) for i in a]
r = a[b.index(min(b))]
print(n, r)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(_) for _ in input().split()]

ans = []
for _ in range(2, N-1):
    p = A[:_]
    q = A[_:]
    P = sum(p)
    Q = sum(q)
    p_sa = 10**15
    q_sa = 10**15
    for i in range(1,len(p)):
        s = sum(p[:i])
        sa = abs(P-s*2)
        if sa < p_sa:
            n = [s,P-s]
            p_sa = sa
    for i in range(1,len(q)):
        s = sum(q[:i])
        sa = abs(Q - s*2)
        if sa < q_sa:
            m = [s,Q-s]
            q_sa = sa
    ans.append(max(n+m)-min(n+m))
print(min(ans))

Fixed submission:
N = int(input())
A = [int(_) for _ in input().split()]
 
ans = []
t = []
c = 0
for i in range(N):
    c += A[i]
    t.append(c)
    
l = 0
r = 0

for _ in range(1, N-1):
    while t[_] > t[l]+t[l+1]:
        l += 1
    while t[-1]+t[_] > t[r]+t[r+1]:
        r += 1
    n = [t[l], t[_]-t[l], t[r]-t[_], t[-1]-t[r]]
    ans.append(max(n)-min(n))
print(min(ans))
Buggy python submission (verdict: Runtime Error):
K = int(input())
ans = [10**15]
c = 10**15-1
s = 10**15

for i in range(11,0,-1):
    c = 10**i - 1
    for j in range(999,99,-1):
        C = j * (10**i) + c
        S = C/sum(list(map(int, str(C))))
        if S <= s:
            ans.append(C)
            s = S
for i in range(1,10):
    ans += [i,i*10+9,i*100+99]
ans.sort()    
for i in range(K):
    print(ans[i])

Fixed submission:
K = int(input())
ans = [10**16]
c = 10**15-1
s = 10**15

for i in range(12,0,-1):
    c = 10**i - 1
    for j in range(999,99,-1):
        C = j * (10**i) + c
        S = C/sum(list(map(int, str(C))))
        if S <= s:
            ans.append(C)
            s = S
for i in range(1,10):
    ans += [i,i*10+9,i*100+99]
ans.sort()    
if K > len(ans):
    K = len(ans)
for i in range(K):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
input_line = int(input())

if input_line >= 1200
	print("ARC")
else
	print("ABC")

Fixed submission:
input_line = int(input())

if input_line >= 1200:
	print("ARC")
else:
	print("ABC")