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

#include<cstdio>

#include<cstring>

#include<list>

using namespace std;



int main() {

    int n, key;

    char op[20];

    list<int> List;

    scanf("%d", &n);

    getchar();



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

        scanf("%s %d", op, &key);

        if (op[0] == 'i') {

            List.push_front(key);

        }

        else {

            if (strlen(op) > 6) {

                if (op[6] == 'F') {

                    List.pop_front();

                }

                else {

                    List.pop_back();

                }

            }

            else { 

                for (list<int>::iterator it = List.begin(); it != List.end(); it++) {

                    if (*it == key) {

                        List.erase(it);

                        break;

                    }

                }

            }

        }

    }

    int flag = 0;

    for (list<int>::iterator it = List.begin(); it != List.end(); it++) {

        if (flag != 0)

            printf(" ");

        flag++;

        printf("%d", (*it));

    }

    printf("\n");

    return 0;

}


// Optimized solution to the same problem (faster):
//#define _CRT_SECURE_NO_WARNINGS

#include<cstdio>

#include<cstdlib>

#include<cstring>



struct Node {

	int key;

	Node* prev, * next;

};



Node* nil;



Node* listSearch(int key) {

	Node* cur = nil->next;//从头节点后面的元素开始访问

	while (cur != nil && cur->key != key) {

		cur = cur->next;

	}

	return cur;

}



void init() {

	nil = (Node*)malloc(sizeof(Node));

	nil->prev = nil;

	nil->next = nil;

}



void printList() {

	Node* cur = nil->next;

	int isf = 0;

	while (1) {

		if (cur == nil) break;

		if (isf++ > 0)printf(" ");

		printf("%d", cur->key);

		cur = cur->next;

	}

	printf("\n");

}



void deleteNode(Node* t) {

	if (t == nil)return;

	t->prev->next = t->next;

	t->next->prev = t->prev;

	free(t);

}



void deleteFirst() {

	deleteNode(nil->next);

}



void deleteLast() {

	deleteNode(nil->prev);

}



void deleteKey(int key) {

	//删除搜索到的结点

	deleteNode(listSearch(key));

}



void insert(int key) {

	Node* x = (Node*)malloc(sizeof(Node));

	x->key = key;

	//在头结点后添加元素

	x->next = nil->next;

	nil->next->prev = x;

	nil->next = x;

	x->prev = nil;

}



int main() {

	int key, n, i;

	int size = 0;

	char com[20];

	int np = 0, nd = 0;

	scanf("%d", &n);

	init();

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

		scanf("%s%d", com, &key);//使用效率更高的输入函数

		if (com[0] == 'i') { insert(key); np++; size++; }

		else if (com[0] == 'd') {

			if (strlen(com) > 6) {

				if (com[6] == 'F')deleteFirst();

				else if (com[6] == 'L') deleteLast();

			}

			else {

				deleteKey(key);

				nd++;

			}

			size--;

		}

	}



	printList();



	return 0;

}


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

#include <string>

#include <vector>

#include <algorithm>

using namespace std;

inline int xmod(int a, int b) {

    int ret = a % b;

    return (ret >= 0) ? ret : ret + b;

}

int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);



    int n;

    cin >> n;



    int len=1000050;

    vector<int> li(len);

    int fi=0, la=0;



    string op;

    int key;

    vector<int>::iterator pos;



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

        cin >> op;

        if (op[0] == 'i') {

            cin >> key;

            fi = xmod(fi-1, len);

            li[fi] = key;

        } else if (op.size() > 6 && op[6] == 'F') {

            while (li[fi] == -1) {

                fi = (fi+1) % len;

            }

            fi = (fi+1) % len;

        } else if (op.size() > 6 && op[6] == 'L') {

            while (li[xmod(la-1, len)] == -1) {

                la = xmod(la-1, len);

            }

            la = xmod(la-1, len);

        } else {

            cin >> key;

            for (int j=fi; j!=la; j=(j+1)%len) {

                if (li[j] == key) {

                    li[j] = -1;

                    break;

                }

            }

        }

    }



    bool nospace = true;

    for (int i=fi; i!=la; i=(i+1)%len) {

        if (li[i] == -1) {

            continue;

        }

        if (nospace) {

            cout << li[i];

            nospace = false;

        } else {

            cout << " " << li[i];

        }

    }

    cout << endl;

    return 0;

}

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

#include <string>

#include <vector>

#include <algorithm>

using namespace std;

inline int xmod(int a, int b) {

    return (a >= 0) ? a%b : a%b + b;

}

int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    

    int n; cin >> n;



    int len=1000050;

    int* li = new int[len];

    int fi=0, la=0;



    string op;

    int key;

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

        cin >> op;

        if (op == "insert") {

            cin >> key;

            fi = xmod(fi-1, len);

            li[fi] = key;

        } else if (op == "deleteFirst") {

            while (li[fi] == -1) fi = (fi+1) % len;

            fi = (fi+1) % len;

        } else if (op == "deleteLast") {

            while (li[xmod(la-1, len)] == -1) la = xmod(la-1, len);

            la = xmod(la-1, len);

        } else {

            cin >> key;

            for (int j=fi; j!=la; j=(j+1)%len) {

                if (li[j] == key) {

                    li[j] = -1;

                    break;

                }

            }

        }

    }



    bool nospace = true;

    for (int i=fi; i!=la; i=(i+1)%len) {

        if (li[i] == -1) continue;

        if (nospace) {

            cout << li[i];

            nospace = false;

        } else {

            cout << " " << li[i];

        }

    }

    cout << endl;



    delete[] li;

    return 0;

}

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

#include <cstdio>

#include <string>

#include <iostream>



#pragma warning(disable: 4996)



using namespace std;



int main()

{

	int n, v;



	string c;



	list<int> l;



	scanf("%d", &n);



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

	{

		cin >> c;



		if (c[0] == 'i')

		{

			scanf("%d", &v);



			l.push_front(v);

		}

		else if (c.size() == 11)

		{

			l.pop_front();

		}

		else if (c.size() == 10)

		{

			l.pop_back();

		}

		else

		{

			scanf("%d", &v);



			list<int>::iterator it = l.begin();



			while (it != l.end())

			{

				if (*it == v)

				{

					l.erase(it); break;

				}



				it++;

			}

		}



		i++;

	}



	list<int>::iterator it = l.begin();



	while (it != l.end())

	{

		if (it == l.begin())

		{

			printf("%d", *it);

		}

		else

		{

			printf(" %d", *it);

		}



		it++;

	}



	printf("\n");



	return 0;

}

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

#pragma warning(disable : 4996)

const int inf = 1234567890;

int Q, x, a[2000009]; char c[15];

int main() {

	scanf("%d", &Q);

	int l = Q, r = Q;

	while (Q--) {

		scanf("%s", c);

		if (c[0] == 'i') {

			scanf("%d", &x);

			a[--l] = x;

		}

		else if (c[6] == 'F') {

			while (a[l] == inf) l++;

			a[l++] = 0;

		}

		else if (c[6] == 'L') {

			while (a[r - 1] == inf) r--;

			a[--r] = 0;

		}

		else {

			scanf("%d", &x);

			for (int i = l; i < r; i++) {

				if (a[i] == x) {

					a[i] = inf;

					break;

				}

			}

		}

	}

	for (int i = l, cnt = 0; i < r; i++) {

		if (a[i] != inf) {

			printf(cnt++ ? " %d" : "%d", a[i]);

		}

	}

	printf("\n");

	return 0;

}

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

#include <cstdio>



#pragma warning(disable: 4996)



using namespace std;



int main()

{

	int n, v;



	char c[12];



	list<int> l;



	scanf("%d", &n);



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

	{

		scanf("%s", c);



		if (c[0] == 'i')

		{

			scanf("%d", &v);



			l.push_front(v);

		}

		else if (c[6] == 'F')

		{

			l.pop_front();

		}

		else if (c[6] == 'L')

		{

			l.pop_back();

		}

		else

		{

			scanf("%d", &v);



			list<int>::iterator it = l.begin();



			while (it != l.end())

			{

				if (*it == v)

				{

					l.erase(it); break;

				}



				it++;

			}

		}

	}



	list<int>::iterator it = l.begin();



	while (it != l.end())

	{

		if (it == l.begin())

		{

			printf("%d", *it);

		}

		else

		{

			printf(" %d", *it);

		}



		it++;

	}



	printf("\n");



	return 0;

}

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

#pragma warning(disable : 4996)

const int inf = 1234567890;

int Q, x, a[2000009]; char c[15];

int main() {

	scanf("%d", &Q);

	int l = Q, r = Q;

	while (Q--) {

		scanf("%s", c);

		if (c[0] == 'i') {

			scanf("%d", &x);

			a[--l] = x;

		}

		else if (c[6] == 'F') {

			while (a[l] == inf) l++;

			a[l++] = 0;

		}

		else if (c[6] == 'L') {

			while (a[r - 1] == inf) r--;

			a[--r] = 0;

		}

		else {

			scanf("%d", &x);

			for (int i = l; i < r; i++) {

				if (a[i] == x) {

					a[i] = inf;

					break;

				}

			}

		}

	}

	for (int i = l, cnt = 0; i < r; i++) {

		if (a[i] != inf) {

			printf(cnt++ ? " %d" : "%d", a[i]);

		}

	}

	printf("\n");

	return 0;

}

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

#include <cstdio>



using namespace std;



int main()

{

	int n, v;



	char c[12];



	list<int> l;



	scanf("%d", &n);



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

	{

		scanf("%s", c);



		if (c[0] == 'i')

		{

			scanf("%d", &v);



			l.push_front(v);

		}

		else if (c[6] == 'F')

		{

			l.pop_front();

		}

		else if (c[6] == 'L')

		{

			l.pop_back();

		}

		else

		{

			scanf("%d", &v);



			list<int>::iterator it = l.begin();



			while (it != l.end())

			{

				if (*it == v)

				{

					l.erase(it); break;

				}



				it++;

			}

		}

	}



	list<int>::iterator it = l.begin();



	while (it != l.end())

	{

		if (it == l.begin())

		{

			printf("%d", *it);

		}

		else

		{

			printf(" %d", *it);

		}



		it++;

	}



	printf("\n");



	return 0;

}

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

#pragma warning(disable : 4996)

const int inf = 1234567890;

int Q, x, a[2000009]; char c[15];

int main() {

	scanf("%d", &Q);

	int l = Q, r = Q;

	while (Q--) {

		scanf("%s", c);

		if (c[0] == 'i') {

			scanf("%d", &x);

			a[--l] = x;

		}

		else if (c[6] == 'F') {

			while (a[l] == inf) l++;

			a[l++] = 0;

		}

		else if (c[6] == 'L') {

			while (a[r - 1] == inf) r--;

			a[--r] = 0;

		}

		else {

			scanf("%d", &x);

			for (int i = l; i < r; i++) {

				if (a[i] == x) {

					a[i] = inf;

					break;

				}

			}

		}

	}

	for (int i = l, cnt = 0; i < r; i++) {

		if (a[i] != inf) {

			printf(cnt++ ? " %d" : "%d", a[i]);

		}

	}

	printf("\n");

	return 0;

}

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

#include <cstdio>



int main()

{

	int n, v, i;



	char c[12];



	std::list<int> l;



	scanf("%d", &n);



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

	{

		scanf("%s", c);



		if (c[0] == 'i')

		{

			scanf("%d", &v);



			l.push_front(v);

		}

		else if (c[6] == 'F')

		{

			l.pop_front();

		}

		else if (c[6] == 'L')

		{

			l.pop_back();

		}

		else

		{

			scanf("%d", &v);



			std::list<int>::iterator it = l.begin();



			while (it != l.end())

			{

				if (*it == v)

				{

					l.erase(it); break;

				}



				it++;

			}

		}

	}



	std::list<int>::iterator it = l.begin();



	while (it != l.end())

	{

		if (it == l.begin())

		{

			printf("%d", *it);

		}

		else

		{

			printf(" %d", *it);

		}



		it++;

	}



	printf("\n");



	return 0;

}

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

#pragma warning(disable : 4996)

const int inf = 1234567890;

int Q, x, a[2000009]; char c[15];

int main() {

	scanf("%d", &Q);

	int l = Q, r = Q;

	while (Q--) {

		scanf("%s", c);

		if (c[0] == 'i') {

			scanf("%d", &x);

			a[--l] = x;

		}

		else if (c[6] == 'F') {

			while (a[l] == inf) l++;

			a[l++] = 0;

		}

		else if (c[6] == 'L') {

			while (a[r - 1] == inf) r--;

			a[--r] = 0;

		}

		else {

			scanf("%d", &x);

			for (int i = l; i < r; i++) {

				if (a[i] == x) {

					a[i] = inf;

					break;

				}

			}

		}

	}

	for (int i = l, cnt = 0; i < r; i++) {

		if (a[i] != inf) {

			printf(cnt++ ? " %d" : "%d", a[i]);

		}

	}

	printf("\n");

	return 0;

}

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

#include <cstdio>



int main()

{

	int n, v;



	char c[12];



	std::list<int> l;



	scanf("%d", &n);



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

	{

		scanf("%s", c);



		if (c[0] == 'i')

		{

			scanf("%d", &v);



			l.push_front(v);

		}

		else if (c[6] == 'F')

		{

			l.pop_front();

		}

		else if (c[6] == 'L')

		{

			l.pop_back();

		}

		else

		{

			scanf("%d", &v);



			std::list<int>::iterator it = l.begin();



			std::list<int>::iterator end_it = l.end();



			while (it != end_it)

			{

				if (*it == v)

				{

					l.erase(it); break;

				}



				it++;

			}

		}

	}



	std::list<int>::iterator it = l.begin();



	while (it != l.end())

	{

		if (it == l.begin())

		{

			printf("%d", *it);

		}

		else

		{

			printf(" %d", *it);

		}



		it++;

	}



	printf("\n");



	return 0;

}

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

#pragma warning(disable : 4996)

const int inf = 1234567890;

int Q, x, a[2000009]; char c[15];

int main() {

	scanf("%d", &Q);

	int l = Q, r = Q;

	while (Q--) {

		scanf("%s", c);

		if (c[0] == 'i') {

			scanf("%d", &x);

			a[--l] = x;

		}

		else if (c[6] == 'F') {

			while (a[l] == inf) l++;

			a[l++] = 0;

		}

		else if (c[6] == 'L') {

			while (a[r - 1] == inf) r--;

			a[--r] = 0;

		}

		else {

			scanf("%d", &x);

			for (int i = l; i < r; i++) {

				if (a[i] == x) {

					a[i] = inf;

					break;

				}

			}

		}

	}

	for (int i = l, cnt = 0; i < r; i++) {

		if (a[i] != inf) {

			printf(cnt++ ? " %d" : "%d", a[i]);

		}

	}

	printf("\n");

	return 0;

}

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

#include <cstdio>



int main()

{

	int n, v;



	char c[12];



	std::list<int> l;



	scanf("%d", &n);



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

	{

		scanf("%s", c);



		if (c[0] == 'i')

		{

			scanf("%d", &v);



			l.push_front(v);

		}

		else if (c[6] == 'F')

		{

			l.pop_front();

		}

		else if (c[6] == 'L')

		{

			l.pop_back();

		}

		else

		{

			scanf("%d", &v);



			std::list<int>::iterator it = l.begin();



			std::list<int>::iterator end_it = l.end();



			while (it != end_it)

			{

				if (*it == v)

				{

					l.erase(it); break;

				}



				it++;

			}

		}

	}



	std::list<int>::iterator it = l.begin();



	std::list<int>::iterator end_it = l.end();



	printf("%d", *it);



	while (++it != end_it)

	{

		printf(" %d", *it);

	}



	printf("\n");



	return 0;

}

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

#pragma warning(disable : 4996)

const int inf = 1234567890;

int Q, x, a[2000009]; char c[15];

int main() {

	scanf("%d", &Q);

	int l = Q, r = Q;

	while (Q--) {

		scanf("%s", c);

		if (c[0] == 'i') {

			scanf("%d", &x);

			a[--l] = x;

		}

		else if (c[6] == 'F') {

			while (a[l] == inf) l++;

			a[l++] = 0;

		}

		else if (c[6] == 'L') {

			while (a[r - 1] == inf) r--;

			a[--r] = 0;

		}

		else {

			scanf("%d", &x);

			for (int i = l; i < r; i++) {

				if (a[i] == x) {

					a[i] = inf;

					break;

				}

			}

		}

	}

	for (int i = l, cnt = 0; i < r; i++) {

		if (a[i] != inf) {

			printf(cnt++ ? " %d" : "%d", a[i]);

		}

	}

	printf("\n");

	return 0;

}

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

#include <cstdio>

using namespace std;

int Q, a, e; char c[14]; list<int> l;

int main() {

	scanf("%d", &Q);

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

		scanf("%s", c);

		switch(c[0] + c[6]) {

		case 105: scanf("%d", &a), l.push_front(a); break;

		case 170: l.pop_front(); break;

		case 176: l.pop_back(); break;

		default:

			scanf("%d", &a);

			for(list<int>::iterator it = l.begin(); it != l.end(); it++) {

				if(*it == a) {

					l.erase(it); break;

				}

			}

		}

	}

	for(list<int>::iterator it = l.begin(); it != l.end(); it++) printf(e++ ? " %d" : "%d", *it);

	printf("\n");

}

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

#pragma warning(disable : 4996)

const int inf = 1234567890;

int Q, x, a[2000009]; char c[15];

int main() {

	scanf("%d", &Q);

	int l = Q, r = Q;

	while (Q--) {

		scanf("%s", c);

		if (c[0] == 'i') {

			scanf("%d", &x);

			a[--l] = x;

		}

		else if (c[6] == 'F') {

			while (a[l] == inf) l++;

			a[l++] = 0;

		}

		else if (c[6] == 'L') {

			while (a[r - 1] == inf) r--;

			a[--r] = 0;

		}

		else {

			scanf("%d", &x);

			for (int i = l; i < r; i++) {

				if (a[i] == x) {

					a[i] = inf;

					break;

				}

			}

		}

	}

	for (int i = l, cnt = 0; i < r; i++) {

		if (a[i] != inf) {

			printf(cnt++ ? " %d" : "%d", a[i]);

		}

	}

	printf("\n");

	return 0;

}

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

#include <string>

#include <list>

#include <stdio.h>

#include <ctype.h>

#include <string.h>



#define APPTXT_BUFSZ	128



using namespace std;



static void deleteX(list<int> &list, int x) {

    for(auto itr=list.begin(); itr!=list.end(); itr++ ) {

        if(*itr==x) {

            list.erase(itr);

            break;

        }

    }

}



int main(void) {

    list<int> list;

    int n;

    int x;

    string str;



	getline(cin,str);

	n = atoi(&(str[0]));



	while( n-- > 0 && getline(cin, str) ) {

		if (str[0] == 'i') {		// ("insert"?¢????)

			x = atoi(&(str[sizeof("insert") - 1]));

            list.push_front(x);

        } else {

			int c = str[sizeof("delete") - 1];

			if (isalpha(c)) {

				if (c == 'F') {		// ("deleteFirst"?¢????)

		            list.pop_front();

				} else {			// ("deleteLast"?¢????)

		            list.pop_back();

				}

			} else {				// ("delete"?¢????)

				x = atoi(&(str[sizeof("delete") - 1]));

				deleteX(list, x);

			}

		}

    }



	//display list

    for(auto itr=list.begin(); itr!=list.end(); itr++ ) {

        if(itr==list.begin()) {

			printf("%d", *itr);

        } else {

			printf(" %d", *itr);

        }

    }

	fputc('\n', stdout);



	return 0;

}

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

#include <stdlib.h>

#include <ctype.h>

#include <string.h>

#include <assert.h>



using namespace std;



#define MAXDATA			2000000

#define APPTXT_BUFSZ	128



#define countof(arr)		(sizeof(arr) / sizeof(arr[0]))



static int g_anDataBuf[MAXDATA];

static bool g_abInvalid[MAXDATA];



int main(void) {

	char str[APPTXT_BUFSZ];

	int bgn, end;

    int n;

    int x;



	fgets(str, APPTXT_BUFSZ, stdin);

	n = atoi(&(str[0]));



	bgn = end = countof(g_anDataBuf);

	while( n-- > 0 && fgets(str, APPTXT_BUFSZ, stdin) != NULL ) {

		if (str[0] == 'i') {		// ("insert"?¢????)

			x = atoi(&(str[sizeof("insert") - 1]));

			g_anDataBuf[--bgn] = x;

			g_abInvalid[bgn] = false;

        } else {

			int c = str[sizeof("delete") - 1];

			if (isalpha(c)) {

				if (c == 'F') {		// ("deleteFirst"?¢????)

					while (bgn < end && g_abInvalid[bgn++]) { }

					assert(bgn <= end);

				} else {			// ("deleteLast"?¢????)

					while (bgn < end && g_abInvalid[--end]);

					assert(bgn <= end);

				}

			} else {				// ("delete"?¢????)

				x = atoi(&(str[sizeof("delete") - 1]));

				for (int i = bgn; i < end; i++) {

					if (g_abInvalid[i]) {

						continue;

					}

					if (g_anDataBuf[i] == x) {

						g_abInvalid[i] = true;

						break;

					}

				}

			}

		}

    }



	//display list

	bool bFirst = true;

	for (int i = bgn; i < end; i++) {

		if (g_abInvalid[i]) {

			continue;

		}

		const int x = g_anDataBuf[i];

		if (bFirst) {

			printf("%d", x);

			bFirst = false;

		} else {

			printf(" %d", x);

		}

	}

	fputc('\n', stdout);



	return 0;

}

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

#include <vector>

#include <algorithm>

#include <numeric>

#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

using ll = long long;

using namespace std;

int gcd(int a, int b) { while (a) { b %= a; swap(a, b); } return b; }

bool solve(int n, vector<int> & a) {

    ll sum = whole(accumulate, a, 0ll);

    bool is_first = (sum - n) % 2;

    int even = whole(count_if, a, [&](int ai) { return ai % 2 == 0; });

    auto odd = whole(find_if,  a, [&](int ai) { return ai % 2 == 1; });

    if (not is_first and even == n-1 and *odd != 1) {

        -- (*odd);

        int d = a[0]; repeat (i,n) d = gcd(d, a[i]);

        repeat (i,n) a[i] /= d;

        return not solve(n, a);

    } else {

        return is_first;

    }

}

int main() {

    int n; cin >> n;

    vector<int> a(n); repeat (i,n) cin >> a[i];

    cout << (solve(n, a) ? "First" : "Second") << endl;

    return 0;

}

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

#define sev en

using namespace std;

#define N 100010



int a[N],cnt[2],n;



int gcd(int a,int b){

	if(b == 0)

		return a;

	return gcd(b,a % b);

}



int dg(){

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

		if(a[i] & 1)

			a[i]--;

	cnt[0] = cnt[1] = 0;

	int w = a[1];

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

		w = gcd(w,a[i]);

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

		cnt[(a[i] /= w) & 1]++;

	if(cnt[0] & 1)

	return 1;

	else if(cnt[1] > 1)

	return 0;

	else{

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

		if(a[i] == 1)

		return cnt[0] & 1 ? 1 : 0;

		return dg() ^ 1;

	}

}



int main(){

	scanf("%d",&n);

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

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

		cnt[a[i] & 1]++;

	}

	if(cnt[0] & 1)

	printf("First");

	else if(cnt[1] > 1)

	printf("Second");

	else{

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

		if(a[i] == 1){

			printf(cnt[0] & 1 ? "First" : "Second");

			return 0;

		}

		if(dg() ^ 1)

		printf("First");

		else

		printf("Second");

	}

	return 0;

}

// Fastest known solution for this problem: