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: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int,input().split()))
Ae = A[0:n:2]
Ao = A[1:n:2]
if n%2==0:
    print(*Ao[::-1],*Ae)
else:
    print(*Ae[::-1],*Ao)

Submission status: Runtime Error

Solution code:
# C - pushpush
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(a[i])
        else:
            b.insert(0,a[i])
    else:
        if i % 2 !=0:
            b.append(a[i])
        else:
            b.insert(0,a[i])


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

Submission status: Runtime Error

Solution code:
N = int(input())
A = [str(i) for i in input().split()]
dp = [[0,0] for i in range(N+1)]

dp[0][0],dp[0][1] = A[0],A[0]
for i in range(1,N):
    dp[i][0] = dp[i-1][1]+A[i]
    dp[i][1] = A[i]+dp[i-1][0]
ans = list(dp[N-1][1])
print(*ans)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import collections

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

B=collections.deque([])
for i,a in enumerate(A):
  if i%2==0:
    B.append(a)
  else:
    B.appendleft(a)
if N%2==1:
  B=B[::-1]

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = [int(a) for a in input().split()]
B = deque([])
for n in range(N):
    if n % 2 == 0:
        B.append(A[n])
    else:
        B.appendleft(A[n])
print(*B)

Submission status: Runtime Error

Solution code:
# ABC066C - pushpush (ARC077)
def main():
    N, *A = map(int, open(0).read().split())
    if int(N) & 1:
        B = A[::2][::-1] + A[1::2]
    else:
        B = A[1::2][::-1] + A[::2]
    print(" ".join(B))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if len(A) % 2:
  B = [A[-i][::-1] for i in range(1, len(A)-1, 2)] + A[1::2]
else:
  B = [A[-i][::-1] for i in range(1, len(A), 2)] + A[::2]
  b = "".join(B)
print(*b)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(map(int,input().split()))
print(*s[::-2],*s[n%2::2])

Submission status: Runtime Error

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

right = []
left = []
for i in range(N):
    if i % 2 == 0:
        right.append(A[i])
    else:
        left.append(A[i])
answer = left[::-1]
answer += right
print(*answer if N%2 == 0 else *answer[::-1])

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = a[0::2][::-1]
c = a[1::2]

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

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split()))
if n%2:
    print(*l[::-2],*l[1::2])
else:
    print(*l[::-2],*l[0::2])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if len(a) % 2 == 0:
    print(*list(reversed(a[1::2])), *a[0::2])
else:
    print(*list(reversed(a[0::2])), *a[1::2])

Submission status: Runtime Error

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

if len(a) % 2 == 0:
    print(*reversed(a[1::2]), *a[0::2])
else:
    print(*reversed(a[0::2]), *a[1::2])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
an = input().split()
if n == 1:
    print(an[0])
else:
    print(" ".join(list(reversed(an[1::2]))+an[::2]) if n%2==0 else " ".join(reversed(an[::2])+an[1::2]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int, input().split()))
print(*A[::-2], *A[n%2::2])

Submission status: Runtime Error

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

# TLE
# l = []
# for i, a in enumerate(A):
#     if i%2 == 0:
#         l.append(a)
#     else:
#         l.insert(0, a)
# print(' '.join(map(str, l)))

print(*A[::-2], *A[n%2::2])

Submission status: Runtime Error

Solution code:
List = list(map(int,input().split()))
print(*List[::-2],*List[n%2::2])

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys


def solve_naive(n: int, a: "List[int]"):
    b = list()
    for i in range(n):
        b.append(str(a[i]))
        b.reverse()
    print(" ".join(b))
    return

def solve_(n: int, a: "List[int]"):
    a = list(map(str, a))
    b = list()
    for i in range(n):
        if i % 2 == 0:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    if n % 2 == 0:
        b.reverse()
    print(" ".join(b))
    return

def solve__(n: int, a: "List[int]"):
    a = list(map(str, a))
    b = list()
    for i in range(n):
        if i % 2 == (n-1) % 2:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    print(" ".join(b))
    return

def solve___(n: int, a: "List[int]"):
    b = list()
    for i in range(n):
        if i % 2 == (n-1) % 2:
            # push
            b.insert(0, a[i])
        else:
            # append
            b.append(a[i])
    print(*b)
    return

def solve(n: int, a: "List[int]"):
    print(*a[::-2],*a[n%2::2])

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, a)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

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

if n%2 == 0:
    ans = b[::-1]
else:
    ans = b

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

Submission status: Runtime Error

Solution code:
N = input()
nums = list(map(int, 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(even+odd))
else:
  print(' '.join(odd+even))

Submission status: Runtime Error

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

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))

Submission status: Runtime Error

Solution code:
from collections import deque
n = int(input())
a = [int(i) for i in input().split()]
odd = deque()
even = deque()
for i, v in enumerate(a):
    if (i + 1) % 2: odd.appendleft(v)
    else: even.appendleft(v)
print(*(odd + even) if n % 2 else (even + odd))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n =int(input())

a = [str(x) for x in input().split()]

ls = []

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

print(" ".join(ls))

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,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-2,2):
    b.append(a[i])
else:
  for i in range(n,-1,-2):
    b.append(a[i])
  for i in range(1,n-1,2):
    b.append(a[i])
print(' '.join(b))

Submission status: Runtime Error

Solution code:
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(5):
    print(l[i],end=" ")
else:
  l=l[n-1::-2]+l[::2]
  for i in range(5):
    print(l[i],end=" ")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
arr=list(map(int,input()))
q=collections.deque()
for i in range(n):
  if i%2==0:
    q.append(arr[i])
  else2
  q.appendleft(arr[i])
if i%2==1:
  q=list(q)[::-1]
print(' '.join(map(str,q)))

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
from collections import deque

def solve():
    n = int(input())
    A = input().split()

    """方針
    A = 0 6 7 6 7 0
    i | b
    ---------------
    1 | 0
    2 | 0 6 (本当は逆で6 0)
    3 | 7 0 6
    4 | 7 0 6 6 (本当は逆で 6 6 0 7)
    5 | 7 7 0 6 6
    6 | 7 7 0 6 6 0 (本当は逆で0 6 6 0 7 7) 

    ・iが偶数のとき、bの後ろにA[i]を追加する
    ・iが奇数のとき、bの前にA[i]を追加する

    上の操作をn回すべてしたあとに、

    ・nが偶数なら答えを反転する
    ・nが奇数なら答えはそのまま

    ただし、A[i]は2桁以上の数字の可能性も考慮すること

    あとPythonは、list.insert()はとても遅いので（TLEしたので）、代わりにcollections.dequeを使用する

    ・collections.deque
    https://docs.python.org/ja/3/library/collections.html#collections.deque

    dequeとは、「両端における append や pop を高速に行えるリスト風のコンテナ」
    """

    # 1 2 3 -> 3 1 2
    b = deque()
    for i in range(1, n+1):
        if i%2 == 0:
            b.append(A[i-1])
        else:
            b.insert(0, A[i-1])

    if n%2 == 0:
        ans = ""
        for i in range(n-1, -1, -1):
            ans += b[i] + " "
        print(ans[:-1])
    else:
        ans = " ".join(b)
        print(ans)


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, *a = map(int, open(0).read().split())
print(*a[::-2], *a[n%2::2])

Submission status: Runtime Error

Solution code:
n=int(input())
a=input()
ans=""
for i in range(n-1,-1,-2):
  ans+=a[i]
for i in range(n%a,n,2):
  ans+=a[i]
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
a=input().split()
ans=""
for i in range(n-1,-1,-2):
  ans+=a[i]
for i in range(n%a,n,2):
  ans+=a[i]
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

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

import collections

b = collections.deque()

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

print(*b)

Submission status: Runtime Error

Solution code:
n = int(input())

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

import collections
b = collections.deque()

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

print(*b)

Submission status: Runtime Error

Solution code:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
a = collections.deque(nl())
ans = collections.deque()
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            ans.append(str(a.popleft()))
        else:
            ans.insert(0, str(a.popleft()))
else:
    for i in range(n):
        if i % 2 == 0:
            ans.insert(0, str(a.popleft()))
        else:
            ans.append(str(a.popleft()))
print(' '.join(ans))

Submission status: Runtime Error

Solution code:
import sys
fastinput=sys.stdin.readline
N=int(input())
a=[int(i) for i in fastinput().split()]
result=[None]*N
if N%2:#odd
    c=(N-1)//2
    for num,i in enumerate(a):
        r=(num+1)//2
        if num==0:
            result[c]=i
        else:
            if num%2:#右半分
                result[c+r]=i
            else:
                result[c-r]=i
else:#even
    for num,i in enumerate(a):
        d=(N-i)//2
        if num%2:#左半分
            result[d]=i
        else:
            result[N-1-d]=i
print(" ".join([str(j) for j in result]))

Submission status: Runtime Error

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

B = list()
for a in A:
  B.append(a)
  B = B[::-1]
print(" ".join(B))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = ["A" for i in range(1000001)]

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

while b[0] == "A" :
    del b[0]

while "A" in b:
b.remove("A")

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

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

n = int(input())
a = list(map(int,input().split()))
b = ["A" for i in range(1001)]

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

while b[0] == "A" :
    del b[0]

while "A" in b:
    b.remove("A")

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
print(" ".join(a[::-2]+a[n%2::2]))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
print(' '.join(a[::-2]+a[n%2::2]))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
print(''.join(a[::-2]+a[n%2::2]))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int,input().split()))
def dp (x):
    if x==1:
        return [a[0]]
    else:
        c = dp(x-1)+[a[x-1]]
        return c[::-1]
print(" ".join(map(str,dp(n))))

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
 
ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
	}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];
    if(n%2==0){
        for(int i=(n-1);i>0;i-=2) cout << a[i] << " ";
        for(int i=0;i<n;i+=2) cout << a[i] << " ";
    }
    else{
        for(int i=(n-1);i>=0;i-=2) cout << a[i] << " ";
        for(int i=1;i<n;i+=2) cout << a[i] << " ";
    }
    cout << endl;
	return 0;
}

Submission status: Runtime Error

Solution code:
a = ai()
x = lma()
k = [0]*a
s = 0
t = 0
for i in range(a):
    if i%2==0:
        k[s] = x[-1-i]
        s+=1
    else:
        k[-t-1] = x[-1-i]
        t+=1
print(k)

Submission status: Runtime Error

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

b = [0 for _ in range(n)]

i = 0
j = n - 1

while(j > 0):
    b[i] = a[j]
    i += 1
    j -= 2

j = 1 if j == 0 else 0

while(i < n):
    b[i] = a[j]
    i += 1
    j += 2

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import deque

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

B = deque(maxlen=2*10**5)

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 == 0:
            B.insert(0,A[i])
        else:
            B.append(A[i])

print(*B)

Submission status: Runtime Error

Solution code:
from collections import deque

N = int(input())
A = [int(i) for i in input().split()]
 
B = deque(maxlen=2*10**5)
 
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 == 0:
            B.insert(0,A[i])
        else:
            B.append(A[i])

print(*B)

Submission status: Runtime Error

Solution code:
from collections import deque

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

b = deque([])

for i,ai in enumerate(a):
  if i%2 == 0:
    b.append(ai)
    
  else:
    b.appendleft(ai)
    
if n%2 == 1:
  print(*b[::-1])
else:
  print(*b)

Submission status: Runtime Error

Solution code:
#ABC066C
n=int(input())
a=list(map(int, input().split()))
front=[]
back=[]
flg=n%2
for i in range(n//2):
    front.insert(0, a[2*i-flg+1])
    #back.append(a[2*i+flg])
back=[a[2*i+flg] for i in range(n)]
if flg==1:
    front.insert(0, a[n-1])
print(' '.join(map(str, front+back)))

Submission status: Runtime Error

Solution code:
n = int(input())
lis = list(map(int,input().split()))
li = lis[::2]
l = lis[1::2]

if n % 2 == 0:
  l = l[::-1]
  ans = l+li
  print(" ".join(ans))
else:
  li = li[::-1]
  ans = li+l
  print(" ".join(ans))

Submission status: Runtime Error

Solution code:
n = int(input())
lis = list(map(int,input().split()))
li =[]
cou = 0
key = 0
if n % 2 == 1:
  while cou < n:
    if key == 0:
      li.insert(0,lis[cou])
      cou += 1
      key = 1
    else:
      li.append(lis[cou])
      cou += 1
      key = 0
else:
  while cou < n:
    if key == 0:
      li.append(lis[cou])
      cou += 1
      key = 1
    else:
      li.insert(0,lis[cou])
      cou += 1
      key = 0
print(" ".join(li))

Submission status: Runtime Error

Solution code:
print(" ".join((a[1::2][::-1] + a[::2])[::1 if len(a)%2==0 else -1]))

Submission status: Runtime Error

Solution code:
from collections import deque

n = int(input())

result = deque()
index = 0

if n % 2 == 0
    for i in input().split():
        if index % 2 == 1:
            result.appendleft(i)
            index += 1
        else:
            result.append(i)
            index += 1
else:
    for i in input().split():
        if index % 2 == 1:
            result.append(i)
            index += 1
        else:
            result.appendleft(i)
            index += 1

print(" ".join(result))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split(' ')))
b = [0] * n
K = [0] * n
def hopping(j):
    if j == 1: return 0
    else:
        K[j-1] = ((-1)**(j-1))*2*(j-1)+hopping(j-1)
        return K[j-1]

hopping(n)

if n % 2 == 0:
    for i in range(n):
        b[(n+K[i])//2] = a[i]
else:
    for i in range(n):
        b[(n-K[i]-1)//2] = a[i]
print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
s=list(input().split())
t=s[5::-2]+s[0::2]
for i in range(N):
    print(t[i],end=" ")

Submission status: Runtime Error

Solution code:
n - int(input())
a = input().split()
s = a[::-2]+a[::2]
print(" ".join(s))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
origin = list(input().split(' '))

ans = []
if  (n%2==0): #even
	for i in range(int(n/2)):
		ans.append(origin[2*i])
		ans.insert(0,origin[2*i+1])

else: #odd
	ans =ans.append(origin[0])
	for i in range(int((n-1)/2)):
		ans.append(origin[2*i+1])
		ans.insert(0,origin[2*i+2])


print(' '.join(ans))

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(str, input().split(' ')))
F=A[0::2]
L=A[1::2]

ans=[]
an=''
if N%2==0:
    L.reverse()
    ans=L+F
else:
    F.reverse()
    ans=F+L

for i in range(N):
    an=an+' 'str(ans[i])
print(an)

Submission status: Runtime Error

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

dp = [0]*n
for i in range(n):
    now = a[i]
    if i%2 == 0:
        dp[i//2] = now
    else:
        dp[-(i//2 + 1)] = now
print(" ".join(map(str, a)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
a = list(map(int, input().split()))

if N % 2 == 0:
    print(" ".join(a[N::-2] + a[::2]))
else:
    print(" ".join(a[N::-2] + a[1::2]))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
a = list(map(int, input().split()))

if N % 2 == 0:
    print(" ".join(a[N::-2] + a[::2])
else:
    print(" ".join(a[N::-2] + a[1::2])

Submission status: Runtime Error

Solution code:
from collections import deque

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

b = deque()

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

Submission status: Runtime Error

Solution code:
num = int(input())
s = input().split(" ")
b = []
ans = ""
for i in range(num):
    b.append(s[i])
    b.reverse()
    print(b)

for char in b:
    ans += char + " "
print(ans[:-1])

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <string.h>

#define NUM 100000

using namespace std;

int main(void) {
	int a[200001];
	int n,x=1,flag;
	cin >> n;
	cin >> a[NUM];

	if (n%2 == 0) {
		flag = 0;
	} else {
		flag = 1;
	}
	if (flag == 0) {
		for (int i=0;i<n-1;i++) {
			if (i%2 == 0) {
				cin >> a[NUM-x];
			}  else {
				cin >> a[NUM+x];
				x++;
			}
		}
		for(int i=0;i<x*2;i++) {
			cout << a[NUM-x+i] << " ";
		}
	} else {
		for (int i=0;i<n-1;i++) {
			if (i%2 == 1) {
				cin >> a[NUM-x];
				x++;
			}  else {
				cin >> a[NUM+x];
			}
		}
		for(int i=1;i<x*2;i++) {
			cout << a[NUM-x+i] << " ";
		}
	}

	cout << endl;
}

Submission status: Runtime Error

Solution code:
a = int(input())
list = []
for i in range(a):
	c = input();
	if i%2 == 1:
		list.insert(0, c)
	else:
		list.append(c)
for i in range(a):
	print(list[i],end=" ")

Submission status: Runtime Error

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

b=[]
for item in a:
    b.append(item)
    b.reverse()
    print(item,b)

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

Submission status: Runtime Error

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

b=[]
for item in a:
    b.append(item)
    b.reverse

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
quant = int(input())
nums = list(map(int, input().split()))
data = []

for i in range(quant):
    if i % 2 == 0:
        data.append(nums[i])
    else:
        data = nums[i] + data

if quant % 2 == 0:
        for i in data:
            print(i, end=" ")
else:
    for i in reversed(range(quant)):
        print(data[i], end=" ")

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
A = input()
a = list(map(int,A.split(" ")))
a = np.array(a)

if n%2 == 0:
    b = np.append(even[::-1],odd)
else:
    b = np.append(odd[::-1],even)

import sys
for d in b[:-1]:
    sys.stdout.write(str(d)+ " ")
sys.stdout.write(str(b[-1])+"\n")

Submission status: Runtime Error

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

for x in b:
	print(x, end=' ')
print()

Submission status: Runtime Error

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

for x in b:
	print(x, end=' ')
print()

Submission status: Runtime Error

Solution code:
quant = input()
nums = list(map(int, input().split()))
for i in nums:
    if i == 1:
        data = [nums[i]]
        continue
    elif i % 2 == 1:
        data.append(nums[i])
    else:
        data.insert(0, nums[i])

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = input().split()
b = [0] * len(a)
index = 0
for i in range(0,n,2):
    b[index] = a[n - i - 1]
    index += 1
for i in range(0,n,2):
    b[index] = a[i]
    index += 1
print(b)

Submission status: Runtime Error

Solution code:
import numpy as np
n = input()
A = input()
a = list(map(int,A.split(" ")))
a = np.array(a)
odd = a[1::2]
even = a[0::2]
if n//2 == 0:
    b = np.append(even[::-1],odd)
else:
    b = np.append(odd[::-1],even)
import sys
for d in b[:-1]:
    sys.stdout.write(str(d)+ " ")
sys.stdout.write(str(b[-1])+"\n")

Submission status: Runtime Error

Solution code:

n = int(input())
abc = input().split(' ')
b = []
if n <= 4:
    for i in abc:
        b.append(i)
        b = b [::-1]

else:
    abc = abc[::-1]
    
    b = ['0'* n ]
    b[0] = abc[0]
    b[-1] = abc[1]

    l = 1
    r = n - 1
    for i in range(2, n):
        if i%2 == 0:
            b[l] = abc[i]
        else:
            b[r] = abc[i]
    
    
#print(b)
for i in b:
    print(i, end=' ')
    
    
'''
n = int(input())
abc = input().split(' ')
b = str(abc[0])

for i in range(1, n):
    if i%2 != 0:
        b= abc[i] + ' ' + b
    else:
        b += ' '  +  abc[i]
    
print(b)
#for i in b:
 #   print(i, end=' ')'''

Submission status: Runtime Error

Solution code:
quant = input()
nums = list(map(int, input().split()))
data = []

for i in nums:
    if i % 2 == 1:
        data.append(nums[i])
    else:
        data.insert(0, nums[i])

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

Submission status: Runtime Error

Solution code:
N = int(input())
char = input().split()
out = []
cnt = 0
while cnt <= N:
    out.append(char[x])
    out.reverse()
    cnt += 1
print(" ".join(out))

Submission status: Runtime Error

Solution code:
N = input()
a=(map(str, raw_input().split()))

odd=a[1::2]
even=a[0::2]

if N%2==0:
    print ' '.join(reversed(odd))+' '+' '.join(even)
else:
    print ' '.join(reversed(even))+' '+' '.join(odd)
~

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <queue>
using namespace std;

#define MAX_N 200000

int n;
int a[MAX_N] = {0};

void solve(){
    deque<int> di;
    for(int i = 0; i < n; ++i){
        if(i % 2 == 0){
            di.push_back(a[i]);
        }else{
            di.push_front(a[i]);
        }
    }
    if(n % 2 == 1){
        for(int i = n-1; i>=1; i--){
            cout << di[i] << " ";
        }
        cout << di[0] << "\n";
    }else{
        for(int i = 0; i < n-1; ++i){
            cout << di[i] << " ";
        }cout << di[n-1] << "\n";
    }
    return ;
}


int main(){
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    solve();
    return 0;
}