Problem:
 Score : 300 points    Problem Statement You are given an integer sequence of length n , a_1, ..., a_n .
Let us consider performing the following n operations on an empty sequence b .  The i -th operation is as follows:   Append a_i to the end of b .  Reverse the order of the elements in b .   Find the sequence b obtained after these n operations.      Constraints  1 \leq n \leq 2\times 10^5  0 \leq a_i \leq 10^9  n and a_i are integers.         Input Input is given from Standard Input in the following format:  n  a_1  a_2  ...  a_n       Output Print n integers in a line with spaces in between.
The i -th integer should be b_i .        Sample Input 1 4
1 2 3 4      Sample Output 1 4 2 1 3   After step 1 of the first operation, b becomes: 1 .  After step 2 of the first operation, b becomes: 1 .  After step 1 of the second operation, b becomes: 1, 2 .  After step 2 of the second operation, b becomes: 2, 1 .  After step 1 of the third operation, b becomes: 2, 1, 3 .  After step 2 of the third operation, b becomes: 3, 1, 2 .  After step 1 of the fourth operation, b becomes: 3, 1, 2, 4 .  After step 2 of the fourth operation, b becomes: 4, 2, 1, 3 .   Thus, the answer is 4 2 1 3 .       Sample Input 2 3
1 2 3      Sample Output 2 3 1 2  As shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2 .       Sample Input 3 1
1000000000      Sample Output 3 1000000000       Sample Input 4 6
0 6 7 6 7 0      Sample Output 4 0 6 6 0 7 7

Solution (Python):
n = int(input())
lst = [int(i) for i in input().split()]

lstb = [0]*n

mid = n//2
if n % 2 == 0:
    for i in range(n):
        if i%2 == 0:
            lstb[mid + i//2] = lst[i]
        else:
            lstb[mid - i//2 - 1] = lst[i]
else:
    for i in range(n):
        if i==0:
            lstb[mid] = lst[i]
        elif i%2 == 0:
            lstb[mid - i//2] = lst[i]
        else:
            lstb[mid + i//2 + 1] = lst[i]

ans = ''
for i in range(n):
    ans += str(lstb[i])+' '
print(ans[:-1])

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
if n%2 == 0:
    print(*(li[1::2][::-1] + li[0::2]))
elif n%2 ==1:
    print(*(li[0::2][::-1] + li[1::2]))

Solution (Python):
from collections import deque

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

d = deque()
for i in range(n):
    if i % 2 != 0:
        d.append(a[i])
    else:
        d.appendleft(a[i])

if n % 2 == 0:
    print(*list(d)[::-1])
else:
    print(*d)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = [0]*n
for i in range(n):
    if i % 2 == 0:
        b[n//2+i//2] = a[i]
    else:
        b[n//2-i//2-1] = a[i]

if n % 2 == 1:
    print(*b[::-1])
else:
    print(*b)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = [0]*n
for i in range(n):
    if i % 2 == 0:
        b[n//2+i//2] = a[i]
    else:
        b[n//2-i//2-1] = a[i]
        
if n % 2 == 1:
    b = b[::-1]

if len(b) == 1:
    print(b[0])

else:
    for i in range(len(b)-1):
        print(b[i], end=" ")
    print(b[i+1])

Solution (Python):
from collections import deque

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

d = deque()
for i in range(n):
    if i % 2 != 0:
        d.append(a[i])
    else:
        d.appendleft(a[i])

if n % 2 == 0:
    print(*list(reversed(d)))
else:
    print(*d)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print(' '.join(map(str,A[::-2]+A[N%2::2])))

Solution (Python):

import sys, math, fractions, itertools


def solve(n: int, a: "List[int]"):
    r = [str(rr) for rr in list(reversed(a[::2]))]
    l = [str(rr) for rr in a[1::2]]
    if n % 2 == 1:
        print(' '.join(r + l))
    else:
        print(' '.join(list(reversed(r+l))))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(n) ]  
    solve(n, a)

if __name__ == '__main__':
    main()

Solution (Python):

import sys, math, fractions, itertools


def solve(n: int, a: "List[int]"):
    r = [str(rr) for rr in list(reversed(a[::2]))]
    l = [str(rr) for rr in a[1::2]]
    if n % 2 == 1:
        print(' '.join(r + l))
    else:
        print(' '.join(list(reversed(r+l))))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(n) ]  
    solve(n, a)

if __name__ == '__main__':
    main()

Solution (Python):

n = int(input())
an = list(map(int,input().split()))
an.reverse()
b = [0] * n
for i,v in enumerate(an):
    if i%2==0:
        b[i//2]=v
    else:
        b[n-i//2-1]=v
print(" ".join(map(str,b)))

Solution (Python):
def f(n):
    l = []
    for i in range(n):
        l.append(i)
        l = l[::-1]
    return l

def index(N):
    if N % 2 == 0:
        L = list(range(1, N, 2)[::-1])
        L.extend(range(0, N, 2))
    else:
        L = list(range(2, N, 2)[::-1])
        L.append(0)
        L.extend(range(1, N-1, 2))
    return L

def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    print(*[A[i] for i in index(N)])
main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))


if n%2 == 0:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(0, n, 2):
        print(a[i], end=' ')
    
elif n%2 == 1:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(1, n, 2):
        print(a[i], end=' ')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))


if n%2 == 0:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(0, n, 2):
        print(a[i], end=' ')
    
elif n%2 == 1:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(1, n, 2):
        print(a[i], end=' ')

Solution (Python):
from collections import deque

n = int(input())
A = list(map(int, input().split()))
D = deque()
for i in range(n):
    if i % 2 == 0:
        D.append(A[i])
    else:
        D.appendleft(A[i])
if i % 2 == 0:
    D.reverse()
print(*D)

Solution (Python):
N = int(input())
nums = list(input().split())
odd = []
even = []
for idx, num in enumerate(nums):
  if idx%2 == 0:
    even.append(num)
  else:
    odd.append(num)
if N%2 == 0:
  print(' '.join(odd[::-1]+even))
else:
  print(' '.join(even[::-1]+odd))

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
 




 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    A = inputList()
    
    b = [0 for _ in range(N)]
    base = (N//2)
    cnt = 1
    
    flg = False
    if N % 2 == 0:
        flg = True
    
    for i, val in enumerate(A):
        
        if flg == True:
            if i == 0:
                b[base] = val
            elif i % 2 == 1:
                b[base-cnt] = val
            else:
                b[base+cnt] = val
                cnt+=1
        else:
            if i == 0:
                b[base] = val
            elif i % 2 == 1:
                b[base+cnt] = val
            else:
                b[base-cnt] = val
                cnt+=1
    
    print(*b)
    
        
if __name__ == "__main__":
	main()

Solution (Python):


def main(n,A):
    B = []
    if n%2==1:
        for i in range(n-1,-1,-2):
            B.append(A[i])
        for i in range(1,n-1,2):
            B.append(A[i])
    else:
        for i in range(n-1,0,-2):
            B.append(A[i])
        for i in range(0,n-1,2):
            B.append(A[i])
        
    print(" ".join(B))
    
if __name__ == '__main__':
    n = int(input())
    A = [str(a) for a in input().split()]
    main(n,A)

Solution (Python):
n = int(input())
a = input().split()

a_odd = a[0::2]
a_even = a[1::2]

if n % 2 == 1:
    print(" ".join(a_odd[::-1] + a_even))
else:
    print(" ".join(a_even[::-1] + a_odd))

Solution (Python):



N = int(input())
tmp = input()
list = []
list = tmp.split()

if (N % 2 == 0):
    for i in range(N - 1, -1, -2):
        print(list[i], end=" ")
    for i in range(0, N, 2):
        print(list[i], end=" ")
else:
    for i in range(N - 1, -1, -2):
        print(list[i], end=" ")
    for i in range(1, N, 2):
        print(list[i], end=" ")

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
for i in range(n-1,-1,-2):print(a[i],end=' ')
for i in range(n%2,n,2):print(a[i],end=' ')

Solution (Python):
from collections import deque

N = int(input())
A = list(map(int, input().split()))
B = deque([])

for i, a in enumerate(A):
    if i % 2 == 0:
        B.append(a)
    else:
        B.appendleft(a)

C = list(B)
if N % 2 == 1:
    C = C[::-1]

for c in C:
    print(c, end=' ')
print()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range((n - 1) // 2 + 1):
    b.append(a[n - 1 - 2 * i])
for i in range(n // 2):
    b.append(a[2 * i + n % 2])
for i in range(n):
    print(b[i], end = " ")
print()

Solution (Python):
import sys
input=sys.stdin.readline
n=int(input())
a_list=list(map(int,input().split()))
if n%2==0:
    c=n//2
    x=n
    for i in range(c):
        print(a_list[x-1],end='')
        print(' ',end='')
        x-=2
    x=1
    for i in range(c):
        print(a_list[x-1],end='')
        print(' ',end='')
        x+=2
else:
    c=n//2
    x=n
    for i in range(c+1):
        print(a_list[x-1],end='')
        print(' ',end='')
        x-=2
    x=2
    for i in range(c):
        print(a_list[x-1],end='')
        print(' ',end='')
        x+=2

Solution (Python):
from collections import deque
def main():
    n = int(input())
    a = [0] + list(map(int, input().split()))
    b = deque(maxlen=n+1)
    for i in range(1,n+1):
        if (i % 2 == 0 and n % 2 == 0 ) or (i % 2 != 0 and n % 2 != 0 ):
            b.appendleft(a[i])
        else:
            b.append(a[i])

    print(*b)

main()

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
odd, even = [],[]
for i in range(n):
  if i%2 == 1:
    odd.append(a[i])
  else:
    even.append(a[i])

if n%2 == 0:
  odd.reverse()
  b = odd+even
else:
  even.reverse()
  b = even+odd
print(" ".join(map(str,b)))

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a, b, c = LI()
    print(min(a+b,b+c,c+a))
    return


def B():
    def check(s):
        x = len(s)
        if x % 2:
            return False
        if s[:x // 2] == s[x // 2:]:
            return True
    s = S()
    for i in range(1,len(s)):
        if check(s[: - i]):
            print(len(s) - i)
            return


def C():
    II()
    a = LI()
    ans1 = a[-1::-2]
    ans2 = a[-2::-2][::-1]
    ans = ans1 + ans2
    print(*ans)
    return


def D():
    return


if __name__ == '__main__':
    C()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

b1=[]
b2=[]
offset=0
if n%2==1:
    offset=1
for i in range(n):
    if (i+offset)%2==0:
        b1.append(a[i])
    else:
        b2.append(a[i])
b2=list(reversed(b2))
b=b2+b1
for i in b:
    print(i,end=" ")

Solution (Python):
n=int(input())
a_L=list(input().split())
ans1=[]
ans2=[]

if n==1:
	print(a_L[0])
else:
	for i in range(0,n,2):
		ans2.append(a_L[i])
	for i in range(1,n,2):
		ans1.append(a_L[i])


if n%2==0:
	ans1.reverse()
	print(*(ans1+ans2))
else:
	ans2.reverse()
	print(*(ans2+ans1))

Solution (Python):
n=int(input())
A=list(map(str,input().split()))
ans=A[1::2][::-1]+A[::2]
if n%2==1:
  print(*[ans[::-1]][0])

else:
  print(*[ans][0])

Solution (Python):
from collections import deque

n = int(input())
a = [int(i) for i in input().split()]
d = deque()
for i, v in enumerate(a):
    if i % 2: d.append(v)
    else: d.appendleft(v)
print(*d if n % 2 else reversed(d))

Solution (Python):



import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 

n = int(input())
a = [int(i) for i in readline().split()]

from collections import deque

ans = deque()

x = 1
for i in a:
    if x: ans.append(i)
    else: ans.appendleft(i)
    x^=1

if x: print(*ans)
else: print(*(reversed(ans)))

Solution (Python):



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

front = []
back = []

for i in range(n):
    if i % 2 == 0:
        front.append(a[i])
    else:
        back.append(a[i])
if n % 2 == 1:
    front = front[::-1]
    ans = front+back
    print(' '.join(map(str,ans)))
else:
    back = back[::-1]
    ans = back+front
    print(' '.join(map(str,ans)))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

b = [0] * n


if n % 2 == 1:
    for i in reversed(range(n)):
        if i % 2 == 1:
            b[n // 2 + int(i/2 + 0.9)] = a[i]
        else:
            b[n // 2 - int(i/2 + 0.9)] = a[i]
else:
    for i in reversed(range(n)):
        if i % 2 == 1:
            b[n // 2 - 1 + int(i/2 + 0.9)] = a[i]
        else:
            b[n // 2 - 1 - int(i/2 + 0.9)] = a[i]


if n % 2 == 1:
    for i in b:
        print(i, end=" ")
else:
    for i in reversed(b):
        print(i, end=" ")

Solution (Python):
BIGMOD = 10**9+7

def modPow(x,n):
    ans = 1
    while n >= 1:
        if bin( n & 1)==bin(1):
            ans = (ans*x) % BIGMOD
        x = x * x % BIGMOD
        n = n>>1
    return ans % BIGMOD

def modFact(N):
    fact = []
    fact.append(1) 
    for i in range(1,N+1):
        a = fact[i-1]*i % BIGMOD
        fact.append(a)
    return fact

def modInvFact(fact):
    invFact = []
    for i in range(1,N+2):
        a = modPow(fact[i-1],BIGMOD-2)
        invFact.append(a)
    return invFact

def modPlus(a,b):
    return (a + b) % BIGMOD

def modMinus(a,b):
    if a-b >= 0:
        return (a - b) % BIGMOD
    else:
        return (a - b + BIGMOD)
    
def modMulti(a,b):
    return a * b % BIGMOD


def nCr(fact,invFact,n,r):
    return (fact[n] * invFact[r] * invFact[n-r] ) %BIGMOD

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

odda = []
evena = []
for i in range(n):
    if i%2 == 0:
        odda.append(a[i])
    else:
        evena.append(a[i])
ans = []
if n%2 == 0:
    evena.reverse()
    for i in range(len(evena)):
        ans.append(evena[i])
    for i in range(len(odda)):
        ans.append(odda[i])
else:
    odda.reverse()
    for i in range(len(odda)):
        ans.append(odda[i])
    for i in range(len(evena)):
        ans.append(evena[i])

print(" ".join(map(str,ans)))

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int, input().split()))
dq = deque()
dq.append(a[0])
if n % 2:
    for i in range(1, n):
        if i % 2:
            dq.append(a[i])
        else:
            dq.appendleft(a[i])
else:
    for i in range(1, n):
        if i % 2:
            dq.appendleft(a[i])
        else:
            dq.append(a[i])
print(*dq)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(*a[::-2], end=" ")
print(*a[n%2::2])

Solution (Python):
N=int(input())
s=list(input().split())
b=s[N::-2]+s[N%2::2]
print(*(b))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in [i for i in range(n) if i%2 != n%2][::-1]:
     ans += [a[i]]

for i in [i for i in range(n) if i%2 == n%2]:
     ans += [a[i]]

print(*ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = []
if n % 2 == 0:
    for i in [i for i in range(n) if i%2 == 1][::-1]:
         ans += [a[i]]

    for i in [i for i in range(n) if i%2 == 0]:
         ans += [a[i]]

if n % 2 == 1:
    for i in [i for i in range(n) if i%2 == 0][::-1]:
         ans += [a[i]]

    for i in [i for i in range(n) if i%2 == 1]:
         ans += [a[i]]

print(*ans)

Solution (Python):
from collections import deque

n=int(input())
a=list(input().split())

que=deque()

for i in range(n):
    if n%2==i%2:que.append(a[i])
    else:que.appendleft(a[i])
print(*que)

Solution (Python):
n=int(input())
a=list(input().split())

even,odd=[],[]

for i in range(n):
    if i%2==0:even+=[a[i]]
    else:odd+=[a[i]]

if n%2==0:print(*odd[::-1]+even)
else:print(*even[::-1]+odd)

Solution (Python):
def main():
    n = int(input())
    A = input().split()
    if n % 2 == 0:
        print(' '.join(A[1::2][::-1] + A[0::2]))
    else:
        print(' '.join(A[0::2][::-1] + A[1::2]))


main()

Solution (Python):
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()

Solution (Python):
from collections import deque
n=int(input())
a=list(map(int,input().split()))

ans=deque()

if n%2==0:
    for i in range(n):
        if i%2==0:
            ans.append(a[i])
        else:
            ans.appendleft(a[i])
else:
    for i in range(n):
        if i%2==1:
            ans.append(a[i])
        else:
            ans.appendleft(a[i])

print(" ".join(map(str, ans)))

Solution (Python):

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
            

        else:

            lis[fo] = a[i]
            fo += 1
            


else:

    for i in range(n-1):

        i+=1

        if i % 2 == 1:
            
            lis[fo] = a[i]
            fo += 1
            

        else:
            
            lis[be] = a[i]
            be -= 1
            

            
for i in range(n):

        i -= n//2

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



print(ans)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
b = list(reversed(a[0::2])) + a[1::2]
if N%2==0:print(*list(reversed(b)))
else:print(*b)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

key = len(A) % 2
ans = [0]*N
mid = (len(A)) // 2
for i in range(N):
    ans[mid + ((-1)**(i+key))*((i+1)//2)] = A[i]
for i in range(N):
    print(ans[i], end = " ")
print("")

Solution (Python):
def main():
    n = int(input())
    a = input().split()
    if n%2: ans = a[n-1::-2] + a[1:n-1:2]
    else: ans = a[n-1:0:-2] + a[0:n-1:2]
    print(" ".join(ans))
if __name__=="__main__": main()

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
b = l[::-2]+l[n%2::2]
b = [str(i)for i in b]
print(" ".join(b))

Solution (Python):
from collections import deque
n=int(input())
A=list(input().split())
B=deque([])
if n%2==0:
    for i in range(n//2):
        B.append(A[i*2])
        B.appendleft(A[i*2+1])
    print(" ".join(B))
else:
    for j in range((n-1)//2):
        B.append(A[j*2])
        B.appendleft(A[j*2+1])
    B.append(A[n-1])
    B.reverse()
    print(" ".join(B))

Solution (Python):

import sys


def solve(n: int, a: "List[int]"):
    from collections import deque

    d = deque()
    for i in range(n):
        if(i%2 == 0):
            d.append(a[i])
        else:
            d.appendleft(a[i])

    if(n%2 == 1):
        d.reverse()

    d = map(str, d)
    print(' '.join(d))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(n) ]  
    solve(n, a)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
print(*a[-1::-2]+a[n%2::2])

Solution (Python):
"""
1 2 3 4 5 6 7

1

1 2
2 1

2 1 3
3 1 2

3 1 2 4
4 2 1 3

4 2 1 3 5
5 3 1 2 4

5 3 1 2 4 6
6 4 2 1 3 5

6 4 2 1 3 5 7
7 5 3 1 2 4 6
"""

n = int(input())
a = list(map(int, input().split()))
ans = ""
if(n % 2 == 0):
    for i in range(n-1, 0, -2):
        ans += str(a[i]) + " "
    for i in range(0, n-1, 2):
        ans += str(a[i]) + " "
    print(ans)
else:
    for i in range(n-1, -1, -2):
        ans += str(a[i]) + " "
    for i in range(1, n-1, 2):
        ans += str(a[i]) + " "
    print(ans)

Solution (Python):


def main():
    num = int(input())
    data = list(map(int, input().split()))
    a = data[0::2]
    b = data[1::2]
    if num % 2 == 0:
        ans = b[::-1] + a
    else:
        ans = a[::-1] + b
    print(' '.join(list(map(str, ans))))




if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = list(input().split())


med = N // 2
B = ['0' for i in range(N)]
fo = []


if N % 2 == 0:
    f_c = med
    for i in range(0, N, 2):
        B[f_c] = A[i]
        f_c += 1

    
    
    B = B[::-1]
    f_c = med
    for i in range(1, N, 2):
        B[f_c] = A[i]
        f_c += 1

    B = B[::-1]
    
    print(' '.join(B))

else:
    B[med] = A[0]
    f_c = med+1
    for i in range(1, N, 2):
        B[f_c] = A[i]
        f_c += 1
    
    B = B[::-1]
    
    f_c = med
    for i in range(0, N, 2):
        B[f_c] = A[i]
        f_c += 1

    B = B[::-1]
    print(' '.join(B))

Solution (Python):
n =int(input())
a = list(map(str,input().split()))
lss = []
lse = []
if n%2==0:
    for i in range(n//2):
        lss.append(a[2*i])
    for i in range(n//2):
        lse.append(a[n-(2*i+1)])

else:
    for i in range(n//2):
        lss.append(a[2*i+1])
    for i in range(n//2+1):
        lse.append(a[n-2*i-1])


ls = lse+lss

print(" ".join(ls))

Solution (Python):
n = int(input())
A = [int(i) for i in input().split()]
center = n//2
ans = [0 for i in range(n)]
haba = 1
hugou = n%2 == 1

for a in A:
    ans[center] = a
    if hugou:
        center += haba
    else:
        center -= haba
    haba += 1
    hugou = not(hugou)
for i in ans[:-1]:
    print(i,end = " ")
print(ans[-1])

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=[]
if n%2==0:
    for i in range(n//2):
        ans.append(a[n-1-2*i])
    for i in range(n//2):
        ans.append(a[2*i])
else:
    for i in range(n//2+1):
        ans.append(a[n-1-2*i])
    for i in range(n-n//2-1):
        ans.append(a[1+2*i])

ans = map(str,ans)
print(' '.join(ans))

Solution (Python):
from collections import deque

N = int(input())
*A, = map(int, input().split())
B = deque([])
for i, a in enumerate(A):
    if i % 2 == 0:
        B.append(a)
    else:
        B.appendleft(a)
if N % 2 == 1:
    B.reverse()
print(*B)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
b = []
k = (n-1)//2
for i in range(k, 0, -1):
    b.append(a[i*2])
b.append(a[0])
k = n//2
for i in range(k):
    b.append(a[i*2+1])
if n%2 == 0:
    b = b[::-1]
print(*b)

Solution (Python):

import sys
sys.setrecursionlimit(300000)


def solve(n: int, a: "List[int]"):
    ret = []
    if n % 2 == 0:
        for i in range(n - 1, 0, -2):
            ret.append(a[i])
        for i in range(0, n - 1, 2):
            ret.append(a[i])
    else:
        for i in range(n - 1, -1, -2):
            ret.append(a[i])
        for i in range(1, n - 1, 2):
            ret.append(a[i])
    print(' '.join([str(r) for r in ret]))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(n) ]  
    solve(n, a)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=list(input().split())
b=[]
if len(a)%2==0:
  for i in range(n-1,0,-2):
    b.append(a[i])
  for i in range(0,n-1,2):
    b.append(a[i])
else:
  for i in range(n-1,-1,-2):
    b.append(a[i])
  for i in range(1,n-1,2):
    b.append(a[i])
print(' '.join(b))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
i=N-1
while(i>=0):
    print(A[i],end=" ")
    i-=2
if i==-2:
    i=1
else:
    i=0
while(i<N):
    print(A[i],end=" ")
    i+=2
print()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
c = []
a.reverse()
if(len(a)%2==0):
    for i in range(len(a)):
        if(i%2==0):
            c.append(a[i])
    a.reverse()
    for i in range(len(a)):
        if(i%2==0):
            c.append(a[i])
    print(*c)
else:
    for i in range(len(a)):
        if(i%2==0):
            c.append(a[i])
    a.reverse()
    for i in range(len(a)):
        if(i%2==1):
            c.append(a[i])
    print(*c)

Solution (Python):
n=int(input())
a=list(input().split())
b=[]
if len(a)%2==0:
  for i in range(n-1,0,-2):
    b.append(a[i])
  for i in range(0,n-1,2):
    b.append(a[i])
else:
  for i in range(n-1,-1,-2):
    b.append(a[i])
  for i in range(1,n-1,2):
    b.append(a[i])
print(' '.join(b))

Solution (Python):
N = int(input())
A = [int(s) for s in input().split()]

def main():
    a = A
    even = [n for i, n in enumerate(a) if i % 2 == 0]
    odd = [n for i, n in enumerate(a) if i % 2 != 0]

    l = len(a)
    if l % 2 != 0:
        even.reverse()
        ans = even + odd
    else:
        odd.reverse()
        ans = odd + even
    print(*ans)

if __name__ == '__main__':
    main()

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LS()

  l1=[]
  l2=[]

  for i in range(len(l)):
    if i%2==0:
      l1.append(l[i])
    else:
      l2.append(l[i])

  if n%2==0:
    l2.reverse()
    l2+=l1
    return ' '.join(str(x) for x in l2)
  else:
    l1.reverse()
    l1+=l2
    return ' '.join(str(x) for x in l1)

print(main())

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

if n%2 == 0:
    for i in range(n-1,-1,-2):
        print (a[i], end = ' ')
    for i in range(0, n, 2):
        print (a[i], end = ' ')
else:
    for i in range(n-1, -1, -2):
        print (a[i], end = ' ')
    for i in range(1, n, 2):
        print (a[i], end = ' ')

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
if n%2==1:
  l=l[n-1::-2]+l[1::2]
  for i in range(n):
    print(l[i],end=" ")
else:
  l=l[n-1::-2]+l[::2]
  for i in range(n):
    print(l[i],end=" ")

Solution (Python):
n = int(input())

b = ["

li = list(input().split())

if n % 2 == 0:
    for i in range(n):
        if i == 0:
            s = (n//2)
        b[s] = li[i]

        if i != n-1:
            if i % 2 == 0:
                s = s-i-1
            else:
                s = s+i+1
else:
    for i in range(n):
        if i == 0:
            s = n//2
        b[s] = li[i]
        
        if i != n-1:
            if i % 2 == 0:
                s = s+i+1
            else:
                s = s-i-1

        
print(*b)

Solution (Python):
import math
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
be = []
af = []
for i in range(math.floor(n/2)):
    be.append(a[n-(2*i)-1])
    af.append(a[n-(2*i)-2])
af.reverse()
if n%2 == 1:
    ans = be + [a[0]] + af
else:
    ans = be + af
for i in range(n):
    print(ans[i], end=' ')
print('\n')

Solution (Python):
n = int(input())

a = list(map(int, input().split()))

ans = a[::-2] + a[len(a)%2::2]

print(*ans)

Solution (Python):

import collections

n = int(input())
a = list(map(int, input().split()))
b = collections.deque()

for i in range(n):
    if i % 2 == 0:
        b.appendleft(a[i])
    else:
        b.append(a[i])

if n % 2 == 0:
    b.reverse()

for i in b:
    print('{} '.format(i), end='')
print()

Solution (Python):




n = int(input())
arr = input().split()
pre, epi = [], []
if n % 2 == 0:
    pre = arr[::-2]
    epi = arr[::2]
else:
    pre = arr[-1::-2]
    epi = arr[1::2]
print(" ".join(pre), end=" ")
print(" ".join(epi))

Solution (Python):
n = int(input())
l,r = [],[]
for i,a in enumerate([int(i) for i in input().split()]):
    if (n%2 == 0 and (i+1)%2 == 0) or (n%2 == 1 and (i+1)%2 == 1):
        l.append(str(a))
    else:
        r.append(str(a))
for a in l[::-1]:
    print(a,end=' ')
for b in r:
    print(b,end=' ')
print()

Solution (Python):
n = int(raw_input())
a = map(int, raw_input().split())

i = n-1
while i >= 0:
    print a[i],
    i -= 2

i = n % 2
while i < n:
    print a[i],
    i +=2

Solution (Python):
import collections


def main():
    n = int(input())
    a = [int(ele) for ele in input().split()]
    b = collections.deque()

    ct = 1
    for i in range(n):
        if ct % 2 == 1:
            b.append(str(a[i]))
        else:
            b.appendleft(str(a[i]))
        ct += 1

    if ct % 2 == 0:
        print(" ".join(list(b)[::-1]))
    else:
        print(" ".join(list(b)))


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]

B_right = A[0::2]
B_left = list(reversed(A[1::2]))

B_left.extend(B_right)
ans = B_left

if len(A)%2 == 1:
  ans = list(reversed(ans))

print(" ".join(map(str, ans)))

Solution (Python):
n = int(input())
dat_a = map(int, input().split())
dat_a = list(dat_a)

import collections
q = collections.deque([])
c = 1
q.append((dat_a[0]))
while True:
    if c == len(dat_a):
        break
    q.appendleft(dat_a[c])
    c += 1

    if c == len(dat_a):
        break
    q.append(dat_a[c])
    c += 1

res = list(q)

if n %2  == 1:
    res.reverse()
res = map(str, res)
print(" ".join(res))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ev = a[1::2]
od = a[::2]
if n % 2 == 0:
    ev = ev[::-1]
    ans = ev + od
else:
    od = od[::-1]
    ans = od + ev
print(" ".join(map(str, ans)))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=a[::2]
c=a[1::2]
a=b[::-1]+c if n%2==1 else c[::-1]+b
print(str(a)[1:-1].replace(",",""))

Solution (Python):

from collections import deque

n = int(input())
lst = list(map(int, input().rstrip().split()))
b = deque()
parity = n % 2
for i, j in enumerate(lst, start=1):
    if i % 2 == parity:
        b.appendleft(j)
    else:
        b.append(j)
print(*b)

Solution (Python):
N = int(input())
arr = input().split()


answer = arr[::2][::-1] + arr[1::2]
if not N&1:
  answer = answer[::-1]
  
print(*answer,sep=' ')

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
odd = a[0::2]
even = a[1::2]
ans = []
if n%2 == 0:
    even = even[::-1]
    ans = even + odd
else:
    odd = odd[::-1]
    ans = odd + even
for i in range(len(ans)):
    print(str(ans[i])+" ",end="")
print()