stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;

}

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

} 

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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] << " ";

		}

	}

}

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

	}

} 


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

 } 

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

	}

} 


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

	}

} 


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

	

}

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

	}

} 


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

	}

} 


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

} 

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

	}

} 


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

#include<stdio.h>

using namespace std;

int a[200050], b[200050];

int main()

{

	int n;

	cin>>n;

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

	    cin>>a[i]; 

	b[n/2]=a[0];

	if(n%2)

	{

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

		{

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

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

		}

	 }

	 else

	 {

	 	if(n>1)

	 	{	

		 b[n/2]=a[0];

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

		{

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

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

		 }

	    }

	  } 

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

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

} 

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

	}

} 


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

#include<algorithm>

#include<cstdio>

#include<string>

#include<cstring>

#include<cstdlib>

#include<cmath>

using namespace std;

int main()

{

    int n,f[200005]= {0};

    cin>>n;

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

            cin>>f[i];

    if (n%2==0)

    {

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

            cout<<f[i]<<" ";

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

            cout<<f[i]<<" ";

    }

    else

    {

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

            cout<<f[i]<<" ";

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

            cout<<f[i]<<" ";

    }

}


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

#include <stdlib.h>

#include <string>

#include <math.h>

#include <algorithm>

#include <cstring>

#include <cstdio>

#include <stack>

#include <queue>

#include <deque>



using namespace std;



int main()

{   

    int n;

    cin >> n;

    int i;

    deque<int> deq;

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

    {

        int x;

        cin >> x;

        if (i % 2 == 0)

        deq.push_front(x);

        else

        deq.push_back(x);

    }



    if (n % 2 == 1)

    {

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

        cout << deq[i] << ' ' ;

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

    }

    else

    {

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

        cout << deq[i] << ' ' ;

        cout << deq[0] << endl;

    }

    

    return 0;

}

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

#define Ll long long

using namespace std;

const Ll N=4e5+5;

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

int main()

{

	cin>>n;

	int l=2e5+5,r=2e5+4;

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

		if(i&1)cin>>a[++r];

		else cin>>a[--l];

	if(n&1)for(int i=r;i>=l;i--)cout<<a[i]<<' ';

	else for(int i=l;i<=r;i++)cout<<a[i]<<' ';

}

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

#include<string.h>

#include<algorithm>

using namespace std;

int a[200005];

int main()

{

    int n;

    while(~scanf("%d",&n))

    {

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

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

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

        else if(n==2) printf("%d %d\n",a[1],a[0]);

        else

        {

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

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

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

            if(n%2==1)

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

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

            if(n%2==0)

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

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

            printf("\n");

        }

    }

    return 0;

}


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

#include <deque>

#include <algorithm>

using namespace std;

int main()

{

	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	deque<int> ans;

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

	{

		int x;

		cin >> x;

		if (i & 1)

			ans.push_back(x);

		else

			ans.push_front(x);

	}

	if (n & 1)

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

	for (int i : ans)

		cout << i << ' ';

	cout << endl;

	return 0;

}

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

#include<string.h>

#include<algorithm>

using namespace std;

int a[200005];

int main()

{

    int n;

    while(~scanf("%d",&n))

    {

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

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

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

        else if(n==2) printf("%d %d\n",a[1],a[0]);

        else

        {

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

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

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

            if(n%2==1)

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

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

            if(n%2==0)

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

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

            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>

#include<algorithm>

using namespace std;

int a[200005];

int main()

{

    int n;

    while(~scanf("%d",&n))

    {

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

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

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

        else if(n==2) printf("%d %d\n",a[1],a[0]);

        else

        {

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

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

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

            if(n%2==1)

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

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

            if(n%2==0)

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

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

            printf("\n");

        }

    }

    return 0;

}


// Fastest known solution for this problem: