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

#define int long long

using namespace std;

int read(){

	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();

	int kk=1,k=0;if (c=='-')kk=-1,c=getchar();

	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();return kk*k;

}int n,a[1000000],d;

signed main(){

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

	for (;d>=1;d-=2)cout<<a[d]<<' ';d+=2;if (d==2)d=1;else d=2;

	for (;d<=n;d+=2)cout<<a[d]<<' ';

}


// 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 <iostream>

#include <algorithm> 

using namespace std;

int main()

{

	int n=0;

	cin>>n;

	int a[n];

	for(int i=0;i<n;i++) cin>>a[i];

	int b[n];

	int c=0;

	if(n%2==1){ //3       1 2 3

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

			b[c]=a[i];//b[0]=3 b[1]=1

			c++;//1 2

		}

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

			b[c]=a[i];//b[2]=2

			c++;//3

		}

	}//3 1 2

	else{ //4      1 2 3 4

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

			b[c]=a[i]; //b[0]=4 b[1]=2

			c++; //1 2

		}

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

			b[c]=a[i]; //b[2]=1 b[3]=3

			c++;//3

		}

	}//4 2 1 3

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

		cout<<b[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 "bits/stdc++.h"

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

#define INF 1<<30

#define LINF 1LL<<60



int main(void) {

    cin.tie(0); ios::sync_with_stdio(false);

    ll n; cin >> n;

    vector<ll> a(n);

    for(auto& in:a) cin >> in;

    

    deque<ll> dep;

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

        if(i%2 == 0){

            dep.push_back(a[i]);

        }else{

            dep.push_front(a[i]);

        }

    }

    vector<ll> res(dep.begin(),dep.end());

    if(n%2==1)reverse(res.begin(), res.end());

    for(auto v:res){

        cout << v << " ";

    }

    cout << endl;

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



using namespace std;



int main() {

	int n, m;

	scanf("%d", &n);

	m = n;



	int a[n];



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

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

	}



	while (n > 0) {

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

		n -= 2;

	}

	if (n % 2) {

		n = 2;

	} else {

		n = 1;

	}

	while (n < m) {

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

		n += 2;

	}





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

}




// 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<iostream>

using namespace std;

int main()

{

	int n;

	scanf("%d", &n);

	int *a = new int[n];

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

	{

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

	}

	int nn = n / 2;

	if (n % 2 == 0)

	{

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

		{

			printf("%d ", a[n - 2 * i - 1]);

		}

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

		{

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

		}

	}

	else

	{

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

		{

			printf("%d ", a[n - 2 * i - 1]);

		}

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

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

		{

			printf("%d ", a[2 * i + 1]);

		}

	}

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

using namespace std;

const int MAXN=2e5+5;

int a[MAXN];





int main()

{

    int n;

    while(cin>>n)

    {

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

        {

            cin>>a[i];

        }

        if(n&1)

        {

            cout<<a[n];

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

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

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

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

            cout<<endl;

        }else

        {

            cout<<a[n];

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

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

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

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

            cout<<endl;

        }

    }

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

using namespace std;

int n;

int a[200000+5];

int main(){

	scanf("%d",&n);

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

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

	}

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

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

	}

	int i = 1;

	if(n%2==1)

		i =2;

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

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

	}

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

		

	printf("\n");

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

using namespace std;

int main()

{

	int n,m,y,z=0;

	cin >> n;

	y = n-1;

	int a[200010], b[200010];

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

	{

		cin >> a[i];

	}

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

	{

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

		{

			if (j % 2 == 0)

			{

				b[z] = a[j];

				z++;

			}

			else {

				b[y] = a[j];

				y--;

			}		

		}

	}

	else

	{

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

		{

			if (j % 2 != 0)

			{

				b[z] = a[j];

				z++;

			}

			else {

				b[y] = a[j];

				y--;

			}		

		}

	}

	

	for (int x = 0; x < n-1; x++)

	{

		cout << b[x] << " ";

	}

	cout << b[n - 1] << endl;

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

#include<stack>

#include<cmath>

#include<queue>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<iostream>

#include<algorithm>

using namespace std;

#define ll long long

int a[210000],b[210000];

int main()

{

    int n;

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

    {

        int i,j,q=1,flag=1,k=0;

        memset(a,0,sizeof(a));

        memset(b,0,sizeof(b));

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

        {

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

        }

        if(n%2==0)

        {

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

            {

                b[i]=a[n-k];

                k+=2;

            }

            for(i=n; i>n/2; i--)

            {

                b[i]=a[n-q];

                q+=2;

            }

        }

        else

        {

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

            {

                b[i]=a[n-k];

                k+=2;

            }

            for(i=n;i>(n+1)/2;i--)

            {

                b[i]=a[n-q];

                q+=2;

            }

        }

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

        {

            if(i==1)

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

            else

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

        }



        printf("\n");

    }

    return 0;

}


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

#include<queue>

#include<cstdio>

using namespace std;







int main()

{

    deque<int> ans;

    int n;

    scanf("%d",&n);

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

    {

        int num;

        scanf("%d",&num);

        if(i&1)

            ans.push_front(num);

        else

            ans.push_back(num);

    }

    int i = 0;

    if(n&1)

    {

        while(i<n-1)

        {

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

            ans.pop_front();

            i++;

        }

        printf("%d\n",ans.front());

    }

    else

    {

        while(i<n-1)

        {

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

            ans.pop_back();

            i++;

        }

        printf("%d\n",ans.back());

    }

    return 0;

}


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

#include<iomanip>

#include<cmath>

#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<algorithm>

#include<set>

#include<map>

#include<queue>

#include<stack>

#include<vector>

#include<cctype>

#define szxb 200010

#define F(a,b,c,d,e) for(register int (a)(b);((e)?((a)<=(c)):((a)>=(c)));(a)+=(d))

using namespace std;

int n,a[szxb];

inline void print(int x){putchar(32),printf("%d",x);return;}

signed main()

{

	scanf("%d",&n);

	F(i,1,n,1,1){scanf("%d",&a[i]);}printf("%d",a[n]);

	F(i,(n-2),1,-2,0){print(a[i]);}F(i,(1+(n&1)),n,2,1){print(a[i]);}

	return putchar(10),0;

}

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

#define ll long long

int a[200100];

int b[100100],c[100100];

int main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0);

    int i,j,k,m,n;

    int bb=0,cc=0;

    cin>>n;

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

        cin>>a[i];

    if(n%2==0)

    {

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

        {

            if(i%2==0)

            {

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

            }

            else

                c[++cc]=a[i];

        }

    }

    else

    {

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

        {

            if(i%2!=0)

            {

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

            }

            else

                c[++cc]=a[i];

        }

    }

    for(i=bb; i>=1; i--)

        cout<<b[i]<<' ';

    cout<<a[1]<<' ';

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

        cout<<c[i]<<' ';

    if(cc)

        cout<<c[cc]<<endl;

    return 0;

}


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

vector <int> V;



int main() {

    scanf("%d", &n);

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

    	int temp;

        scanf("%d", &temp);

        if((n + i) & 1) V.push_back(temp);

        else V.insert(V.begin(), temp);

    }

    for (int i = 0; i < n; ++i) printf("%d ", V[i]);

}

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

int n,w;

int main()

{

    cin>>n;

    for(int i=n%2;i<n+n%2;i++)

    {

        cin>>w;

        if(i%2==0) dq.push_back(w);

        else dq.push_front(w);

    }

    for(deque<int>::iterator i=dq.begin();i!=dq.end();i++)

    cout<<*i<<" ";

}

// Optimized solution to the same problem (faster):
#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):
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")

//#pragma GCC optimize(2)

//#include <immintrin.h>

#include<bits/stdc++.h>

using namespace std;

int main()

{

   	deque<int> a;

   	int n,o;

   	cin >> n;

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

   	{

   		cin >> o;

   		if(i & 1)

   			a.push_back(o);

   		else

   			a.push_front(o);

	}

	if(n & 1)

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

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

	{

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

	}

	puts("");

    return 0;

}

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