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



Sample input:
4
1 2 3 4


Sample output:
4 2 1 3

Submission status: Time Limit Exceeded

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  n = int(input())
  LIST = readInts()
  ANS = []
  for i in range(n):
    ANS.append(LIST[i])
    ANS = ANS[::-1]
  print(*ANS)
if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

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

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

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

ans = ' '.join(ans)
print(ans)

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
from collections import deque

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

b = deque()
for i in range(n):
    b.append(a[i])
    b.reverse()

print(*b)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ARR = [int(s) for s in input().split(" ")]
def calculate(n,arr):

    left = list([])
    right = list([])
    if n % 2 == 0:
        for index,ar in enumerate(arr):
            if index % 2 == 0:
                right.append(str(ar))
            else:
                left.insert(0,str(ar))
    else:
        for index,ar in enumerate(arr):
            if index % 2 == 0:
                left.insert(0,str(ar))
            else:
                right.append(str(ar))
    left.extend(right)

    return left

result = calculate(N,ARR)
print(" ".join(result))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ARR = [int(s) for s in input().split(" ")]
def calculate(n,arr):

    result = list([])
    if n % 2 == 0:
        for index,ar in enumerate(arr):
            if index % 2 == 0:
                result.append(str(ar))
            else:
                result.insert(0,str(ar))
    else:
        for index,ar in enumerate(arr):
            if index % 2 == 0:
                result.insert(0,str(ar))
            else:
                result.append(str(ar))

    return result

result = calculate(N,ARR)
print(" ".join(result))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ARR = [int(s) for s in input().split(" ")]
def calculate(n,arr):
    result = ""
    if n % 2 == 0:
        for index,ar in enumerate(arr):
            if index % 2 == 0:
                if result == "":
                    result = result + str(ar)
                else:
                    result = result + " " + str(ar)
            else:
                if result == "":
                    result = str(ar) + result
                else:
                    result = str(ar) + " " + result
    else:
        for index,ar in enumerate(arr):
            if index % 2 == 0:
                if result == "":
                    result = str(ar) + result
                else:
                    result = str(ar) + " " + result
            else:
                if result == "":
                    result = result + str(ar)
                else:
                    result = result + " " + str(ar)




    return result

result = calculate(N,ARR)
print(result)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
b = []
if N%2 == 0:
    for i in range(N):
        if i%2 == 0:
            b.append(A[i])
        else:
            b.insert(0,A[i])
else:
    for i in range(N):
        if i%2 == 1:
            b.append(A[i])
        else:
            b.insert(0,A[i])
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n, *a = map(int, open(0).read().split())
b = []
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b = [a[i]] + b

if n % 2 == 0:       
    print(' '.join(map(str, b)))
else:
    print(' '.join(map(str, b[::-1])))

Submission status: Time Limit Exceeded

Solution code:
n, *a = map(int, open(0).read().split())
b = []
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.insert(0, a[i])

if n % 2 == 0:       
    print(' '.join(map(str, b)))
else:
    print(' '.join(map(str, b[::-1])))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
if n == 1:
	print(a_list[0])
	exit()
isEven = n%2 == 0
b_list = [a_list[1], a_list[0]] if isEven else [a_list[0]] 
index = 2 if isEven else 1
for i in range(index, n, 2):
	b_list.insert(0, a_list[i+1])
	b_list.append(a_list[i])	
r = ' '.join(list(map(str, b_list)))
print(r)

Submission status: Time Limit Exceeded

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
from collections import deque

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

n = i_i()
a = i_l()

d = deque([a[0]])

for x in a[1:]:
    d.append(x)
    d.reverse()

print(*d)

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(100000)

def main():
    n = int(input())
    data = list(map(int, input().split()))

    if n == 1:
        print(data[0])
    elif n == 2:
        print(data[1], data[0])
    else:
        firs_value = [data[0]]
        second_value = [data[1], data[0]]

        def get_value(index, data):
            if index == 0:
                return firs_value
            elif index == 1:
                return second_value
            else:
                lis = get_value(index - 2, data)
                lis.append(data[index - 1])
                lis.insert(0, data[index])
                return lis

        result = get_value(n - 1, data)
        print(" ".join(str(n) for n in result))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = list(map(str, input().split()))
if n == 1:
	print(a_list[0])
	exit()
isEven = n%2 == 0
b_list = [a_list[1], a_list[0]] if isEven else [a_list[0]] 
index = 2 if isEven else 1
for i in range(index, n, 2):
	b_list.insert(0, a_list[i+1])
	b_list.append(a_list[i])	
r = ' '.join( b_list)
print(r)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
b_list = []
isEven = n%2==0
for i, x in enumerate(a_list):
	if (isEven and i%2==0) or (not isEven and i%2!=0):
		b_list.append(x)
	else:
		b_list.insert(0, x)
r = ' '.join(list(map(str, b_list)))
print(r)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
if n == 1:
	print(a_list[0])
	exit()
isEven = n%2 == 0
b_list = [a_list[1], a_list[0]] if isEven else [a_list[0]] 
index = 2 if isEven else 1
while True:
	b_list.insert(0, a_list[index+1])
	b_list.append(a_list[index])
	if index >= n - 2:
		break
	index += 2
r = ' '.join(list(map(str, b_list)))
print(r)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
if n == 1:
	print(a_list[0])
	exit()
isEven = n%2 == 0
s = str(a_list[0]) if not isEven else '{0} {1}'.format(a_list[1], a_list[0])
index = 2 if isEven else 1
total = len(a_list)
while True:
	s = '{0} {1} {2}'.format(a_list[index+1], s, a_list[index])
	if index >= total - 2:
		break
	index += 2
print(s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
b_list = []
for i in range(n):
	b_list.append(a_list[i])
	b_list.reverse()
r = ' '.join(list(map(str, b_list)))
print(r)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = list(map(int,input().split()))
t = []
for i in s:
  t.append(i)
  t = t[::-1]
print(*t)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))
    result = []

    for i in range(N):
        if i % 2:
            result.append(A[i])
        else:
            result.insert(0, A[i])

    if N % 2:
        print(*result)
    else:
        print(*result[::-1])


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))
    result = []

    for a in A:
        result.append(a)
        result = result[::-1]

    print(*result)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.insert(0, a[i])
if n % 2 == 1:
    b.reverse()
print(" ".join(map(str, b)))

Submission status: Time Limit Exceeded

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

b = []
for i in a:
    b.append(i)
    b = b[::-1]

print(' '.join(map(str, b)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = list(map(int, input().split()))

x = []
for i in range(n):
    if i%2 == 1:
        x.append(l[i])
    else:
        x.insert(0,l[i])

if n%2 == 0:
    x.reverse()
    print(*x)
else:
    print(*x)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque


def main(n, a):
    d = deque(a)
    ans = []

    for i in range(n):
        if n % 2 != i % 2:
            ans.insert(0, str(d.popleft()))
        else:
            ans.append(str(d.popleft()))

    print(' '.join(ans))


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    main(n, a)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
res = []
if n % 2 == 0:
  for i in range(n):
    if i % 2 == 0:
      res.append(a[i])
    else:
      res.insert(0,a[i])
  print(*res)
else:
  for i in range(n):
    if i % 2 == 0:
      res.insert(0,a[i])
    else:
      res.append(a[i])
  print(*res)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=input().split()
numbers=[int(b) for b in a]
b=[]
for c in numbers:
    b.append(c)
    b.reverse()
answer=''
for d in b:
    answer+=str(d)
    answer+=' '
print(answer)

Submission status: Time Limit Exceeded

Solution code:
b=[]
n=int(input())
a=list(map(str,input().split()))
b.append(a[0])
for i in range(1,n):
  if i%2==0:
    b.append(a[i])
  else:
    b.insert(0,a[i])
if n%2==0:
  print(*b)
else:
  print(*reversed(b))

Submission status: Time Limit Exceeded

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

b = []
for i in range(N):
    if i % 2 == 1:
        b = b + [A[i]]
    else:
        b = [A[i]] + b
if N % 2 == 0:
    b = b[::-1]

print(" ".join(b))

Submission status: Time Limit Exceeded

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

b = []
for i in range(N):
    b.append(A[i])
    b = b[::-1]
print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = []
for num in a:
    ans.append(num)
    ans.reverse()
print(*ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
N=int(input())
A=tuple(map(str,input().split()))
B=deque()
for i in range(N):
  B.append(A[i])
  B.reverse()
ans=' '.join(list(B))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []


if n % 2 == 0:
    for i in range(n):
        if i % 2 != 0:  # 偶数なら前
            b.insert(0, a[i])
        else:
            b.append(a[i])
else:
    for j in range(n):
        if j % 2 == 0:  # 偶数なら後ろ
            b.insert(0, a[j])
        else:
            b.append(a[j])

for j in b:
    print("{}".format(j), end=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []

for i in range(n):
    b.append(a[i])
    b.reverse()

for j in b:
    print("{}".format(j), end=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(str(a[i]))
  b.reverse()
print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_L = list(map(int,input().split()))

b_L = []
for i in range(n):
    b_L.append(a_L[i])
    b_L = list(reversed(b_L))

print(*b_L)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = list(map(int,input().split()))

ans = []

if N%2 == 0:
    for i in range(N):
        if i%2 == 0:
            ans.append(a[i])
        else:
            ans.insert(0,a[i])
else:
    for i in range(N):
        if i%2 == 0:
            ans.insert(0,a[i])
        else:
            ans.append(a[i])

for i in range(N):
    print(ans[i],end=" ")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append(a[i])
    b=b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    n = int(input())
    a = input().split()
    b = []
    for i in range(n):
        b.append(a[i])
        b = b[::-1]
    print(' '.join(b))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
print(*b)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = input().split()
c = []
for i in range(a):
  c.append(b[i])
  c = c[::-1]
print(" ".join(c))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
b = []
is_even = len(a) % 2 == 0

if is_even:
    for i in range(n):
        if i % 2 == 0:
            b.append(str(a[i]))
        else:
            b.insert(0, str(a[i]))
else:
    for i in range(n):
        if i % 2 == 0:
            b.insert(0, str(a[i]))
        else:
            b.append(str(a[i]))
print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
b = []
is_even = len(a) % 2 == 0

if is_even:
    for i in range(n):
        if i % 2 == 0:
            b.append(a[i])
        else:
            b.insert(0, a[i])
else:
    for i in range(n):
        if i % 2 == 0:
            b.insert(0, a[i])
        else:
            b.append(a[i])
print(" ".join(map(str, b)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
b=[]
for i in range(n):
    b.append(a[i])
    b=b[::-1]

print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int, input().split()))
ne = n%2
B = []
for i in range(n):
    if (i+1)%2 == ne:
        B = [A[i]]+B
    else:
        B = B + [A[i]]
print(*B)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int, input().split()))
if n==1:
    print(*A)
else:
    B = [0]*n
    for i in range(n):
        B[i] = A[i]
        B = B[i::-1] + B[i+1:]
    print(*B)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int, input().split()))
B = []
for i in range(n):
    B.append(A[i])
    B = B[::-1]
print(*B)

Submission status: Time Limit Exceeded

Solution code:
def main():
    length = int(input())
    numbers = list(map(int, input().split()))
    answer = []
    for num in numbers:
        answer.append(num)
        answer = list(reversed(answer))
    print(" ".join(map(str, answer)))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
a=list(map(int,input().split()))
b=[]
bnew=[]

for i in a:
  b.append(i)
  for j in reversed(b):
    bnew.append(j)
  else:
    b=bnew
    bnew=[]
print(" ".join(map(str,b)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    if(i%2==0):
        b.append(a[i])
    else:
        b.insert(0,a[i])

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

a=list(map(int,input().split()))
b=[a[0]]
if n%2:#n%2==1
    for i in range(1,n):
        if i%2==1:
            b.append(a[i])
        else:
            b.insert(0,a[i])
else:
    for i in range(1,n):
        if i%2==0:
            b.append(a[i])
        else:
            b.insert(0,a[i])
"""
for i in range(n):
    b.append(a[i])
    b.reverse()
"""
for i in range(n):
    print(b[i],end=" ")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

a=list(map(int,input().split()))
b=[]

for i in range(n):
    b.append(a[i])
    b.reverse()

for i in range(n):
    print(b[i],end=" ")

Submission status: Time Limit Exceeded

Solution code:
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce
import sys
sys.setrecursionlimit(4100000)

n = int(input())
a = list(map(int, input().split()))
ans = []
for i in a:
    ans.append(i)
    ans.reverse()
ans = [str(i) for i in ans]
output = " ".join(ans)
print(output)

Submission status: Time Limit Exceeded

Solution code:
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

n = int(input())
a = list(map(int, input().split()))
ans = []
for i in a:
    ans.append(i)
    ans.reverse()
ans = [str(i) for i in ans]
output = " ".join(ans)
print(output)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int, input().split()))

B = []

for i in A:
    B.append(str(i))
    B = list(reversed(B))
print(" ".join(B))

Submission status: Time Limit Exceeded

Solution code:
import sys
read_=sys.stdin.buffer.readline

N=int(read_())
A=input().split()

B=[A[0]]

cnt=0
for a in A[1:]:
    if cnt%2==0:
        B.insert(0,a)
        cnt+=1
        continue
    B.append(a)
    cnt+=1

if N%2==0:
    print(' '.join(B))
else:
    print(' '.join(reversed(B)))

Submission status: Time Limit Exceeded

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

d = list()
for i, v in enumerate(a):
    if i % 2 == 0:
        d.insert(0, v)
    else:
        d.append(v)
if i % 2 == 1:
    d = d[::-1]
print(*d, sep=' ')

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b.reverse()
for i in range(n):
    print(b[i])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))[::-1]
b = []
for _ in range(n):
    b.append(a.pop())
    b = b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n = int(input())
    a = list(map(int,input().split()))
    ans = []
    if len(a) % 2 == 0:
        for i in range(n):
            if i % 2 == 0:
                ans.append(a[i])
            else:
                ans = [a[i]] + ans
    else:
        for i in range(n):
            if i % 2 == 0:
                ans = [a[i]] + ans
            else:
                ans.append(a[i])

    print(*ans,sep = " ")
if __name__ == "__main__":
    main() 
    
#endline===============================================

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
num = list(map(int, input().split()))
new_list = []
for i in num:
    new_list.append(i)
    new_list.reverse()
    
for i in range(n):
    print(new_list[i], end = " ")

Submission status: Time Limit Exceeded

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

B = []

if N % 2 == 0:
  for index, a in enumerate(A):
    if index % 2 == 1:
      B.insert(0, a)
    else:
      B.append(a)
else:
  for index, a in enumerate(A):
    if index % 2 == 0:
      B.insert(0, a)
    else:
      B.append(a)

for b in B:
  print(b, end=" ")

Submission status: Time Limit Exceeded

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

B = []

for a in A:
  B.append(a)
  B.reverse()

for b in B:
  print(b, end=" ")

Submission status: Time Limit Exceeded

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    n = int(input())
    l = list(map(int,input().split()))
    ans = []
    for i in l:
        ans.append(i)
        ans = ans[::-1]
    print(*ans)
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys

def even(*a):
	n=len(a)
	b=[]
	b.append(a[0])
	for i in range(1,n,2):
		b.insert(0, a[i])
		try:
			b.append(a[i+1])
		except:
			pass
	for j in range(n):
		print(str(b[j])+" ", end="")

def odd(*a):
	n=len(a)
	b=[]
	b.append(a[0])
	for i in range(1,n,2):
		b.append(a[i])
		try:
			b.insert(0,a[i+1])
		except:
			pass
	for j in range(n):
		print(str(b[j])+" ", end="")

input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
	even(*a)
else:
	odd(*a)

Submission status: Time Limit Exceeded

Solution code:
def even(*a):
	b=[]
	b.append(a[0])
	for i in range(1,n,2):
		b.insert(0, a[i])
		try:
			b.append(a[i+1])
		except:
			pass
	for j in range(n):
		print(str(b[j])+" ", end="")

def odd(*a):
	b=[]
	b.append(a[0])
	for i in range(1,n,2):
		b.append(a[i])
		try:
			b.insert(0,a[i+1])
		except:
			pass
	for j in range(n):
		print(str(b[j])+" ", end="")

n=int(input())
a=list(map(int,input().split()))
if n%2==0:
	even(*a)
else:
	odd(*a)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(x) for x in input().split()]

b = []

for i in range(n):
    b.append(a[i])
    b = b[::-1]

print(*b)

Submission status: Time Limit Exceeded

Solution code:
import math

def pushpush(n , a):

    ans = []

    for i in range(n):


        if i % 2 == 0 if n % 2 == 0 else i % 2 == 1:
            ans = ans + [a[i]]
        else:
            #ans.insert(0 , int(a[i]))
            ans = [a[i]] + ans

    return ans

def main():
    n = int(input())
    a = list(map(int , input().split()))
    print(*pushpush(n , a))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math

def pushpush(n , a):

    ans = []

    for i in range(n):
        ans.append(int(a[i]))
        ans.reverse()

    return ans

def main():
    n = int(input())
    a = list(map(int , input().split()))
    print(*pushpush(n , a))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
S = list(map(int, input().split()))
b=[]
if len(S)%2==0:
    for i in range(n):
        if i%2==0:
            b.append(S[i])
        else:
            b.insert(0, S[i])
else:
    for i in range(n):
        if i%2!=0:
            b.append(S[i])
        else:
            b.insert(0, S[i])
print(*b, sep=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
S = list(map(int, input().split()))
b=[]
for i in range(n):
    b.append(S[i])
    b=b[::-1]
print(*b, sep=" ")

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    b = []
    for a in map(int, input().split()):
        b.append(str(a))
        b.reverse()

    print(" ".join(b))

main()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(str,input().split()))
b=[]
for i in range(n):
  if n % 2 == 1 and i % 2 == 0:
    b = [a[i]]+b
  elif n % 2 == 1 and i % 2 == 1:
    b = b + [a[i]]
  elif n % 2 == 0 and i % 2 == 0:
    b = b + [a[i]]
  else:
    b = [a[i]] + b
print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(str,input().split()))
b=[]
for i in range(n):
  b.append(a[i])
  b.reverse()
print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
import copy
kaisuu = int(input())
a_list = list(map(str, input().split()))

tmp_strings = []

for i in range(kaisuu):
    tmp_strings.append(a_list[i])
    tmp_strings.reverse()

print(' '.join(tmp_strings))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
if n%2==0:
    for i in range(n):
        if i%2==0:b.append(a[i])
        if i%2==1:b.insert(0,a[i])
if n%2==1:
    for i in range(n):
        if i%2==1:b.append(a[i])
        if i%2==0:b.insert(0,a[i])


print(*b)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    if i%2==0:b.append(a[i])
    if i%2==1:b.insert(0,a[i])

if n%2==1:b.reverse()
print(*b)

Submission status: Time Limit Exceeded

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

b = []

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

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

Submission status: Time Limit Exceeded

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

for i in range(n):
  b.append(a[i])
  b.reverse()
print(*b)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
n=int(input())
A=list(map(int,input().split()))
B=[]
if n%2==0:
    for i in range(n):
        if i%2==0:
            B.append(str(A[i]))
        else:
            B.insert(0,str(A[i]))
else:
    for i in range(n):
        if i%2!=0:
            B.append(str(A[i]))
        else:
            B.insert(0,str(A[i]))
print(' '.join(B))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
ans = ""
for i in range(N):
    if i % 2 == 0:
        ans += str(A[i])
    else:
        ans = str(A[i]) + ans
if N % 2 != 0:
    for i in range(N-1, -1, -2):
        print(A[i], end=" ")
    for i in range(1, N, 2):
        print(A[i], end=" ")
else:
    for i in range(N-1, 0, -2):
        print(A[i], end=" ")
    for i in range(0, N, 2):
        print(A[i], end=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b=[]

a = a[::-1]
for i in range(n):
    b.append(a.pop(-1))
    b = b[::-1]

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
n=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(n):
    if n%2==0:
        if i%2==0:
            B.append(str(A[i]))
        else:
            B.insert(0,str(A[i]))
    else:
        if i%2!=0:
            B.append(str(A[i]))
        else:
            B.insert(0,str(A[i]))
print(' '.join(B))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
n=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(n):
    B.append(str(A[i]))
    B=B[::-1]
print(' '.join(B))