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

numbers_minus1 = numbers_full
for i, tmp in enumerate(numbers_full):
  numbers_minus1[i] = 0
  print(str(max(numbers_minus1)))
  numbers_minus1[i] = tmp

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

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

numbers_minus1 = numbers_full
for i, tmp in enumerate(numbers_full):
  numbers_minus1[i] = 0
  print(str(max(numbers_minus1)))
  numbers_minus1[i] = tmp

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

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

for i in range(N):
  numbers_minus1 = numbers_full
  tmp = numbers_minus1[i]
  numbers_minus1[i] = 0
  print(str(max(numbers_minus1)))
  numbers_minus1[i] = tmp

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):
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()
  numbers_minus1[i] = 0
  print(str(max(numbers_minus1)))

Fixed submission:
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))

Buggy python submission (verdict: Time Limit Exceeded):
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)))
  print(str(max(numbers_minus1)))

Fixed submission:
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))