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.148617826973492x):
#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 <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.83138362947859x):
#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 <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.218983396446257x):
#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;



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.331599184386834x):
#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>

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.207727934750947x):
#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>



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.293757646373434x):
#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>

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.203099330032042x):
#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>

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.366310806874454x):
#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>

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.207727934750947x):
#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<cmath>

using namespace std;

int main( )

{

	int size,s,i;

	cin>>size;

	s=size/2;

    int* a=new int[size];

	if(size%2==0) 

	{

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

	{

		s=s+(pow(-1,i))*i;

		cin>>a[s];

	}}

	else{

	

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

	{

		s=s-(pow(-1,i))*i;

		cin>>a[s];

	}}

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

	{

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

	}

	delete [] a;

	return 0;

	

}

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

}

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

using namespace std;

int main()

{

	int n;

	scanf("%d",&n);

	int *a=new int [n];

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

	{

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

	}

	if(n%2!=0)          

	{

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

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

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

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

	}

	else

	{

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

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

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

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

	}

	return 0;

} 

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

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

#include<string.h>

#include<stdlib.h>

#define zero 200000

int main()

{

	int n;

	int *numbers;

	int *commands;

	numbers=(int *)malloc(sizeof(int)*400000);

	commands=(int *)malloc(sizeof(int)*200000);

	int i;

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

	{

		int mode=1;

		int i1=0,i2=1;

		for(i=0;i<n;i++)scanf("%d",&commands[i]);

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

		{

			if(mode)

			{

				numbers[zero+i1]=commands[i];

				i1++;

				mode=0;	

			}

			else

			{

				numbers[zero-i2]=commands[i];

				i2++;

				mode=1;

			}

		}

		if(mode)

		{

			for(i=zero-i2+1;i<zero+i1;i++)

			{

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

			}

		}

		else

		{

			for(i=zero+i1-1;i>=zero-i2+1;i--)

			{

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

			}

		}

		printf("\n");

	}

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

#include<string.h>

#include<stdlib.h>

#define zero 200000

int main()

{

	int n;

	int *numbers;

	int *commands;

	numbers=(int *)malloc(sizeof(int)*400000);

	commands=(int *)malloc(sizeof(int)*200000);

	int i;

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

	{

		int mode=1;

		int i1=0,i2=1;

		for(i=0;i<n;i++)scanf("%d",&commands[i]);

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

		{

			if(mode)

			{

				numbers[zero+i1]=commands[i];

				i1++;

				mode=0;	

			}

			else

			{

				numbers[zero-i2]=commands[i];

				i2++;

				mode=1;

			}

		}

		if(mode)

		{

			for(i=zero-i2+1;i<zero+i1;i++)

			{

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

			}

		}

		else

		{

			for(i=zero+i1-1;i>=zero-i2+1;i--)

			{

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

			}

		}

		printf("\n");

	}

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

#include<string.h>

#include<stdlib.h>

#define zero 200000

int main()

{

	int n;

	int *numbers;

	int *commands;

	numbers=(int *)malloc(sizeof(int)*400000);

	commands=(int *)malloc(sizeof(int)*200000);

	int i;

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

	{

		int mode=1;

		int i1=0,i2=1;

		for(i=0;i<n;i++)scanf("%d",&commands[i]);

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

		{

			if(mode)

			{

				numbers[zero+i1]=commands[i];

				i1++;

				mode=0;	

			}

			else

			{

				numbers[zero-i2]=commands[i];

				i2++;

				mode=1;

			}

		}

		if(mode)

		{

			for(i=zero-i2+1;i<zero+i1;i++)

			{

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

			}

		}

		else

		{

			for(i=zero+i1-1;i>=zero-i2+1;i--)

			{

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

			}

		}

		printf("\n");

	}

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

#include<string.h>

#include<stdlib.h>

#define zero 200000

int main()

{

	int n;

	int *numbers;

	int *commands;

	numbers=(int *)malloc(sizeof(int)*400000);

	commands=(int *)malloc(sizeof(int)*200000);

	int i;

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

	{

		int mode=1;

		int i1=0,i2=1;

		for(i=0;i<n;i++)scanf("%d",&commands[i]);

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

		{

			if(mode)

			{

				numbers[zero+i1]=commands[i];

				i1++;

				mode=0;	

			}

			else

			{

				numbers[zero-i2]=commands[i];

				i2++;

				mode=1;

			}

		}

		if(mode)

		{

			for(i=zero-i2+1;i<zero+i1;i++)

			{

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

			}

		}

		else

		{

			for(i=zero+i1-1;i>=zero-i2+1;i--)

			{

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

			}

		}

		printf("\n");

	}

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

#include<string.h>

#include<stdlib.h>

#define zero 200000

int main()

{

	int n;

	int *numbers;

	int *commands;

	numbers=(int *)malloc(sizeof(int)*400000);

	commands=(int *)malloc(sizeof(int)*200000);

	int i;

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

	{

		int mode=1;

		int i1=0,i2=1;

		for(i=0;i<n;i++)scanf("%d",&commands[i]);

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

		{

			if(mode)

			{

				numbers[zero+i1]=commands[i];

				i1++;

				mode=0;	

			}

			else

			{

				numbers[zero-i2]=commands[i];

				i2++;

				mode=1;

			}

		}

		if(mode)

		{

			for(i=zero-i2+1;i<zero+i1;i++)

			{

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

			}

		}

		else

		{

			for(i=zero+i1-1;i>=zero-i2+1;i--)

			{

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

			}

		}

		printf("\n");

	}

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

#include<string.h>

#include<stdlib.h>

#define zero 200000

int main()

{

	int n;

	int *numbers;

	int *commands;

	numbers=(int *)malloc(sizeof(int)*400000);

	commands=(int *)malloc(sizeof(int)*200000);

	int i;

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

	{

		int mode=1;

		int i1=0,i2=1;

		for(i=0;i<n;i++)scanf("%d",&commands[i]);

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

		{

			if(mode)

			{

				numbers[zero+i1]=commands[i];

				i1++;

				mode=0;	

			}

			else

			{

				numbers[zero-i2]=commands[i];

				i2++;

				mode=1;

			}

		}

		if(mode)

		{

			for(i=zero-i2+1;i<zero+i1;i++)

			{

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

			}

		}

		else

		{

			for(i=zero+i1-1;i>=zero-i2+1;i--)

			{

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

			}

		}

		printf("\n");

	}

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

#include<string.h>

#include<stdlib.h>

#define zero 200000

int main()

{

	int n;

	int *numbers;

	int *commands;

	numbers=(int *)malloc(sizeof(int)*400000);

	commands=(int *)malloc(sizeof(int)*200000);

	int i;

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

	{

		int mode=1;

		int i1=0,i2=1;

		for(i=0;i<n;i++)scanf("%d",&commands[i]);

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

		{

			if(mode)

			{

				numbers[zero+i1]=commands[i];

				i1++;

				mode=0;	

			}

			else

			{

				numbers[zero-i2]=commands[i];

				i2++;

				mode=1;

			}

		}

		if(mode)

		{

			for(i=zero-i2+1;i<zero+i1;i++)

			{

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

			}

		}

		else

		{

			for(i=zero+i1-1;i>=zero-i2+1;i--)

			{

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

			}

		}

		printf("\n");

	}

}