Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b, m = map(int, input().split())
a_price = list(map(int, input().split()))
b_price = list(map(int, input().split()))
coupon = []
for _ in range(m):
  coupon.append(list(map(int, input().split())))
  
a_copy = a_price.copy()
a_copy.sort()
b_copy = b_price.copy()
b_copy.sort()
a_min = a_copy[0]
b_min = b_copy[0]
min = a_min + b_min
totals = [min]
for list in coupon:
  tmp = a_list[list[0]-1] + b_list[list[1]-1] - list[2]
  totals.append(tmp)

totals.sort()
ans = totals[0]

print(ans)


Fixed submission:
a, b, m = map(int, input().split())
a_price = list(map(int, input().split()))
b_price = list(map(int, input().split()))
coupon = []
for _ in range(m):
    coupon.append(list(map(int, input().split())))

a_copy = a_price.copy()
a_copy.sort()
b_copy = b_price.copy()
b_copy.sort()
a_min = a_copy[0]
b_min = b_copy[0]
min = a_min + b_min
totals = [min]
for list in coupon:
    tmp = a_price[list[0] - 1] + b_price[list[1] - 1] - list[2]
    totals.append(tmp)

totals.sort()
ans = totals[0]

print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, m = map(int, input().split())
a_price = list(map(int, input().split()))
b_price = list(map(int, input().split()))
coupon = []
for _ in range(m):
  coupon.append(list(map(int, input().split())))
  
a_copy = a_price.copy()
b_copy = b_price.copy()
a_min = a_copy.sort()[0]
b_min = b_copy.sort()[0]
min = a_min + b_min
totals = [min]
for list in coupon:
  tmp = a_list[list[0]-1] + b_list[list[1]-1] - list[2]
  totals.append(tmp)

totals.sort()
ans = totals[0]

print(ans)


Fixed submission:
a, b, m = map(int, input().split())
a_price = list(map(int, input().split()))
b_price = list(map(int, input().split()))
coupon = []
for _ in range(m):
    coupon.append(list(map(int, input().split())))

a_copy = a_price.copy()
a_copy.sort()
b_copy = b_price.copy()
b_copy.sort()
a_min = a_copy[0]
b_min = b_copy[0]
min = a_min + b_min
totals = [min]
for list in coupon:
    tmp = a_price[list[0] - 1] + b_price[list[1] - 1] - list[2]
    totals.append(tmp)

totals.sort()
ans = totals[0]

print(ans)

Buggy python submission (verdict: Runtime Error):
a, b, m = map(int, input().split())
a_price = list(map(int, input().split()))
b_price = list(map(int, input().split()))
coupon = []
for _ in range(m):
  coupon.append(list(map(int, input().split())))
  
a_min = a_price.sort()[0]
b_min = b_price.sort()[0]
min = a_min + b_min
totals = [min]
for list in coupon:
  tmp = a_list[list[0]-1] + b_list[list[1]-1] - list[2]
  totals.append(tmp)

totals.sort()
ans = totals[0]

print(ans)

Fixed submission:
a, b, m = map(int, input().split())
a_price = list(map(int, input().split()))
b_price = list(map(int, input().split()))
coupon = []
for _ in range(m):
    coupon.append(list(map(int, input().split())))

a_copy = a_price.copy()
a_copy.sort()
b_copy = b_price.copy()
b_copy.sort()
a_min = a_copy[0]
b_min = b_copy[0]
min = a_min + b_min
totals = [min]
for list in coupon:
    tmp = a_price[list[0] - 1] + b_price[list[1] - 1] - list[2]
    totals.append(tmp)

totals.sort()
ans = totals[0]

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(inpur())

if n % 2 == 0:
  print(int(n/2))
else:
  print(int((n/2)+1))

Fixed submission:
n = int(input())
 
if n % 2 == 0:
  print(int(n/2))
else:
  print(int((n/2)+1))
Buggy python submission (verdict: Runtime Error):
n = int(inpout())
numbers = map(int, input().split())

even_numbers = []
for i in numbers:
  if i % 2 == 0:
    even_numbers.append(i)

answers = []
for i in even_numbers:
  if i % 3 == 0 or i % 5 == 0:
    answers.append(i)

if even_numbers == answers:
  print('APPROVED')
else:
  print('DENIED')

Fixed submission:
n = int(input())
numbers = map(int, input().split())

even_numbers = []
for i in numbers:
  if i % 2 == 0:
    even_numbers.append(i)

answers = []
for i in even_numbers:
  if i % 3 == 0 or i % 5 == 0:
    answers.append(i)

if even_numbers == answers:
  print('APPROVED')
else:
  print('DENIED')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s, t = map(int, input().split())
 
answer_list = []
for i in range(n):
  answer_list.append(s[i])
  answer_list.append(t[i])

s = ''.join(answer_list)
print(s)

Fixed submission:
n = int(input())
s, t = input().split()
 
answer_list = []
for i in range(n):
  answer_list.append(s[i])
  answer_list.append(t[i])

joint = ''.join(answer_list)
print(joint)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s, t = map(int, input().split())

answer_list = []
for i in range(n):
  answer_list.append(s[i])
  answer_list.append(t[i])
  
print(answer_list.join())

Fixed submission:
n = int(input())
s, t = input().split()
 
answer_list = []
for i in range(n):
  answer_list.append(s[i])
  answer_list.append(t[i])

joint = ''.join(answer_list)
print(joint)
Buggy python submission (verdict: Runtime Error):
s = input()

dict = {
  'SUN':7
  'MON':6
  'TUE':5
  'WED':4
  'THU':3
  'FRI':2
  'SAT':1
}

print(dict[s])

Fixed submission:
s = input()

dict = {
    'SUN': 7,
    'MON': 6,
    'TUE': 5,
    'WED': 4,
    'THU': 3,
    'FRI': 2,
    'SAT': 1
}

print(dict[s])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num_list = list(map(int, input().split()))

copy = num_list.copy()
copy.sort()

ans_list = [0]*n
for i in range(len(copy)):
    ans_list[i] = str(num_list.index(copy[i]) + 1)

ans = ' '.join(ans_list)
print(ans)

Fixed submission:
n = int(input())
num_list = list(map(int, input().split()))

ans_list = [0]*n
for i, j in enumerate(num_list):
    ans_list[j-1] = str(i+1)

ans = ' '.join(ans_list)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num_list = list(map(int, input().split()))

copy = num_list.copy()
copy.sort()

ans_list = [0]*n
for i in range(len(copy)):
    ans_list[i] = str(num_list.index(copy[i]) + 1)

ans = ' '.join(ans_list)
print(ans)

Fixed submission:
n = int(input())
num_list = list(map(int, input().split()))

ans_list = [0]*n
for i, j in enumerate(num_list):
    ans_list[j-1] = str(i+1)

ans = ' '.join(ans_list)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num_list = list(map(int, input().split()))

ans_list = []
for r in range(1, n+1, 1):
    index = num_list.index(r)+1
    ans_list.append(str(index))

ans = ' '.join(ans_list)
print(ans)

Fixed submission:
n = int(input())
num_list = list(map(int, input().split()))

ans_list = [0]*n
for i, j in enumerate(num_list):
    ans_list[j-1] = str(i+1)

ans = ' '.join(ans_list)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
heights = list(map (int, input().split()))

cnt_list = []
for i in range(len(heights)):
  cnt = 0
  while True:
    j = i+1
    if heights[j] <= heights[i]:
      cnt += 1
    else:
      break
  cnt_list.append(cnt)

cnt_list.sort(reverse=True)
ans = cnt_list[0]

print(ans)

Fixed submission:
n = int(input())
heights = list(map(int, input().split()))

ans_list = [0]*n
for i in range(n):
  if i == 0:
    continue
  else:
    if heights[i] <= heights[i-1]:
      ans_list[i] = ans_list[i-1]+1
    else:
      ans_list[i] = 0
      
ans_list.sort()
ans = ans_list[-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))

copy = num_list.copy()
copy.sort()
maximum = copy[-1]

for i in range(n):
    if num_list[i] == maximum:
        tmp = num_list[:i]+num_list[i+1:]
        tmp.sort()
        print(tmp[-1])
    else:
        print(maximum)

Fixed submission:
n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))

copy =  num_list.copy()
copy.sort()
maximum = copy[-1]
second = copy[-2]

for i in num_list:
    if i == maximum:
        print(second)
    else:
        print(maximum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))

ans_list = []
for i in range(n):
    tmp = num_list.copy()
    tmp = tmp[:i] + tmp[i+1:]
    tmp.sort()
    maximum = tmp[-1]
    ans_list.append(maximum)

for j in ans_list:
    print(j)

Fixed submission:
n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))

copy =  num_list.copy()
copy.sort()
maximum = copy[-1]
second = copy[-2]

for i in num_list:
    if i == maximum:
        print(second)
    else:
        print(maximum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))

ans_list = []
for i in range(n):
    tmp = num_list.copy()
    tmp = tmp[:i] + tmp[i+1:]
    tmp.sort()
    maximum = tmp[-1]
    ans_list.append(maximum)

for j in ans_list:
    print(j)

Fixed submission:
n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))

copy =  num_list.copy()
copy.sort()
maximum = copy[-1]
second = copy[-2]

for i in num_list:
    if i == maximum:
        print(second)
    else:
        print(maximum)
Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())

taste_lists = []
for i in range(n):
  taste = l+i-1
  taste_lists.append(taste)

for i in taste_lists:
  if i<0:
    taste_lists[i] = abs(i)

taste_lists.sort()
taste_lists.pop(0)

ans = 0
for i in taste_lists:
  ans += i
  
print(ans)

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

taste_lists = list()
for i in range(n):
    taste = l+i
    taste_lists.append(taste)

eat = 0
if taste_lists[0] > 0 and taste_lists[-1] > 0:
    eat = taste_lists[0]
elif taste_lists[0] < 0 and taste_lists[-1] < 0:
    eat = taste_lists[-1]
else:
    eat = 0

taste_lists.remove(eat)
ans = 0
for i in taste_lists:
    ans += i

print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

num_list = [a, b, c, d, e]
last_digit = []
for i in num_list:
    d = str(i)
    digit = d[-1]
    digit = int(digit)
    last_digit.append(digit)

min = 10000
for j in last_digit:
    if j < min and j != 0:
        min = j
last_digit[last_digit.index(min)] = 0

for k in range(len(num_list)):
    if last_digit[k] != 0:
        num_list[k] += 10-last_digit[k]

ans = 0
for l in num_list:
    ans += l

print(ans)

Fixed submission:
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

num_list = [a, b, c, d, e]
factorial = list(itertools.permutations(num_list, 5))
ans_list = []
for list in factorial:
    tmp = 0
    for i in list:
        if tmp%10 == 0:
            tmp += i
        else:
            tmp += 10 - tmp%10
            tmp += i
    ans_list.append(tmp)

ans_list.sort()
ans = ans_list[0]

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

min = a
if b < min:
  min = b

ans_lists = []
for i in range(1, min+1, 1):
  if a%i == 0 and b%i == 0:
    ans_lists.append(i)

ans_lists.reverse()
ans = lists[k-1]

print(ans)

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

min = a
if b < min:
  min = b

ans_lists = []
for i in range(1, min+1, 1):
  if a%i == 0 and b%i == 0:
    ans_lists.append(i)

ans_lists.reverse()
ans = ans_lists[k-1]

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lists = list(map(int, input().split()))

lists.sorted()
print(lists[-1] - lists[0])

Fixed submission:
import numpy as np

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

arr = np.array(lists)
maximum = arr.max()
minimum = arr.min()
print(maximum - minimum)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

num_list = [i for i in range(a, b+1, 1)]
copy = num_list.copy()
copy.sort(reverse=True)
ans_list = []
for j in num_list:
    if num_list.index(j) <= k-1 or copy.index(j) <= k-1:
        ans_list.append(j)

for k in ans_list:
    print(k)

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

num_limit = b-a+1
if num_limit <= k*2:
    ans_list = [i for i in range(a, b+1, 1)]
else:
    ans_list = []
    for j in range(k):
        low = a+j
        high = b-j
        ans_list.append(low)
        ans_list.append(high)
    ans_list.sort()

for l in ans_list:
    print(l)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lists = list(map(int, input().split()))

sets = set(lists)
ans = len(sets)

print(ans)

Fixed submission:
n = int(input())
lists = input().split()

sets = set(lists)
if len(sets) == 3:
    ans = 'Three'
else:
    ans = 'Four'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x, y = map(int, input().split())

if x%y == 0:
    ans = -1
else:
    ans = 0
    cnt = 2
    while True:
        if (x*cnt)%y != 0:
            ans = x*cnt
            break

print(ans)

Fixed submission:
x, y = map(int, input().split())

if x%y == 0:
    ans = -1
else:
    ans = 0
    cnt = 2
    while True:
        if (x*cnt)%y != 0:
            ans = x*cnt
            break
        else:
            cnt += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n, y = map(int, input().split())

total = 0
ans = list()
for a in range(0, n+1, 1):
  for b in range(0, n+1, 1):
    if a + b <= n:
      c = n - (a+b)
      total = a*10000 + b*5000 + c*1000
      if total == y:
        lists = [a,b,c]
        ans.append(lists)
    else:
      break

if ans == False:
  answer = ['-1', '-1', '-1']
  answer = ' '.join(answer)
else:
  answer = [str(i) for i in ans[0]]
  answer = ' '.join(answer)

print(answer)

Fixed submission:
n, y = map(int, input().split())

total = 0
ans = list()
for a in range(0, n+1, 1):
  for b in range(0, n+1, 1):
    if a + b <= n:
      c = n - (a+b)
      total = a*10000 + b*5000 + c*1000
      if total == y:
        lists = [a,b,c]
        ans.append(lists)
    else:
      break

if ans == []:
  answer = ['-1', '-1', '-1']
  answer = ' '.join(answer)
else:
  answer = [str(i) for i in ans[0]]
  answer = ' '.join(answer)

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

print(mean(a, b).roundup())

Fixed submission:
import math

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

if a < b:
  ans = 'Bob'
elif a == b:
  ans = 'Draw'
else:
  a > b:
    ans = 'Alice'
print(ans)

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

if a == 1:
  a += 13
if b == 1:
  b += 13

if a < b:
  ans = 'Bob'
elif a == b:
  ans = 'Draw'
else:
  ans = 'Alice'
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()

if s == 'a' or s == 'i' or s == 'u' or s == 'e' or s == 'o':
  ans = 'vowel'
else:
  ans = 'consonant"

print(ans)

Fixed submission:
s = input()

if s == 'a' or s == 'i' or s == 'u' or s == 'e' or s == 'o':
  ans = 'vowel'
else:
  ans = 'consonant'

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

num_lists = [a, b, c]
maximum = a
if a == b or a == c or b == c:
  ans = 'No'
else:
  if maximum < b:
    maximum = b
  if maximum < c:
    maximum = c

num_lists.remove(maximum)
if num_lists[0] + num_lists[1] == maximum:
  ans ='Yes'

print(ans)

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

num_lists = [a, b, c]
maximum = a
if maximum < b: maximum = b
if maximum < c: maximum = c

max_index = num_lists.index(maximum)
num_lists.pop(max_index)

remainder = num_lists[0] + num_lists[1]
if maximum == remainder:
  ans = 'Yes'
else:
  ans = 'No'
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

ans = n(1+n)/2
print(ans)

Fixed submission:
n = int(input())

ans = int(n * (1 + n) / 2)
print(ans)
Buggy python submission (verdict: Runtime Error):
x,k,d = map(int, input().split())

walk = min(k,x//d)
k -= walk

x = abs(x)

if x > 0:
    x -= walk*d

    if abs(x - d) < x and k > 0:
        k -= 1
        x -= d

    if k % 2 == 0:
        ans = abs(x)
    else:
        ans = min(abs(x-d),abs(x+d))

print(ans)

Fixed submission:
x,k,d = map(int, input().split())
x = abs(x)

walk = min(k,x//d)
k -= walk
x -= walk*d

if k%2 == 0:
    print(x)
else:
    print(d-x)
Buggy python submission (verdict: Runtime Error):
n = int(input())

name = []

while n > 0:
    n -= 1
    name.append(alp[n % 26])
    n //= 26

name.reverse()

print(*name,sep='')

Fixed submission:
n = int(input())

alp = 'abcdefghijklmnopqrstuvwxyz'

name = []

while n > 0:
    n -= 1
    name.append(alp[n % 26])
    n //= 26

name.reverse()

print(*name,sep='')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a_l = list(map(int, input().split()))

i = 0
score = 1
b_score = None
while i < n:
    score *= a_l[i]
    if i > k-1:
        score = int(score/a_l[i-k])
    if b_score is not None:
        if score > b_score:
            print('Yes')
        else:
            print('No')
    if i >= k-1:
        b_score = score
    i+=1

Fixed submission:
n, k = map(int, input().split())
a_l = list(map(int, input().split()))
i = 0
while i < n:
    if i >= k:
        if a_l[i] > a_l[i-k]:
            print('Yes')
        else:
            print('No')
    i+=1

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a_l = list(map(int, input().split()))

i = 0
test = []
b = None
while i < n:
    test.append(a_l[i])
    if len(test) > k:
        test = test[len(test)-k:]
    if len(test) == k:
        p = 1
        for m in test:
            p *= m
        if b is not None:
            if p > b:
                print('Yes')
            else:
                print('No')
        b = p
    i+=1

Fixed submission:
n, k = map(int, input().split())
a_l = list(map(int, input().split()))
i = 0
while i < n:
    if i >= k:
        if a_l[i] > a_l[i-k]:
            print('Yes')
        else:
            print('No')
    i+=1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in a:
    ans *= i
if ans > 10**18:
    print('-1')
else:
    print(int(ans))

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

if 0 in a:
    ans = 0
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
a = int(a)
import math
b = math.floor(b*100)
ans = int(a*b/100)
print(ans)

Fixed submission:
from decimal import Decimal
a,b=input().split()
print(int(Decimal(a)*Decimal(b)))

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

Fixed submission:
from decimal import Decimal
a,b=input().split()
print(int(Decimal(a)*Decimal(b)))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
h = list(map(int, input().split()))
p = [ list(map(int, input().split())) for _ in range(m) ]


d = [[ 0 for j in range(n)   ] for i in range(n) ]

for i in p:
    d[i[0]-1][i[1]-1] = h[i[1]-1]
    d[i[1]-1][i[0]-1] = h[i[0]-1]
c = [ 1 for i,v in enumerate(d) if max(v) < h[i] ]
print(sum(c))

Fixed submission:
n, m = map(int, input().split())
h = list(map(int, input().split()))
p = [ set(map(int, input().split())) for _ in range(m) ]
d = [ 0 ] * n
for i,j in p:
    d[i-1] = max(d[i-1], h[j-1])
    d[j-1] = max(d[j-1], h[i-1])
c = [ 0 for i in range(n) if d[i] < h[i] ]
print(len(c))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

Fixed submission:
print(int(input()) * 2 * 3.141)
Buggy python submission (verdict: Runtime Error):
 = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

Fixed submission:
N = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a_list = list(map(int, input().split()))
for i in range(1,N+1):
    print(a_list.count(i))

Fixed submission:
N = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0
Buggy python submission (verdict: Runtime Error):
a_l = [ int(input()) for _ in range(n)]

l = []
r = []
l_max = 0
r_max = 0
for i in range(n):
    l_max = max(l_max, a_l[i])
    r_max = max(r_max, a_l[-i-1])
    l.append(l_max)
    r.append(r_max)
for i in range(n):
    if i == 0:
        t_l = 0
    else:
        t_l = l[i-1]
    if i == n-1:
        t_r = 0
    else:
        t_r = r[-i-2]
    print(max([t_l,t_r]))

Fixed submission:
n = int(input())
a_l = [ int(input()) for _ in range(n)]

l = []
r = []
l_max = 0
r_max = 0
for i in range(n):
    l_max = max(l_max, a_l[i])
    r_max = max(r_max, a_l[-i-1])
    l.append(l_max)
    r.append(r_max)
for i in range(n):
    if i == 0:
        t_l = 0
    else:
        t_l = l[i-1]
    if i == n-1:
        t_r = 0
    else:
        t_r = r[-i-2]
    print(max([t_l,t_r]))

Buggy python submission (verdict: Runtime Error):
a_l = [ int(input()) for _ in range(n)]


l = []
r = []
l_max = 0
r_max = 0
for i in range(n):
    l_max = max(l_max, a_l[i])
    r_max = max(r_max, a_l[-i-1])
    l.append(l_max)
    r.append(r_max)
for i in range(n):
    if i == 0:
        t_l = 0
    else:
        t_l = l[i-1]
    if i == n-1:
        t_r = 0
    else:
        t_r = r[-i-2]
    print(max([t_l,t_r]))

Fixed submission:
n = int(input())
a_l = [ int(input()) for _ in range(n)]

l = []
r = []
l_max = 0
r_max = 0
for i in range(n):
    l_max = max(l_max, a_l[i])
    r_max = max(r_max, a_l[-i-1])
    l.append(l_max)
    r.append(r_max)
for i in range(n):
    if i == 0:
        t_l = 0
    else:
        t_l = l[i-1]
    if i == n-1:
        t_r = 0
    else:
        t_r = r[-i-2]
    print(max([t_l,t_r]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_l = [ int(input()) for _ in range(n)]

for i in range(n):
    if i == 0:
        l = 0
    else:
        l = max(a_l[:i])

    if i == n-1:
        r = 0
    else:
        r = max(a_l[i+1:])
    print(max([l,r]))

Fixed submission:
n = int(input())
a_l = [ int(input()) for _ in range(n)]

l = []
r = []
l_max = 0
r_max = 0
for i in range(n):
    l_max = max(l_max, a_l[i])
    r_max = max(r_max, a_l[-i-1])
    l.append(l_max)
    r.append(r_max)
for i in range(n):
    if i == 0:
        t_l = 0
    else:
        t_l = l[i-1]
    if i == n-1:
        t_r = 0
    else:
        t_r = r[-i-2]
    print(max([t_l,t_r]))