stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
//周♂雨扬是最强的！！！

//大佬祝您AK

//沈哲♂贝是最强的！！！

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<fstream>

using namespace std;

//ifstream fin(.in);

//ofstream fout(.out);

int n,head,tail;

int num[800003];

int main(){

	cin>>n;

	int head=300001,tail=300000;

	bool ok=!(n&1);

	for(int i=1;i<=n;i++){

		int x;

		cin>>x;

		if(ok){

			num[head++]=x;

		}else{

			num[tail--]=x;

		}

		ok^=1;

	}

	for(int i=tail+1;i<=head-1;i++){

		cout<<num[i]<<" ";

	}

	return 0;

}

//沈♂哲贝是最强的！！！

//大佬祝您AK

//周♂雨扬是最强的！！！

// Faster C++ solution for the same problem (measured speedup: 5.213275561084528x):
#include<cstdio>

using namespace std;

const int MAX = 2e5 + 5;

int a[MAX];

int main() {

	int n;

	int f, b, temp;

	bool odd = false;

	scanf("%d", &n);

	int m = n / 2;

	if (n % 2 != 0)

		odd = true;

	f = m - 1;

	b = m + 1;

	scanf("%d", &a[m]);

	for (int i = 1; i < n; i++)

	{

		if (i % 2 != 0) {

			scanf("%d", a + f);

			f--;

		}

		else

		{

			scanf("%d", a + b);

			b++;

		}	

	}

	

	if (odd) {

		for (int i = n-1; i != 0; i--)

		{

			printf("%d ", a[i]);

		}

		printf("%d\n", a[0]);

	}

	else

	{

		for (int i = 0; i != n - 1; i++)

		{

			printf("%d ", a[i]);

		}

		printf("%d\n", a[n-1]);

	}

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

#define RALL(a) (a).rbegin(), (a).rend()

#define PB push_back

#define EB emplace_back

#define MP make_pair

#define SZ(a) int((a).size())

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };



/* -----  2017/11/29  Problem: 077_arc_c / Link: https://arc077.contest.atcoder.jp/tasks/arc077_a  ----- */

/* ------問題------



-----問題ここまで----- */

/* -----解説等-----



dequeさん…はじめて会ったね



----解説ここまで---- */



LL N;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	deque<int>dq;

	cin >> N;

	FOR(i, 0, N) {

		int a; cin >> a;

		if (SZ(dq) % 2 == N%2) { dq.push_back(a); }

		else { dq.push_front(a); }

	}

	FOR(i, 0, N) {

		cout << dq.front() << (i != N - 1 ? ' ' : '\n');

		dq.pop_front();

	}



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.347517285734912x):
#include<cstdio>

using namespace std;

const int MAX = 2e5 + 5;

int a[MAX];

int main() {

	int n;

	int f, b, temp;

	bool odd = false;

	scanf("%d", &n);

	int m = n / 2;

	if (n % 2 != 0)

		odd = true;

	f = m - 1;

	b = m + 1;

	scanf("%d", &a[m]);

	for (int i = 1; i < n; i++)

	{

		if (i % 2 != 0) {

			scanf("%d", a + f);

			f--;

		}

		else

		{

			scanf("%d", a + b);

			b++;

		}	

	}

	

	if (odd) {

		for (int i = n-1; i != 0; i--)

		{

			printf("%d ", a[i]);

		}

		printf("%d\n", a[0]);

	}

	else

	{

		for (int i = 0; i != n - 1; i++)

		{

			printf("%d ", a[i]);

		}

		printf("%d\n", a[n-1]);

	}

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=2e5+105;

int ax[maxn],bx[maxn];

int main()

{

    int n;

    while(scanf("%d",&n)!=EOF)

    {

        for(int i=0;i<n;i++)

            scanf("%d",&ax[i]);

        int l=0,r=n-1,index=n-1,cnt=0;

        while(1)

        {

           if(cnt%2==0)

             bx[l++]=ax[index--];

           else

             bx[r--]=ax[index--];

           cnt++;

           if(n%2==0&&r==(n/2)-1)

             break;

           if(n%2==1&&l==n/2+1)

               break;

        }

        for(int i=0;i<n;i++)

        {

            if(i!=0)

                printf(" ");

            printf("%d",bx[i]);

        }

        printf("\n");

    }





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.163819618743993x):
#include<cstdio>

using namespace std;

const int MAX = 2e5 + 5;

int a[MAX];

int main() {

	int n;

	int f, b, temp;

	bool odd = false;

	scanf("%d", &n);

	int m = n / 2;

	if (n % 2 != 0)

		odd = true;

	f = m - 1;

	b = m + 1;

	scanf("%d", &a[m]);

	for (int i = 1; i < n; i++)

	{

		if (i % 2 != 0) {

			scanf("%d", a + f);

			f--;

		}

		else

		{

			scanf("%d", a + b);

			b++;

		}	

	}

	

	if (odd) {

		for (int i = n-1; i != 0; i--)

		{

			printf("%d ", a[i]);

		}

		printf("%d\n", a[0]);

	}

	else

	{

		for (int i = 0; i != n - 1; i++)

		{

			printf("%d ", a[i]);

		}

		printf("%d\n", a[n-1]);

	}

	

	return 0;

}
// Slower C++ solution:
//周♂雨扬是最强的！！！

//大佬祝您AK

//沈哲♂贝是最强的！！！

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<fstream>

using namespace std;

//ifstream fin(.in);

//ofstream fout(.out);

int n,head,tail;

int num[800003];

int main(){

	cin>>n;

	int head=300001,tail=300000;

	bool ok=!(n&1);

	for(int i=1;i<=n;i++){

		int x;

		cin>>x;

		if(ok){

			num[head++]=x;

		}else{

			num[tail--]=x;

		}

		ok^=1;

	}

	for(int i=tail+1;i<=head-1;i++){

		cout<<num[i]<<" ";

	}

	return 0;

}

//沈♂哲贝是最强的！！！

//大佬祝您AK

//周♂雨扬是最强的！！！

// Faster C++ solution for the same problem (measured speedup: 5.010988826134313x):
#include<stdio.h>

int main()

{

	int n,i,j;

	scanf("%d",&n);

	long int b[n]={0};

	long int a[n]={0};

	for(i=0;i<n;i++)

	{

		scanf("%ld",&a[i]);

	}

		for(i=n-1,j=0;i>=0;i=i-2,j++)

		{

			b[j]=a[i];

			if(i!=0)

			b[n-j-1]=a[i-1];

			

		}

		for(i=0;i<n;i++)

		{

			printf("%ld ",b[i]);

		}

		return 0;

 }
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

#define RALL(a) (a).rbegin(), (a).rend()

#define PB push_back

#define EB emplace_back

#define MP make_pair

#define SZ(a) int((a).size())

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };



/* -----  2017/11/29  Problem: 077_arc_c / Link: https://arc077.contest.atcoder.jp/tasks/arc077_a  ----- */

/* ------問題------



-----問題ここまで----- */

/* -----解説等-----



dequeさん…はじめて会ったね



----解説ここまで---- */



LL N;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	deque<int>dq;

	cin >> N;

	FOR(i, 0, N) {

		int a; cin >> a;

		if (SZ(dq) % 2 == N%2) { dq.push_back(a); }

		else { dq.push_front(a); }

	}

	FOR(i, 0, N) {

		cout << dq.front() << (i != N - 1 ? ' ' : '\n');

		dq.pop_front();

	}



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.140021672056645x):
#include<stdio.h>

int main()

{

	int n,i,j;

	scanf("%d",&n);

	long int b[n]={0};

	long int a[n]={0};

	for(i=0;i<n;i++)

	{

		scanf("%ld",&a[i]);

	}

		for(i=n-1,j=0;i>=0;i=i-2,j++)

		{

			b[j]=a[i];

			if(i!=0)

			b[n-j-1]=a[i-1];

			

		}

		for(i=0;i<n;i++)

		{

			printf("%ld ",b[i]);

		}

		return 0;

 }
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=2e5+105;

int ax[maxn],bx[maxn];

int main()

{

    int n;

    while(scanf("%d",&n)!=EOF)

    {

        for(int i=0;i<n;i++)

            scanf("%d",&ax[i]);

        int l=0,r=n-1,index=n-1,cnt=0;

        while(1)

        {

           if(cnt%2==0)

             bx[l++]=ax[index--];

           else

             bx[r--]=ax[index--];

           cnt++;

           if(n%2==0&&r==(n/2)-1)

             break;

           if(n%2==1&&l==n/2+1)

               break;

        }

        for(int i=0;i<n;i++)

        {

            if(i!=0)

                printf(" ");

            printf("%d",bx[i]);

        }

        printf("\n");

    }





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.963451884810075x):
#include<stdio.h>

int main()

{

	int n,i,j;

	scanf("%d",&n);

	long int b[n]={0};

	long int a[n]={0};

	for(i=0;i<n;i++)

	{

		scanf("%ld",&a[i]);

	}

		for(i=n-1,j=0;i>=0;i=i-2,j++)

		{

			b[j]=a[i];

			if(i!=0)

			b[n-j-1]=a[i-1];

			

		}

		for(i=0;i<n;i++)

		{

			printf("%ld ",b[i]);

		}

		return 0;

 }
// Slower C++ solution:
#include <iostream>

using namespace std;



int main()

{

	int n;

	cin >> n;

	long long int *b;

	int k = n / 2;

	int var = 0;

	var = n - 2 * k;

	b = new long long int[n];

	for (int i = 1; i <= n; i++) {

		cin >> b[k];

		if (var == 0) {

			k -= i;

			var++;

		}

		else {

			k += i;

			var--;

		}

	}

	cout << b[0];

	for (int i = 1; i < n; i++) {

		cout << " " << b[i];

	}

	return 0;

}




// Faster C++ solution for the same problem (measured speedup: 5.025719095941606x):
#include<stdio.h>

int main()

{

	int n,i,j;

	scanf("%d",&n);

	long int b[n]={0};

	long int a[n]={0};

	for(i=0;i<n;i++)

	{

		scanf("%ld",&a[i]);

	}

		for(i=n-1,j=0;i>=0;i=i-2,j++)

		{

			b[j]=a[i];

			if(i!=0)

			b[n-j-1]=a[i-1];

			

		}

		for(i=0;i<n;i++)

		{

			printf("%ld ",b[i]);

		}

		return 0;

 }
// Slower C++ solution:
#include <algorithm>

#include <iostream>

#include <cstring>

#include <cstdio>

#include <cmath>



using namespace std;



int a[300000],b[300000];



int main ()

{

	int n,m;

	scanf ("%d",&n);

	m=n;

	for (int i=1;i<=n;i++)

		scanf ("%d",&a[i]);

	int j=0;

	for (int i=n;i>0;i-=2)

		b[++j]=a[i];

	for (int i=n-1;i>0;i-=2)

		b[m--]=a[i];

	for (int i=1;i<n;i++)

		printf ("%d ",b[i]);

	printf ("%d\n",b[n]);

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.956095160795165x):
#include<stdio.h>

int main()

{

	int n,i,j;

	scanf("%d",&n);

	long int b[n]={0};

	long int a[n]={0};

	for(i=0;i<n;i++)

	{

		scanf("%ld",&a[i]);

	}

		for(i=n-1,j=0;i>=0;i=i-2,j++)

		{

			b[j]=a[i];

			if(i!=0)

			b[n-j-1]=a[i-1];

			

		}

		for(i=0;i<n;i++)

		{

			printf("%ld ",b[i]);

		}

		return 0;

 }
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>



using namespace std;



#define N 200008



int n;

int a[N],b[N];



void solve()

{

	int len = 0;

	for (int i = n; i>= 1; i-=2)

		b[++len] = a[i];

	for (int i = n-1,len = n; i >= 1; i-=2)

		b[len--] = a[i];

	for (int i = 1; i <= n; i++)

		printf("%d ", b[i]);

	printf("\n");

}



void init()

{

	scanf("%d", &n);

	for (int i = 1; i <= n; i++)

		scanf("%d", &a[i]);

}



int main()

{

	init();

	solve();

	return 0; 

} 

// Faster C++ solution for the same problem (measured speedup: 4.957262872514757x):
#include<stdio.h>

int main()

{

	int n,i,j;

	scanf("%d",&n);

	long int b[n]={0};

	long int a[n]={0};

	for(i=0;i<n;i++)

	{

		scanf("%ld",&a[i]);

	}

		for(i=n-1,j=0;i>=0;i=i-2,j++)

		{

			b[j]=a[i];

			if(i!=0)

			b[n-j-1]=a[i-1];

			

		}

		for(i=0;i<n;i++)

		{

			printf("%ld ",b[i]);

		}

		return 0;

 }
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



const int MAXN = 2*(1e5 + 100);



int main () {

	int n, a[MAXN], b[MAXN];

	scanf ("%d", &n);

	for (int i = 1; i <= n; i ++)

		scanf ("%d", &a[i]);

	int m = n >> 1;

	for (int i = 1; i <= m; i ++) {

		b[i] = a[n - (i << 1) + 2];

		b[n - i + 1] = a[n - (i << 1) + 1];

	}

	if (n & 1)

		b[m + 1] = a[1];

	for (int i = 1; i < n; i ++)

		printf ("%d ", b[i]);

	printf ("%d\n", b[n]);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.148384899090362x):
#include<stdio.h>

int main()

{

	int n,i,j;

	scanf("%d",&n);

	long int b[n]={0};

	long int a[n]={0};

	for(i=0;i<n;i++)

	{

		scanf("%ld",&a[i]);

	}

		for(i=n-1,j=0;i>=0;i=i-2,j++)

		{

			b[j]=a[i];

			if(i!=0)

			b[n-j-1]=a[i-1];

			

		}

		for(i=0;i<n;i++)

		{

			printf("%ld ",b[i]);

		}

		return 0;

 }
// Slower C++ solution:
#include<iostream>

using namespace std;



int a[200000];

int n,i;

void init()

{

    cin >> n;

	for (i=0; i<n; i++)

    {

		cin >> a[i];

	}

}

int main()

{

    init();

	for (i=n-1; i>=0; i-=2)

    {

		cout << a[i] << " ";

	}

	i++;

	if (n % 2) i += 2;

	for (; i<=n-2; i+=2)

	{

        cout << a[i] << " ";

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.011493479458507x):
#include<stdio.h>

int main()

{

	int n,i,j;

	scanf("%d",&n);

	long int b[n]={0};

	long int a[n]={0};

	for(i=0;i<n;i++)

	{

		scanf("%ld",&a[i]);

	}

		for(i=n-1,j=0;i>=0;i=i-2,j++)

		{

			b[j]=a[i];

			if(i!=0)

			b[n-j-1]=a[i-1];

			

		}

		for(i=0;i<n;i++)

		{

			printf("%ld ",b[i]);

		}

		return 0;

 }
// Slower C++ solution:
//周♂雨扬是最强的！！！

//大佬祝您AK

//沈哲♂贝是最强的！！！

#include<iostream>

#include<algorithm>

#include<cmath>

#include<cstring>

#include<fstream>

using namespace std;

//ifstream fin(.in);

//ofstream fout(.out);

int n,head,tail;

int num[800003];

int main(){

	cin>>n;

	int head=300001,tail=300000;

	bool ok=!(n&1);

	for(int i=1;i<=n;i++){

		int x;

		cin>>x;

		if(ok){

			num[head++]=x;

		}else{

			num[tail--]=x;

		}

		ok^=1;

	}

	for(int i=tail+1;i<=head-1;i++){

		cout<<num[i]<<" ";

	}

	return 0;

}

//沈♂哲贝是最强的！！！

//大佬祝您AK

//周♂雨扬是最强的！！！

// Faster C++ solution for the same problem (measured speedup: 4.64757352998536x):
#include <stdio.h>

#include <string.h>

#define MAXN 100005



int main()

{

    int n;

    while(scanf("%d", &n) != EOF)

    {

        int a,num = n,flag = 1;

        int head[MAXN],tail[MAXN];

        int num_i = 0, num_j = 0;

        while(num--)

        {

            scanf("%d", &a);

            if(flag)

                tail[num_j++] = a;

            else

                head[num_i++] = a;

            flag = !flag;

        }

        if(n%2 == 0)

        {

            for(int i = num_i - 1; i >= 0; i--)

            {

                printf("%d ", head[i]);

            }

            for(int j = 0; j < num_j - 1; j++)

            {

                printf("%d ", tail[j]);

            }

            if(num_j)printf("%d\n", tail[num_j - 1]);

            else printf("\n");

        }

        else

        {

            for(int j = num_j - 1; j >= 0; j--)

            {

                printf("%d ", tail[j]);

            }

            for(int i = 0; i < num_i - 1; i++)

            {

                printf("%d ", head[i]);

            }

            if(num_i)printf("%d\n", head[num_i - 1]);

            else printf("\n");

        }

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



using VS = vector<string>;    using LL = long long;

using VI = vector<int>;       using VVI = vector<VI>;

using PII = pair<int, int>;   using PLL = pair<LL, LL>;

using VL = vector<LL>;        using VVL = vector<VL>;



#define ALL(a)  begin((a)),end((a))

#define RALL(a) (a).rbegin(), (a).rend()

#define PB push_back

#define EB emplace_back

#define MP make_pair

#define SZ(a) int((a).size())

#define SORT(c) sort(ALL((c)))

#define RSORT(c) sort(RALL((c)))

#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

#define debug(x) cerr << #x << ": " << x << endl

const int INF = 1e9;                          const LL LINF = 1e16;

const LL MOD = 1000000007;                    const double PI = acos(-1.0);

int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };



/* -----  2017/11/29  Problem: 077_arc_c / Link: https://arc077.contest.atcoder.jp/tasks/arc077_a  ----- */

/* ------問題------



-----問題ここまで----- */

/* -----解説等-----



dequeさん…はじめて会ったね



----解説ここまで---- */



LL N;



LL ans = 0LL;



int main() {

	cin.tie(0);

	ios_base::sync_with_stdio(false);



	deque<int>dq;

	cin >> N;

	FOR(i, 0, N) {

		int a; cin >> a;

		if (SZ(dq) % 2 == N%2) { dq.push_back(a); }

		else { dq.push_front(a); }

	}

	FOR(i, 0, N) {

		cout << dq.front() << (i != N - 1 ? ' ' : '\n');

		dq.pop_front();

	}



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.767248440470031x):
#include <stdio.h>

#include <string.h>

#define MAXN 100005



int main()

{

    int n;

    while(scanf("%d", &n) != EOF)

    {

        int a,num = n,flag = 1;

        int head[MAXN],tail[MAXN];

        int num_i = 0, num_j = 0;

        while(num--)

        {

            scanf("%d", &a);

            if(flag)

                tail[num_j++] = a;

            else

                head[num_i++] = a;

            flag = !flag;

        }

        if(n%2 == 0)

        {

            for(int i = num_i - 1; i >= 0; i--)

            {

                printf("%d ", head[i]);

            }

            for(int j = 0; j < num_j - 1; j++)

            {

                printf("%d ", tail[j]);

            }

            if(num_j)printf("%d\n", tail[num_j - 1]);

            else printf("\n");

        }

        else

        {

            for(int j = num_j - 1; j >= 0; j--)

            {

                printf("%d ", tail[j]);

            }

            for(int i = 0; i < num_i - 1; i++)

            {

                printf("%d ", head[i]);

            }

            if(num_i)printf("%d\n", head[num_i - 1]);

            else printf("\n");

        }

    }

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=2e5+105;

int ax[maxn],bx[maxn];

int main()

{

    int n;

    while(scanf("%d",&n)!=EOF)

    {

        for(int i=0;i<n;i++)

            scanf("%d",&ax[i]);

        int l=0,r=n-1,index=n-1,cnt=0;

        while(1)

        {

           if(cnt%2==0)

             bx[l++]=ax[index--];

           else

             bx[r--]=ax[index--];

           cnt++;

           if(n%2==0&&r==(n/2)-1)

             break;

           if(n%2==1&&l==n/2+1)

               break;

        }

        for(int i=0;i<n;i++)

        {

            if(i!=0)

                printf(" ");

            printf("%d",bx[i]);

        }

        printf("\n");

    }





    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.603484142069995x):
#include <stdio.h>

#include <string.h>

#define MAXN 100005



int main()

{

    int n;

    while(scanf("%d", &n) != EOF)

    {

        int a,num = n,flag = 1;

        int head[MAXN],tail[MAXN];

        int num_i = 0, num_j = 0;

        while(num--)

        {

            scanf("%d", &a);

            if(flag)

                tail[num_j++] = a;

            else

                head[num_i++] = a;

            flag = !flag;

        }

        if(n%2 == 0)

        {

            for(int i = num_i - 1; i >= 0; i--)

            {

                printf("%d ", head[i]);

            }

            for(int j = 0; j < num_j - 1; j++)

            {

                printf("%d ", tail[j]);

            }

            if(num_j)printf("%d\n", tail[num_j - 1]);

            else printf("\n");

        }

        else

        {

            for(int j = num_j - 1; j >= 0; j--)

            {

                printf("%d ", tail[j]);

            }

            for(int i = 0; i < num_i - 1; i++)

            {

                printf("%d ", head[i]);

            }

            if(num_i)printf("%d\n", head[num_i - 1]);

            else printf("\n");

        }

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main()

{

	int n;

	cin >> n;

	long long int *b;

	int k = n / 2;

	int var = 0;

	var = n - 2 * k;

	b = new long long int[n];

	for (int i = 1; i <= n; i++) {

		cin >> b[k];

		if (var == 0) {

			k -= i;

			var++;

		}

		else {

			k += i;

			var--;

		}

	}

	cout << b[0];

	for (int i = 1; i < n; i++) {

		cout << " " << b[i];

	}

	return 0;

}




// Faster C++ solution for the same problem (measured speedup: 4.661235506577459x):
#include <stdio.h>

#include <string.h>

#define MAXN 100005



int main()

{

    int n;

    while(scanf("%d", &n) != EOF)

    {

        int a,num = n,flag = 1;

        int head[MAXN],tail[MAXN];

        int num_i = 0, num_j = 0;

        while(num--)

        {

            scanf("%d", &a);

            if(flag)

                tail[num_j++] = a;

            else

                head[num_i++] = a;

            flag = !flag;

        }

        if(n%2 == 0)

        {

            for(int i = num_i - 1; i >= 0; i--)

            {

                printf("%d ", head[i]);

            }

            for(int j = 0; j < num_j - 1; j++)

            {

                printf("%d ", tail[j]);

            }

            if(num_j)printf("%d\n", tail[num_j - 1]);

            else printf("\n");

        }

        else

        {

            for(int j = num_j - 1; j >= 0; j--)

            {

                printf("%d ", tail[j]);

            }

            for(int i = 0; i < num_i - 1; i++)

            {

                printf("%d ", head[i]);

            }

            if(num_i)printf("%d\n", head[num_i - 1]);

            else printf("\n");

        }

    }

    return 0;

}
// Slower C++ solution:
#include <algorithm>

#include <iostream>

#include <cstring>

#include <cstdio>

#include <cmath>



using namespace std;



int a[300000],b[300000];



int main ()

{

	int n,m;

	scanf ("%d",&n);

	m=n;

	for (int i=1;i<=n;i++)

		scanf ("%d",&a[i]);

	int j=0;

	for (int i=n;i>0;i-=2)

		b[++j]=a[i];

	for (int i=n-1;i>0;i-=2)

		b[m--]=a[i];

	for (int i=1;i<n;i++)

		printf ("%d ",b[i]);

	printf ("%d\n",b[n]);

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.596660954674169x):
#include <stdio.h>

#include <string.h>

#define MAXN 100005



int main()

{

    int n;

    while(scanf("%d", &n) != EOF)

    {

        int a,num = n,flag = 1;

        int head[MAXN],tail[MAXN];

        int num_i = 0, num_j = 0;

        while(num--)

        {

            scanf("%d", &a);

            if(flag)

                tail[num_j++] = a;

            else

                head[num_i++] = a;

            flag = !flag;

        }

        if(n%2 == 0)

        {

            for(int i = num_i - 1; i >= 0; i--)

            {

                printf("%d ", head[i]);

            }

            for(int j = 0; j < num_j - 1; j++)

            {

                printf("%d ", tail[j]);

            }

            if(num_j)printf("%d\n", tail[num_j - 1]);

            else printf("\n");

        }

        else

        {

            for(int j = num_j - 1; j >= 0; j--)

            {

                printf("%d ", tail[j]);

            }

            for(int i = 0; i < num_i - 1; i++)

            {

                printf("%d ", head[i]);

            }

            if(num_i)printf("%d\n", head[num_i - 1]);

            else printf("\n");

        }

    }

    return 0;

}