stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

int a[500000];

int main(){

int q,h,i,j,k,l,m,n,r;

l=250000;

r=250001;

k=0;

scanf("%d",&n);

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

 if(k==0){

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

 	r++;

 	k=1;

 }

 else{

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

 	l--;

 	k=0;

 }

 

}

if(k==0){

for(i=l+1;i<r;i++){

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

}

}

else{

	for(i=r-1;i>l;i--){

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

}

}

return 0;

} 

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

#pragma warning(disable:4996)

int main()

{

	int a;

	scanf("%d", &a);

	long long *b = (long long *)malloc(sizeof(long long)*a);

	long long *c = (long long *)malloc(sizeof(long long)*a);

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

	{

		scanf("%lld", b + i);

	}

	int A = a;

	if (a % 2 == 0)

	{

		for (int i = 0; i < A/2; i++)

		{

			c[i] = b[a - 2 * i-1];

		}

		for (int i = 0; i < A/2; i++)

		{

			c[i+A/2] = b[2 * i];

		}

	}

	if (a % 2 == 1)

	{

		for (int i = 0; i <= A/2; i++)

		{

			c[i] = b[a - 2 * i-1];

		}

		for (int i = 1; i <= A / 2; i++)

		{

			c[A / 2+i] = b[2 * i-1];

		}

	}

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

	{

		printf("%lld ", c[i]);

	}

	getchar();

	getchar();

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<stack>

#include<queue>

using namespace std;

int main()

{

    int n,i;

    int a;

    while(cin>>n)

    {

        

        

        queue<int> b;

        stack<int> c;

        if(n%2==0)

        {

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

            {

                cin>>a;

             if(i%2==0)

             c.push(a);

             else 

             b.push(a);

            }

             

            while(!c.empty())

        {

            int k=c.top();

            cout<<k<<" ";

            c.pop();



        }

         while(b.size()>1)

        {

            int k=b.front();

            cout<<k<<" ";

            b.pop();



        }

        cout<<b.front()<<endl;





        }

        else if(n>1)

        {

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

            {

                cin>>a;

             if(i%2==0)

             b.push(a);

             else 

             c.push(a);

            }

             

             while(!c.empty())

            

            {

                int k=c.top();

                cout<<k<<" ";

                c.pop();

            }

            while(b.size()>1)

        {

            int k=b.front();

            cout<<k<<" ";

            b.pop();



        }

        cout<<b.front()<<endl;



        }

        if(n==1)

        {

            cin>>a;

            cout<<a<<endl;

        }

        

        

         } 

        

    

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

#pragma warning(disable:4996)

int main()

{

	int a;

	scanf("%d", &a);

	long long *b = (long long *)malloc(sizeof(long long)*a);

	long long *c = (long long *)malloc(sizeof(long long)*a);

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

	{

		scanf("%lld", b + i);

	}

	int A = a;

	if (a % 2 == 0)

	{

		for (int i = 0; i < A/2; i++)

		{

			c[i] = b[a - 2 * i-1];

		}

		for (int i = 0; i < A/2; i++)

		{

			c[i+A/2] = b[2 * i];

		}

	}

	if (a % 2 == 1)

	{

		for (int i = 0; i <= A/2; i++)

		{

			c[i] = b[a - 2 * i-1];

		}

		for (int i = 1; i <= A / 2; i++)

		{

			c[A / 2+i] = b[2 * i-1];

		}

	}

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

	{

		printf("%lld ", c[i]);

	}

	getchar();

	getchar();

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//author:happylkx

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

#include <string.h>

#include <string>

#include <math.h>

#include <queue>

#include <stack>

#include <list>

using namespace std;

typedef long long LL;



int main()

{

	int n;

	cin >> n;

	list <int> li;

	bool rev = false;

	while (n--) {

		int temp;

		cin >> temp;

		if (rev)li.push_front(temp);

		else li.push_back(temp);

		rev = !rev;

	}

	if (rev) {

		li.reverse();

		for (auto i : li) {

			cout << i << " ";

		}

	}

	else {

		for (auto i : li) {

			cout << i << " ";

		}

	}



	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

#pragma warning(disable:4996)

int main()

{

	int a;

	scanf("%d", &a);

	long long *b = (long long *)malloc(sizeof(long long)*a);

	long long *c = (long long *)malloc(sizeof(long long)*a);

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

	{

		scanf("%lld", b + i);

	}

	int A = a;

	if (a % 2 == 0)

	{

		for (int i = 0; i < A/2; i++)

		{

			c[i] = b[a - 2 * i-1];

		}

		for (int i = 0; i < A/2; i++)

		{

			c[i+A/2] = b[2 * i];

		}

	}

	if (a % 2 == 1)

	{

		for (int i = 0; i <= A/2; i++)

		{

			c[i] = b[a - 2 * i-1];

		}

		for (int i = 1; i <= A / 2; i++)

		{

			c[A / 2+i] = b[2 * i-1];

		}

	}

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

	{

		printf("%lld ", c[i]);

	}

	getchar();

	getchar();

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include "deque"

#include "vector"

using namespace std;

typedef long long ll;

int main()

{

    ll n,x;

    cin >> n;

    deque<ll> deq;

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

        cin >> x;

        if (i%2==0)

        deq.push_back(x);

        else deq.push_front(x);

    }

    bool flag=false;

    if (n%2==0){

        for(int i=0;i<deq.size();i++){

            if (flag) cout << " ";

            flag=true;

            cout << *(i+deq.begin());

        }

    }else {

        for (int i=deq.size()-1;i>=0;i--){

           if (flag) cout << " ";

            flag=true;

          cout << *(i+deq.begin());

    }

    }



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

#pragma warning(disable:4996)

int main()

{

	int a;

	scanf("%d", &a);

	long long *b = (long long *)malloc(sizeof(long long)*a);

	long long *c = (long long *)malloc(sizeof(long long)*a);

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

	{

		scanf("%lld", b + i);

	}

	int A = a;

	if (a % 2 == 0)

	{

		for (int i = 0; i < A/2; i++)

		{

			c[i] = b[a - 2 * i-1];

		}

		for (int i = 0; i < A/2; i++)

		{

			c[i+A/2] = b[2 * i];

		}

	}

	if (a % 2 == 1)

	{

		for (int i = 0; i <= A/2; i++)

		{

			c[i] = b[a - 2 * i-1];

		}

		for (int i = 1; i <= A / 2; i++)

		{

			c[A / 2+i] = b[2 * i-1];

		}

	}

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

	{

		printf("%lld ", c[i]);

	}

	getchar();

	getchar();

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <vector>

#include <string>

#include <stack>

#include <queue>

#include <cctype>

#include <cmath>

#include <map>

#include <set>

#define rep(i, m, n) for(int i = m;i < n;i++)

#define repr(i, n) for(int i = n;i >= 0;i--)

#define ll long long

#define ull unsigned long long

#define pb(a) push_back(a)

#define popb(a) pop_back(a)

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

#define SORT(v, n) sort(v, v+n);

#define VSORT(v) sort(v.begin(), v.end());

#define INF 999999999

#define PI 3.14159265358979

using namespace std;

typedef pair<int, int> P;

typedef pair<ll, ll> LP;

typedef pair<int, P> PP;

typedef pair<ll, LP> LPP;

 

int dy[]={0, 0, 1, -1, 0};

int dx[]={1, -1, 0, 0, 0};

 

int main(){

  ll n,b[200005]={};

  cin>>n;

  rep(i,0,n){

    cin>>b[i];

  }

  if(n%2==0){

    for(ll i=n-1; i>0; i--){

      if(i!=n-1&&i%2==1)cout<<" ";

      if(i%2==1)cout<<b[i];

    }

    cout<<" ";

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

      if(i%2==0)cout<<b[i];

      if(i!=n-1&&i%2==0)cout<<" ";

    }

    cout<<endl;

  }else{

    for(ll i=n-1; i>=0; i--){

      if(i!=n-1&&i%2==0)cout<<" ";

      if(i%2==0)cout<<b[i];

    }

    cout<<" ";

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

      if(i%2==1)cout<<b[i];

      if(i!=n-1&&i%2==1)cout<<" ";

    }

    cout<<endl;

  }

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <algorithm>

#include <vector>

#include <string>

#include <stack>

#include <queue>

#include <cctype>

#include <cmath>

#include <map>

#include <set>

#define rep(i, m, n) for(int i = m;i < n;i++)

#define repr(i, m, n) for(int i = m;i >= n;i--)

#define ll long long

#define ull unsigned long long

#define push(a) push_back(a)

#define pop(a) pop_back(a)

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

#define SORT(v, n) sort(v, v+n);

#define VSORT(v) sort(v.begin(), v.end());

#define INF 999999999

#define PI 3.14159265358979

using namespace std;

typedef pair<int, int> P;

typedef pair<ll, ll> LP;

typedef pair<int, P> PP;

typedef pair<ll, LP> LPP;



int dy[]={0, 0, 1, -1, 0};

int dx[]={1, -1, 0, 0, 0};



int main(){

    deque<int> dq;

    int n,a;

    cin>>n;

    rep(i,0,n){

        cin>>a;

        if(i%2==1){

            dq.push_back(a);

        }else{

            dq.push_front(a);

        }

    }

    if(n%2==0){

        reverse(dq.begin(),dq.end());

    }

    rep(i,0,n){

        if(i)cout<<" ";

        cout<<dq[i];

    }

    cout<<endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#define ll long long

#define ffor(i, a, b) for (int i = (a); i < (b); i++)

#define rfor(i, a, b) for (int i = (b)-1; i >= (a); i--)

#define rep(i, n) for (int i = 0; i < (n); i++)

#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)

#include <algorithm>

#include <cmath>

#include <cstdio>

#include <deque>

#include <iomanip>

#include <iostream>

#include <map>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

#define SIZE 100001

#define MOD 1000000007

#define INF 100000000

using namespace std;



int main() {

  int n;

  scanf("%d", &n);



  vector<int> a(250001);

  deque<int> deq;

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



  rep(i, n) {

    if (i % 2 == (n - 1) % 2)

      deq.push_front(a[i]);

    else

      deq.push_back(a[i]);

  }



  for (auto x : deq) printf("%d ", x);

  printf("\n");

}

// Optimized solution to the same problem (faster):
#define ll long long

#define ffor(i, a, b) for (int i = (a); i < (b); i++)

#define rfor(i, a, b) for (int i = (b)-1; i >= (a); i--)

#define rep(i, n) for (int i = 0; i < (n); i++)

#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)

#include <algorithm>

#include <cmath>

#include <cstdio>

#include <deque>

#include <iomanip>

#include <iostream>

#include <map>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

#define SIZE 100001

#define MOD 1000000007

#define INF 100000000

using namespace std;



int main() {

  int n;

  scanf("%d", &n);



  // vector<int> a(250001);

  deque<int> deq;

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



  rep(i, n) {

    int a;

    scanf("%d", &a);

    if (i % 2 == (n - 1) % 2)

      deq.push_front(a);

    else

      deq.push_back(a);

  }



  for (auto x : deq) printf("%d ", x);

  printf("\n");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

long long a,k;

vector<int>n;

int main()

{

    cin>>a;

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

    {

        cin>>k;

        if((i+a+1)%2)n.push_back(k);

        else n.insert(n.begin(),k);

    }

    for(int i=0; i<a; i++)cout<<n[i]<<" ";

}

// Optimized solution to the same problem (faster):
// luogu-judger-enable-o2

#include<cstdio>

int n,a[200010];

inline int read(){

	int ret=0;char c=getchar();

	while(c<'0'||c>'9')c=getchar();

	while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();

	return ret;

}

int main()

{

	n=read();

	for(register int i=1;i<=n;++i)a[i]=read();

	for(register int i=n;i>0;i-=2)printf("%d ",a[i]);

	for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int n,v,l[200005],b,e;

int main()

{

    cin>>n;

    b=ceil((double)(n+1)/2);

    e=(n%2==0)?(-1):(1);

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

	{

        cin>>v;

        l[b]=v;

        b+=i*e;

        e*=-1;

    }

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

    cout<<l[i]<<" ";

    return 0;

}

// Optimized solution to the same problem (faster):
// luogu-judger-enable-o2

#include<cstdio>

int n,a[200010];

inline int read(){

	int ret=0;char c=getchar();

	while(c<'0'||c>'9')c=getchar();

	while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();

	return ret;

}

int main()

{

	n=read();

	for(register int i=1;i<=n;++i)a[i]=read();

	for(register int i=n;i>0;i-=2)printf("%d ",a[i]);

	for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <queue>

#include <algorithm>

using namespace std;

int n,a;

deque <int> q;

int main(){

    scanf("%d",&n);

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

        scanf("%d",&a);

        if(i&1) q.push_back(a);

        else q.push_front(a);

    }

    if(n&1) reverse(q.begin(),q.end());

    while(!q.empty()){

        int f=q.front();

        printf("%d ",f);

        q.pop_front();

    }

    return 0;

}

// Optimized solution to the same problem (faster):
// luogu-judger-enable-o2

#include<cstdio>

int n,a[200010];

inline int read(){

	int ret=0;char c=getchar();

	while(c<'0'||c>'9')c=getchar();

	while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();

	return ret;

}

int main()

{

	n=read();

	for(register int i=1;i<=n;++i)a[i]=read();

	for(register int i=n;i>0;i-=2)printf("%d ",a[i]);

	for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int n,v,l[200005],b,e;

int main(){

    cin>>n;

    b=ceil((double)(n+1)/2);

    e=(n%2==0)?(-1):(1);

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

        cin>>v;

        l[b]=v;

        b+=i*e;

        e*=-1;

    }

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

    cout<<l[i]<<" ";

    return 0;

}

// Optimized solution to the same problem (faster):
// luogu-judger-enable-o2

#include<cstdio>

int n,a[200010];

inline int read(){

	int ret=0;char c=getchar();

	while(c<'0'||c>'9')c=getchar();

	while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();

	return ret;

}

int main()

{

	n=read();

	for(register int i=1;i<=n;++i)a[i]=read();

	for(register int i=n;i>0;i-=2)printf("%d ",a[i]);

	for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

deque<int>d;

int n,ans,a;

int main() {

	ios::sync_with_stdio(false);

	cin >> n;

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

		cin >> a;

		if(i & 1)

			d.push_back(a);

		else

			d.push_front(a);

	}

	if(n & 1)

		reverse(d.begin(),d.end());

	deque<int>::iterator it;

	for(it = d.begin(); it != d.end(); it++)

		cout << *it << " ";

	cout << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;int n,a[200010];inline int read(){ register int ret=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')ret=(ret<<1)+(ret<<3)+(c^48),c=getchar();return ret;}int main(){n=read();for(register int i=1;i<=n;++i)a[i]=read();for(register int i=n;i>0;i-=2)printf("%d ",a[i]);for(register int i=(n&1)+1;i<=n;i+=2)printf("%d ",a[i]);return 0;}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main() {

    int n; cin >> n;

    int a[n];

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

        cin >> a[i];

    }

    int b[2 * 100000 + 1] = {0};

    int st = n / 2;

    if (n % 2 == 0) {

        b[st] = a[0];

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

            int cont;

            if (i % 2 == 0) {

                cont = 1;

                cont *= i / 2;

            } else {

                cont = -1;

                cont *= i / 2 + 1;

            }

            b[st + cont] = a[i];

        }

    } else {

        b[st] = a[0];

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

            int cont;

            if (i % 2 == 0) {

                cont = -1;

                cont *= i / 2;

            } else {

                cont = 1;

                cont *= i / 2 + 1;

            }

            b[st + cont] = a[i];

        }

    }

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

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

        if (i == n - 1) cout << endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define F first

#define S second

#define pii pair<int, int>

#define eb emplace_back

#define all(v) v.begin(), v.end()

#define rep(i, n) for (int i = 0; i < (n); ++i)

#define rep3(i, l, n) for (int i = l; i < (n); ++i)

#define sz(v) (int)v.size()

#define inf (int)(1e9+7)

#define abs(x) (x >= 0 ? x : -(x))

#define ceil(a, b) a / b + !!(a % b)

template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }

template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }





int main() {

    deque<int> q;

    int n;

    cin >> n;

    rep(i, n) {

        int a;

        cin >> a;

        if (n % 2 == 0) {

            if (i % 2 == 0) {

                q.push_back(a);

            } else {

                q.push_front(a);

            }

        } else {

            if (i % 2 != 0) {

                q.push_back(a);

            } else {

                q.push_front(a);

            }

        }

    }

    rep(i, n) {

        if (i) cout << " ";

        cout << q.front();

        q.pop_front();

    }

    cout << endl;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int n,x,a[500000];

int main(){

	scanf("%d",&n);

	int l=233333,r=233332;

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

		scanf("%d",&x);

		if (i&1) a[++r]=x;

		else a[--l]=x;

	}

	if (n&1)

		for (int i=r;i>=l;i--)

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

	else

		for (int i=l;i<=r;i++)

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

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define N 400020

#define ll long long

using namespace std;

inline int read(){

	int x=0,f=1;char ch=getchar();

	while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());

	while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();

	return f?x:-x;

}

int q[N];

int main(int argc, char const *argv[]) {

	int n = read(), l = 200001, r = 200000;

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

		if (i & 1) q[++r] = read();

		else q[--l] = read();

	if (~ n & 1) for (int i = l; i <= r; i++) printf("%d ", q[i]);

	else for (int i = r; i >= l; i --) printf("%d ", q[i]);

	return 0;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <cmath>

#include <deque>

#include <algorithm>

#include <iostream>

using namespace std;



#define rp(i,t) for(int i=0;i<(t);i++)

#define rep(i,s,t) for(int i=(s);i<=(t);i++)

#define rsp(i,s,t) for(int i=(s);i<(t);i++)

#define rrp(i,t,s) for(int i=(t);i>=(s);i--)

#define rcp(i,s,b,d) for(int i=(s);b;d)

#define mst(a,x) memset(a,x,sizeof(a))

#define INF 0x3f3f3f3f

#define N



#define Dp puts("")

#define Dw printf

#define Ds printf("#")



typedef long long ll;

bool b;

char ch;

int n,x;

deque<int> Q;



inline void read(int &x){x=0;do{ch=getchar();}while(ch<'0'||'9'<ch);do{x=x*10+ch-'0';ch=getchar();}while('0'<=ch&&ch<='9');}



int main(void)

{

	read(n);

	rep(i,1,n)

	{

		read(x);

		if(b)Q.push_front(x);

		else Q.push_back(x);

		b=!b;

	}

	if(b)

	{

		while(!Q.empty())

		{

			printf("%d ",Q.back());

			Q.pop_back();

		}

	}

	else

	{

		while(!Q.empty())

		{

			printf("%d ",Q.front());

			Q.pop_front();

		}

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem: