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):
from sys import stdin

readline = stdin.readline


def ns():
    
    return readline().rstrip()


def ni():
    
    return int(ns())


def nf():
    
    return map(int, open(0).read().split())


def main():
    n = ni()
    a = list(nf())
    for i in range(n):
        tmp = a[:]
        tmp.pop(i)
        print(max(tmp))


if __name__ == "__main__":
    main()


from sys import stdin

readline = stdin.readline


def nf():
    
    return map(int, open(0).read().split())


def main():
    n, *al = nf()
    s, f = sorted(al)[-2:]
    if s == f:
        for _ in range(n):
            print(f)
        return
    for a in al:
        if a == f:
            print(s)
            continue
        print(f)


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):
import numpy as np
import heapq
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
A = np.array(A)
answer = []
for i in range(N):
  A_temp = np.delete(A, i)
  answer.append(heapq.pop(A_temp))
for i in range(N):
  print(answer[i])


import numpy as np
#import heapq
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
A = np.array(A)
A_max_1 = np.max(A)
A_max_index = np.argmax(A)
A = np.delete(A, A_max_index)
A_max_2 = np.max(A)
answer = []
for i in range(N):
  if not i == A_max_index:
    answer.append(A_max_1)
  else:
    answer.append(A_max_2)
for i in range(N):
  print(answer[i])


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 copy
from sys import stdin
n=int(input())
A=[int(stdin.readline().rstrip()) for _ in range(n)]
m=max(A)
for j in range(0,n):
    B=copy.copy(A)
    s=A[j]
    A.pop(j)
    print(m)
    A = copy.copy(B)

import copy
from sys import stdin
n=int(input())
A=[int(stdin.readline().rstrip()) for _ in range(n)]
z=max(A)
B=sorted(A)
o=B[n-2]
for j in range(0,n):
    if A[j]<z:
       print(z)
    else:
        if B[n-2]==B[n-1]:
           print(z)
        else:
           print(o)

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())
AList = [input() for i in range(N)]
max_AList = max(AList)
max2nd_AList = 0

for i in range(N) :
    if AList[i] == max_AList :
        if max2nd_AList == 0 :
            max2nd_AList = max(AList[0:i] + AList[i+1:N])
        else :
            print(max2nd_AList)
    else :
        print(max_AList)

N = int(input())
AList = [int(input()) for i in range(N)]
max_AList = max(AList)
max2nd_AList = sorted(AList, reverse = True)[1]

for i in range(N) :
    if AList[i] == max_AList :
        print(max2nd_AList)
    else :
        print(max_AList)

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 = [map(int, input()split()) for _ in range(N)]
for i in range(N) :
    k = A[i]
    del A[i]
    print(max(A))
    A.insert(i, k)


N = int(input())
A = [int(input()) for _ in range(N)]
A_sort = sorted(A)
for i in range(N) :
    if a[i] == a[-1] :
        print(a[-2])
    else :
        print(a[-1])

N = int(input())
A = [int(input()) for _ in range(N)]
A_sort = sorted(A)
for i in range(N) :
    if A[i] == A_sort[-1] :
        print(A_sort[-2])
    else :
        print(A_sort[-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):
from sys import stdin


def main():
    N = int(stdin.readline())
    A = [int(input()) for _ in range(N)]

    for a in A:
        # if max(A) == a:
        
        #     print(new_A[1])
        # else:
        #     print(max(A))
        print(max(A))


if __name__ == "__main__":
    main()


from sys import stdin


def main():
    N = int(stdin.readline())
    A = [int(input()) for _ in range(N)]

    new_A = sorted(A, reverse=True)
    max_A = new_A.pop(0)
    next_max_A = new_A.pop(0)

    for a in A:
        if max_A == a:
            print(next_max_A)
        else:
            print(max_A)


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):
n = int(input())

a = []
aa = []

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

aa.sort()
firsta = aa[0]
seconda = aa[1]

for i in range(n):
    if a[i] == firsta:
        print(seconda)
    else:
        print(firsta)



n = int(input())

a = []
aa = []

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

aa.sort()
firsta = aa[-1]
seconda = aa[-2]


if firsta == seconda:
    for i in range(n):
        print(firsta)
else:
    for i in range(n):
        if a[i] == firsta:
            print(seconda)
        else:
            print(firsta)

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
import numpy as np
input = sys.stdin.readline


def main():
    N = int(input())
    A = np.array([int(input()) for _ in range(N)])

    for j in range(N):
        if j != A.index(max(A)):
            print(np.max(A))
        else:
            ans = [x for i, x in enumerate(A) if i != j]
            print(np.max(ans))


if __name__ == "__main__":
    main()


def main():
    n = int(input())
    As = [int(input()) for _ in range(n)]

    As_sort = sorted(As)
    second, first = As_sort[-2:]
    for i in range(n):
        if As[i] == first:
            print(second)
        else:
            print(first)


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=[]
for i in range(N):
	a.append(int(input()))
k=max(a)
count=0
for j in range(N):
	if count==1:
		print(k)
	else:
		if a[j]==k:
			b=a[:j]+a[j+1:]
			count=1
			print(max(b))

N=int(input())
a=[]
for i in range(N):
	a.append(int(input()))
k=max(a)
count=0
for j in range(N):
	if count==1:
		print(k)
	else:
		if a[j]==k:
			b=a[:j]+a[j+1:]
			count=1
			print(max(b))
		else:
			print(k)

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=[]
l.append(int(input()))
l.append(int(input()))
m1=max(l)
mx=min(l)
for _ in range(N-2):
  l.append(int(input()))
  if l[-1] >= m1:
    m2 = m1
    m1 = l[-1]
  elif l[-1] > m2:
    m2 = l[-1]
for i in range(N):
  if l[i] == m1:
    print(m2)
  else:
    print(m1)

N=int(input())
l=[]
l.append(int(input()))
l.append(int(input()))
m1=max(l)
m2=min(l)
for _ in range(N-2):
  l.append(int(input()))
  if l[-1] >= m1:
    m2 = m1
    m1 = l[-1]
  elif l[-1] > m2:
    m2 = l[-1]
for i in range(N):
  if l[i] == m1:
    print(m2)
  else:
    print(m1)

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)]
l = sorted(a)
print(l)
for i in a:
    if l[-1] == i:
        print(l[-2])
    else:
        print(l[-1])

n = int(input())
a = [int(input()) for _ in range(n)]
l = sorted(a)
for i in a:
    if l[-1] == i:
        print(l[-2])
    else:
        print(l[-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 = []
for i in range(N):
  a.append(int(input()))

for i in range(N):
  b = a[:]
  b.pop(i)
  print(max(b)

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

sort = sorted(a)
m1 = sort[-1]
m2 = sort[-2]
if m1 == m2:
  for i in range(N):
    print(m1)
else:
  j = a.index(m1)
  for i in range(N):
    if i == j:
      print(m2)
    else:
      print(m1)

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(map(int, input().split()))

ANS = []
for i in range(N):
  Alist = A[:i]+A[i+1:]
  ANS.append(max(Alist))

for i in ANS:
    print(i)

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

maxA = max(A)
max_in = A.index(max(A))
ANS = [maxA]*N
ANS[max_in] = max(A[:max_in]+A[max_in+1:])

for i in ANS:
    print(i)


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(i)) for i in range(N)]

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


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

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


N = int(input())
A = []

for i in range(N):
    a = int(input())
    A.append(a)

x = sorted(A, reverse=True)

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


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)]
mx = max(a)
mxi = a.index(mx)
mx2 = a[:mxi] + a[mxi+1:]

for i in range(n):
    if i == mxi: print(mx2) 
    else: print(mx)


n = int(input())
a = [int(input()) for i in range(n)]
mx = max(a)
mxi = a.index(mx)
mx2 = a[:mxi] + a[mxi+1:]

for i in range(n):
    if i == mxi: print(mx2) 
    else: print(mn)


n = int(input())
a = [int(input()) for i in range(n)]
mx = max(a)
mxi = a.index(mx)
mx2 = max(a[:mxi] + a[mxi+1:])

for i in range(n):
    if i == mxi: print(mx2) 
    else: print(mx)


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):
m = max(l)
ans = [m]*n
if len(set(l)) == 1:
    for i in ans:
        print(i)
else:
    x = sorted(set(l))[-2]
    a = l.index(m)
    ans[a] = x
    for i in ans:
        print(i)


n = int(input())
l = []
for i in range(n):
    l.append(int(input()))
m = max(l)
ans = [m]*n
if len(set(l)) == 1 or l.count(m) > 1:
    for i in ans:
        print(i)
else:
    x = sorted(set(l))[-2]
    a = l.index(m)
    ans[a] = x
    for i in ans:
        print(i)


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 copy

n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
for i in range(n):
    a_copy = copy.deepcopy(a)
    a_copy.pop()
    print(max(a_copy))


n = int(input())
a = [int(input()) for _ in range(n)]
a_sort = sorted(a, reverse=True)
for i in range(n):
    if a[i] == a_sort[0]:
        print(a_sort[1])
    else:
        print(a_sort[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 = []
for i in range(n):
  a.append(int(input()))
aa = sorted(a)
c = aa[-1]
d = aa[-2]
for i in a:
  if i == c:
    print(c)
  else:
    print(d)

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
aa = sorted(a)
c = aa[-1]
d = aa[-2]
for i in a:
  if i == c:
    print(d)
  else:
    print(c)

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):
# -*- coding: utf-8 -*-

N = int(input())

values = [0]*N
max_value_count = 0
max_value = 0
next_max_value = max_value

for i in range(N):
    in_value = int(input())
    values[i] = in_value

    if in_value == max_value:
        max_value_count = max_value_count + 1
    elif in_value > max_value:
        next_max_value = max_value
        max_value = in_value
        max_value_count = 1
    elif in_value > next_max_value:
        next_max_value = in_value

max_value_count = value_count_map[max_value]

for row in range(N):
    if values[row] == max_value and max_value_count == 1:
        print(next_max_value)
    else:
        print(max_value)


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

N = int(input())

values = [0]*N
value_count_map = {}
for i in range(N):
    in_value = int(input())
    values[i] = in_value
    value_count = 0
    if in_value in value_count_map:
        value_count = value_count_map[in_value]
    value_count_map[in_value] = value_count + 1

for row in range(N):
    row_value = values[row]
    if row_value != max_value:
        max_value = max(value_count_map.keys())
        print(max_value)
    elif value_count_map[row_value] != 1:
        max_value = max(value_count_map.keys())
        print(max_value)
    else:
        # if row value is a unique max value
        value_count = value_count_map.pop(row_value)
        max_value = max(value_count_map.keys())
        print(max_value)
        value_count_map[row_value] = value_count


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

N = int(input())

values = [0]*N
max_value_count = 0
max_value = 0
next_max_value = max_value

for i in range(N):
    in_value = int(input())
    values[i] = in_value

    if in_value == max_value:
        max_value_count = max_value_count + 1
    elif in_value > max_value:
        next_max_value = max_value
        max_value = in_value
        max_value_count = 1
    elif in_value > next_max_value:
        next_max_value = in_value

for row in range(N):
    if values[row] == max_value and max_value_count == 1:
        print(next_max_value)
    else:
        print(max_value)


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):
#h = list(map(int, input().split()))
#r = int(input())
#n, d = map(int, input().split())

n = int(input())
a = []

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

sa = sorted(a)
sa.reverse()

h = {}
for i in sa:
    h[i] = i
    for j in sa:
        if j != i:
            h[i] = j
            break
            
for x in sa:
    print(h[x])


#h = list(map(int, input().split()))
#r = int(input())
#n, d = map(int, input().split())

n = int(input())
a = []

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

sa = sorted(a)
sa.reverse()

ma = sa[0]
mi = sa[0]
for i in sa:
    if i != mi:
        mi = i

for x in sa:
    if i == ma:
        print(mi)
    else:
        print(ma)



#h = list(map(int, input().split()))
#r = int(input())
#n, d = map(int, input().split())

n = int(input())
a = []

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

sa = sorted(a)
sa.reverse()

if sa[0] == sa[1]:
    for i in a:
        print(sa[0])
else:
    for i in a:
        if i == sa[0]:
            print(sa[1])
        else:
            print(sa[0])



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 = [int(input()) for i in range(n)]

numset = set(arr)
maxval = max(numset)

if len(numset) == 1:
    for i in range(n):
        print(maxval)
else:
    numset.remove(maxval)
    semimax = max(numset)
    for i in range(n):
        if arr[i] == maxval and not arr[i] in arr:
            print(semimax)
        else:
            print(maxval)

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

numset = set(arr)
maxval = max(numset)
count = 0

if len(numset) == 1:
    for i in range(n):
        print(maxval)
else:
    numset.remove(maxval)
    semimax = max(numset)
    for j in range(n):
        if arr[j] == maxval:
            count +=1
    for i in range(n):
        if arr[i] == maxval and count == 1:
            print(semimax)
        else:
            print(maxval)

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 abc_134c(N):
    max_1 = (0, 0)
    max_2 = (0, 0)
    for i in range(N):
        buf = int(input())
        if max_2[1] < buf:
            if max_1[1] < buf:
                max_2 = max_1
                max_1 = (i, buf)
            else:
                max_2 = (i, buf)

    output = [max_1[1] for _ in range(N)]
    output[max_1[0]] = max_2[1]
    print(output)


if __name__ == "__main__":
    N = int(input())
    abc_134c(N)


def abc_134c(N):
    max_1 = (0, 0)
    max_2 = (0, 0)
    for i in range(N):
        buf = int(input())
        if max_2[1] < buf:
            if max_1[1] < buf:
                max_2 = max_1
                max_1 = (i, buf)
            else:
                max_2 = (i, buf)

    output = [max_1[1] for _ in range(N)]
    output[max_1[0]] = max_2[1]
    [print(output[i]) for i in range(N)]


if __name__ == "__main__":
    N = int(input())
    abc_134c(N)


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_max = 0
for i in range(n):
  a = int(input())
  if a > a_max:
    print(a)
    a_max = a
  else:
    print(a_max)

n = int(input())
a_max = 0
data = [int(input()) for i in range(n)]
a_max = max(data)
flag = True if a_max == a_max(data.remove(a_max)) else False
for i in range(n):
  if data[i] == a_max and not flag:
    tmp = data.pop(data[i])
    print(max(data))
    data.append(tmp)
    
  else:
  
  	print(a_max)

n = int(input())
a_max = 0
data = [int(input()) for i in range(n)]
a_max = max(data)
flag = True if a_max == a_max(data.remove(a_max)) else False
for i in range(n):
  if data[i] == a_max and not flag:
    tmp = data.pop(data[i])
    print(max(data))
    data.append(tmp,0)
    
  else:
  	print(a_max)

n = int(input())
a_max = 0
data = [int(input()) for i in range(n)]
a_max = max(data)
flag = True if 2 <= data.count(a_max) else False
for i in range(n):
  if data[i] == a_max and not flag:
    tmp = data.pop(i)
    print(max(data))
    data.insert(tmp,0)
    
  else:
  	print(a_max)

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):
# -*- coding: utf-8 -*-
n = int(input())

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

for i in a:
    print(max(a[:i]+a[i+1:]))


# -*- coding: utf-8 -*-
n = int(input())

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

most = max(a)
most_idx = a.index(most)
second = max(a[:most_idx] + a[most_idx+1:])

for i in range(n):
    print(second if a[i] == most else most)


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 = list(map(int, input().split()))
b = [0] * n

for i in reversed(range(n)):
    for j in range(i + 1, n, i + 1):
        x = 1
        k = j
        while k < n:
            x ^= b[k - 1]
            k += j
        if x == a[i]:
            b[i] = 1

print(sum(b))
for i in range(n):
    if b[i] == 1:
        print(i + 1)

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

b = sorted(a, reverse=True)
max1 = b[0]
max2 = b[1]

for ai in a:
    if ai != max1:
        print(max1)
    else:
        print(max2)

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

N = int(input())
A = [int(input()) for _ in range(N)]

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

import bisect

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[1])
  else:
    print(B[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=[-1]+list(map(int,input().split()))

t=((n+1)+2-1)//2

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

for i in range(t-1,0,-1):
 t_sum=sum(ans[i+i::i])
 if a[i]%2==t_sum%2:
  ans[i]=0
 else:
  ans[i]=1

m=ans.count(1)
ans_l=[]
for i in range(n+1):
 if ans[i]==1:
  ans_l.append(i)
print(m)
if ans_l:
 print(*ans_l)

n = int(input())
a = [int(input()) for i in range(n)]
a_s = sorted(a, reverse=True)
a_max_ind = index(max(a))
a_max = a_s[0]
a_sec = a_s[1]
for i in range(n):
    if i == a_max_ind:
        print(a_sec)
    else:
        print(a_max)

n = int(input())
a = [int(input()) for i in range(n)]
a_s = sorted(a, reverse=True)
a_max_ind = index(max(a))
a_max = a_s[0]
a_sec = a_s[1]
for i in range(n)
    if i == a_max_ind:
        print(a_sec)
    else:
        print(a_max)

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

for i in a:
  if i==a2[0]:
    print(a2[1])
  else:
    print(a2[0])

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())
s = [int(input()) for i in range(N)]

s_max=max(s)

for i in range(N):
  if s[i]<s_max:
    print(s_max)
  else:
	print(max([s[x] for x in range(i)]+[s[x] for x in range(i+1, N)]))


N = int(input())
s = [int(input()) for i in range(N)]
temp=s.copy()
s_max=temp.pop(max(temp))
s_max2=temp.pop(max(temp))

for i in range(N):
  if s[i]<s_max:
    print(s_max)
  else:
	print(s_max2)


N = int(input())
s = [int(input()) for i in range(N)]
temp=s.copy()
s_max=temp.remove(max(temp))
s_max2=temp.remove(max(temp))

for i in range(N):
  if s[i]<s_max:
    print(s_max)
  else:
	print(s_max2)


N = int(input())
s = [int(input()) for i in range(N)]
temp=s.copy()
s_max=max(temp)
temp.remove(s_max)
s_max2=max(temp)

for i in range(N):
  if s[i]<s_max:
    print(s_max)
  else:
	print(s_max2)


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

for i in range(N):
  temp=[s[x] for x in range(i)]+[s[x] for x in range(i+1, N)]
  print(min(temp))

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

s_max=s.pop(max(s))
s_max2=s.pop(max(s))

for i in range(N):
  if s[i]<s_max:
    print(s_max)
  else:
	print(s_max2)


N = int(input())
s = [int(input()) for i in range(N)]
temp=s.copy()
s_max=max(temp)
temp=temp.remove(s_max)
s_max2=max(temp)

for i in range(N):
  if s[i]<s_max:
    print(s_max)
  else:
	print(s_max2)


import numpy as np

N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))
  
m1=np.max(A)
m1i=np.argmax(A)

A.remove(m1)
m2=np.max(A)

for i in range(N):
  if i!=m1i:
    print(m1)
  else:
    print(m2)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

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 math

N = int(input())

numbers_full = []
for _ in range(N):
  numbers_full.append(int(input()))

for i in range(N):
  numbers_minus1 = numbers_full.copy()
  del numbers_minus1[i]
  print(numbers_full, numbers_minus1, str(max(numbers_minus1)))

N = int(input())
number_list = [int(input()) for _ in range(N)]

sorted_num = sorted(number_list)
number_max = sorted_num[-1]
number_second_max = sorted_num[-2]

if number_max == number_second_max:
  output_always_max = True
else:
  output_always_max = False

for number in number_list:
  if output_always_max:
    print(str(number_max))
  else:
    if number == number_max:
      print(str(number_second_max))
    else:
      print(str(number_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):
import numpy as np
l = list(map(int, input().split()))
n = l[0]
A = np.array(l[1:])
for i in range(n):
  m = np.max(A)
  if A[i] == m:
    mask = A != A[i]
    print(np.max(A[mask]))
  else:
    print(m)

import numpy as np
n = int(input())
A = np.array([int(input()) for i in range(n)])
idxs = np.argsort(A)
m1 = A[idxs[-1]]
m2 = A[idxs[-2]]
if m1 == m2:
  for i in range(n):
    print(m1)
else:
  for i in range(n):
    if i != idx[-1]:
      print(m1)
    else:
   	  print(m2)

import numpy as np
n = int(input())
A = np.array([int(input()) for i in range(n)])
idxs = np.argsort(A)
m1 = A[idxs[-1]]
m2 = A[idxs[-2]]
if m1 == m2:
  for i in range(n):
    print(m1)
else:
  for i in range(n):
    if i != idx[-1]:
      print(m1)
    else:
   	  print(m2)

import numpy as np
n = int(input())
A = np.array([int(input()) for i in range(n)])
idxs = np.argsort(A)
m1 = A[idxs[-1]]
m2 = A[idxs[-2]]
for i in range(n):
  if i != idxs[-1]:
    print(m1)
  else:
    print(m2)

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 = [int(input()) for i in range(n)]
a_copy = a
for j in range(0,n):
  if max(a) = a[j]:
    a_copy.remove(a_copy[j])
    print(max(a_copy))
  else:
    print(max(a))

import sys
input = sys.stdin.readline
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a_max = max(a)
b = a
b.remove(max(b))
b_max = max(b)
for j in range(n):
  if a[j] == a_max:
    print(b_max)
  else:
    print(a_max)

import sys
input = sys.stdin.readline
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a_max = max(a)
b_max = sorted(a)[-2]
for j in range(n):
  if a[j] == a_max:
    print(b_max)
  else:
    print(a_max)

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 = []
for _ in range(N):
    A.append(int(input()))

max_num = max(A)

for i in range(N):
    if A[i] != max_num:
        print(max_num)
    else:
        print(max(max(A[0:i]),max(A[i + 1:]))
    



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

A_sorted = sorted(A)

for i in range(N):
    if A[i] != A_sorted[-1]:
        print(A_sorted[-1])
    else:
        print(A_sorted[-2])


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=[input() for _ in range(n)]
m=max(a)
for i in range(n):
  if m>a[i]:
    print(m)
  else:
    print(a[i])

n=int(input())
a=[input() for _ in range(n)]
m1=max(a)
m2=sorted(a)[n-2]
for i in range(n):
  if m1>=a[i]:
    print(m1)
  else:
    print(m2)

n=int(input())
a=[int(input()) for _ in range(n)]
m_1=max(a)
m_2=sorted(a)[n-2]
for i in range(n):
  if a[i]==m_1:
    print(m_2)
  else:
    print(m_1)

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):
import copy
N = int(input())

A = [0]*N

for r in range(N):
  A[r] = int(input())
Elias_A = copy.copy(A)
A.sort()
Sorted_A = copy.copy(A)
  
for r in range(N):
  if N >= 3:
    if A[r] == Sorted_A[N-1]: print(A[r])
    elif A[r] == Sorted_A[N-2]: print(A[r])
    elif A[r] == sorted_A[N-3]: print(A[r])
    else:
      A.remove(Elias_A[r])
      print(A[N-2])
      A = copy.copy(Sorted_A)
  else:
    A.remove(Elias_A[r])
    print(A[N-2])
    A = copy.copy(Sorted_A)

import copy
N = int(input())

A = [0]*N

for r in range(N):
  A[r] = int(input())
A.sort()
B = copy.copy(A)
  
for r in range(N):
  A.remove(B[r])
  print(A[N-2])
  A = copy.copy(B)

N = int(input())
A = [0]*N

for r in range(N): A[r] = int(input())
A_max = max(A)
A_sec = sorted(A)[-2]

for r in range(N):
  if A[r] == A_max: print(A_sec)
  elif A[r] == A_sec: print(A_max)
  else: print(A_max)

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):
import copy
A = list(map(int, input().split()))

a = max(A)
AA = copy.deepcopy(A)
AA.remove(a)
b = max(AA)

for hoge in A:
  if hoge == a:
    print(b)
  else:
    print(a)

import copy
A = list(map(int, input().split))

a = max(A)
AA = copy.deepcopy(A)
AA.remove(a)
b = max(AA)

for hoge in A:
  if hoge == a:
    print(b)
  else:
    print(a)

import copy
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
a = max(A)
AA = copy.deepcopy(A)
AA.remove(a)
b = max(AA)

for hoge in A:
  if hoge == a:
    print(b)
  else:
    print(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):
import heapq

n = int(input())
a = [int(input()) for i in range(n)]
b = heapq.nlargest(2, set(a))
c = [i for i, x in enumerate(a) if x == b[0]] 

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


import heapq

n = int(input())
a = [int(input()) for i in range(n)]
b = heapq.nlargest(2, set(a))
c = a.count(b[0])

if len(b) == 1 or c > 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: 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)
print(b)
for i in a:
  if i==b[-1]:
    print(b[-2])
  else:
    print(b[-1])

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

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

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

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

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):
from copy import deepcopy

def solve():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    B = deepcopy(A)
    B.sort()

    for a in A:
        if a != B[-1]:
            print(B[-1])
        else:
            print(B[-2])

print(solve())

from copy import deepcopy

def solve():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    B = deepcopy(A)
    B.sort()

    for a in A:
        if a != B[-1]:
            print(B[-1])
        else:
            print(B[-2])

solve()

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)]
for i in range(n):
    num=max(a)
    if a.index(num)==i:
        aa=sorted(a)
        print(a[-2])
    else:
        print(num)

n=int(input())
a=[int(input()) for _ in range(n)]
max_a=max(a)
index=a.index(max_a)
a.pop(index)
for i in range(n):
    if i ==index:
        print(max(a))
    else:
        print(max_a)

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)]
a_sort = sorted(a.copy())
for i in range(n):
    print(a_sort[-2] if a[i] == a_sort[-1] else a_sort[-2])

n = int(input())
a = [int(input()) for i in range(n)]
a_sort = sorted(a.copy())
for i in range(n):
    print(a_sort[-2] if a[i] == a_sort[-1] else a_sort[-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):
import numpy as np

n = int(input())

a = np.array([int(input()) for _ in range(n)])
[print(np.amax(np.amax(a[:i]), np.amax(a[i+1:]))) for i in range(n)]

import heapq

n = int(input())
a = [int(input()) for _ in range(n)]
a1, a2 = heapq.nlargest(2, a)
[print(a1) if _ != a1 else print(a2) for _ in 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):
n=int(input())
a=list(map(int,input().split()))
val=max(a)
inx=a.index(val)

for i in range(0,n):
  if i==inx:
    del a[inx]
    print(max(a))
  else:
    print(val)
  


n=int(input())
a=list(map(int,input().split()))
x=max(a)
y=a.index(x)

for i in range(0,n):
  print(x)

n=int(input())
a=[]

for j in range(0,n):
  a.append(int,input())
  
x=max(a)
y=a.index(x)
del a[y]
z=max(a)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    print(z)
  


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

for i in range(0,n):
  x=a[i]
  a[i]=0
  print(max(a))
  a.insert(i,x)
  

n=int(input())
a=list(map(int,input().split()))
x=max(a)
y=a.index(x)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    a.pop(y)
    print(max(a))
  


n=int(input())
a=list(map(int,input().split()))
x=max(a)
y=a.index(x)
for i in range(0,n):
  if i!=y:
    print(x)
  else:
    del a(x)
    print(max(a))
  

n=int(input())
a=list(map(int,input().split()))
x=max(a)
y=a.index(x)
del a[y]
z=max(a)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    print(z)
  


n=int(input())
a=list(int,input().split(), for _ in range(0,n))
x=max(a)
y=a.index(x)
del a[y]
z=max(a)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    print(z)
  


n=int(input())
a=list(map(int,input().split()))
x=max(a)
y=a.index(x)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    del a[y]
    print(max(a))
  


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

value=max(a)
index=a.index(max(a))

for i in range(n):
  if i==index:
    b=a.pop(i)
    print(max(a))
  else:
      print(value)

n=int(input())
a=[]

for j in range(0,n):
  a.append(int(input()))
  
x=max(a)
y=a.index(x)
del a[y]
z=max(a)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    print(z)
  


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

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())
l=[int(input()) for x in range(n)]
ll=l
for i in range(n):
    l.pop(i)
    print(max(l))
    l.insert(i,ll[i])

n = int(input())
l=[int(input()) for x in range(n)]
setl=list(set(l))
setl.sort()
m=max(l)
print(m)
print(setl)
print(l)
for i in range(n):
    if len(setl)==1:
        print(m)
    else:
        second=setl[-2]
        if l[i]==m:
            print(second)
        else:
            print(m)

n = int(input())
l=[int(input()) for x in range(n)]
l.sort()
setl=list(set(l))
setl.sort()
m=max(l)

for i in range(n):
    if len(setl)==1:
        print(m)
    else:
        second=l[-2]
        if l[i]==m:
            print(second)
        else:
            print(m)

n = int(input())
l=sorted(int(input()) for x in range(n))
for i in range(len(l)):
    if l[i]<max(l):
        print(max(l))
    elif l[i]==max(l):
        set(l)
        if len(l)==1:
            print(l[i])
        else:
            print(l[-2])

import copy
n = int(input())
l=[int(input()) for x in range(n)]
ll=copy.copy(l)
ll.sort()
setl=list(set(ll))
m=max(l)
for i in range(n):
    if len(setl)==1:
        print(m)
    elif l[i]==m:
        print(ll[-2])
    else:
        print(m)

Verdicts: Runtime Error

Wrong Answer

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)]
MAX1=max(A)
copyA=A.copy()
copyA.remove(MAX)
MAX2=max(copyA)
for i in A:
  if (i==MAX1):
    print(MAX2)
  else:
    print(MAX1)

N=int(input())
A=[int(input()) for i in range(N)]
MAX1=max(A)
copyA=A.copy()
copyA.remove(MAX1)
MAX2=max(copyA)
for i in A:
  if (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 = []
for _ in range(N):
    A.append(int(input()))

L = []
R = []

for a in A:
    if len(L) == 0:
        L.append(a)
    L.append(max(L[-1]), a)

A.reverse()
for a in A:
    if len(R) == 0:
        R.append(a)
    R.append(max(R[-1]), a)

R.reverse()

print(R[0])
for i in range(1, N-1):
    print(max(L[i-1], R[i+1]))
print(L[len(L)-2])


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

L = [1]
for n in range(N-1):
    L.append(max(L[-1], A[n]))

R = [1]
A.reverse()
for n in range(N-1):
    R.append(max(R[-1], A[n]))
R.reverse()

for i in range(N):
    print(max(L[i], R[i]))


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=[]
b=sorted(a)
mx=b[-1]
mx2=b[-2]
for i in a:
    if i==mx:
        print(mx2)
    else:
        print(mx)

n=int(input())
a=[int(input()) for _ in range(n)]
b=sorted(a)
mx=b[-1]
mx2=b[-2]
for i in a:
    if i==mx:
        print(mx2)
    else:
        print(mx)

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=[int(input()) for _ in range(n)]
print(l)

n=int(input())
l=[int(input()) for _ in range(n)]
#print(l)
k=l
k.sort()
dic_lst={}
for i in l:
  if i not in dic_lst:
    dic_lst[i]=1
  else:
    dic_lst[i]+=1
for i in l:
  max_num=max(dic_lst.keys())
  if i<max_num:
    print(max_num)
  if i==max_num:
    if dic_lst[i]>1:
      print(max_num)
    elif dic_lst[i]==1:
      print(k[1])

n=int(input())
l=[int(input()) for _ in range(n)]
k=sorted(l)

for i in l:
	if i<k[-1]:
    	print(k[-1])
	if i==k[-1]:
		print(k[-2])

n=int(input())
l=[int(input()) for _ in range(n)]
k=sorted(l)

for i in l:
	if i<k[-1]:
		print(k[-1])
	if i==k[-1]:
		print(k[-2])


Verdicts: Wrong Answer

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())
list=[int(input()) for i in range(n)]

for i in range(n):
  listA=list.remove[i]
  print(max(listA))

n=int(input())
l1=[int(input()) for i in range(n)]
l2=sorted(l1)
max1=l2[-1]
max2=l2[-2]
for i in l1:
  if 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):
l,r = map(int,input().split())

r = min(r, l+4038)

min = 99999999
for i in range(l,r):
  for j in range(i+1,r+1):
    value = (i*j)%2019
    if min > value:
      min = value
print(min)

import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]


i1 = np.argmax(a)
temp = a.pop(i1)

i2 = np.argmax(a)
a.insert(i1, temp)

for i in range(n):
  if i == i1:
    print(a[i2])
  else:
    print(a[i1])
  

import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]


i1 = np.argmax(a)
temp = a[i1]
a[i1] = 0

i2 = np.argmax(a)
a[i1] = temp


for i in range(n):
  if i == i1:
    print(a[i2])
  else:
    print(a[i1])
  

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):
n=int(input())
a=[int(input()) for i in range(n)]
for _ in range(n):
  #b=a[0:_]+a[_+1:n]
  #print(max(b))
  print(max(a[0:_]),max(a[_+1:n]))


n=int(input())
a=[int(input()) for i in range(n)]
for _ in range(n):
  #b=a[0:_]+a[_+1:n]
  #print(max(b))
  print(max(max(a[0:_]),max(a[_+1:n])))


import numpy as np
n=int(input())
a=np.zeros(n)
print(a)
for _ in range(n):
  x=int(input())
  a[_]=x
a=list(a)
for _ in range(n):
  b=a[0:_]+a[_+1:n]
  print(max(b))

n,*a=map(int,open(0).read().split())
b=sorted(a)[::-1]
ma1=b[0]
ma2=b[1]
for i in a:
  if ma1==i:
    print(ma2)
  else:
    print(ma1)
    

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())
a = [int(input()) for _ in range(n)]
sorted_a = sorted(a)
for i in range(n):
    if a[i] != sorted_a[-1]:
        print(sorted_a[-2])
    else:
        print(sorted_a[-1])


n = int(input())
a = [int(input()) for _ in range(n)]
sorted_a = sorted(a)
for i in range(n):
    if a[i] != sorted_a[-1]:
        print(sorted_a[-1])
    else:
        print(sorted_a[-2])


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=[]
for i in range(n):
    x=int(input())
    l.append(x)
x=sorted(l)
for i in range(n):
    if l[i]==x:
        print(x[-2])
    else:
        print(x[-1])

n=int(input())
l=[]
for i in range(n):
    x=int(input())
    l.append(x)
x=max(l)
for i in range(n):
    if l[i]==x:
        l[i]=0
for i in range(n):
    if l[i]==0:
        print(x)
    else:
        print(l[i])


n=int(input())
l=[]
for i in range(n):
    x=int(input())
    l.append(x)
x=sorted(l)
for i in range(n):
    if l[i]==x[-1]:
        print(x[-2])
    else:
        print(x[-1])

Verdicts: Wrong Answer

Wrong Answer

Accepted