Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
b = set(a)
c = max(b)
for i in range(n):
  if a[i] != c:
    print(c)
  else:
    print(int(max(np.concatenate([a[:i], a[i+1:]]))))

Fixed submission:
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
max_a_num = a.count(max(a))
b = sorted(a, reverse=True)
m1, m2 = b[0], b[1]
for i in range(n):
  if max_a_num == 1:
    if a[i] == m1:
      print(m2)
    else:
      print(m1)
  else:
    print(m2)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]



[print(int(max(set(np.concatenate([a[:i], a[i+1:]]))))) for i in range(n)]

Fixed submission:
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
max_a_num = a.count(max(a))
b = sorted(a, reverse=True)
m1, m2 = b[0], b[1]
for i in range(n):
  if max_a_num == 1:
    if a[i] == m1:
      print(m2)
    else:
      print(m1)
  else:
    print(m2)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]

[print(int(max(np.concatenate([a[:i], a[i+1:]])))) for i in range(n)]

Fixed submission:
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
max_a_num = a.count(max(a))
b = sorted(a, reverse=True)
m1, m2 = b[0], b[1]
for i in range(n):
  if max_a_num == 1:
    if a[i] == m1:
      print(m2)
    else:
      print(m1)
  else:
    print(m2)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]

for i in range(n):
  print(int(max(np.concatenate([a[:i], a[i+1:]]))))

Fixed submission:
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
max_a_num = a.count(max(a))
b = sorted(a, reverse=True)
m1, m2 = b[0], b[1]
for i in range(n):
  if max_a_num == 1:
    if a[i] == m1:
      print(m2)
    else:
      print(m1)
  else:
    print(m2)

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

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

Fixed submission:
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
max_a_num = a.count(max(a))
b = sorted(a, reverse=True)
m1, m2 = b[0], b[1]
for i in range(n):
  if max_a_num == 1:
    if a[i] == m1:
      print(m2)
    else:
      print(m1)
  else:
    print(m2)

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

for i in range(n):
  b = a.copy()
  b.pop(i)
  print(max(b))

Fixed submission:
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
max_a_num = a.count(max(a))
b = sorted(a, reverse=True)
m1, m2 = b[0], b[1]
for i in range(n):
  if max_a_num == 1:
    if a[i] == m1:
      print(m2)
    else:
      print(m1)
  else:
    print(m2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
for i in range(n):
  b = a.copy()
  b.pop(i)
  print(max(b))

Fixed submission:
import numpy as np
n = int(input())
a =  [int(input()) for i in range(n)]
max_a_num = a.count(max(a))
b = sorted(a, reverse=True)
m1, m2 = b[0], b[1]
for i in range(n):
  if max_a_num == 1:
    if a[i] == m1:
      print(m2)
    else:
      print(m1)
  else:
    print(m2)