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

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

    for i in range(len(A)):
        ans = calcMax(A, i)
        print(ans)



def calcMax(A, i):
    ans = max(A)
    if not ans == A[i]:
        return ans

    else:
        tmp = A[i]
        A[i] = 0
        ans = calcMax(A, i)
        A[i] = tmp
        return ans

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max1st = max(A)
    max1stIndex = A.index(max1st)

    for i in range(len(A)):
        if i == max1stIndex:
            tmp = A[i]
            A[i] = 0
            print(max(A))
            continue

        print(max1st)




if __name__ == '__main__':
    main()

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

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

    for i in range(len(A)):
        ans = calcMax(A, i)
        print(ans)



def calcMax(A, i):
    ans = max(A)
    if not ans == A[i]:
        return ans

    else:
        tmp = A[i]
        A[i] = 0
        ans = calcMax(A, i)
        A[i] = tmp
        return ans

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max1st = max(A)
    max1stIndex = A.index(max1st)

    for i in range(len(A)):
        if i == max1stIndex:
            tmp = A[i]
            A[i] = 0
            print(max(A))
            continue

        print(max1st)




if __name__ == '__main__':
    main()

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

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

    for i in range(len(A)):
        tmp = A[i]
        A[i] = 0
        print(max(A))
        A[i] = tmp

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max1st = max(A)
    max1stIndex = A.index(max1st)

    for i in range(len(A)):
        if i == max1stIndex:
            tmp = A[i]
            A[i] = 0
            print(max(A))
            continue

        print(max1st)




if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

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

B = copy.copy(A)

for i in range(len(A)):
    A[i] = 0
    print(max(A))
    A[i] = B[i]


Fixed submission:
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max1st = max(A)
    max1stIndex = A.index(max1st)

    for i in range(len(A)):
        if i == max1stIndex:
            tmp = A[i]
            A[i] = 0
            print(max(A))
            continue

        print(max1st)




if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

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

B = copy.copy(A)

for i in range(len(A)):
    A[i] = 0
    print(max(A))
    A[i] = B[i]


Fixed submission:
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max1st = max(A)
    max1stIndex = A.index(max1st)

    for i in range(len(A)):
        if i == max1stIndex:
            tmp = A[i]
            A[i] = 0
            print(max(A))
            continue

        print(max1st)




if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

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

B = copy.copy(A)

for i in range(len(A)):
    A[i] = 0
    print(max(A))
    A[i] = B[i]


Fixed submission:
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max1st = max(A)
    max1stIndex = A.index(max1st)

    for i in range(len(A)):
        if i == max1stIndex:
            tmp = A[i]
            A[i] = 0
            print(max(A))
            continue

        print(max1st)




if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())

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

for i in range(len(A)):
    B = copy.copy(A)
    del(B[i])
    # print("B = {}".format(B))
    print(max(B))


Fixed submission:
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    max1st = max(A)
    max1stIndex = A.index(max1st)

    for i in range(len(A)):
        if i == max1stIndex:
            tmp = A[i]
            A[i] = 0
            print(max(A))
            continue

        print(max1st)




if __name__ == '__main__':
    main()