Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())

a_list = list(map(int, input().split()))
a_list.sort()
b_list = list(map(int, input().split()))
b_list.sort()
c_list = list(map(int, input().split()))
c_list.sort()

a_index = a-x
b_index = b-y
for c_data in c_list:
    if a_index < a and a_list[a_index] < b_list[b_index]:
        if(a_list[a_index] < c_data):
            a_list[a_index] = c_data
            a_index += 1
    elif b_index < b:
        if(b_list[b_index] < c_data):
            b_list[b_index] = c_data
            b_index += 1
    else:
        break

count = 0
for i in range(a-1, a-x-1, -1):
    count += a_list[i]
for i in range(b-1, b-y-1, -1):
    count += b_list[i]
print(count)


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

a_list = list(map(int, input().split()))
a_list.sort(reverse=True)
b_list = list(map(int, input().split()))
b_list.sort(reverse=True)
c_list = list(map(int, input().split()))
c_list.sort(reverse=True)

a_index =0
b_index =0
c_index = 0
count = 0
for i in range(x+y):
    if (a_index < x) and \
        (b_index >= y or a_list[a_index] >= b_list[b_index]) and \
        (c_index >= c or a_list[a_index] >= c_list[c_index]):
        count += a_list[a_index]
        a_index += 1
    elif (b_index < y) and \
        (a_index >= x or b_list[b_index] >= a_list[a_index]) and \
        (c_index >= c or b_list[b_index] >= c_list[c_index]):
        count += b_list[b_index]
        b_index += 1
    elif (c_index < c) and \
        (a_index >= x or c_list[c_index] >= a_list[a_index]) and \
        (b_index >= y or c_list[c_index] >= b_list[b_index]):
        count += c_list[c_index]
        c_index += 1
    
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p_list = list(map(int, input().split(" ")))
count = 0
for i in range(n):
    for j in range(i+1):
        if p_list[i] > p_list[j]:
            break
    else:
        count += 1
print(count)


Fixed submission:
n = int(input())
p_list = list(map(int, input().split(" ")))
count = 0
minimum = 10000000
for i in p_list:
    if(i <= minimum):
        minimum = i
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
job_list = {}
for i in range(N):
	day, pay = map(int, input().split())
	if((day-1) in job_list):
		job_list[day-1].append(pay)
	else:
		job_list[day-1] = [pay]

now_date = 0
money = 0
now_job_list = []
sorted = False
for i in range(M):
	if(i in job_list):
		now_job_list.extend(job_list[i])
		sorted = False
	if(len(now_job_list) > 0):
		if(not sorted):
			now_job_list.sort()
			sorted = True
		money += now_job_list.pop()
print(money)


Fixed submission:
N, M = map(int, input().split())
job_list = {}
for i in range(N):
	day, pay = map(int, input().split())
	if((day-1) in job_list):
		job_list[day-1].append(pay)
	else:
		job_list[day-1] = [pay]

now_date = 0
money = 0
now_job_list = []
sorted = False
for i in range(M):
	if(i in job_list):
		now_job_list.extend(job_list[i])
		sorted = False
	if(len(now_job_list) > 0):
		if(not sorted):
			now_job_list.sort()
			sorted = True
		money += now_job_list.pop()
print(money)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

N, M = map(int, input().split())
job_list = []
for i in range(M):
    job_list.append([])
for i in range(N):
    day, pay = map(int, input().split())
    if(day - 1 < M):
        job_list[day-1].append(pay)

now_date = 0
money = 0
now_job_list = []
for i in range(M):
    now_job_list.extend(job_list[i])
    if(len(now_job_list) > 0):
        now_job_list.sort()
        money += now_job_list.pop()
print(money)


Fixed submission:
N, M = map(int, input().split())
job_list = {}
for i in range(N):
	day, pay = map(int, input().split())
	if((day-1) in job_list):
		job_list[day-1].append(pay)
	else:
		job_list[day-1] = [pay]

now_date = 0
money = 0
now_job_list = []
sorted = False
for i in range(M):
	if(i in job_list):
		now_job_list.extend(job_list[i])
		sorted = False
	if(len(now_job_list) > 0):
		if(not sorted):
			now_job_list.sort()
			sorted = True
		money += now_job_list.pop()
print(money)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
color_list = []
for i in range(N):
    a = int(input())
    for j in range(len(color_list)):
        if a > color_list[j]:
            color_list[j] = a
            break
    else:
        color_list.append(a)
print(len(color_list))


Fixed submission:
def reverse_bisect(a, x, lo=0, hi=None):
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if x > a[mid]: hi = mid
        else: lo = mid+1
    return lo

N = int(input())
color_list = []
color_len = 0
for i in range(N):
    a = int(input())
    index = reverse_bisect(color_list, a, 0, color_len)
    if(index == color_len):
        color_list.append(a)
        color_len += 1
    else:
        color_list[index] = a
print(color_len)
Buggy python submission (verdict: Runtime Error):
# 1.A_C間,B_D間に##となっているマスがないこと
# 2.D>CまたはDの周辺に#がないまたはB_D間に...があること
n, a, b, c, d = map(int, input().split())
s = " " + input()
Triple_floor = False
Triple_floor = False
before_stat = ""
floor_num = 0
counter = a+1
for char in s[a+1:]:
    if(counter > c and counter > d):
        # この先はどうでもいい.
        break
    if(char == "."):
        floor_num += 1
        if(floor_num >= 3 and counter > (b+1) and counter <= (d+1)):
            Triple_floor = True
    else:
        floor_num = 0
        if(before_stat == "#"):
            print("No")
            exit(1)
    before_stat = char
    counter += 1
if(c<d or Triple_floor):
    print("Yes")
else:
    print("No")

Fixed submission:
# 1.A_C間,B_D間に##となっているマスがないこと
# 2.D>CまたはDの周辺に#がないまたはB_D間に...があること
n, a, b, c, d = map(int, input().split())
s = " " + input()
Triple_floor = False
before_stat = ""
floor_num = 0
counter = a
for char in s[a:]:
    if(counter > max(c,d)):
        # この先はどうでもいい.
        break
    if(char == "."):
        floor_num += 1
        if(floor_num >= 3 and counter >= (b+1) and counter <= (d+1)):
            Triple_floor = True
    else:
        floor_num = 0
        if(before_stat == "#"):
            c=d
            Triple_floor = False
            break
    before_stat = char
    counter += 1
if(c<d or Triple_floor):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):

import math
a = int(input())
num_list = list(map(int, input().split()))
head_gcd_list = [num_list[0]]
tail_gcd_list = [num_list[-1]]
for i in range(a - 2):
    head_gcd_list.append(math.gcd(head_gcd_list[i], num_list[i+1]))
    tail_gcd_list.append(math.gcd(tail_gcd_list[(i*-1) - 1], num_list[(i*-1) - 2]))
max_gcd = max(head_gcd_list.pop(-1), tail_gcd_list.pop(-1))
for i,j in zip(head_gcd_list, reversed(tail_gcd_list)):
    current_gcd = math.gcd(i, j)
    if(current_gcd > max_gcd):
        max_gcd = current_gcd
print(max_gcd)

Fixed submission:

import fractions
a = int(input())
num_list = list(map(int, input().split()))
head_gcd_list = [0]
tail_gcd_list = [0]
for i in range(a - 1):
    head_gcd_list.append(fractions.gcd(head_gcd_list[i], num_list[i]))
    tail_gcd_list.append(fractions.gcd(tail_gcd_list[i], num_list[(i*-1) - 1]))
max_gcd = 0
for i,j in zip(head_gcd_list, reversed(tail_gcd_list)):
    current_gcd = fractions.gcd(i, j)
    if(current_gcd > max_gcd):
        max_gcd = current_gcd
print(max_gcd)

Buggy python submission (verdict: Runtime Error):

import math
input()
num_list = list(map(int, input().split()))
head_gcd_list = [num_list[0]]
tail_gcd_list = [num_list[-1]]
for i in range(len(num_list) - 1):
    head_gcd_list.append(math.gcd(head_gcd_list[i], num_list[i+1]))
    tail_gcd_list.append(math.gcd(tail_gcd_list[(i*-1) - 1], num_list[(i*-1) - 2]))
max_gcd = 0
for i,j in zip(head_gcd_list, reversed(tail_gdc_list)):
    current_gcd = math.gcd(i, j)
    if(current_gcd > max_gcd):
        max_gcd = current_gcd
print(max_gcd)

Fixed submission:

import fractions
a = int(input())
num_list = list(map(int, input().split()))
head_gcd_list = [0]
tail_gcd_list = [0]
for i in range(a - 1):
    head_gcd_list.append(fractions.gcd(head_gcd_list[i], num_list[i]))
    tail_gcd_list.append(fractions.gcd(tail_gcd_list[i], num_list[(i*-1) - 1]))
max_gcd = 0
for i,j in zip(head_gcd_list, reversed(tail_gcd_list)):
    current_gcd = fractions.gcd(i, j)
    if(current_gcd > max_gcd):
        max_gcd = current_gcd
print(max_gcd)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if(e - a >= k):
  print(":(")
  else:
    print("Yai!")

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if(e - a > k):
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
a, b  map(int, input().split())
if b // a == b / a:
  print(a+b)
else:
  print(a-b)

Fixed submission:
a, b = map(int, input().split())
if b // a == b / a:
  print(a+b)
else:
  print(b-a)
Buggy python submission (verdict: Runtime Error):
b, c = map(int, input().split())
print(B*C-B-C+1)

Fixed submission:
B, C = map(int, input().split())
print(B*C-B-C+1)
Buggy python submission (verdict: Runtime Error):
s = input()
if(s[0] == s[1]):
    if(s[1] == s[2]):
        print("Yes")
        return
if(s[1] == s[2]):
    if(s[2] == s[3]):
        print("Yes")
        return
print("No")


Fixed submission:
s = input()
if(s[0] == s[1]):
    if(s[1] == s[2]):
        print("Yes")
        exit()
if(s[1] == s[2]):
    if(s[2] == s[3]):
        print("Yes")
        exit()
print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int, input().split())
print(max((a!=b)+(b!=c)+(c!=a),1)

Fixed submission:
a,b,c=map(int, input().split())
print(max((a!=b)+(b!=c)+(c!=a),1))
Buggy python submission (verdict: Runtime Error):
print((int(input())+int(input())*int(input())//2)

Fixed submission:
print((int(input())+int(input()))*int(input())//2)

Buggy python submission (verdict: Runtime Error):
print((input()+input())*input()//2)

Fixed submission:
print((int(input())+int(input()))*int(input())//2)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]

E_p = []
for i in p:
    E_p.append((i + 1) / 2)

ans = 0
for i in range(N - K + 1):
    ans = max(ans, sum(E_p[i:i+K]))

print(ans)

Fixed submission:
N, K = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]

E_acc = [0]
for i in range(N):
    E_acc.append((p[i] + 1) / 2 + E_acc[i])

ans = 0
for i in range(N - K + 1):
    ans = max(ans, E_acc[i + K] - E_acc[i])

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(x) for x in input().split()]

ans = 1
for i in range(1, N):
    tmp = 1
    j = 0
    while j < i:
        if P[i] > P[j]:
            tmp = 0
            break
        j += 1
    ans += tmp
print(ans)

Fixed submission:
N = int(input())
P = [int(x) for x in input().split()]

ans = 1
P_min = P[0]
for i in range(1, N):
    if P[i] < P_min:
        ans += 1
    P_min = min(P_min, P[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(x) for x in input().split()]

ans = 1
for i in range(1, N):
    tmp = 1
    j = 0
    while j < i:
        if P[i] > P[j]:
            tmp = 0
            break
        j += 1
    ans += tmp
print(ans)

Fixed submission:
N = int(input())
P = [int(x) for x in input().split()]

ans = 1
P_min = P[0]
for i in range(1, N):
    if P[i] < P_min:
        ans += 1
    P_min = min(P_min, P[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = [int(x) for x in input().split()]
p = []; S = []
for _ in range(M):
    p_tmp, S_tmp = input().split()
    p.append(int(p_tmp))
    S.append(str(S_tmp))

AC = [0] * N
WA = [0] * M
for i in range(M):
    if AC[p[i] - 1] == 1:
        continue
    if S[i] == 'AC':
        AC[p[i] - 1] = 1
    else:
        WA[p[i] - 1] += 1
AC_count = sum(AC)
WA_count = sum(WA)
print(AC_count, WA_count)

Fixed submission:
N, M = [int(x) for x in input().split()]
p = []; S = []
for _ in range(M):
    p_tmp, S_tmp = input().split()
    p.append(int(p_tmp))
    S.append(str(S_tmp))

AC = [0] * N
WA = [0] * N
for i in range(M):
    if AC[p[i] - 1] == 1:
        continue
    if S[i] == 'AC':
        AC[p[i] - 1] = 1
    else:
        WA[p[i] - 1] += 1
for i in range(N):
    if AC[i] == 0:
        WA[i] = 0
AC_count = sum(AC)
WA_count = sum(WA)
print(AC_count, WA_count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [int(x) for x in input().split()]

import bisect
L = sorted(L)
ans = 0
for i in range(1, N - 1):
    for j in reversed(range(i + 1, N)):
        k = bisect.bisect_right(L[0:i], L[j] - L[i])
        ans += i - k
print(ans)

Fixed submission:
N = int(input())
L = [int(x) for x in input().split()]

import bisect
L = sorted(L)
ans = 0
for i in range(N - 2):
    for j in reversed(range(i + 1, N - 1)):
        k = bisect.bisect_left(L, L[i] + L[j], j)
        ans += k - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [int(x) for x in input().split()]

import bisect
L = sorted(L)
ans = 0
for i in range(N - 2):
    for j in reversed(range(i + 2, N)):
        k = bisect.bisect_right(L[i+1:j], L[j] - L[i]) + i + 1
        ans += j - k
print(ans)

Fixed submission:
N = int(input())
L = [int(x) for x in input().split()]

import bisect
L = sorted(L)
ans = 0
for i in range(N - 2):
    for j in reversed(range(i + 1, N - 1)):
        k = bisect.bisect_left(L, L[i] + L[j], j)
        ans += k - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [int(x) for x in input().split()]

L = sorted(L)
ans = 0
for i in range(N - 2):
    for j in range(i + 2, N):
        k = j - 1
        while L[k] > L[j] - L[i] and k > i:
            k -= 1
        ans += j - k - 1
print(ans)

Fixed submission:
N = int(input())
L = [int(x) for x in input().split()]

import bisect
L = sorted(L)
ans = 0
for i in range(N - 2):
    for j in reversed(range(i + 1, N - 1)):
        k = bisect.bisect_left(L, L[i] + L[j], j)
        ans += k - j - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = [int(x) for x in input().split()]

L = sorted(L)
ans = 0
for i in range(N - 2):
    for j in reversed(range(i + 2, N)):
        k = j - 1
        while L[k] > L[j] - L[i] and k > i:
            ans += 1
            k -= 1
print(ans)

Fixed submission:
N = int(input())
L = [int(x) for x in input().split()]

import bisect
L = sorted(L)
ans = 0
for i in range(N - 2):
    for j in reversed(range(i + 1, N - 1)):
        k = bisect.bisect_left(L, L[i] + L[j], j)
        ans += k - j - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
s = str(input())
k = int(input())

def func(s, k):
    ans = 0
    n = len(s)
    s_list = list(s)
    for i in range(n - 1):
        if s_list[i] == s_list[i + 1]:
            ans += 1
            s_list[i + 1] = str(i + 1)
    ans *= k
    if s_list[0] == s_list[n - 1]:
        ans += k - 1
    return ans

ans1 = func(s, k)
s_inv = ''.join(list(reversed(s)))
ans2 = func(s_inv, k)

if len(s) % 2 == 1:
    check = True
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            pass
        else:
            check = False
            break
if check:
    ans3 = len(s) * k // 2
else:
    ans3 = ans1

print(min(ans1, ans2, ans3))

Fixed submission:
s = str(input())
k = int(input())

def func(s, k):
    ans = 0
    n = len(s)
    s_list = list(s)
    for i in range(n - 1):
        if s_list[i] == s_list[i + 1]:
            ans += 1
            s_list[i + 1] = str(i + 1)
    ans *= k
    if s_list[0] == s_list[n - 1]:
        ans += k - 1
    return ans

ans1 = func(s, k)
s_inv = ''.join(list(reversed(s)))
ans2 = func(s_inv, k)

if len(s) % 2 == 1:
    check = True
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            pass
        else:
            check = False
            break
    if check:
        ans3 = len(s) * k // 2
    else:
        ans3 = ans1
else:
    ans3 = ans1

print(min(ans1, ans2, ans3))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]

for i in range(n):
    print(a.index(i + 1) + 1,end=' ')
print('\n')

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]

ans_list = [0 for i in range(n)]
for i in range(n):
    ans_list[a[i] - 1] = i + 1

for i in range(n):
    print(ans_list[i], end=' ')
print('\n')
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

def factorize(n):
    result = {}
    dev = 2
    while dev ** 2 <= n:
        cnt = 0
        while n % dev == 0:
            n //= dev
            cnt += 1
        result[dev] = cnt
        dev += 1
    if n > 1:
        if max(result) == n:
            result[n] += 1
        else:
            result[n] = 1
    return result

A, B = [int(x) for x in input().split()]
fct = factorize(gcd(A, B))
print(len(fct) + 1)

Fixed submission:
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

def factorize(n):
    a = 2
    lst = []
    while a * a <= n:
        if n % a == 0:
            n = n / a
            lst.append(a)
        else:
            a += 1
    if n > 1:
        lst.append(n)
    return lst

A, B = [int(x) for x in input().split()]
lst = factorize(gcd(A, B))
print(len(set(lst)) + 1)

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a > b:
        big = a
        small = b
    else:
        big = b
        small = a
    while True:
        remain = big % small
        if remain == 0:
            break
        big = small
        small = remain
    return small

def factorize(n):
    result = {}
    dev = 2
    while dev ** 2 <= n:
        cnt = 0
        while n % dev == 0:
            n //= dev
            cnt += 1
        result[dev] = cnt
        dev += 1
    if n > 1:
        if max(result) == n:
            result[n] += 1
        else:
            result[n] = 1
    return result

A, B = [int(x) for x in input().split()]
gcd_AB = gcd(A, B)
fct = factorize(gcd_AB)
print(len(fct) + 1)

Fixed submission:
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

def factorize(n):
    a = 2
    lst = []
    while a * a <= n:
        if n % a == 0:
            n = n / a
            lst.append(a)
        else:
            a += 1
    if n > 1:
        lst.append(n)
    return lst

A, B = [int(x) for x in input().split()]
lst = factorize(gcd(A, B))
print(len(set(lst)) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

s_srt = []
for i in range(n):
    s_srt.append(sorted(s[i]))
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        if s_srt[i] == s_srt[j]:
            ans += 1
print(ans)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(str(input()))

s_srt = []
for i in range(n):
    s_srt.append(''.join(sorted(s[i])))
s_srt.sort()

tmp = [0,]
k = 0
next = False
for i in range(n - 1):
    if s_srt[i] == s_srt[i + 1]:
        tmp[k] += 1
        next = True
    else:
        if next:
            tmp.append(0)
            k += 1
if tmp[-1] == 0:
    tmp.remove(0)

ans = 0
m = len(tmp)
if m != 0:
    for i in range(m):
        ans += int((tmp[i] + 1) * tmp[i] / 2)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]

AB_dict = {}
for i in range(M):
    AB_dict[i + 1] = []
for i in range(N):
    if AB[i][0] > M:
        continue
    AB_dict[AB[i][0]].append(AB[i][1])

Job = []
ans = 0
for i in range(M):
    Job = Job + AB_dict[i + 1]
    if len(Job) != 0:
        ans += max(Job)
        Job.remove(max(Job))

print(ans)

Fixed submission:
N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]

import heapq
AB_dict = {}
for i in range(M):
    AB_dict[i + 1] = []
for i in range(N):
    if AB[i][0] > M:
        continue
    AB_dict[AB[i][0]].append(-AB[i][1])

Job = []
ans = 0
for i in range(M):
    for j in range(len(AB_dict[i + 1])):
        heapq.heappush(Job, AB_dict[i + 1][j])
    if len(Job) != 0:
        ans -= heapq.heappop(Job)
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())

n = len(S)
dp = [[0 for x in range(13)] for _ in range(n + 1)]
dp[0][0] = 1

for i in range(n):
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])
    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki]
    for j in range(13):
        dp[i + 1][j] %= 10**9 + 7

print(dp[n][5])

Fixed submission:
S = str(input())

ans = [0] * 13
ans[0] = 1
MOD = 10**9 + 7

for i in S:
    dp = [0] * 13
    for j in range(13):
        dp[(j * 10) % 13] = ans[j] % MOD
    dp += dp
    if i == '?':
        for j in range(13):
            ans[j] = sum(dp[j+4:j+14])
    else:
        for j in range(13):
            ans[j] = dp[j + 13 - int(i)]

print(ans[5] % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [[int(input())] for _ in range(n)]
for i in range(n):
    tmp = a[:]
    del tmp[i]
    print(max(tmp)[0])

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

tmp = a[:]
max1_val = max(tmp)
max1_idx = tmp.index(max1_val)
del tmp[max1_idx]
max2_val = max(tmp)

for i in range(n):
    if i != max1_idx:
        print(max1_val)
    else:
        print(max2_val)
Buggy python submission (verdict: Runtime Error):
l, r = [int(x) for x in input().split()]

l_mod = l % 2019
r_mod = l_mod + (r - l + 1) % 2019 - 1

for i in range(l_mod, r_mod):
    for j in range(i + 1, r_mod + 1):
        tmp = (i * j) % 2019
        if (i = l_mod and j = i + 1) or tmp < ans:
            ans = tmp

print(ans)

Fixed submission:
l, r = [int(x) for x in input().split()]

l_mod = l % 2019
if r - l >= 2019:
    r_mod = l_mod + (r - l - 2019) % 2019 + 2019
else:
    r_mod = l_mod + (r - l) % 2019

ans = 2019
for i in range(l_mod, r_mod):
    for j in range(i + 1, r_mod + 1):
        tmp = (i * j) % 2019
        if tmp < ans:
            ans = tmp

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
l, r = [int(x) for x in input().split()]

l_mod = l % 2019
r_mod = r - (l - l_mod)
if l_mod >= r_mod:
    r_mod += 2019

ans = 2019
for i in range(l_mod, r_mod):
    for j in range(i + 1, r_mod + 1):
        tmp = (i * j) % 2019
        if tmp < ans:
            ans = tmp

print(ans)

Fixed submission:
l, r = [int(x) for x in input().split()]

l_mod = l % 2019
if r - l >= 2019:
    r_mod = l_mod + (r - l - 2019) % 2019 + 2019
else:
    r_mod = l_mod + (r - l) % 2019

ans = 2019
for i in range(l_mod, r_mod):
    for j in range(i + 1, r_mod + 1):
        tmp = (i * j) % 2019
        if tmp < ans:
            ans = tmp

print(ans)
Buggy python submission (verdict: Runtime Error):
num_list = []
while True:
    element = input()
    if element is None:
        break

    if element == '':
        break

    num_list.append(int(element))

limit = num_list[-1]

ans_string = "Yay!"
# for i in range(len(num_list) - 1):
#     print(num_list[i + 1] - num_list[i])
#     if num_list[i + 1] - num_list[i] > limit:
#         ans_string = ":("

for i in range(len(num_list) - 1):
    for j in range(i, len(num_list) - 1):
        if num_list[j] - num_list[i] > limit:
            ans_string = ":("

print(ans_string)


Fixed submission:
num_list = []
while True:
    try:
        element = input()
    except EOFError:
        break

    num_list.append(int(element))

limit = num_list[-1]

ans_string = "Yay!"
# for i in range(len(num_list) - 1):
#     print(num_list[i + 1] - num_list[i])
#     if num_list[i + 1] - num_list[i] > limit:
#         ans_string = ":("

for i in range(len(num_list) - 1):
    for j in range(i, len(num_list) - 1):
        if num_list[j] - num_list[i] > limit:
            ans_string = ":("

print(ans_string)