Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
a = list(map(int,input().split()))
ans = ""

lis = [a[0]] + [0] * (n-1)
fo = 1
be = -1

if n % 2 == 0:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:

            lis[be] = a[i]
            be -= 1
            #ans = str(a[i])+" "+ans

        else:

            lis[fo] = a[i]
            fo += 1
            #ans = ans+" "+ str(a[i])


else:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:
            
            lis[fo] = a[i]
            fo += 1
            #ans = str(a[i])+" "+ans

        else:
            
            lis[be] = a[i]
            be -= 1
            #ans = ans+" "+ str(a[i])

            
for i in range(n):

        i -= n//2

        ans += str(lis[i]) + " "


#print(lis)
print(ans)


Fixed submission:

n = int(input())
a = list(map(int,input().split()))
ans = ""

lis = [a[0]] + [0] * (n-1)
fo = 1
be = -1

if n % 2 == 0:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:

            lis[be] = a[i]
            be -= 1
            #ans = str(a[i])+" "+ans

        else:

            lis[fo] = a[i]
            fo += 1
            #ans = ans+" "+ str(a[i])


else:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:
            
            lis[fo] = a[i]
            fo += 1
            #ans = str(a[i])+" "+ans

        else:
            
            lis[be] = a[i]
            be -= 1
            #ans = ans+" "+ str(a[i])

            
for i in range(n):

        i -= n//2

        ans += str(lis[i]) + " "


#print(lis)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
a = list(map(int,input().split()))
ans = str(a[0])

if n % 2 == 0:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:

            ans = str(a[i])+" "+ans

        else:

            ans = ans+" "+ str(a[i])

else:

    for i in range(n-1):

        i+=1

        if i % 2 == 0:

            ans = str(a[i])+" "+ans

        else:

            ans = ans+" "+ str(a[i])

print(ans)


Fixed submission:

n = int(input())
a = list(map(int,input().split()))
ans = ""

lis = [a[0]] + [0] * (n-1)
fo = 1
be = -1

if n % 2 == 0:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:

            lis[be] = a[i]
            be -= 1
            #ans = str(a[i])+" "+ans

        else:

            lis[fo] = a[i]
            fo += 1
            #ans = ans+" "+ str(a[i])


else:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:
            
            lis[fo] = a[i]
            fo += 1
            #ans = str(a[i])+" "+ans

        else:
            
            lis[be] = a[i]
            be -= 1
            #ans = ans+" "+ str(a[i])

            
for i in range(n):

        i -= n//2

        ans += str(lis[i]) + " "


#print(lis)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
a = list(map(int,input().split()))
ans = str(a[0])

if n % 2 == 0:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:

            ans = str(a[i])+" "+ans

        else:

            ans = ans+" "+ str(a[i])

else:

    for i in range(n-1):

        i+=1

        if i % 2 == 0:

            ans = str(a[i])+" "+ans

        else:

            ans = ans+" "+ str(a[i])

print(ans)


Fixed submission:

n = int(input())
a = list(map(int,input().split()))
ans = ""

lis = [a[0]] + [0] * (n-1)
fo = 1
be = -1

if n % 2 == 0:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:

            lis[be] = a[i]
            be -= 1
            #ans = str(a[i])+" "+ans

        else:

            lis[fo] = a[i]
            fo += 1
            #ans = ans+" "+ str(a[i])


else:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:
            
            lis[fo] = a[i]
            fo += 1
            #ans = str(a[i])+" "+ans

        else:
            
            lis[be] = a[i]
            be -= 1
            #ans = ans+" "+ str(a[i])

            
for i in range(n):

        i -= n//2

        ans += str(lis[i]) + " "


#print(lis)
print(ans)