TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
# -*- coding: utf-8 -*-

a = int(input())

for i in range(a):
  nums[i] = int(input())

for j in range(a):
  thisnums = nums
  thisnums[j] = 0
  print(max(thisnums))

# -*- coding: utf-8 -*-

import copy

a = int(input())
nums = [0]*a

for i in range(a):
    nums[i] = int(input())
    
maxnum = max(nums)
maxenum = [i for i, x in enumerate(nums) if x == maxnum]
maxquant = len(maxenum)


if maxquant != 1:
    for j in range(a):
        print(maxnum)
else:
    for j in range(a):
        if nums[j] != maxnum:
            print(maxnum)
        else:
            copylist = copy.deepcopy(nums)
            copylist[maxenum[0]] = 0
            print(max(copylist))

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
numList  = [input() for i in range(n)]
maxVal = max(numList)
workList = numList[:]
secondVal = max(workList.remove(maxVal))
for num in numList:
  if num != maxVal:
    print(maxVal)
  else
    print(secondVal)

import sys
input = sys.stdin.readline
 
def main():
  n = int(input())
  numList  = [int(input()) for _ in range(n)]
  maxVal = max(numList)
  workList = numList[:]
  workList.remove(maxVal)
  secondVal = max(workList)
  for num in numList:
    if num != maxVal:
      print(maxVal)
    else:
      print(secondVal)
      
if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = list(int(input()) for k in range(N))

mx, mxn = sorted(A, reverse=True)[:2]

result = [mxn if x==mn else mx for x in A]
print('\n'.join(map(str, result)))

N = int(input())
A = list(int(input()) for k in range(N))

mx, mxn = sorted(A, reverse=True)[:2]

result = [mxn if x==mx else mx for x in A]
print('\n'.join(map(str, result)))

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(N)]

a = np.array(list(itertools.accumulate(A, max)))
b = list(itertools.accumulate(A[::-1], max))[::-1]

for i in range(len(A)):
    r = 0
    if len(a[:i]) > 0:
        r = max(r, *a[:i])
    if len(b[i + 1:]) > 0:
        r = max(r, *b[i + 1:])
    print(r)


import itertools
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(N)]

a = list(itertools.accumulate(A, max))
b = list(itertools.accumulate(A[::-1], max))[::-1]

for i in range(len(A)):
    r = 0
    if 0 <= i - 1 < N:
        r = max(r, a[i - 1])
    if 0 <= i + 1 < N:
        r = max(r, b[i + 1])
    print(r)


Verdicts: Time Limit Exceeded

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):

import math




def main():
    n = int(input())
    lista = []
    for i in range(0, n):
        lista.append(int(input()))
    print(lista)
    maxim1 = -999999
    maxim2 = -9999999
    for element in lista:
        if element > maxim1:
            maxim2 = maxim1
            maxim1 = element
        elif element < maxim1 and element > maxim2:
            maxim2 = element
    
    for element in lista:
        if element == maxim1:
            print(maxim1)
        else:
            print(maxim2)



if __name__ == "__main__":
    main()


import math




def main():
    n = int(input())
    lista = []
    for i in range(0, n):
        lista.append(int(input()))
    print(lista)
    maxim1 = -999999
    maxim2 = -9999999
    for element in lista:
        if element > maxim1:
            maxim2 = maxim1
            maxim1 = element
        elif element < maxim1 and element > maxim2:
            maxim2 = element
    
    for element in lista:
        if element == maxim1:
            print(maxim2)
        else:
            print(maxim1)



if __name__ == "__main__":
    main()


import math




def main():
    n = int(input())
    lista = []
    for i in range(0, n):
        lista.append(int(input()))
    maxim1 = -999999
    maxim2 = -9999999
    for element in lista:
        if element > maxim1:
            maxim2 = maxim1
            maxim1 = element
        elif element <= maxim1 and element > maxim2:
            maxim2 = element
    
    for element in lista:
        if element == maxim1:
            print(maxim2)
        else:
            print(maxim1)



if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
A = [int(input()) for _ in range(n)]
B = sorted(A)
B_M = max(B)
B_M_1 = max(B[:n-1])
for i in range(n):
    if B[i] == B_M:
       print(B_M_1)
    else:
        print(B_M)

n = int(input())
A = [int(input()) for _ in range(n)]
B = sorted(A)
B_M = max(B)
B_M_1 = max(B[:n-1])
for i in range(n):
    if A[i] == B_M:
       print(B_M_1)
    else:
        print(B_M)

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
a = [int(input()) for i in range(N)]

for j in a:
    if j >= max(a):
        print(sorted(a)[-2])
    else:
        print(max(a))

n = int(input())
a = [int(input()) for i in range(n)]
b = a[:]
b.sort()

if b[n-1] == b[n-2]:
    for _ in range(n): 
        print(b[n-1])
else:
    for j in a:
        if j >= b[n-1]:
            print(b[n-2])
        else:
            print(b[n-1])

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N=int(input())
Numbers=sorted([int(input()) for i in range(N)])
Amax=Numbers[-1]
Asecond=Numbers[-2]
for j in Numbers:
        if j != Amax:
                print(Amax)
        else:
                print(Asecond)

N=int(input())
Numbers=[int(input()) for i in range(N)]
Numbers2=sorted(Numbers)
Amax=Numbers2[-1]
Asecond=Numbers2[-2]
for j in Numbers:
        if j != Amax:
                print(Amax)
        else:
                print(Asecond)

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n=int(input())
a=[int(input()) for _ in range(n)]

m1=max(a)
m2=max(a[a.index(max(a)):]+a[:a.index(max(a))+1])
for i in range(n):
    if a[i]==m1:
        print(m2)
    else:
        print(m1)


n=int(input())
a=[int(input()) for _ in range(n)]

a_s=sorted(a)
m1=a_s[-1]
m2=a_s[-2]

for i in range(n):
    if a[i]==m1:
        print(m2)
    else:
        print(m1)


Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
import numpy as np

N=int(input())

X=[]
for x in range(N):
    X.append(int(input()))

Y=[]
Y=np.sort(X)[::-1]

for i in range(N):
    ans=s[0]
    if ans==X[i]:
        ans=s[1]
    print(ans)


import numpy as np

N=int(input())

X=[]
for x in range(N):
    X.append(int(input()))

Y=[]
Y=np.sort(X)[::-1]

for i in range(N):
    ans=Y[0]
    if ans==X[i]:
        ans=Y[1]
    print(ans)

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
hoge = input().split()
A = []
for i in range(N):
  A.append(hoge[i])

max_itr = [i for i, v in enumerate(A) if v == max(A)]
max_number = max(A)
for i in range(N):
  if i not in max_itr:
    print(max_number)
  else:
    print(sorted(A)[-2])

import numpy as np
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))

npA = np.array(A)
max_number = max(A)
max_itr = np.where(npA == npA.max())
if len(max_itr[0]) == 1:
  for i in range(N):
    if i != max_itr[0][0]:
      print(max_number)
    else:
      print(sorted(A)[-2])
else:
  for i in range(N):
    print(max_number)

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
from collections import defaultdict
d = defaultdict(int)
n, *a = map(int,open(0))
for i in a:
  d[i] += 1
l = list(d.key())
l.sort()
m = l[-1]
if d[m] == 1:
  i = a.index(m)
  [print(m) for j in range(i)]
  print(l[-2])
  [print(m) for j in range(n-i-1)]
else:
  [print(m) for i in range(n)]

from collections import defaultdict
d = defaultdict(int)
n, *a = map(int,open(0))
for i in a:
  d[i] += 1
l = list(d.keys())
l.sort()
m = l[-1]
if d[m] == 1:
  i = a.index(m)
  [print(m) for j in range(i)]
  print(l[-2])
  [print(m) for j in range(n-i-1)]
else:
  [print(m) for i in range(n)]

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())

for i in range(n):
    a.append(int(input()))

for i in range(n):
    if i == 1:
        result = a[2:]
        print(max(result))
    elif i == n-1:
        result = a[:n-1]
        print(max(result))
    else:
        result = a[:i] + a[i+1:]
        print(max(result))


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

for i in range(n):
    if i == 1:
        print(max(a[2:]))
    elif i == n-1:
        print(max(a[:n-1]))
    else:
        print(max(a[i+1:],a[:i]))

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

for i in range(n-1):
    if i == 1:
        result = a[2:]
        print(max(result))
    elif i == n-1:
        result = a[:n-1]
        print(max(result))
    else:
        result = a[:i] + a[i+1:]
        print(max(result))

n = int(input())
a = [int(input()) for i in range(n)]
a_s = sorted(a, reverse=True)
hantei = a_s[:2]
del a_s
for i in range(n):
    if a[i] == hantei[0]:
        print(hantei[1])
    else:
        print(hantei[0])

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
an = []
max_1 = 1
max_2 = 1
count = 1
for i in range(n):
    a = int(input())
    if a > max_1:
        tmp = max_1
        max_1 = a
        count = 1
        max1_index = [i]
        max_2 = tmp
    elif a == max_1:
        count += 1
        max1_index.append(i)
    elif max_1 >  a > max_2:
        max_2 = a
    an.append(a)
    
if count == 1:
    for i in range(n):
        if i in max1_index:
            print(max_2)
        else:
            print(max_1)
else:
    for i in range(n):
        print(max_1)

n = int(input())
an = []
max_1 = 1
max_2 = 1
count = 1
for i in range(n):
    a = int(input())
    if a > max_1:
        max_1 = a
        count = 1
        max1_index = [i]
    elif a == max_1:
        count += 1
        max1_index.append(i)
    elif max_1 > a and a > max_2:
        max_2 = a
        max2_index = i
    an.append(a)
    
    
if count == 1:
    for i in range(n):
        if i in max1_index:
            print(max_2)
        else:
            print(max_1)
else:
    for i in range(n):
        print(max_1)

n = int(input())
an = []
max_1 = 1
max_2 = 1
count = 1
max1_index = [0]
for i in range(n):
    a = int(input())
    if a > max_1:
        tmp = max_1
        max_1 = a
        count = 1
        max1_index = [i]
        max_2 = tmp
    elif a == max_1:
        count += 1
        max1_index.append(i)
    elif max_1 >  a > max_2:
        max_2 = a
    an.append(a)
if count == 1:
    for i in range(n):
        if i in max1_index:
            print(max_2)
        else:
            print(max_1)
else:
    for i in range(n):
        print(max_1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n=int(input())
a=[int(input()) for i in range(n)]
t=list(enumerate(a))
t.sort(key=lambda x:x[1])
print(t)
mx=t[-1][1]
ans=[mx for i in a]
ans[t[-1][0]]=t[-2][1]
for k in ans:
    print(k)

n=int(input())
a=[int(input()) for i in range(n)]
t=list(enumerate(a))
t.sort(key=lambda x:x[1])

mx=t[-1][1]
ans=[mx for i in a]
ans[t[-1][0]]=t[-2][1]
print(ans)

n=int(input())
a=[int(input()) for i in range(n)]
t=list(enumerate(a))
t.sort(key=lambda x:x[1])
mx=t[-1][1]
ans=[mx for i in a]
ans[t[-1][0]]=t[-2][1]
for k in ans:
    print(k)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())


list = []
for i in range(n):
    list.append(int(input()))


new_list = sorted(list,reverse=True)
print(new_list)


for c in range(n):
    if new_list[0] == list[c]:
        print(new_list[1])
    else:
        print(new_list[0])

n = int(input())


list = []
for i in range(n):
    list.append(int(input()))


new_list = sorted(list,reverse=True)


for c in range(n):
    if new_list[0] == list[c]:
        print(new_list[1])
    else:
        print(new_list[0])


Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
nums = [input() for i in range(N)]

max_list = []

for i in range(0, N):
    f_nums = nums[:i-1]
    l_nums = nums[i+1:]
    f_nums.extend(l_nums)
    _max = max(f_nums)
    max_list.append(_max)

for x in max_list:
    print(x)
    




N = int(input())
nums = [int(input()) for i in range(N)]

_nums = sorted(nums, reverse=True)
max1 = _nums[0]
max2 = _nums[1]
for i in range(0, N):
    if nums[i] == max1:
        print(max2)
    else:
        print(max1)


Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
a = [int(input()) for i in range(n)]
maxi = max(a)
for i in range(n):
    if a[i] != maxi:
        print(maxi)
    else:
        b = a.pop(a[i])
        print(max(a))


n = int(input())
a = [int(input()) for i in range(n)]
maxi = max(a)
s = sorted(a,reverse=True)

for i in range(n):
    if a[i] != maxi:
        print(maxi)
    else:
        print(s[1])


Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
li = []
max1 = 0
max2 = 0
for i in range(N):
  s = int(input())
  li.append(s)
  
  if s > max1:
    max1 = s
    
  if max1 >= s > max2:
    max2 = s

for index, i in enumerate(li):
  if max1 == li[index]:
    print(max2)
  else:
    print(max1)

N = int(input())
li = []
for i in range(N):
  s = int(input())
  li.append(s)
  
new = sorted(li, reverse=True)

s = max(li)
for index, i in enumerate(li):
  if s == li[index]:
    print(new[1])
  else:
    print(new[0])

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
X = [0] * N
count = 0
max = 0
for i in range(N):
    for j in range(N):
        if j != i:
            if max < A[j]:
                max = A[j]
    X[i] = max
for i in range(N):
    print(X[i])

import math
import heapq
import copy
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
X = [0] * N
for i in range(N):
    B = copy.copy(A)
    del B[i]
    max = max(B)
    X[i] = max
    print(X[i])

import math
import copy
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())

X = [0] * N
for i in range(N):
    B = copy.copy(A)
    del B[i]
    max = max(B)
    X[i] = max
for i in range(N):
    print(X[i])


import math
import copy
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())

max_item = max(A)
count = 0
second_item = 0
for i in range(N):
    if A[i] == max_item:
        count += 1
    elif second_item < A[i]:
        second_item = A[i]
    if count > 1:
        break
X = [0] * N
judge = False
for i in range(N):
    if count > 1:
        judge = True
        break
    if A[i] == max_item:
        X[i] = second_item
    else:
        X[i] = max_item

if judge:
    for i in range(N):
        X[i] = max_item
for i in range(N):
    print(X[i])

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
import numpy as np
import math

N = int(input())

A = np.empty(N)
for i in range(N):
   A[i] = int(input())


max_a = np.max(A)
max_i = np.argmax(A)

for i in range(N):
   if(i == max_i):
      max_n0 = np.max(A[0:i-1])
      max_n1 = np.max(A[i+1,N-1])
      if(max_n0 > max_n1):
         print(max_n0)
      else:
         print(max_n1)
   else:
      print(max_a)


import numpy as np
import math

N = int(input())

A = np.empty(N)
for i in range(N):
   A[i] = int(input())


max_a = np.max(A)
max_i = np.argmax(A)

for i in range(N):

   if(i == max_i):
      max_n0 = np.max(A[0:i-1)
      max_n1 = np.max(A[i+1,N-1)
      if(max_n0 > max_n1):
         print(max_n0)
      else:
         print(max_n1)
   else:
      print(max_a)


import numpy as np
import math

N = int(input())

A = np.empty(N)
for i in range(N):
   A[i] = int(input())


max_a = np.max(A)
max_i = np.argmax(A)

for i in range(N):
   if(i == max_i):
      aa = np.sort(A)
      print(int(aa[-2]))
   else:
      print(int(max_a))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n=int(input())
a=[int(input()) for _ in range(n)]
new_a=sorted(a)
max=new_a[0]
max2=new_a[1]
for i in a:
    if(i==max):
        print(max2)
    else:
        print(max)


n=int(input())
a=list()
for i in range (n):
    a.append(int(input()))
new_a=sorted(a)
max=new_a[0]
max2=new_a[1]
for i in a:
    if(i==max):
        print(max2)
    else:
        print(max)


n=int(input())
a=list()
for i in range (n):
    a.append(int(input()))
new_a_reverse=sorted(a,reverse=True)
max=new_a_reverse[0]
max2=new_a_reverse[1]
for i in a:
    if(i==max):
        print(max2)
    else:
        print(max)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A,reverse=True)
if B[0] = B[1]:
    for i in range(N):
        print(B[0])
else:
    for i in range(N):
        if A[i] = B[0]:
            print(B[1])
        else:
            print(B[0])

N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A,reverse=True)
if B[0] == B[1]:
    for i in range(N):
        print(B[0])
else:
    for i in range(N):
        if A[i] == B[0]:
            print(B[1])
        else:
            print(B[0])

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
a = int(input()) 
b = [int(input()) for i in range(n)] 
for i in range(a):
  c=pop(b.i-1)
  print(max(c))

a = int(input()) 
b = [int(input()) for i in range(n)] 
for i in range(a):
  d=b[i-1]
  c=pop(b.i-1)
  print(max(c))
  b.insert(i-1.d)

a = int(input()) 
b = [int(input()) for i in range(n)] 
for i in range(a):
  d=b[i]
  b.pop(i)
  print(max(b))
  b.insert(i,d)

a = int(input()) 
b = [int(input()) for i in range(a)] 

m=max(b)
for i in range(a):
  if m>b[i]:
    print(m)
  else:
    print(b[i])

a = int(input()) 
b = [int(input()) for i in range(a)] 
 
m=max(b)
for i in range(a):
  if m>b[i]:
    print(m)
  else:
    d=b[i]
  	b.pop(i)
  	print(max(b))
  	b.insert(i,d)

a = int(input()) 
b = [int(input()) for i in range(a)] 
m=max(b)
for i in range(a):
  if m>=b[i]:
    print(max(b))
  else:
    print(b[i])

a = int(input()) 
b = [int(input()) for i in range(a)] 
 
m=max(b)
sorted(b)
s=sorted(b)[-2]
for i in range(a):
  if m>b[i]:
    print(m)
  else:
    print(s)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))
s=sorted(A)
for i in range(N):
  if A[i]!=s[0]:
    print(s[0])
  else:
    print(s[1])

N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))
s=sorted(A,reverse=True)
for i in range(N):
  if A[i]!=s[0]:
    print(s[0])
  else:
    print(s[1])

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n=int(input())
a = [input() for _ in range(n)]
b=a.copy()
b.sort()
bset=list(set(b))
c=[0]*(n)

for i in range(n):
	if a[i]==bset[-1]:
		c[i]=b[-1]
	else:
		c[i]=b[-2]
for i in range(n):
	print(c[i])

n=int(input())
a = [int(input()) for _ in range(n)]
b=sorted(a)
c=[0]*n

for i in range(n):
	if a[i]==b[-1]:
		c[i]=b[-2]
	else:
		c[i]=b[-1]
for i in range(n):
	print(c[i])

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n=int(input())
a=[]
for i in range(n):
  b=int(input())
  a.append(b)
s=a.copy()
for i in range(n):
  if s[i]==max(s):
    print(s[i])
  else:
    del s[i]
    print(max(s))

n=int(input())
a=[]
for i in range(n):
  b=int(input())
  a.append(b)
s=a.copy()
a=sorted(a,reverse=True)

if a[0]==a[1]:
  for i in range(n):
    print(a[0])
  exit()
for i in range(n):
  if s[i]==a[0]:
    print(a[1])
  else:
    print(a[0])

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input()) 
s = []
s = [input() for i in range(N)] 

max_num = max(s)
max_ind = s.index(mux_num)
s.remove(max_num)
max2_num = max(s)
 
for i in range(N):
    if i == max_ind:
        print(max2_num)
    else:
        print(max_num)

N = int(input()) 
s = []
s = [int(input()) for i in range(N)] 

max_num = max(s)
max_ind = s.index(max_num)
s.remove(max_num)
max2_num = max(s)
 
for i in range(N):
    if i == max_ind:
        print(max2_num)
    else:
        print(max_num)

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N=int(input())
L=[]
for i in range(N):
    L.append(int(input()))

L_max=max(L)

L_max_count=0
for l in L:
    if l==L_max:
        L_max_count+=1
    if L_max_count > 1:
        break

for i in range(N):
    now=L[i]
    
    if L_max_count > 1:
        ans=L_max
    
    elif now!=L_max:
        ans=L_max
        
    else:
        L_temp=L.copy()
        L_temp_p=L_temp.pop(i)
        ans=max(L_temp)
    
    print(ans)
    
    print(ans)

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

L_max=max(L)

L_max_count=0
for l in L:
    if l==L_max:
        L_max_count+=1
    if L_max_count > 1:
        break

for i in range(N):
    now=L[i]
    
    if L_max_count > 1:
        ans=L_max
    
    elif now!=L_max:
        ans=L_max
        
    else:
        L_temp=L.copy()
        L_temp_p=L_temp.pop(i)
        ans=max(L_temp)
    
    print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
l = [int(input()) for i in range(n)]
l.sort(reverse=True)
m1 = l[0]
m2 = l[1]
for i in l:
    if i == m1:
        print(m2)
    else:
        print(m1)

n = int(input())
l = [int(input()) for i in range(n)]
la = sorted(l, reverse=True)
print(l)
m1 = la[0]
m2 = la[1]
for i in l:
    if i == m1:
        print(m2)
    else:
        print(m1)

n = int(input())
l = [int(input()) for i in range(n)]
la = sorted(l, reverse=True)
m1 = la[0]
m2 = la[1]
for i in l:
    if i == m1:
        print(m2)
    else:
        print(m1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())

arr = []
for i in range(n):
	temp = int(input())
	arr.append(temp)

max_element = max(arr)
second_max = -12123122

for i in arr:
	if  i > second_max and i <= max_element:
		second_max = i

for i in arr:
	if i != max_element:
		print(max_element)
	else:
		print(second_max)

n = int(input())

arr = []
for i in range(n):
	temp = int(input())
	arr.append(temp)

temp = sorted(arr)
max_element = temp[-1]
second_max = temp[-2]

for i in arr:
	if i != max_element:
		print(max_element)
	else:
		print(second_max)

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
a = [int(input()) for _ in range(n)]
a1 = sorted(a)
if a1[n-1]==a1[n-2]:
  flag = True ## true = have repeat
  maxone = a1[n-1]
else:
  flag = False 
  maxone = a1[n-1]
  maxtwo = a1[n-2]
for i in range(n):
  if a[i]==1max and flag==True: print(maxone)
  elif a[i]==1max and flag==False: print(maxtwo)
  elif a[i]!=1max: print(maxone)


n = int(input())
a = [int(input()) for _ in range(n)]
a1 = sorted(a)
if a1[n-1]==a1[n-2]:
  flag = True ## true = have repeat
  1max = a1[n-1]
else:
  flag = False 
  1max = a1[n-1]
  2max = a1[n-2]
for i in range(n):
  if a[i]==1max and flag==True: print(1max)
  elif a[i]==1max and flag==False: print(2max)
  elif a[i]!=1max: print(1max)


n = int(input())
a = [int(input()) for _ in range(n)]
a1 = sorted(a)
if a1[n-1]==a1[n-2]:
  flag = True ## true = have repeat
  maxone = a1[n-1]
else:
  flag = False 
  maxone = a1[n-1]
  maxtwo = a1[n-2]
for i in range(n):
  if a[i]==maxone and flag==True: print(maxone)
  elif a[i]==maxone and flag==False: print(maxtwo)
  elif a[i]!=maxone: print(maxone)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input()) 
s = [int(input() for i in range(n))] 

for i in range (n):
    a = s.pop(0)
    ans = max(s)
    print(ans)
    s.append(a)

n = int(input()) 
s = [input() for i in range(n)] 

for i in range (n):
    a = s.pop(i-1)
    ans = max(s)
    print(ans)
    s.append(a)

n = int(input()) 
list = [input() for i in range(n)] 
lint = [int(s) for s in list]

ans = max(lint)
index = lint.index(max(lint))
lint.remove(max(lint))
ans2 = max(lint)

if ans == ans2:
    for i in range(n):
        print(ans)
else:
    for i in range(0, index):
        print(ans)
    print(ans2)
    for i in range(index+1, n):
        print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
l=[]
t=int(input())
b=0
c=0
for i in range(t):
    a=int(input())
    if(a>b):
        b=a
    else if(b>a and a>c):
            c=a
    l.append(a)
for i in range(0,t):
    if(l[i]!=b):
        print(b)
    else:
        print(c)


l=[]
t=int(input())
b=0
c=0
for i in range(t):
    a=int(input())
    if(a>b):
        b=a
    else if(b>a and a>c):
        c=a
    l.append(a)
for i in range(0,t):
    if(l[i]!=b):
        print(b)
    else:
        print(c)

t=int(input())
l=[]
b=0
c=0
for j in range(t):
    a=int(input())
    l.append(a)
    if(a>b):
        b=a
    elif(b>a):
        c=a
for i in l:
    if(i!=c):
        print(c)
    else:
        print(b)

t=int(input())
l=[]
b=0
c=0
for j in range(t):
    a=int(input())
    l.append(a)
    if(a>b):
        b=a
    elif(a>c):
        c=a
for i in l:
    if(i!=b):
        print(b)
    else:
        print(c)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
def main():
    N=int(input())
    A=[0 for i in range(0,N)]
    for i in range(0,N):
        A[i]=int(input())
    L=[0 for i in range(0,N)]
    R=[0 for i in range(0,N)]
    L[0]=A[0]
    R[0]=A[N-1]
    for i in range(0,N-1):
        L[i+1]=max(A[i+1],L[i])
        R[i+1]=max(A[N-i-2],R[i])
    print(L,R)
    for i in range(0,N):
        if i==0:
            print(R[N-2])
        elif i==N-1:
            print(L[N-2])
        else:
            print(max(L[i-1],R[i-1]))

if __name__ == '__main__':
    main()

def main():
    N=int(input())
    A=[0 for i in range(0,N)]
    for i in range(0,N):
        A[i]=int(input())
    s=max(A)
    index=0
    value=[0 for i in range(0,s+1)]
    for i in range(0,N):
        value[A[i]]+=1
        if A[i]==s:
            index=i
    if value[s]>1:
        for i in range(0,N):
            print(s)
    else:
        for i in range(0,N):
            if i==index:
                A[index]=0
                print(max(A))
            else:
                print(s)

if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
def exception_handling(n, ali):

    ali.sort(reverse=True)

    alimax = ali[0]
    alimax2 = ali[1]

    ans = []

    for i in ali:
        if i != alimax:
            ans.append(alimax)
        else:
            ans.append(alimax2)

    return ans

def main():
    n = int(input())
    ali = [int(input())for i in range(n)]
    ans = exception_handling(n, ali)
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()

import copy
def exception_handling(n, ali):

    sortali = copy.copy(ali)
    sortali.sort(reverse=True)

    alimax = sortali[0]
    alimax2 = sortali[1]

    ans = []

    for i in ali:
        if i != alimax:
            ans.append(alimax)
        else:
            ans.append(alimax2)

    return ans

def main():
    n = int(input())
    ali = [int(input())for i in range(n)]
    ans = exception_handling(n, ali)
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
import sys

def main():
    N = int(input())
    A = [int(input()) for i in range(N)]

    print(A)

    for j in range(N):
        if j == 0:
            print(max(A[1:]))

        elif j == N-1:
            print(max(A[:N-1]))

        else:
            print(max(max(A[:j]), max(A[j+1:])))


main()

import sys

def main():
    N = int(input())
    A = [int(sys.stdin.readline()) for i in range(N)]
    anoA = sorted(A)
    mA = max(A)

    for j in range(N):
        if mA == A[j]:
            print(anoA[-2])

        else:
            print(mA)


main()

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
li = [int(input()) for _ in range(n)]

mi = li.index(max(li))
m = max(li)

for a, b in enumerate(li):
  if a != mi:
    print(m)
  else:
    print(max(l[a+1:]+l[:a]))

n = int(input())
li = [int(input()) for _ in range(n)]

mi = li.index(max(li))
m = max(li)

for a, b in enumerate(li):
  if a != mi:
    print(m)
  else:
    print(max(li[a+1:]+li[:a]))

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
#B
# import math
# n, d = map(int, input().split())


#C
from collections import Counter
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
first = sorted(set(a))[-1]
if sorted(set(a))[0] == sorted(set(a))[-1]:
    pass
else:
    second = sorted(set(a))[-2]
for i in a:
    if i == first:
        print(first)
    else:
        print(second)

#C
from collections import Counter
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
b = a.copy()
b.sort()
b.reverse()
fi = b[0]
se = b[1]
for i in a:
    if i == fi:
        print(se)
    else:
        print(fi)

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = []
for _ in range(N):
    A.append(input())

B = sorted(A, reverse=True)
max_first = B[0]
max_second = B[1]

for i in range(N):
	answer = max_first
    if A[i] == max_first:
        answer = max_second
    print(answer)


N = int(input())
A = []
for i in range(N):
	A.append(input())
 
B = sorted(A, reverse=True, key=number)
max_first = B[0]
max_second = B[1]
max_third = B[2]
 
for i in range(N):
	if A[i] != max_first:
		print(max_first)
    else if A[i] != max_second:
		print(max_second)
    else:
		print(max_third)


N = int(input())
A = []
for i in range(N):
  A.append(input())
 
B = sorted(A, reverse=True, key=number)
max_first = B[0]
max_second = B[1]
max_third = B[2]
 
for i in range(N):
    if A[i] != max_first:
        print(max_first)
    elif A[i] != max_second:
        print(max_second)
    else:
        print(max_third)

import copy
 
N=int(input())
A=[]
for _ in range(N):
    A.append(int(input()))
 
A_max=max(A)
#ind_max=A.index(A_max)
B=copy.copy(A)
B.remove(A_max)
B_max=max(B)
 
for i in range(N):
    if A[i]!=A_max:
        print(A_max)
    else:
        print(B_max)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
a = [0] * n
for i in range(n):
  a[i] = int(input())

for i in range(n):
  for j in range(n):
    b = [0] * n
    if j != i:
      continue
    b[j] = a[j]
  print(max(b))

n = int(input())
a = [0] * n
for i in range(n):
  a[i] = int(input())

asort = sorted(a,reverse=True)
for i in range(n):
  if a[i] == asort[0]:
    print(asort[1])
  else:
    print(asort[0])

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A,reverse=True)
max1 = B[0]
max2 = B[1]
 
for i in range(N):
    if A[i] == max1:
        print(max1)
    else:
        print(max2)

N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A,reverse=True)
max1 = B[0]
max2 = B[1]
print(max1,max2)
for i in N:
    if A[i] == max1:
        print(max2)
    else:
        print(max1)

N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A,reverse=True)
max1 = B[0]
max2 = B[1]
print(max1,max2)
for i in A:
    if A[i] == max1:
        print(max2)
    else:
        print(max1)

N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A,reverse=True)
max1 = B[0]
max2 = B[1]
for i in range(N):
    if A[i] == max1:
        print(max2)
    else:
        print(max1)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
import sys

#+++++
		
def main():
	n = int(input())
	ll=[int(input()) for _ in range(n)]
	
	mm = ll.sort()
	ma=mm[-1]
	mb=mm[-2]
	
	for i in ll:
		pp = ma if i != ma else mb:
		print(pp)
		
	
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

import sys

#+++++
		
def main():
	n = int(input())
	ll=[int(input()) for _ in range(n)]
	
	mm = sorted(ll)
	#print(ll)
	ma=mm[-1]
	mb=mm[-2]
	
	for i in ll:
		pp = ma if i != ma else mb
		print(pp)
		
	
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N=int(input())
A=sorted(list(map(int,input().split())))
M=A[0]
for i in range(N):
  if i==M:
    print(A[1])
  else:
    print(M)
 
    

import copy
N=int(input())
A=[int(input()) for i in range(N)]
B = copy.deepcopy(A)
B.sort(reverse=True)
for i in range(N):
  if A[i]==B[0]:
    print(B[1])
  else:
    print(B[0])

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = [int(input) for _ in range(N)]
B = sorted(A, reverse=True)

for i in range(N):
    if A[i] <= B[0]:
        print(B[0])
    else:
        print(B[1])

N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A, reverse=True)

for i in range(N):
    if A[i] < B[0]:
        print(B[0])
    else:
        print(B[1])

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
for n in range(i):
	print([maxInt,data[n]])

data = []
res = []

data = [int(input()) for _n in range(int(input()))]

for n in range(i):
	res.append(max(data[0:n]+data[n+1:]))

for item in res:
	print(item)



import copy

data = []
i = int(input())

data = [int(input()) for _n in range(i)]
maxInt = max(data)
data2 = copy.copy(data)
data2.remove(maxInt)
max2Int = max(data2)
for n in range(i):
	if maxInt != data[n]:
		print(maxInt)
	else:
		print(max2Int)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n=int(input())
a=list(int(input()) for i in range(n))
if a.count(max(a))==1:
  for y in range(n):
  	if a[y]==max(a):
  		a.remove(a[y])
  		print(max(a))
  	else:
  		print(max(a))
else:
  for i in range(n):
    print(max(a))



n=int(input())
a=list(int(input()) for i in range(n))
for y in range(n):
  if a[y]==max(a):
  	a.remove(a[y])
  	print(max(a))
  else:
  	print(max(a))

n=int(input())
a=list(int(input()) for i in range(n))
b=a.remove(max(a))
c=max(b)
if a.count(max(a))==1:
  for y in range(n):
  	if a[y]==max(a):
  		
  		print(c)
  	else:
  		print(max(a))
else:
  for i in range(n):
    print(max(a))

n=int(input())
a=list(int(input()) for i in range(n))
x=max(a)
b=a.remove(x)
c=max(b)
if a.count(max(a))==1:
  for y in range(n):
  	if a[y]==max(a):
  		
  		print(c)
  	else:
  		print(max(a))
else:
  for i in range(n):
    print(max(a))



##C
n=input().int
a=list(int(input()) for i in range(n))
b=sorted(a,reverse=True)

for i in range(n):
    if a[i]==b[-1]:
        print(b[-2])
    else:
        print(b[-1])

n=int(input())
a=
a=list(int(input()) for i in range(n-1))
if a[i]=max(a) for i in range(n-1):
  a.remove(a[i])
  print(max[a])
else:
  print(max[a])

n=int(input())
a=list[int(input()) for i in range(n-1)]
if a[i]=max(a) for i in range(n-1):
  a.remove(a[i])
  print(max[a])
else:
  print(max[a])

n=int(input())
a=list(int(input()) for i in range(n))
if a.count(max(a))==0:
  for y in range(n):
  	if a[y]==max(a):
  		a.remove(a[y])
  		print(max(a))
  	else:
  		print(max(a))
else:
  for i in range(n):
    print(max(a))

n=int(input())
a=list(int(input()) for i in range(n-1))
if a[i]=max(a) for i in range(n-1):
  a.remove(a[i])
  print(max[a])
else:
  print(max[a])



n=int(input())
a=list(int(input()) for i in range(n))
if a.count(max(a))==0:
  for y in range(n):
  	if a[y]==max(a):
  		a[y]=max(a)-1
  		print(max(a))
  	else:
  		print(max(a))
else:
  for i in range(n):
    print(max(a))


n=int(input())
a=list(int(input()) for i in range(n))
if a.count(max(a))==1:
  for y in range(n):
  	if a[y]==max(a):
  		a[y]=min(a)
  		print(max(a))
  	else:
  		print(max(a))
else:
  for i in range(n):
    print(max(a))


##C
n=input().int
a=list(int(input()) for i in range(n))
b=sorted(a)

for i in range(n):
    if a[i]==b[-1]:
        print(b[-2])
    else:
        print(b[-1])

n=int(input())
a=list(int(input()) for i in range(n))
if a.count(max(a))==1:
  for y in range(n):
  	if a[y]==max(a):
  		a[y]=max(a)-1
  		print(max(a))
  	else:
  		print(max(a))
else:
  for i in range(n):
    print(max(a))


##C
n=int(input())
a=list(int(input()) for i in range(n))
b=sorted(a)

for i in range(n):
    if a[i]==b[-1]:
        print(b[-2])
    else:
        print(b[-1])

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted