Buggy python submission (verdict: Time Limit Exceeded):


import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		g=gcd(g,x[i])
	return(g)

def score(A):
	return(sum(A)-len(A))

def Ifavor(A):
	return(score(A)%2==1)	

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	
def testmove(N,A,i):
	if A[i]<=1:
		return(False)
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	if Ifavor(A):
		return(False)
	else:
		j=0
		while j<N:
			if A[j]<=1:
				continue
			A[j]-=1
			h=gcdm(A)	
			if Ifavor([x//h for x in A])==False:
				return(False)
			A[j]+=1
			j+=1
		return(True)

N=int(input())
B=[int(x) for x in input().split()]
'''
inp=St.splitlines()
N=int(inp[0])
B=[int(x) for x in inp[1].split()]
'''
if Ifavor(B):
	print('First')
else:
	e=0
	while e<N:
		A=copy.copy(B)
		if testmove(N,A,e):
			break
		e+=1
	
	if e==N:
		print('Second')
	else:
		print('First')
	





	

Fixed submission:
import random
def tester(N=0):
	'''制約
1≦N≦105
1≦Ai≦109
'''
	maxno1=1e5
	maxno2=1e9
	s=input()
	if s!='':return(s)
	
	if N==0:
		return(random.randint(2,maxno1))
	else:
		print('Testing...')
		print('N=',N)
		A=[]
		for i in range(N):
			A.extend([random.randint(1,maxno2)])
		return(' '.join(list(map(str,A))))

import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		if g==1:
			return(g)
		g=gcd(g,x[i])
	return(g)

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	return([x//g for x in A])

def noofevens(A):
	r=0
	for i in A:
		if i%2==0:
			r+=1
	return(r)
			

N=int(tester())
A=[int(x) for x in tester(N).split()]


isFirstmove=True
while True:
	e=noofevens(A)
	if e%2==1:
		if isFirstmove:
			print('First')
		else:
			print('Second')
		break
	elif N-e>1:
		if isFirstmove:
			print('Second')
		else:
			print('First')
		break
	else:	
		for i in range(N):
			if A[i]%2==1:
				break
		if A[i]==1:
			if isFirstmove:
				print('Second')
			else:
				print('First')
			break
		else:
			A=playmove(A,i)
			isFirstmove=(isFirstmove!=True)

Buggy python submission (verdict: Time Limit Exceeded):


import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		g=gcd(g,x[i])
	return(g)

def score(A):
	return(sum(A)-len(A))

def Ifavor(A):
	return(score(A)%2==1)	

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	
def testmove(N,A,i):
	if A[i]<=1:
		return(False)
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	if Ifavor(A):
		return(False)
	else:
		j=0
		while j<N:
			if A[j]<=1:
				continue
			A[j]-=1
			h=gcdm(A)	
			if Ifavor([x//h for x in A])==False:
				return(False)
			A[j]+=1
			j+=1
		return(True)

N=int(input())
B=[int(x) for x in input().split()]
'''
inp=St.splitlines()
N=int(inp[0])
B=[int(x) for x in inp[1].split()]
'''
if Ifavor(B):
	print('First')
else:
	e=0
	while e<N:
		A=copy.deepcopy(B)
		if testmove(N,A,e):
			break
		e+=1
	
	if e==N:
		print('Second')
	else:
		print('First')
	





	

Fixed submission:
import random
def tester(N=0):
	'''制約
1≦N≦105
1≦Ai≦109
'''
	maxno1=1e5
	maxno2=1e9
	s=input()
	if s!='':return(s)
	
	if N==0:
		return(random.randint(2,maxno1))
	else:
		print('Testing...')
		print('N=',N)
		A=[]
		for i in range(N):
			A.extend([random.randint(1,maxno2)])
		return(' '.join(list(map(str,A))))

import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		if g==1:
			return(g)
		g=gcd(g,x[i])
	return(g)

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	return([x//g for x in A])

def noofevens(A):
	r=0
	for i in A:
		if i%2==0:
			r+=1
	return(r)
			

N=int(tester())
A=[int(x) for x in tester(N).split()]


isFirstmove=True
while True:
	e=noofevens(A)
	if e%2==1:
		if isFirstmove:
			print('First')
		else:
			print('Second')
		break
	elif N-e>1:
		if isFirstmove:
			print('Second')
		else:
			print('First')
		break
	else:	
		for i in range(N):
			if A[i]%2==1:
				break
		if A[i]==1:
			if isFirstmove:
				print('Second')
			else:
				print('First')
			break
		else:
			A=playmove(A,i)
			isFirstmove=(isFirstmove!=True)

Buggy python submission (verdict: Runtime Error):
import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		g=gcd(g,x[i])
	return(g)

def score(A):
	return(sum(A)-len(A))

def Ifavor(A):
	return(score(A)%2==1)	

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	
def testmove(A,i):
	N=len(A)
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	if Ifavor(A):
		A=[x*g for x in A]
		A[i]+=1
		return(False)
	else:
		j=0
		while j<N:
			A[j]-=1
			h=gcdm(A)	
			if Ifavor([x//h for x in A])==False:
				A[j]+=1
				A=[x*g for x in A]
				A[i]+=1
				return(False)
			A[j]+=1
			j+=1
		A=[x*g for x in A]
		A[i]+=1	
		return(True)

N=int(input())
B=[int(x) for x in input().split()]

#inp=St.splitlines()
#N=int(inp[0])
#B=[int(x) for x in inp[1].split()]

if Ifavor(B):
	print('First')
else:
	maxply=sum(B)-N
	ply=1
	e=0
	while e<N:
		if testmove(B,e):
			break
		e+=1
			
	if e!=N:
		playmove(B,e)
		ply+=1

	if (ply%2==1)!=Ifavor(B):
		print('Second')
	else:
		print('First')
	

Fixed submission:
import random
def tester(N=0):
	'''制約
1≦N≦105
1≦Ai≦109
'''
	maxno1=1e5
	maxno2=1e9
	s=input()
	if s!='':return(s)
	
	if N==0:
		return(random.randint(2,maxno1))
	else:
		print('Testing...')
		print('N=',N)
		A=[]
		for i in range(N):
			A.extend([random.randint(1,maxno2)])
		return(' '.join(list(map(str,A))))

import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		if g==1:
			return(g)
		g=gcd(g,x[i])
	return(g)

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	return([x//g for x in A])

def noofevens(A):
	r=0
	for i in A:
		if i%2==0:
			r+=1
	return(r)
			

N=int(tester())
A=[int(x) for x in tester(N).split()]


isFirstmove=True
while True:
	e=noofevens(A)
	if e%2==1:
		if isFirstmove:
			print('First')
		else:
			print('Second')
		break
	elif N-e>1:
		if isFirstmove:
			print('Second')
		else:
			print('First')
		break
	else:	
		for i in range(N):
			if A[i]%2==1:
				break
		if A[i]==1:
			if isFirstmove:
				print('Second')
			else:
				print('First')
			break
		else:
			A=playmove(A,i)
			isFirstmove=(isFirstmove!=True)

Buggy python submission (verdict: Time Limit Exceeded):
import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		g=gcd(g,x[i])
	return(g)

def score(A):
	return(sum(A)-len(A))

def Ifavor(A):
	return(score(A)%2==1)	

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	A=[x//g for x in A]
	
def testmove(A,i):
	B=copy.deepcopy(A)
	N=len(B)
	playmove(B,i)
	if Ifavor(B):
		return('False')
	else:
		e=0
		while e<N:
			C=copy.deepcopy(B)
			playmove(C,e)
			e+=1
			if Ifavor(C)==False:
				return(False)
		return('True')
	

N=int(input())
A=[int(x) for x in input().split()]
#inp=St.splitlines()
#N=int(inp[0])
#A=[int(x) for x in inp[1].split()]

B=copy.deepcopy(A)


if Ifavor(B):
	print('First')
else:
	maxply=sum(B)-N
	ply=1
	while min(B)>1 and ply<=maxply:
		e=0
		while e<N:
			if testmove(B,e):
				break
			e+=1
			
		if e==N:
			break
		else:
			playmove(B,e)
			ply+=1

	if (ply%2==1)!=Ifavor(B):
		print('Second')
	else:
		print('First')

Fixed submission:
import random
def tester(N=0):
	'''制約
1≦N≦105
1≦Ai≦109
'''
	maxno1=1e5
	maxno2=1e9
	s=input()
	if s!='':return(s)
	
	if N==0:
		return(random.randint(2,maxno1))
	else:
		print('Testing...')
		print('N=',N)
		A=[]
		for i in range(N):
			A.extend([random.randint(1,maxno2)])
		return(' '.join(list(map(str,A))))

import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		if g==1:
			return(g)
		g=gcd(g,x[i])
	return(g)

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	return([x//g for x in A])

def noofevens(A):
	r=0
	for i in A:
		if i%2==0:
			r+=1
	return(r)
			

N=int(tester())
A=[int(x) for x in tester(N).split()]


isFirstmove=True
while True:
	e=noofevens(A)
	if e%2==1:
		if isFirstmove:
			print('First')
		else:
			print('Second')
		break
	elif N-e>1:
		if isFirstmove:
			print('Second')
		else:
			print('First')
		break
	else:	
		for i in range(N):
			if A[i]%2==1:
				break
		if A[i]==1:
			if isFirstmove:
				print('Second')
			else:
				print('First')
			break
		else:
			A=playmove(A,i)
			isFirstmove=(isFirstmove!=True)

Buggy python submission (verdict: Time Limit Exceeded):
import random
import copy
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		g=gcd(g,x[i])
	return(g)
def candi(x):
	d=dict()
	for i in range(len(x)):
		d[x[i]]=i
	y=list(d.values())
	return(y)
def sto(N,AAA,tryno,isFirst=True):
	AA=copy.deepcopy(AAA)
	ply=0
	moves=[]
	moves_win=[]
	
	if max(AA)<=1: 	return(0,0,True)
	cAA=candi(AA)
	for j in cAA:
		if AA[j]>1:
			win=0
			
			for r in range(tryno):
				A=copy.deepcopy(AA)
				ply=1
				A[j]-=1
				g=gcdm(A)
				A=[x//g for x in A]
				while max(A)>1 and min(A)>1:
					ca=candi(A)
					i=ca[random.randint(0,len(ca)-1)]
					if A[i]>1:
						ply+=1
						A[i]-=1
						g=gcdm(A)
						A=[x//g for x in A]
				ply+=sum(A)-N
				if (ply %2==0)!=isFirst:win+=1
				
			moves.extend([j])
			moves_win.extend([win])
		
	if isFirst:
		player='First'
		ans=max(moves_win)
	else:
		player='Second'
		ans=min(moves_win)
	selected=moves[moves_win.index(ans)]
	#print(AAA)
	#print(cAA)
	#print(moves_win,player,selected)
	
	AAA[selected]-=1
	g=gcdm(AAA)
	AAA=[x//g for x in AAA]
	#print(AAA)
	return([selected,ans,False,AAA])



N=int(input())
AAA=[int(x) for x in input().split()]


tryno=100
F=[]
isFirst=True
while max(AAA)>1 and min(AAA)>1:
	y=sto(N,AAA,tryno,isFirst)
	if y[2]: break
	F.extend([y[0]])
	isFirst=(isFirst!=True)
	AAA=y[3]

judge=len(F)+sum(AAA)-N

if judge%2==1:
	print('First')
else:
	print('Second')

	

Fixed submission:
import random
def tester(N=0):
	'''制約
1≦N≦105
1≦Ai≦109
'''
	maxno1=1e5
	maxno2=1e9
	s=input()
	if s!='':return(s)
	
	if N==0:
		return(random.randint(2,maxno1))
	else:
		print('Testing...')
		print('N=',N)
		A=[]
		for i in range(N):
			A.extend([random.randint(1,maxno2)])
		return(' '.join(list(map(str,A))))

import copy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcdm(x):
	g=x[0]
	for i in range(1,len(x)):
		if g==1:
			return(g)
		g=gcd(g,x[i])
	return(g)

def playmove(A,i):
	A[i]-=1
	g=gcdm(A)
	return([x//g for x in A])

def noofevens(A):
	r=0
	for i in A:
		if i%2==0:
			r+=1
	return(r)
			

N=int(tester())
A=[int(x) for x in tester(N).split()]


isFirstmove=True
while True:
	e=noofevens(A)
	if e%2==1:
		if isFirstmove:
			print('First')
		else:
			print('Second')
		break
	elif N-e>1:
		if isFirstmove:
			print('Second')
		else:
			print('First')
		break
	else:	
		for i in range(N):
			if A[i]%2==1:
				break
		if A[i]==1:
			if isFirstmove:
				print('Second')
			else:
				print('First')
			break
		else:
			A=playmove(A,i)
			isFirstmove=(isFirstmove!=True)