Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = [int(input()) for _ in range(n)]
b = copy.copy(a)
b.sort(reverse=True)
s = b[1]
m = max(a)

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

Fixed submission:
import copy
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
b = copy.copy(a)
a.sort(reverse=True)
for i in range(n):
    if b[i] == a[0]:
        print(a[1])
    else:
        print(a[0])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = [int(input()) for _ in range(n)]
b = copy.copy(a)
b.sort(reverse=True)
m = max(a)

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

Fixed submission:
import copy
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
b = copy.copy(a)
a.sort(reverse=True)
for i in range(n):
    if b[i] == a[0]:
        print(a[1])
    else:
        print(a[0])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = [int(input()) for _ in range(n)]
b = copy.copy(a)
b.sort(reverse=True)
m = max(a)

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

Fixed submission:
import copy
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
b = copy.copy(a)
a.sort(reverse=True)
for i in range(n):
    if b[i] == a[0]:
        print(a[1])
    else:
        print(a[0])

Buggy python submission (verdict: Runtime Error):
import copy
n = int(input())
a = [int(input()) for _ in range(n)]
b = (copy.copy(a)).sort(reverse=True)
m = max(a)

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

Fixed submission:
import copy
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
b = copy.copy(a)
a.sort(reverse=True)
for i in range(n):
    if b[i] == a[0]:
        print(a[1])
    else:
        print(a[0])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
a = [int(input()) for _ in range(n)]
m = max(a)

for i in range(n):
    if a[i] != max(a):
        print(max(a))
    else:
        b = copy.copy(a)
        b.pop(i)
        print(max(b))

Fixed submission:
import copy
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
b = copy.copy(a)
a.sort(reverse=True)
for i in range(n):
    if b[i] == a[0]:
        print(a[1])
    else:
        print(a[0])

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

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


Fixed submission:
import copy
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
b = copy.copy(a)
a.sort(reverse=True)
for i in range(n):
    if b[i] == a[0]:
        print(a[1])
    else:
        print(a[0])

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

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

Fixed submission:
import copy
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
b = copy.copy(a)
a.sort(reverse=True)
for i in range(n):
    if b[i] == a[0]:
        print(a[1])
    else:
        print(a[0])