stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<stdio.h>

#include<iostream>

#include<algorithm>

#include<math.h>

#include<stdlib.h>

#include<string.h>

#include<string>

#include<set>

#include<vector>

#include<bitset>

#include<map>

#define N 400005

#define ll long long

#define oo 1000000000000000

#define For(i,x,y) for(int i=x;i<=y;i++)

#define Rep(i,x,y) for(int i=x;i>=y;i--)

#define Forn(i,x,y) for(int i=x;i<y;i++)

using namespace std;

inline int read(){int x=0,f=0;char ch=getchar();for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-48;return f?-x:x;}

inline void write(ll x){if(x<10) putchar(x+48);else write(x/10),putchar(x%10+48);}

inline void writeln(ll x){if(x<0) putchar('-'),x=-x;write(x);putchar('\n');}

int n,a[N],l,r,p[N];

int main(){

	n=read();For(i,1,n) a[i]=read();

	p[l=r=200000]=a[1];

	For(i,2,n){

		if(i&1) p[--l]=a[i];

		else p[++r]=a[i];

	}

	if(n&1) For(i,l,r) cout<<p[i]<<" ";

	else Rep(i,r,l) cout<<p[i]<<" ";

	return 0;

}

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

#include<stdlib.h>



int main() {

	int n;

	scanf("%d", &n);



	int *a;

	int head, tail,b;



	a = (int *)malloc(n * sizeof(int));

	if (n % 2 == 1) {

		head = (n - 1) / 2 - 1;

		tail = (n - 1) / 2 + 1;

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

			scanf("%d", &b);

			if (i == 0) {

				a[head + 1] = b;

			}

			else if (i % 2 == 1) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

	else{

		head = n / 2 - 1;

		tail = n / 2;

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

			scanf("%d", &b);

			if (i % 2 == 0) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

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

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

	}

	return 0;

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

#include <deque>



int main() {

	int n;

	scanf("%d", &n);

	std::deque<int> que;

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

		int a;

		scanf("%d", &a);

		if (i & 1)

			que.push_front(a);

		else

			que.push_back(a);

	}

	if (n & 1) {

		for (auto it = que.crbegin(); it != que.crend(); ++it) {

			printf("%d ", *it);

		}

	}

	else {

		for (auto it = que.cbegin(); it != que.cend(); ++it) {

			printf("%d ", *it);

		}

	}

	return 0;

}

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

#include<stdlib.h>



int main() {

	int n;

	scanf("%d", &n);



	int *a;

	int head, tail,b;



	a = (int *)malloc(n * sizeof(int));

	if (n % 2 == 1) {

		head = (n - 1) / 2 - 1;

		tail = (n - 1) / 2 + 1;

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

			scanf("%d", &b);

			if (i == 0) {

				a[head + 1] = b;

			}

			else if (i % 2 == 1) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

	else{

		head = n / 2 - 1;

		tail = n / 2;

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

			scanf("%d", &b);

			if (i % 2 == 0) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

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

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

	}

	return 0;

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

#include<iostream>

using namespace std;

list<int> sequenceb;

int main()

{

	int num, sequencea;

	bool flag = true;

	cin>> num;

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

	{

		cin>>sequencea;

		flag = !flag;

		if (flag) sequenceb.push_back(sequencea);

		else sequenceb.push_front(sequencea);

	}

	if (!(num& 1)) sequenceb.reverse();

	for (auto i = sequenceb.begin(); i != sequenceb.end(); i++)

		cout<<*i<<" ";

	return 0;

}

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

#include<stdlib.h>



int main() {

	int n;

	scanf("%d", &n);



	int *a;

	int head, tail,b;



	a = (int *)malloc(n * sizeof(int));

	if (n % 2 == 1) {

		head = (n - 1) / 2 - 1;

		tail = (n - 1) / 2 + 1;

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

			scanf("%d", &b);

			if (i == 0) {

				a[head + 1] = b;

			}

			else if (i % 2 == 1) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

	else{

		head = n / 2 - 1;

		tail = n / 2;

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

			scanf("%d", &b);

			if (i % 2 == 0) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

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

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

	}

	return 0;

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

using namespace std;



int main()

{

	cin.tie(0);

	cout.tie(0);

	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	int *a = new int[n];

	int tmp = 0;

	deque<int> dq;

	while (n--)

		cin >> a[tmp++];

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

	{

		if ((i + 1) % 2 == 1)

			dq.push_front(a[i]);

		if ((i + 1) % 2 == 0)

			dq.push_back(a[i]);

	}

	if (tmp % 2 != 0)

	{

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

		{

			cout << dq[i] << " ";

		}

	}

	else

	{

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

		{

			cout << dq[i] << " ";

		}

	}

	return 0;

}

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

#include<stdlib.h>



int main() {

	int n;

	scanf("%d", &n);



	int *a;

	int head, tail,b;



	a = (int *)malloc(n * sizeof(int));

	if (n % 2 == 1) {

		head = (n - 1) / 2 - 1;

		tail = (n - 1) / 2 + 1;

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

			scanf("%d", &b);

			if (i == 0) {

				a[head + 1] = b;

			}

			else if (i % 2 == 1) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

	else{

		head = n / 2 - 1;

		tail = n / 2;

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

			scanf("%d", &b);

			if (i % 2 == 0) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

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

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

	}

	return 0;

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

using namespace std;

int a[200050];

int main() {

	

	int n,i;

	cin >> n;

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

		cin >> a[i];

	}

	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.218231278220946x):
#include<stdio.h>

#include<stdlib.h>



int main() {

	int n;

	scanf("%d", &n);



	int *a;

	int head, tail,b;



	a = (int *)malloc(n * sizeof(int));

	if (n % 2 == 1) {

		head = (n - 1) / 2 - 1;

		tail = (n - 1) / 2 + 1;

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

			scanf("%d", &b);

			if (i == 0) {

				a[head + 1] = b;

			}

			else if (i % 2 == 1) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

	else{

		head = n / 2 - 1;

		tail = n / 2;

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

			scanf("%d", &b);

			if (i % 2 == 0) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

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

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

	}

	return 0;

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



using namespace std;



int main()

{

	int a[200000];

	int n,i;

	cin>>n;

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

	   cin>>a[i];

	if (n==1) cout<<a[0];

	else

	{

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

		cout<<a[i]<<' ';

		if (n%2==0) i=0;

		else i=1;

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

		cout<<a[i]<<' ';

		cout<<endl;

	}

	return 0;

} 

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

#include<stdlib.h>



int main() {

	int n;

	scanf("%d", &n);



	int *a;

	int head, tail,b;



	a = (int *)malloc(n * sizeof(int));

	if (n % 2 == 1) {

		head = (n - 1) / 2 - 1;

		tail = (n - 1) / 2 + 1;

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

			scanf("%d", &b);

			if (i == 0) {

				a[head + 1] = b;

			}

			else if (i % 2 == 1) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

	else{

		head = n / 2 - 1;

		tail = n / 2;

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

			scanf("%d", &b);

			if (i % 2 == 0) {

				a[tail] = b;

				tail++;

			}

			else {

				a[head] = b;

				head--;

			}

		}

	}

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

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

	}

	return 0;

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

using namespace std;

const int N=200005;

int b;

int n;

int a[N];

int x;

int main()

{

	scanf("%d",&n);

	b=1;

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

		scanf("%d",&x);

		a[n/2+(i/2)*b]=x;

		b=-b;

	}

	if(n%2==0)for(int i=0;i<n;i++)cout<<a[i]<<' ';

	else for(int i=n-1;i>=0;i--)cout<<a[i]<<' ';

}

// Faster C++ solution for the same problem (measured speedup: 5.011332270757723x):
#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 <deque>

using namespace std;



const int N = 2e5 + 5;



int n;

deque<int> Q;



int main() {

	ios::sync_with_stdio(false);

	cin >> n;

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

		int x;

		cin >> x;

		if (i & 1) Q.push_back(x);

		else Q.push_front(x);

	}

	if (n & 1) {

		for (auto it = Q.rbegin(); it != Q.rend(); ++it)

			cout << *it << ' ';

		cout << endl;

	} else {

		for (auto it = Q.begin(); it != Q.end(); ++it)

			cout << *it << ' ';

		cout << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.13184628820471x):
#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;

deque<int> q;

int n;

 int main()

{

	scanf("%d",&n);

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

	{

		int x;

		scanf("%d",&x);

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

		else q.push_front(x);

	}

	if (n&1) 

		for (int i=q.size()-1;i>=0;--i) printf("%d ",q[i]);

	else 

		for (int i=0;i<q.size();++i) printf("%d ",q[i]);

}

// Faster C++ solution for the same problem (measured speedup: 5.004597952509319x):
#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<stdio.h>

#include<iostream>

#include<algorithm>

#include<math.h>

#include<stdlib.h>

#include<string.h>

#include<string>

#include<set>

#include<vector>

#include<bitset>

#include<map>

#define N 400005

#define ll long long

#define oo 1000000000000000

#define For(i,x,y) for(int i=x;i<=y;i++)

#define Rep(i,x,y) for(int i=x;i>=y;i--)

#define Forn(i,x,y) for(int i=x;i<y;i++)

using namespace std;

inline int read(){int x=0,f=0;char ch=getchar();for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=1;for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-48;return f?-x:x;}

inline void write(ll x){if(x<10) putchar(x+48);else write(x/10),putchar(x%10+48);}

inline void writeln(ll x){if(x<0) putchar('-'),x=-x;write(x);putchar('\n');}

int n,a[N],l,r,p[N];

int main(){

	n=read();For(i,1,n) a[i]=read();

	p[l=r=200000]=a[1];

	For(i,2,n){

		if(i&1) p[--l]=a[i];

		else p[++r]=a[i];

	}

	if(n&1) For(i,l,r) cout<<p[i]<<" ";

	else Rep(i,r,l) cout<<p[i]<<" ";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.95547275502866x):
#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 <cstdio>

#include <deque>



int main() {

	int n;

	scanf("%d", &n);

	std::deque<int> que;

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

		int a;

		scanf("%d", &a);

		if (i & 1)

			que.push_front(a);

		else

			que.push_back(a);

	}

	if (n & 1) {

		for (auto it = que.crbegin(); it != que.crend(); ++it) {

			printf("%d ", *it);

		}

	}

	else {

		for (auto it = que.cbegin(); it != que.cend(); ++it) {

			printf("%d ", *it);

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.65013927029933x):
#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 <list>

#include<iostream>

using namespace std;

list<int> sequenceb;

int main()

{

	int num, sequencea;

	bool flag = true;

	cin>> num;

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

	{

		cin>>sequencea;

		flag = !flag;

		if (flag) sequenceb.push_back(sequencea);

		else sequenceb.push_front(sequencea);

	}

	if (!(num& 1)) sequenceb.reverse();

	for (auto i = sequenceb.begin(); i != sequenceb.end(); i++)

		cout<<*i<<" ";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.023198632950217x):
#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;



int main()

{

	cin.tie(0);

	cout.tie(0);

	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	int *a = new int[n];

	int tmp = 0;

	deque<int> dq;

	while (n--)

		cin >> a[tmp++];

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

	{

		if ((i + 1) % 2 == 1)

			dq.push_front(a[i]);

		if ((i + 1) % 2 == 0)

			dq.push_back(a[i]);

	}

	if (tmp % 2 != 0)

	{

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

		{

			cout << dq[i] << " ";

		}

	}

	else

	{

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

		{

			cout << dq[i] << " ";

		}

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.131589756098244x):
#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[200050];

int main() {

	

	int n,i;

	cin >> n;

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

		cin >> a[i];

	}

	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.01236540825753x):
#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 a[200000];

	int n,i;

	cin>>n;

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

	   cin>>a[i];

	if (n==1) cout<<a[0];

	else

	{

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

		cout<<a[i]<<' ';

		if (n%2==0) i=0;

		else i=1;

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

		cout<<a[i]<<' ';

		cout<<endl;

	}

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.095167804239368x):
#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;

long int j[200000];

int main()

{

	int i;

	cin >> i;

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

	{

		cin >> j[z];

	}

	if (i % 2 == 0)

	{

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

		{

			cout << j[z] << " ";

		}

		for (int z = 0; z < i; z = z + 2)

		{

			cout << j[z] << " ";

		}

	}

	else

	{

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

		{

			cout << j[z] << " ";

		}

		for (int z = 1; z < i; z = z + 2)

		{

			cout << j[z] << " ";

		}

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.007910440856733x):
#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()

{const int size=2e+5;

int a[size],b[size];

int n;

cin>>n;



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

{cin>>a[i];

}



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

{

	

	

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

	

	if(i<0)

	break;

	

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



}





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

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

}

return 0;

 } 

// Faster C++ solution for the same problem (measured speedup: 5.164999207974644x):
#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 <deque>

using namespace std;



const int N = 2e5 + 5;



int n;

deque<int> Q;



int main() {

	ios::sync_with_stdio(false);

	cin >> n;

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

		int x;

		cin >> x;

		if (i & 1) Q.push_back(x);

		else Q.push_front(x);

	}

	if (n & 1) {

		for (auto it = Q.rbegin(); it != Q.rend(); ++it)

			cout << *it << ' ';

		cout << endl;

	} else {

		for (auto it = Q.begin(); it != Q.end(); ++it)

			cout << *it << ' ';

		cout << endl;

	}

	return 0;

}

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

#include<list>

using namespace std;

int main(void)

{

	int m,n;

	int t = 1;

	list<int>List;

	scanf("%d", &n);

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

	{

		scanf("%d", &m);

		t = !t;

		if(t)

			List.push_back(m);

		else

			List.push_front(m);

	}

	if (n%2==0) 

		List.reverse();

	for(auto i = List.begin(); i!= List.end();i++)

		printf("%d ",*i);

	return 0;

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

using namespace std;



int main()

{

	cin.tie(0);

	cout.tie(0);

	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	int *a = new int[n];

	int tmp = 0;

	deque<int> dq;

	while (n--)

		cin >> a[tmp++];

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

	{

		if ((i + 1) % 2 == 1)

			dq.push_front(a[i]);

		if ((i + 1) % 2 == 0)

			dq.push_back(a[i]);

	}

	if (tmp % 2 != 0)

	{

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

		{

			cout << dq[i] << " ";

		}

	}

	else

	{

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

		{

			cout << dq[i] << " ";

		}

	}

	return 0;

}

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

#include<list>

using namespace std;

int main(void)

{

	int m,n;

	int t = 1;

	list<int>List;

	scanf("%d", &n);

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

	{

		scanf("%d", &m);

		t = !t;

		if(t)

			List.push_back(m);

		else

			List.push_front(m);

	}

	if (n%2==0) 

		List.reverse();

	for(auto i = List.begin(); i!= List.end();i++)

		printf("%d ",*i);

	return 0;

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

using namespace std;

int main()

{const int size=2e+5;

int a[size],b[size];

int n;

cin>>n;



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

{cin>>a[i];

}



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

{

	

	

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

	

	if(i<0)

	break;

	

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



}





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

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

}

return 0;

 } 

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

#include<list>

using namespace std;

int main(void)

{

	int m,n;

	int t = 1;

	list<int>List;

	scanf("%d", &n);

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

	{

		scanf("%d", &m);

		t = !t;

		if(t)

			List.push_back(m);

		else

			List.push_front(m);

	}

	if (n%2==0) 

		List.reverse();

	for(auto i = List.begin(); i!= List.end();i++)

		printf("%d ",*i);

	return 0;

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

using namespace std;

const int N=200005;

int b;

int n;

int a[N];

int x;

int main()

{

	scanf("%d",&n);

	b=1;

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

		scanf("%d",&x);

		a[n/2+(i/2)*b]=x;

		b=-b;

	}

	if(n%2==0)for(int i=0;i<n;i++)cout<<a[i]<<' ';

	else for(int i=n-1;i>=0;i--)cout<<a[i]<<' ';

}

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

#include<stdlib.h>



int main()

{

	int *a, *b, n;

	scanf("%d", &n);



	a = (int *)malloc(n * sizeof(int));

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

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



	b = (int *)malloc(n * sizeof(int));



	if (n % 2 == 0)//n为偶数

	{

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

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

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

			b[n / 2 + i] = a[2 * i];

	}

	else//n为奇数

	{

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

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

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

			b[n / 2 + 1 + i] = a[2 * i + 1];

	}



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

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

	printf("\n");



	return 0;

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

#include <deque>

using namespace std;



const int N = 2e5 + 5;



int n;

deque<int> Q;



int main() {

	ios::sync_with_stdio(false);

	cin >> n;

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

		int x;

		cin >> x;

		if (i & 1) Q.push_back(x);

		else Q.push_front(x);

	}

	if (n & 1) {

		for (auto it = Q.rbegin(); it != Q.rend(); ++it)

			cout << *it << ' ';

		cout << endl;

	} else {

		for (auto it = Q.begin(); it != Q.end(); ++it)

			cout << *it << ' ';

		cout << endl;

	}

	return 0;

}

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

#include<stdlib.h>



int main()

{

	int *a, *b, n;

	scanf("%d", &n);



	a = (int *)malloc(n * sizeof(int));

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

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



	b = (int *)malloc(n * sizeof(int));



	if (n % 2 == 0)//n为偶数

	{

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

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

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

			b[n / 2 + i] = a[2 * i];

	}

	else//n为奇数

	{

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

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

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

			b[n / 2 + 1 + i] = a[2 * i + 1];

	}



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

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

	printf("\n");



	return 0;

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

using namespace std;

deque<int> q;

int n;

 int main()

{

	scanf("%d",&n);

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

	{

		int x;

		scanf("%d",&x);

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

		else q.push_front(x);

	}

	if (n&1) 

		for (int i=q.size()-1;i>=0;--i) printf("%d ",q[i]);

	else 

		for (int i=0;i<q.size();++i) printf("%d ",q[i]);

}

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

#include<stdlib.h>



int main()

{

	int *a, *b, n;

	scanf("%d", &n);



	a = (int *)malloc(n * sizeof(int));

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

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



	b = (int *)malloc(n * sizeof(int));



	if (n % 2 == 0)//n为偶数

	{

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

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

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

			b[n / 2 + i] = a[2 * i];

	}

	else//n为奇数

	{

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

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

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

			b[n / 2 + 1 + i] = a[2 * i + 1];

	}



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

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

	printf("\n");



	return 0;

}