Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
maxa = max(A)
for i in range(N):
    if maxa == A[i]:
        tmp = A[i]
        A[i] = 0
        print(max(A))
        A[i] = tmp
    else:
        print(maxa)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maxind = A.index(max(A))
maxa = max(A)
A = sorted(A)
ans = [maxa]*maxind
ans.append(A[-2])
[ans.append(i) for i in [maxa]*(N-maxind-1)]
print(*ans,sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
maxa = max(A)
for i in range(N):
    if maxa == A[i]:
        tmp = A.pop(i)
        print(max(A))
        A.insert(i,tmp)
    else:
        print(maxa)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maxind = A.index(max(A))
maxa = max(A)
A = sorted(A)
ans = [maxa]*maxind
ans.append(A[-2])
[ans.append(i) for i in [maxa]*(N-maxind-1)]
print(*ans,sep="\n")

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
maxa = max(A)
for i in range(N):
    if maxa == A[i]:
        tmp = A.pop(i)
        print(max(A))
        insert(i,tmp)
    else:
        print(maxa)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maxind = A.index(max(A))
maxa = max(A)
A = sorted(A)
ans = [maxa]*maxind
ans.append(A[-2])
[ans.append(i) for i in [maxa]*(N-maxind-1)]
print(*ans,sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
for i in range(N):
    tmp = A.pop(i)
    print(max(A))
    A.insert(i,tmp)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maxind = A.index(max(A))
maxa = max(A)
A = sorted(A)
ans = [maxa]*maxind
ans.append(A[-2])
[ans.append(i) for i in [maxa]*(N-maxind-1)]
print(*ans,sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
A = [int(input()) for i in range(N)]
for i in range(N):
    tmp = copy.copy(A)
    tmp.pop(i)
    print(max(tmp))

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maxind = A.index(max(A))
maxa = max(A)
A = sorted(A)
ans = [maxa]*maxind
ans.append(A[-2])
[ans.append(i) for i in [maxa]*(N-maxind-1)]
print(*ans,sep="\n")

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
maxnum = max(A)
for i in range(N):
    if i == A.index(maxnum):
        tmp = A
        del tmp[tmp.index(max(tmp))]
        print(max(tmp))
    else:
        print(maxnum)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maxind = A.index(max(A))
maxa = max(A)
A = sorted(A)
ans = [maxa]*maxind
ans.append(A[-2])
[ans.append(i) for i in [maxa]*(N-maxind-1)]
print(*ans,sep="\n")

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
maxnum = max(A)
for i in range(N):
    if i == maxindex:
        tmp = A
        del tmp[tmp.index(max(tmp))]
        print(max(tmp))
    else:
        print(maxnum)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maxind = A.index(max(A))
maxa = max(A)
A = sorted(A)
ans = [maxa]*maxind
ans.append(A[-2])
[ans.append(i) for i in [maxa]*(N-maxind-1)]
print(*ans,sep="\n")