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

using namespace std;



int main() {



	int length;

	cin >> length;

	int *a = new int[length];

	int *b = new int[length];

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

		cin >> a[i];

	}



	int left = 0, right = length - 1;

	if (length % 2 == 0) {

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

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

			b[right--] = a[i - 1];

		}

	}

	else {

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

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

			b[right--] = a[i - 1];

		}

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

	}





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

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

	}

}






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

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

#include <iostream>

#include <algorithm>

using namespace std;



int main()

{

    int n;

    cin >> n;

    bool flag=true;

    list<int> mylist;

    int t;

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

    {

        cin >> t;

        if(flag)

        {

            mylist.push_front(t);

        } else {

            mylist.push_back(t);

        }

        flag=!flag;

    }



    flag=n%2;



    if(flag)

    {

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

        {

            cout << *it << ' ';



        }

    } else {

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

        {

            cout << *it << ' ';



        }

    }



	return 0;

}


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

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

using namespace std;

int main()

{

	int n,temp;

	list<int> l;

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

		l.clear();

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

			scanf("%d",&temp);

			if(i&1){

				l.push_front(temp);

			}else{

				l.push_back(temp);

			}

		}

		if(n&1){

			list<int>::reverse_iterator a,b;

			a=l.rbegin(),b=l.rend();

			printf("%d",*a);

			++a;

			for(;a!=b;++a){

				printf(" %d",*a);

			}

		}else{

			list<int>::iterator a,b;

			a=l.begin(),b=l.end();

			printf("%d",*a);

			++a;

			for(;a!=b;++a){

				printf(" %d",*a);

			}

		}

		putchar('\n');

	}

	return 0;

}

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

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

using namespace std;



const int M = 2e5;

int a[M];

int main()

{

	

	int n;

	while (cin >> n)

	{

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

			cin >> a[i];

		if (n % 2 == 1)

		{

			cout << a[n];

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

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

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

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

			cout << endl;

		}

		else

		{

			cout << a[n];

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

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

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

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

			cout << endl;

		}

	}

	return 0;

}

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

}
// Slower C++ solution:
#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]<<' ';

}

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

}
// Slower C++ solution:
#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;

}

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

}
// Slower C++ solution:
#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;

}

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

}
// Slower C++ solution:
/*

TLE発生

原因はvectorのreverseかな？

*/





#include <bits/stdc++.h>

using namespace std;



using LL = long long;



int main(){

    cin.tie(0);

    ios::sync_with_stdio(false);



    LL n;

    cin >> n;

    vector<LL> a(n);

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

        cin >> a[i];

    }



    vector<LL> b;

    b.reserve(n);



    if(n == 1){

        cout << a[0] << endl;

        return 0;

    }



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

        b.push_back(a[i]);

    }

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

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

        b.push_back(a[i]);

    }

    if(n % 2 == 0){

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

    }



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

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

    }



    cout << endl;



    return 0;

}

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

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

using namespace std;



long long int* sat(long long int*a,long long int *b,int n)

{

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

	{

		b[j]=a[j];

	} 

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

	{

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

	}

	return a;

}



int main(void)

{

	int n = 0;

	cin>>n;

	long long int a[n]={0};

	long long int b[n] ={0};

	

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

		long long int h =0;

		cin>>h;

		a[k]=h;

	}



	if(n%2 == 0)

	{

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

		{

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

		}

		for(int j=n/2;j<n;j++)

		{

			b[j]=a[2*(j-n/2)];

		}

	}else

	{

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

		{

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

		}

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

		{

			b[j]=a[2*(j-(n+1)/2)+1];

		}

	}



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

	{

		cout<<b[o]<<" ";

	}

	



	return 0;

}








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

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

#define rep(i,l,p) for(int i = l; i<=p; i++)

#define drep(i,p,l) for(int i = p; i>=l; i++)

using namespace std;



int n;

struct node

{

	int val;

	node *front,*after;

	node(){

		front = NULL;

		after = NULL;

		val = -1;

	}



	node(node* inifront, int inival,node* iniafter){

		val = inival;

		after = iniafter;

		front = inifront;

	}

};



node* first = new node();

node* last = new node();





void lastPlus(int val){

	node *tmp = last->front;

	last->front = new node(last->front,val,last);

	if(tmp != NULL) tmp->after = last->front;

}



void firstPlus(int val){

	node *tmp = first->after;

	first->after = new node(first,val,first->after);



	if(tmp != NULL)tmp->front = first->after;

}

void conbine(){

	node* tmp1 = first;

	while(tmp1->after != NULL){

		tmp1 = tmp1->after;

	//	printf("%d ", tmp1->val);

	}

	//printf("\n");

	

	node* tmp2 = last;

	while(tmp2->front != NULL){

		tmp2 = tmp2->front;

	//	printf("%d ",tmp2->val);

	}

	//printf("\n");



	tmp1->after = tmp2;

	tmp2->front = tmp1;

	//printf("conbine:\n");



//	tmp1 = first;

	// rep(i,1,n){ 

	// 	printf("%d ",tmp1->val);

	// 	tmp1 = tmp1->after;

		

//	}

}

void outputfirst(){

	node* tmp;



	tmp = first->after;

	rep(i,1,n){

		printf("%d ",tmp->val);

		tmp = tmp->after;

	}

}

void outputlast(){

	node *tmp = last->front;

	rep(i,1,n){

		printf("%d ",tmp->val);

		tmp = tmp->front;

	}

}

int main(){

	scanf("%d",&n);

	int t;

	rep(i,1,n){

		scanf("%d",&t);

		if( i % 2 == 1){

			lastPlus(t);

		}else firstPlus(t);

	}

	conbine();

	t = (n+1) % 2 ;

	if ( t == 1){

		outputfirst();

	}else {

		outputlast();

	}



	 return 0;



}

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

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

using namespace std; 

int main() 

{ 	

	cin.tie(0); 	

	cout.tie(0); 

	ios::sync_with_stdio(false); 

	int count; 	

	cin >> count; 

	int *a = new int[count]; 	

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

	{

		cin >> a[i]; 

	}	

	

	deque<int> dq; 

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

	{ 		

		if (i % 2 == 0) 		

		dq.push_front(a[i]); 

		if (i % 2 == 1) 	

		dq.push_back(a[i]); 

	} 

	if (count % 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: 4.76049546117622x):
#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;

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

using namespace std;



int main() {



	int length;

	cin >> length;

	int *a = new int[length];

	int *b = new int[length];

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

		cin >> a[i];

	}



	int left = 0, right = length - 1;

	if (length % 2 == 0) {

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

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

			b[right--] = a[i - 1];

		}

	}

	else {

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

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

			b[right--] = a[i - 1];

		}

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

	}





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

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

	}

}






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

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

#include <iostream>

#include <algorithm>

using namespace std;



int main()

{

    int n;

    cin >> n;

    bool flag=true;

    list<int> mylist;

    int t;

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

    {

        cin >> t;

        if(flag)

        {

            mylist.push_front(t);

        } else {

            mylist.push_back(t);

        }

        flag=!flag;

    }



    flag=n%2;



    if(flag)

    {

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

        {

            cout << *it << ' ';



        }

    } else {

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

        {

            cout << *it << ' ';



        }

    }



	return 0;

}


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

}