Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    A = input().split()
    ans = []
    if n % 2 == 0:
        for i in range(0, n - 1, 2):
            ans.append(A[i])
            ans = [A[i + 1]] + ans
    else:
        for i in range(0, n - 1, 2):
            ans.append(A[i + 1])
            ans = [A[i]] + ans
        ans = [A[-1]] + ans
    print(' '.join(ans))


main()


Fixed submission:
def main():
    n = int(input())
    A = input().split()
    B = [0] * n
    k = n % 2
    l = n // 2
    if k == 0:
        l -= 1
    r = l + 1
    for i in range(n):
        if i % 2 != k:
            B[l] = A[i]
            l -= 1
        else:
            B[r] = A[i]
            r += 1
    print(' '.join(B))


main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    A = input().split()
    ans = []
    if n % 2 == 0:
        for i in range(0, n - 1, 2):
            ans.append(A[i])
            ans.insert(0, A[i + 1])
    else:
        for i in range(0, n - 1, 2):
            ans.append(A[i + 1])
            ans.insert(0, A[i])
        ans.insert(0, A[-1])
    print(' '.join(ans))


main()


Fixed submission:
def main():
    n = int(input())
    A = input().split()
    B = [0] * n
    k = n % 2
    l = n // 2
    if k == 0:
        l -= 1
    r = l + 1
    for i in range(n):
        if i % 2 != k:
            B[l] = A[i]
            l -= 1
        else:
            B[r] = A[i]
            r += 1
    print(' '.join(B))


main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    A = input().split()
    ans = []
    if n % 2 == 0:
        for i in range(0, n - 1, 2):
            ans.append(A[i])
            ans.insert(0, A[i + 1])
    else:
        for i in range(0, n - 1, 2):
            ans.append(A[i + 1])
            ans.insert(0, A[i])
        ans.insert(0, A[-1])
    print(' '.join(ans))


main()


Fixed submission:
def main():
    n = int(input())
    A = input().split()
    B = [0] * n
    k = n % 2
    l = n // 2
    if k == 0:
        l -= 1
    r = l + 1
    for i in range(n):
        if i % 2 != k:
            B[l] = A[i]
            l -= 1
        else:
            B[r] = A[i]
            r += 1
    print(' '.join(B))


main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = input().split()
    k = n % 2
    ans = ''
    for i in range(n):
        if i % 2 == k:
            ans += a[i] + ' '
        else:
            ans = a[i] + ' ' + ans
    print(ans.rstrip(' '))


main()


Fixed submission:
def main():
    n = int(input())
    A = input().split()
    B = [0] * n
    k = n % 2
    l = n // 2
    if k == 0:
        l -= 1
    r = l + 1
    for i in range(n):
        if i % 2 != k:
            B[l] = A[i]
            l -= 1
        else:
            B[r] = A[i]
            r += 1
    print(' '.join(B))


main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    A = input().split()
    B = []
    k = n % 2
    for i in range(n):
        if i % 2 == k:
            B.append(A[i])
        else:
            B.insert(0, A[i])
    print(' '.join(B))


main()


Fixed submission:
def main():
    n = int(input())
    A = input().split()
    B = [0] * n
    k = n % 2
    l = n // 2
    if k == 0:
        l -= 1
    r = l + 1
    for i in range(n):
        if i % 2 != k:
            B[l] = A[i]
            l -= 1
        else:
            B[r] = A[i]
            r += 1
    print(' '.join(B))


main()