Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from operator import itemgetter


def get_root(A):
    res = [A]
    search = [A]
    visit = [False for i in range(N)]
    while(len(search) > 0):
        now = search.pop()
        if visit[now-1]:
            continue
        visit[now-1] = True
        for a in ans[now-1]:
            if a == 0:
                continue
            if visit[a-1]:
                continue
            res.append(a)
            search.append(a)
    return set(res)


N, M = map(int, input().split(" "))
AB = [list(map(int, input().split(" "))) for i in range(N+M-1)]

AB = sorted(AB, key=itemgetter(1))
count = 1
before = -1
temp = [AB[0][0]]
ans = [[0, ] for i in range(N)]
before = AB[0][1]
for a, b in AB[1:]:
    if before != b:
        ans[before-1] = temp
        temp = [a, ]
        before = b
    else:
        temp.append(a)

if len(temp) > 0:
    ans[-1] = (temp)

new_ans = []
for i, each_ans in enumerate(ans):
    if len(each_ans) == 1:
        new_ans.append(each_ans[0])
        continue
    for a in each_ans:
        if set(each_ans) & get_root(a) == set(each_ans):
            new_ans.append(a)
            break

for line in new_ans:
    print(line)


### FIXED CODE ###

from collections import deque
from operator import itemgetter


def topolo():
    q = deque(v1 for v1 in range(N) if ins[v1] == 0)
    res = []
    popleft, append = q.popleft, q.append
    res_append = res.append
    while q:
        v1 = popleft()
        res_append(v1)
        for v2 in edges[v1]:
            ins[v2] -= 1
            if ins[v2] == 0:
                append(v2)
    return res


N, M = map(int, input().split(" "))
edges = [[] for _ in [0]*N]
rev = [[] for _ in [0]*N]

ins = [0]*N

for a, b in (map(int, input().split(" ")) for _ in [0]*(N+M-1)):
    edges[a-1].append(b-1)
    rev[b-1].append(a-1)
    ins[b-1] += 1

sorted_nodes = topolo()
order = [i for i, v in sorted(enumerate(sorted_nodes), key=itemgetter(1))]

for input_nodes in rev:
    l = len(input_nodes)
    if l == 0:
        print(0)
        continue
    elif l == 1:
        print(input_nodes[0] + 1)
        continue
    temp = 0
    for node in input_nodes:
        temp = max(temp, order[node])
    print(sorted_nodes[temp] + 1)
### BUGGY CODE ###

from bisect import bisect_left

N=int(input())
*A,=map(int,input().split())
G=[[] for _ in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
def bfs(s):
    from collections import deque
    seen = [0]*N
    d = [0]*N
    prev = [-1]*N
    todo = deque()
    seen[s]=1
    todo.append(s)
    while todo:
      a = todo.popleft()
      for b in G[a]:
        if seen[b] == 0:
          seen[b] = 1
          todo.append(b)
          d[b] += d[a] + 1
          prev[b] = a
    return d, prev
  
def argsort(arr, reverse=False, shift=20):
    tmp = sorted([arr[i]<<shift | i for i in range(len(arr))],reverse=reverse)
    mask = (1<<shift) - 1
    return [tmp[i] & mask for i in range(len(arr))]
  
d,prev = bfs(0)
order = argsort(d)
dp = [[] for _ in range(N)]
dp[0] = [A[0]]
for v in order:
  if v == 0: continue
  p = prev[v]
  idx = bisect_left(dp[p],A[v])
  if idx == len(dp[p]): dp[v] = dp[p]+[A[v]]
  else: dp[v] = [dp[p][i] if i != idx else A[v] for i in range(len(dp[p]))]
  
print(*[len(dp[i]) for i in range(N)],sep="\n")

### FIXED CODE ###

from bisect import bisect_left

N=int(input())
*A,=map(int,input().split())
INF=10**20
G=[[] for _ in range(N)]
ab = [tuple(map(int,input().split())) for _ in range(N-1)]
for a,b in ab:
  G[a-1].append(b-1)
  G[b-1].append(a-1)
  
def dfs(a0):
    seen =[0]*len(G)
    todo = [~a0, a0]
    while todo:
        a = todo.pop()
        if a >= 0:
            seen[a] = 1
            idx = bisect_left(lis,A[a])
            his[a] = (idx,lis[idx])
            lis[idx] = A[a]
            dp[a] = bisect_left(lis,INF)
            for b in G[a]:
                if seen[b]: continue
                todo.append(~b)
                todo.append(b)
        else:
          idx,val = his[~a]
          lis[idx] = val
    return
  
lis = [INF]*N
dp = [0]*N
his = {}
dfs(0)
print(*dp,sep="\n")
### BUGGY CODE ###

import math
import collections
from sys import exit
from itertools import product

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
a = li()

sa = set(a)

ans = 0
for i in sa:
    tmp = a.count(i)
    if tmp < i:
        ans += tmp
    else:
        ans += tmp - i
print(ans)

### FIXED CODE ###

import math
from collections import Counter
from sys import exit
from itertools import product

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
a = li()

cnt = Counter(a)
ans = 0
for i,j in cnt.items():
    if i > j:
        ans += j
    else:
        ans += j - i
print(ans)
### BUGGY CODE ###

s1 = input()
s2 = input()
arra = ["-"]
arrb = ["-"]
for i in s1:
    arra.append(i)
for i in s2:
    arrb.append(i)
n1 = len(s1)
n2 = len(s2)
temparr = [[] for i in range(n2 + 1)]
dp = [temparr[::] for i in range(n1 + 1)]

for i in range(1, n1 + 1):
    for j in range(1 , n2 + 1):
        #print("i " + str(i) + " j " + str(j))
        if arra[i] != arrb[j]:
            dig = dp[i -1][j-1]
            upp = dp[i - 1][j]
            left = dp[i][j - 1]
            dign = len(dig)
            uppn = len(upp)
            leftn = len(left)
            if dign >= uppn and dign >= leftn:
                dp[i][j] = dig[::] 
            elif uppn >= dign and uppn >= leftn:
                dp[i][j] = upp[::]
            else:
                dp[i][j] = left[::]
        else:
            dig = dp[i -1][j-1]
            upp = dp[i - 1][j]
            left = dp[i][j - 1]
            dig.append(arra[i])
            #print(dig)
            
            dign = len(dig)
            uppn = len(upp)
            leftn = len(left)
            if dign >= uppn and dign >= leftn:
                dp[i][j] = dig[::] 
            elif uppn >= dign and uppn >= leftn:
                dp[i][j] = upp[::]
            else:
                dp[i][j] = left[::]

# for i in dp:
#     print(i) 
print("".join(dp[-1][-1]))
   
        
        

### FIXED CODE ###

s1 = input()
s2 = input()
arra = ["-"]
arrb = ["-"]
for i in s1:
    arra.append(i)
for i in s2:
    arrb.append(i)
n1 = len(s1)
n2 = len(s2)
temparr = [0 for i in range(n2 + 1)]
dp = [temparr[::] for i in range(n1 + 1)]

for i in range(1, n1 + 1):
    for j in range(1 , n2 + 1):
        if arra[i] != arrb[j]:
            dig = dp[i -1][j-1]
            upp = dp[i - 1][j]
            left = dp[i][j - 1]
            dign = dig
            uppn = upp
            leftn = left
            if dign >= uppn and dign >= leftn:
                dp[i][j] = dig
            elif uppn >= dign and uppn >= leftn:
                dp[i][j] = upp
            else:
                dp[i][j] = left
        else:
            dig = dp[i -1][j-1]
            upp = dp[i - 1][j]
            left = dp[i][j - 1]
            dig = dig + 1
            #print(dig)
            
            dign = dig
            uppn = upp
            leftn = left
            if dign >= uppn and dign >= leftn:
                dp[i][j] = dig
            elif uppn >= dign and uppn >= leftn:
                dp[i][j] = upp
            else:
                dp[i][j] = left

# for i in dp:
#     print(i) 
ans = ""

while n2 != 0 and n1 != 0 :
    
    if arra[n1] == arrb[n2]:
        ans += arra[n1]
        n2 -= 1 
        n1 -= 1 
        continue 
    else:
        if dp[n1 - 1][n2] >= dp[n1][n2 - 1]:
            n1 -= 1 
        else:
            n2 -=1 
print(ans[::-1])
### BUGGY CODE ###

h,n = map(int,input().split())

ls = [list(map(int,input().split())) for _ in range(n)]

amax = max(a for a,b in ls)

dp = [0]*(h+amax)

for i in range(1,h+amax):
  dp[i] = min(dp[max(0,i-a)]+b for a,b in ls)

print(min(dp[h:]))



### FIXED CODE ###

n,m=map(int, input().split())
s=[list(map(int, input().split())) for i in range(m)]
x=max(a for a,b in s)
dp=[0]*(n+x)
for i in range(0,n+x):
  if i>0:
    dp[i]=min(dp[i-a]+b for a,b in s)
print(min(dp[n:]))
### BUGGY CODE ###

N, P = list(map(int, input().split()))


def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1


ans = 1
tmp = P

for i in range(2, P):
    if not is_prime(i):
        continue
    while True:
        rest = tmp % (i ** N)
        newtmp = tmp // (i ** N)
        # print(i, tmp, rest, ans)
        if rest == 0:
            ans = ans * i
            tmp = newtmp
        else:
            break
    if newtmp == 0:
        break

print(ans)


### FIXED CODE ###

N, P = list(map(int, input().split()))
if N == 1:
    print(P)
    exit()
elif P == 1:
    print("1")
    exit()

ans = 1
tmp = P

for i in range(2, int(pow(P, 1 / N)) + 1):
    po = pow(i, N)
    while tmp % po == 0:
        tmp = tmp // po
        ans = ans * i
        # print(i, tmp, ans)

    if tmp < po:
        break

print(ans)
### BUGGY CODE ###

import sys

N,P=[int(i) for i in input().split()]
i=2
ans = 1
c=0
if N == 1:
  print(P)
  sys.exit()
while P>1:
  if P%i==0:
    P//=i
    c+=1
    if c==N:
      ans*=i
      c=0
  else:
    c=0
    i+=1
print(ans)


### FIXED CODE ###

import sys

N,P=[int(i) for i in input().split()]
i=2
ans = 1
c=0
if N == 1:
  print(P)
  sys.exit()
while P>i*i-4:
  if P%i==0:
    P//=i
    c+=1
    if c==N:
      ans*=i
      c=0
  else:
    c=0
    i+=1
if P==i and c+1 ==N:
  ans*=i
print(ans)
### BUGGY CODE ###

a,b,c,d=map(int,input().split())
count = 0
for i in range(a,b+1):
  if i % c != 0 and i % d !=0:
    count += 1
print(count)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
a -= 1
from fractions import gcd
divac = a // c
divad = a // d
divbc = b // c
divbd = b // d
divacd = a // (c*d//gcd(c,d))
divbcd = b // (c*d//gcd(c,d))
Acd = divac + divad - divacd
Bcd = divbc + divbd - divbcd
wareru = Bcd - Acd
ans = b-a-wareru
print(ans)
### BUGGY CODE ###

n=int(input())
import math
nn=int(n/2)
a=[3,2]
a*=(n+1)
a[1]-=1
a[2]-=1
for i in range(3,nn+1):
    t=i+i
    while t<=n:
        a[t]+=1
        t+=i
ans=0
for i in range(1,n+1):
    ans+=a[i]*i

print(ans)

### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,n+1):
    m=n//i
    ans+=m*i*(m+1)/2
    
print(int(ans))
### BUGGY CODE ###

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

INF = 1e10
maze = []

dh = [-1,0,1,0]
dw = [0,1,0,-1]

for i in range(H):
    tmp = list(input())
    maze.append(tmp)

reached = [[INF]*W for _ in range(H)]

l = deque()
l.appendleft((Ch, Cw))
reached[Ch][Cw] = 0
while l:
    h, w = l.popleft()
    d = reached[h][w]
    for i in range(4):
        nh = h + dh[i]
        nw = w + dw[i]
        if not (0 <= nh <= H-1 and 0 <= nw <= W-1):
            continue
        if not maze[nh][nw] != "#":
            continue
        if not reached[nh][nw] > d:
            continue
        reached[nh][nw] = d
        l.appendleft((nh, nw))
    for i in range(-2, 3):
        for j in range(-2, 3):
            nh = h + i
            nw = w + j
            if not (0 <= nh <= H-1 and 0 <= nw <= W-1):
                continue
            if not maze[nh][nw] != "#":
                continue
            if not reached[nh][nw] > d:
                continue
            reached[nh][nw] = d + 1
            l.append((nh, nw))

ans = reached[Dh][Dw]
if ans != INF:
    print(ans)
else:
    print(-1)

    

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1

INF = 1e10
maze = []

dh = [-1,0,1,0]
dw = [0,1,0,-1]

for i in range(H):
    tmp = list(input())
    maze.append(tmp)

reached = [[INF]*W for _ in range(H)]

l = deque()
l.appendleft((Ch, Cw))
reached[Ch][Cw] = 0
while l:
    h, w = l.popleft()
    d = reached[h][w]
    for i in range(4):
        nh = h + dh[i]
        nw = w + dw[i]
        if not (0 <= nh <= H-1 and 0 <= nw <= W-1):
            continue
        if not maze[nh][nw] != "#":
            continue
        if not reached[nh][nw] > d:
            continue
        reached[nh][nw] = d
        l.appendleft((nh, nw))
    for i in range(-2, 3):
        for j in range(-2, 3):
            nh = h + i
            nw = w + j
            if not (0 <= nh <= H-1 and 0 <= nw <= W-1):
                continue
            if not maze[nh][nw] != "#":
                continue
            if not reached[nh][nw] > d + 1:
                continue
            reached[nh][nw] = d + 1
            l.append((nh, nw))

ans = reached[Dh][Dw]
if ans != INF:
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

x, k, d = map(int, input().split())
add_list = []
for i in range(k//2+1):
  num = k - 2*i
  add_list.append(d * num)
answer = float('inf')
for add in add_list:
  answer = min(abs(x + add), abs(x - add), answer)
print(answer)

### FIXED CODE ###

x, k, d = map(int, input().split())
x_abs = abs(x)
if x_abs - k * d >= 0:
  print(x_abs - k * d)
else:
  kk = k - x_abs // d
  x_now = x_abs - (k - kk) * d
  if kk % 2 == 0:
    print(x_now)
  else:
    print(abs(x_now - d))
### BUGGY CODE ###

from collections import Counter

N = int(input())
A = list(map(int,input().split()))

a = list(set(A))
cc = Counter(A)
dup = [x for x in a if cc[x] > 1]
m = len(a)
l = len(A) 
c_l = [(cc[i]-1)*(cc[i])/2 for i in a]
al = sum(c_l)

for k in A:
    if k in dup:
        print(int(al-cc[k]+1))
    else :
        print(int(al))

### FIXED CODE ###

from collections import Counter

N = int(input())
A = list(map(int,input().split()))
a = list(set(A))
cc = Counter(A)
dup = set([x for x in a if cc[x] > 1])
c_l = [(cc[i]-1)*(cc[i])/2 for i in a]
al = sum(c_l)

# for k in A:
#     if k in dup:
#         print(int(al-cc[k]+1))
#     else :
#         print(int(al))
[print(int(al-cc[k]+1)) if k in dup else print(int(al)) for k in A]
### BUGGY CODE ###

import math
from functools import reduce

K=int(input())

def gcd(*numbers):
    return reduce(math.gcd, numbers)
sum = 0

for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            sum += gcd(a, b, c)

print(sum)

### FIXED CODE ###

K=int(input())

cache = [1, 
9, 
30, 
76, 
141, 
267, 
400, 
624, 
885, 
1249, 
1590, 
2208, 
2689, 
3411, 
4248, 
5248, 
6081, 
7485, 
8530, 
10248, 
11889, 
13687, 
15228, 
17988, 
20053, 
22569, 
25242, 
28588, 
31053, 
35463, 
38284, 
42540, 
46581, 
50893, 
55362, 
61824, 
65857, 
71247, 
76884, 
84388, 
89349, 
97881, 
103342, 
111528, 
120141, 
128047, 
134580, 
146316, 
154177, 
164817, 
174438, 
185836, 
194157, 
207927, 
218812, 
233268, 
245277, 
257857, 
268182, 
288216, 
299257, 
313635, 
330204, 
347836, 
362973, 
383709, 
397042, 
416448, 
434025, 
456967, 
471948, 
499740, 
515581, 
536073, 
559758, 
583960, 
604833, 
633651, 
652216, 
683712, 
709065, 
734233, 
754734, 
793188, 
818917, 
846603, 
874512, 
909496, 
933081, 
977145, 
1006126, 
1041504, 
1073385, 
1106467, 
1138536, 
1187112, 
1215145, 
1255101, 
1295142, 
1342852, 
1373253, 
1422195, 
1453816, 
1502376, 
1553361, 
1595437, 
1629570, 
1691292, 
1726717, 
1782111, 
1827492, 
1887772, 
1925853, 
1986837, 
2033674, 
2089776, 
2145333, 
2197483, 
2246640, 
2332104, 
2379085, 
2434833, 
2490534, 
2554600, 
2609625, 
2693919, 
2742052, 
2813988, 
2875245, 
2952085, 
3003306, 
3096024, 
3157249, 
3224511, 
3306240, 
3388576, 
3444609, 
3533637, 
3591322, 
3693924, 
3767085, 
3842623, 
3912324, 
4027884, 
4102093, 
4181949, 
4270422, 
4361548, 
4427853, 
4548003, 
4616104, 
4718640, 
4812789, 
4918561, 
5003286, 
5131848, 
5205481, 
5299011, 
5392008, 
5521384, 
5610705, 
5739009, 
5818390, 
5930196, 
6052893, 
6156139, 
6239472, 
6402720, 
6493681, 
6623853, 
6741078, 
6864016, 
6953457, 
7094451, 
7215016, 
7359936, 
7475145, 
7593865, 
7689630, 
7886244, 
7984165, 
8130747, 
8253888, 
8403448, 
8523897, 
8684853, 
8802826, 
8949612, 
9105537, 
9267595, 
9376656, 
9574704, 
9686065, 
9827097, 
9997134, 
10174780, 
10290813, 
10493367, 
10611772, 
10813692, 
10962213]

print(cache[K-1])
### BUGGY CODE ###

import re
N, Q = input().split()
N = int(N)
Q = int(Q)
S=str(input())

for i in range(Q):
  l, r = input().split()
  l = int(l)
  r = int(r)
  s = S[l-1:r]

  print(s.count("AC"))

### FIXED CODE ###

N, Q = input().split()
N = int(N)
Q = int(Q)
S=str(input())

im = [0 for i in range(N)]
AA = False
for i,v in enumerate(S):
  if AA:
    if v=="C": im[i] += 1
    elif v=="A": continue
    AA = False
  else:
    if v=="A": AA=True

for i in range(1,N):
  im[i] = im[i-1]+im[i]

for i in range(Q):
  l, r = input().split()
  l = int(l)-1
  r = int(r)-1
  print(im[r]-im[l])
### BUGGY CODE ###

from collections import deque
def bfs():
    move=[[1,0],[0,1],[-1,0],[0,-1]]
    
    queue=deque()
    queue.append([sy,sx]) #queue=deque([[sy,sx]])でもよい
    visited[sy][sx]=0 #スタート地点の距離は0
    while queue:
        y,x=queue.popleft()
        cnt=visited[y][x]
        
        for dy,dx in move:
            my,mx=y+dy,x+dx 
            if (0<=my<tate and 0<=mx<yoko) and maze[my][mx]=="." and visited[my][mx]>cnt:
                queue.append([my,mx])
                visited[my][mx]=cnt # visitedは距離も兼ねてる
        for my in range(y-2,y+3):
            for mx in range(x-2,x+3):
                if (0<=my<tate and 0<=mx<yoko) and maze[my][mx]==".":
                    if visited[my][mx]>cnt+1:
                        queue.append([my,mx])
                        visited[my][mx]=cnt+1
    if visited[gy][gx]==inf:
        print(-1)
    else:
        print(visited[gy][gx])


tate,yoko=map(int,input().split())
sy,sx=map(int,input().split())
gy,gx=map(int,input().split())
sy,sx,gy,gx=sy-1,sx-1,gy-1,gx-1
maze=[]
inf=float('inf')
visited=[[inf]*yoko for i in range(tate)]

for i in range(tate):
    line=list(input())
    maze.append(line)
bfs()

### FIXED CODE ###

from collections import deque
def bfs():
    move=[[1,0],[0,1],[-1,0],[0,-1]]
    
    queue=deque()
    queue.append([sy,sx]) #queue=deque([[sy,sx]])でもよい
    visited[sy][sx]=0 #スタート地点の距離は0
    while queue:
        y,x=queue.popleft()
        cnt=visited[y][x]
        
        for dy,dx in move:
            my,mx=y+dy,x+dx 
            if my<0 or my>=tate:
                continue
            if mx<0 or mx>=yoko:
                continue
            if maze[my][mx]=="#":
                continue
            if visited[my][mx]>cnt:
                queue.appendleft([my,mx])
                visited[my][mx]=cnt # visitedは距離も兼ねてる
        for my in range(y-2,y+3):
            for mx in range(x-2,x+3):
                if my<0 or my>=tate:
                    continue
                if mx<0 or mx>=yoko:
                    continue
                if maze[my][mx]=="#":
                    continue
                if visited[my][mx]>cnt+1:
                    queue.append([my,mx])
                    visited[my][mx]=cnt+1
    if visited[gy][gx]==inf:
        print(-1)
    else:
        print(visited[gy][gx])


tate,yoko=map(int,input().split())
sy,sx=map(int,input().split())
gy,gx=map(int,input().split())
sy,sx,gy,gx=sy-1,sx-1,gy-1,gx-1
maze=[]
inf=float('inf')
visited=[[inf]*yoko for i in range(tate)]

for i in range(tate):
    line=list(input())
    maze.append(line)
bfs()
### BUGGY CODE ###

n, m, k = map(int, input().split())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
ans = [0]
time_sum = 0
i, j = 0, 0

flag_a = True
flag_b = True
flag = False
for i in range(0, len(aa)+1):
    for j in range(0, len(bb)+1):
        asum, bsum = sum(aa[:i]), sum(bb[:j])
        if k < asum and k < bsum:
            flag = True
            break
        else:
            time_total = asum + bsum
            if time_total > k:
                break
            else:
                ans.append(i+j)
    if flag:
        break

print(max(ans))


### FIXED CODE ###

n, m, k = map(int, input().split())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
asum = [0]
bsum = [0]

for i in range(len(aa)):
    asum.append(asum[i]+aa[i])
for i in range(len(bb)):
    bsum.append(bsum[i]+bb[i])

j = len(bsum)-1
ans = 0
for i in range(len(asum)):
    while j >= 0:
        if k >= asum[i] + bsum[j]:
            ans = max(ans, i+j)
            break
        else:
            j -= 1


print(ans)
### BUGGY CODE ###

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    l,r = map(int, input().split())
    ans = 2019

    for i in range(l,r+1):
        for j in range(i+1,r+1):
            if i%2019 == 0 or j%2019 == 0:
                ans = 0
                break
            else:
                ans = min(ans, (i*j)%2019)
    print(ans)
   
if __name__ == "__main__":
    main()

### FIXED CODE ###

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    l,r = map(int, input().split())
    ans = 2019

    if r - l >= 2019:
        print(0)
        sys.exit()

    for i in range(l,r+1):
        for j in range(i+1,r+1):
            if i%2019 == 0 or j%2019 == 0:
                ans = 0
                break
            else:
                ans = min(ans, (i*j)%2019)
    print(ans)
   
if __name__ == "__main__":
    main()
### BUGGY CODE ###

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 CODE ###

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)