Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
MOD = 10**9 + 7
exist = [1 for _ in range(N+2)]
for _ in range(M):
    exist[int(input())] = 0
dp = [0 for _ in range(N+2)]
dp[0] = 1
for i in range(N):
    dp[i+1] = (dp[i+1] + dp[i] * exist[i+1]) % MOD
    dp[i+2] = (dp[i+2] + dp[i] * exist[i+2]) % MOD
print(dp[N])

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
from collections import *
from math import atan2, pi
from bisect import *
mod = 10**9+7

L = input()
N = len(L)
dp = [0] * N
dp[0] = 1
T = 2
for i in range(1, N):
    if L[i] == '1':
        dp[i] = (dp[i-1] * 3 + T) % mod
        T = T * 2 % mod
    else:
        dp[i] = dp[i-1] * 3 % mod
print((dp[-1] + T) % mod)
def itoa(i):
    if i==0:
        return "a"
    elif i==1:
        return "b"
    elif i==2:
        return "c"
    elif i==3:
        return "d"
    elif i==4:
        return "e"
    elif i==5:
        return "f"
    elif i==6:
        return "g"
    elif i==7:
        return "h"
    elif i==8:
        return "i"
    elif i==9:
        return "j"
    elif i==10:
        return "k"
    elif i==11:
        return "l"
    elif i==12:
        return "m"
    elif i==13:
        return "n"
    elif i==14:
        return "o"
    elif i==15:
        return "p"
    elif i==16:
        return "q"
    elif i==17:
        return "r"
    elif i==18:
        return "s"
    elif i==19:
        return "t"
    elif i==20:
        return "u"
    elif i==21:
        return "v"
    elif i==22:
        return "w"
    elif i==23:
        return "x"
    elif i==24:
        return "y"
    elif i==25:
        return "z"



H,W = list(map(int,input().split()))
S = []
for i in range(H):
    S.append(list(map(int,input().split())))

for i in range(H):
    for j in range(W):
        if S[i][j]=="snuke":
            print(itoa(j).upper()+str(i))
        break

### FIXED CODE ###


def itoa(i):
    if i==0:
        return "a"
    elif i==1:
        return "b"
    elif i==2:
        return "c"
    elif i==3:
        return "d"
    elif i==4:
        return "e"
    elif i==5:
        return "f"
    elif i==6:
        return "g"
    elif i==7:
        return "h"
    elif i==8:
        return "i"
    elif i==9:
        return "j"
    elif i==10:
        return "k"
    elif i==11:
        return "l"
    elif i==12:
        return "m"
    elif i==13:
        return "n"
    elif i==14:
        return "o"
    elif i==15:
        return "p"
    elif i==16:
        return "q"
    elif i==17:
        return "r"
    elif i==18:
        return "s"
    elif i==19:
        return "t"
    elif i==20:
        return "u"
    elif i==21:
        return "v"
    elif i==22:
        return "w"
    elif i==23:
        return "x"
    elif i==24:
        return "y"
    elif i==25:
        return "z"


H,W = list(map(int,input().split()))
S = []
for i in range(H):
    S.append(input().split())

for i in range(H):
    for j in range(W):
        if S[i][j]=="snuke":
            print(itoa(j).upper()+str(i+1))
N = list(map(int, input().split()))
min_train = min(N[0],N[1])
min_bus = min(N[2],N[3])
print(min_train+ min_bus)


### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = min(A,B)
F = min(C,D)
print(E+F)
a, b = input().split()
n = int(a + b)

if math.sqrt(n) ** 2 == n:
    print("Yes")
else:
    print("No")



### FIXED CODE ###

import math

a, b = input().split()
n = int(a + b)

if math.floor(math.sqrt(n)) ** 2 == n:
    print("Yes")
else:
    print("No")
import numpy as np

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

X = []
for i in range(N):
    x = [0 for _ in range(N)]
    for j in range(i, i+2):
        if j >= N:
            continue
        x[j] = 1
    if i == N - 1:
        x[0] = 1
    X.append(x)

Y = A
X = np.matrix(X)
Y = np.matrix(Y).reshape(-1, 1)
ans = np.linalg.solve(X,Y) * 2
ans = list(map(lambda x: str(int(x)), ans))
print(' '.join(ans).strip())


### FIXED CODE ###

N,A,B = map(int, input().split())
print(N*A if N*A <= B else B)
n = input()
li = list(map(int, input().split())) 

total = 1

if li.index(0):
    total = 0
    print(total)
else:
    for a in li:
        total *= a
        if 10 ** 18 < total:
            total = -1
    print(total)

### FIXED CODE ###

n = input()
li = list(map(int, input().split())) 

total = 1
li.sort()
for a in li:
    if a == 0:
        total = 0
        break
    total *= a
    if 10 ** 18 < total:
        total = -1
        break
print(total)
S=str(input())
import sys
t=0
lista=[]
for i in range(99):
  try:
    lista.append(S[i])
    t=t+1
  except IndexError:
    break
print (t)
u=t//2
v=u//2+1
p=1
for i in range(v):
  if S[i]==S[u-i-1]:
    p=p*1
  else:
    print ('No')
    sys.exit()
for j in range(v):
  if S[u+j+1]==S[t-1-j]:
    p=p*1
  else:
    print ('No')
    sys.exit()
if t>3:
  print ('Yes')
else:
  if S[0]=S[2]:
    print ('Yes')
  else:
    print ('No')

### FIXED CODE ###

S=str(input())
import sys
t=0
lista=[]
for i in range(99):
    try:
        lista.append(S[i])
        t=t+1
    except IndexError:
        break
u=t//2
v=u//2+1
p=1
for i in range(v):
    if S[i]==S[u-i-1] and S[u-i-1]==S[u+i+1] and S[u+i+1]==S[t-1-i]:
        p=p*1
    else:
        print ('No')
        sys.exit()
print ('Yes')
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

li = []
for i in range(len(h)):
  li.append(abs(a - (t - h[i]*0.006)))
  
print(li.index(min(li)))

### FIXED CODE ###

x,y = map(int,input().split())

yen = x+y/2
print(int(yen))
a, b = map(int,input().split())
print(a / / b, a % b, float(a / b))

### FIXED CODE ###

a,b = map(int,input().split())
d = a // b
r = a % b
f = a / b
print('{} {} {:f}'.format(d,r,f))
a,b = map(int,input().split())
c = a//b
d = a//(b//2)
if b % 2 == 0:
	print(d**3)
else:
	print(c**3)

### FIXED CODE ###

a,b = map(int,input().split())

if b%2 != 0:
  print(pow(a//b,3))
else:
  print(pow(a//b,3)+pow(((a+b//2)//b),3))
# coding: utf-8
N = int(input())

P = []
max = -9999999999999
count = 0
a = int(input())
b = a
max = a
P.append(a)
for i in range(0,N-1):
    a = int(input())
    if a < b:
        P.
        count += 1
        b = a
    if a > max:
        max = a
        count += 1


print(count)


### FIXED CODE ###

# coding: utf-8
a, b = map(int, input().split())
max = -99999999999999
X = [a+b,a-b,a*b]
for i in range(len(X)):
    if X[i] > max:
        max = X[i]

print(max)
x = input()

y = x**3

print int(y)

### FIXED CODE ###

x = int(input())
print(x ** 3)
from collections import deque
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
    x=deque([])
    y=deque([])
    for i in range(n):
        if i%2==1:
            y.appendleft(a[i])
        else:
            x.append(a[i])
    z=y+x
    print(*z)
else:
    x=deque([])
    y=deque([])
    for i in range(n):
        if i%2==0:
            y.appendleft(a[i])
        else:
            x.append(a[i])
    z=y+x
    print(*z)

### FIXED CODE ###

from collections import deque
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
    x=deque([])
    y=deque([])
    for i in range(n):
        if i%2==1:
            y.appendleft(a[i])
        else:
            x.append(a[i])
    z=[]
    for u in y:
        z.append(u)
    for u in x:
        z.append(u)
    print(*z)
else:
    x=deque([])
    y=deque([])
    for i in range(n):
        if i%2==0:
            y.appendleft(a[i])
        else:
            x.append(a[i])
    z=[]
    for u in y:
        z.append(u)
    for u in x:
        z.append(u)
    print(*z)
K, S = list(map(int, input().split()))

a = 0
for i in range(K + 1):
    r = S - i
    if i <= S and r <= K * 2:
        t = (r + 1) - max(0, r - K) * 2
        a += t

print(a)


### FIXED CODE ###

print(input().replace(',',' '))
from collections import Counter
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

B = int(input())
Lb = [input() for _ in range(B)]
R = int(input())
Lr = [input() for _ in range(R)]

Cb = Counter(Lb)
Cr = Counter(Lr)

cand = []
for i, v in Cb.items():
    cand.append([v-Cr[i]])
ans = sum(list(filter(lambda x: x > 0, cand)))
print(ans)


### FIXED CODE ###

from collections import Counter

N = Counter([input() for _ in range(int(input()))])
M = Counter([input() for _ in range(int(input()))])
print(max(0, max(N[key]-M[key] for key in N.keys())))
D, G, *pc = map(int, open(0).read().split())
pc = list(zip(*[iter(pc)]*2))

# 全完一つで達成できるケース

total_points = []
for i in range(D):
    total_points.append(pc[i][0] * (i+1) * 100 + pc[i][1])
    
ans_list = [i[0] for i, x in zip(pc, total_points) if x >= G]

# 完答ボーナスを含め、最も効率の良い問題から解くケース
efficient_order = sorted(list(zip([x/y for x,(y,z) in list(zip(total_points, pc))], range(1, D+1))), reverse = True)

achieved = False
remained = G
highest_p = D

ans_other = 0

for _, i in efficient_order:
        if remained <= 0:
            break
        elif math.ceil(remained / (i * 100)) <= pc[i - 1][0]:
            ans_other += math.ceil(remained / (i * 100))
            remained -= (math.ceil(remained / (i * 100)) * i * 100)
        else:
            ans_other += pc[i - 1][0]
            remained -= (i * 100 * pc[i - 1][0] + pc[i - 1][1])

ans_list.append(ans_other)

print(min(ans_list))

### FIXED CODE ###

import numpy as np

D, G, *pc = map(int, open(0).read().split())
pc = list(zip(*[iter(pc)]*2))
p, c = np.array([]), np.array([])
for (x,y) in pc:
    p = np.append(p, x)
    c = np.append(c, y)
    
import numpy as np
import math

base_points = np.array([i*100 for i in range(1, D+1)])

ans = []

for i in range(2**D):
    bit_flag = np.array(list(map(int, format(i, '0%db' %D))))
    points = sum(bit_flag * (c + p*base_points))
    solved_num = sum(bit_flag * p)
    
    if points >= G:
        ans.append(solved_num)

    else:
        remained = G - points
        remained_problems = sorted((bit_flag==False) * np.array(range(1, D+1)), reverse=True)
        i = 0

        while True:
            if remained <= 0:
                break
                
            highest_p = remained_problems[i]

            if math.ceil(remained / (highest_p * 100)) <= p[highest_p - 1]:
                solved_num += math.ceil(remained / (highest_p * 100))
                remained -= (math.ceil(remained / (highest_p * 100)) * highest_p * 100)
            else:
                solved_num += p[highest_p - 1]
                remained -= (highest_p * 100 * p[highest_p - 1] + c[highest_p - 1])
                i += 1

        ans.append(solved_num)
        
print(int(min(ans)))
a,b,c,d =map(int,raw_input().split())

if c == a/2 and d == b/2:
    print a*b/2, 1
else:
    print a*b/2, 0


### FIXED CODE ###

a,b =map(int,raw_input().split())
if a < b:
    print(0)
else:
    print(10)
S = input()
st = set(S)
for i in range(len(st)):
  if S.count(st[i]) % 2 != 0:
    print("No")
    exit()
print("Yes")

### FIXED CODE ###

S = input()
st = list(set(S))
for i in range(len(st)):
  if S.count(st[i]) % 2 != 0:
    print("No")
    exit()
print("Yes")
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

sx, sy, tx, ty = na()
ans = ""
dx = tx - sx
dy = ty - sy

ans += dy * "U"
ans += dx * "R"

ans += dy * 'D'
ans += dx * "L"

ans += "L"
ans += "U" * (dy + 1)
ans += 'R' * (dx + 1)
ans += "D"

ans += "R"
ans += 'D' * (dy + 1)
ans += "L" * (dx + 1)
ans += "U"

print(ans)










### FIXED CODE ###

import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

sx, sy, tx, ty = na()
ans = ""
dx = tx - sx
dy = ty - sy

ans += dy * "U"
ans += dx * "R"

ans += dy * 'D'
ans += dx * "L"

ans += "L"
ans += "U" * (dy + 1)
ans += 'R' * (dx + 1)
ans += "D"

ans += "R"
ans += 'D' * (dy + 1)
ans += "L" * (dx + 1)
ans += "U"

print(ans)
N = input()
A = input()

print (str(N * N - A))

### FIXED CODE ###

N = int(input())
A = int(input())

print(N*N-A)
n = input()
tmp = 0

for i in range(len(n)):
  tmp += int(n[i])

if n%tmp == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = input()
tmp = 0
 
for i in range(len(n)):
  tmp += int(n[i])
 
if int(n)%tmp == 0:
  print("Yes")
else:
  print("No")
from collections import defaultdict
import sys
import math
from datetime import datetime
import re
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)


def sol(a, b):
    return lcm(a, b)


do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    #print(parsed_lines)
    n = int(parsed_lines[0][0])
    k = int(parsed_lines[0][1])
    #S = parsed_lines[0][0]
    return n, k


if not do_submit:
    n, k = input_parse("""
    5
10 4 8 7 3
    """)
    print(sol(n, k))

    n, k = input_parse("""
    100000 5
    """)
    print(sol(n, k))


else:
    #n = int(input())
    a, b = list(map(int, input().split()))
    print(sol(a, b))

    # S = input().strip()
    # print(sol(S))

### FIXED CODE ###

#-*- coding: utf-8 -*-


def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def lcm(x, y):
    return (x * y) // gcd(x, y)

def sol(a, b):
    return (a * b) // gcd(a, b)


a, b = list(map(int, input().split()))
print(sol(a, b))
a,b,x=map(int,input().split())
print(len(list(range(a,b+1,x)))-(a==b))

### FIXED CODE ###

a,b,x=map(int,input().split())
print(b//x-a//x+(a%x==0))
A, B = map(int, input().split())
print('Alice' if A>B or A==1 and B==2 elif A==B 'Draw' else 'Bob')

### FIXED CODE ###

A, B = map(int, input().split()) 
if A==B:
    print('Draw')
elif A==1:
    print('Alice')
elif B==1:
    print('Bob')
elif A>B:
    print('Alice')
else:
    print('Bob')
a, op,  b = map(int, input().split())
if op =="+":
    print(int(a+b))
else:
    print(int(a-b))

### FIXED CODE ###


a, op,  b = map(str, input().split())
if op =="+":
    print(int(a)+int(b))
else:
    print(int(a)-int(b))
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]

class UnionFind():
    def __init__(self,n):
        self.n=n
        self.root=[-1]*(n+1)
        self.rnk=[0]*(n+1)

    def Find_Root(self,x):
        if self.root[x]<0:
            return x
        else:
            self.root[x]=self.Find_Root(self.root[x])
            return self.root[x]

    def Unite(self,x,y):
        x=self.Find_Root(x)
        y=self.Find_Root(y)
        if x==y:
            return
        elif self.rnk[x]>self.rnk[y]:
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y
            if self.rnk[x]==self.rnk[y]:
                self.rnk[y]+=1

    def isSameGroup(self,x,y):
        return self.Find_Root(x)==self.Find_Root(y)

    def Count(self,x):
        return -self.root[self.Find_Root(x)]

uf=UnionFind(h*w)

for i in range(h):
    for j in range(w):
        if j<w-1 and g[i][j]!=g[i][j+1]:
            uf.Unite(i*w+j,i*w+j+1)
        if i<h-1 and g[i][j]!=g[i+1][j]:
            uf.Unite(i*w+j,(i+1)*w+j)

kuro={}
siro={}

for i in range(h):
    for j in range(w):
        k=i*w+j
        if g[i][j]=="#":
            if uf.Find_Root(k) in kuro.keys():
                kuro[uf.Find_Root(k)]+=1
            else:
                kuro[uf.Find_Root(k)]=1
        else:
            if uf.Find_Root(k) in siro.keys():
                siro[uf.Find_Root(k)]+=1
            else:
                siro[uf.Find_Root(k)]=1

ans=0
for k in siro.keys():
    ans+=kuro[k]*siro[k]
print(ans)


### FIXED CODE ###

class UnionFind():
    def __init__(self,n):
        self.n=n
        self.root=[-1]*(n+1)
        self.rnk=[0]*(n+1)

    def Find_Root(self,x):
        if self.root[x]<0:
            return x
        else:
            self.root[x]=self.Find_Root(self.root[x])
            return self.root[x]

    def Unite(self,x,y):
        x=self.Find_Root(x)
        y=self.Find_Root(y)
        if x==y:
            return
        elif self.rnk[x]>self.rnk[y]:
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y
            if self.rnk[x]==self.rnk[y]:
                self.rnk[y]+=1

    def isSameGroup(self,x,y):
        return self.Find_Root(x)==self.Find_Root(y)

    def Count(self,x):
        return -self.root[self.Find_Root(x)]

h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
uf=UnionFind(h*w)
dyx=[(1,0),(-1,0),(0,1),(0,-1)]
for i in range(h):
    for j in range(w):
        if g[i][j]==".":
            continue
        p=i*w+j
        for dy,dx in dyx:
            y=i+dy
            x=j+dx
            if 0<=y<h and 0<=x<w:
                if g[y][x]==".":
                    np=y*w+x
                    uf.Unite(p,np)

rt=[0]*(h*w)
for i in range(h*w):
    rt[i]=uf.Find_Root(i)

m=min(rt)
rt=list(map(lambda x:x-m, rt))
m=max(rt)
a=[[0,0] for _ in range(m+1)]
for i in range(h*w):
    y=i//w
    x=i%w
    if g[y][x]=="#":
        a[rt[i]][0]+=1
    else:
        a[rt[i]][1]+=1
ans=0
for i,j in a:
    ans+=i*j

print(ans)
n = int(input())
x = list(map(int,input().split()))
min_energy = 250000
for i range(100):
  energy = 0
  for k range(n):
    energy += (i+1-x[k])*(i+1-x[k])
  if energy < min_energy:
    min_energy = energy
print(min_energy)

### FIXED CODE ###

n = int(input())
x = list(map(int,input().split()))
m_energy = 250000
for i in range(1,101):
  energy = 0
  for k in range(n):
    energy += (x[k]-i)**2
  if energy < m_energy:
    m_energy = energy
print(m_energy)
n=int(input())
l=[]
for i in range(n):
  a=int(input())
  l.append(1/a)

print(1/sum(l))

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))

ll=[1/x for x in l]

print(1/sum(ll))
import sys,math
for v in sys.stdin:
	print int(math.ceil(v**2/2/9.8/5))+1

### FIXED CODE ###

import sys,math
for v in sys.stdin:
	print int(math.ceil(float(v)**2/2/9.8/5))+1
n,m,c = map(int, input().split())
b = list(map(int,input().split()))
a = []

def mul(x, y):
  ret = 0
  for i in range(len(x)):
    ret += x[i]*y[i]

ans = 0
for i in range(n):
  a = list(map(int, input().split()))
  if mul(a, b) + c > 0:
    ans += 1

print(ans)

### FIXED CODE ###

n,m,c = map(int, input().split())
b = list(map(int,input().split()))
a = []

def mul(x, y):
  ret = 0
  for i in range(len(x)):
    ret += x[i]*y[i]
  return ret
    
ans = 0
for i in range(n):
  a = list(map(int, input().split()))
  if mul(a, b) + c > 0:
    ans += 1

print(ans)
a,b,c,d=map(int,input().split())
ans=0
for x in range(n//r):
    for y in range(n//g):
        if (d-x*a+y*b)//c==0:
            ans+=1
print(ans)

### FIXED CODE ###

r,g,b,n=map(int,input().split())
ans=0
for i in range(n//r+1):
    for j in range(n//g+1):
        if (n-(r*i+g*j))%b==0:
            if (n-(r*i+g*j))//b>=0:
                ans+=1
print(ans)
s = str(input())
year = ''
month = ''
day = ''

for i in range(4):
    y = s[i]
    year += y
for i in range(5, 7):
    m = s[i]
    month += m
for i in range(9, 11):
    d = s[i]
    day += d

year = int(year)
month = int(month)
day = int(day)

if year < 2019:
    answer = 'Heisei'

elif year == 2019 and month <= 4:
    answer = 'Heisei'

else:
    answer = 'TBD'
    
print(answer)

### FIXED CODE ###

s = str(input())

year = ''
for i in range(4):
    y = s[i]
    flag1 = True
    if y == '0':
        if len(year) == 0:
            flag1 = False
        if flag1:
            year += y
    else:
        year += y
year = int(year)

month = ''
for i in range(5, 7):
    m = s[i]
    if i == 5 and m == '0':
        continue
    else:
        month += m
month = int(month)


if year < 2019:
    answer = 'Heisei'

elif year == 2019 and month <= 4:
    answer = 'Heisei'

else:
    answer = 'TBD'

print(answer)
N = int(input())
u, v, w = [0]*(N-1), [0]*(N-1), [0]*(N-1)
n = [-1] * N
# n[][0] 色　n[][1] 連結先一覧リスト n[][2] mod2 
for i in range(N):
    n[i] = [0]*4
    n[i][1] = []
    n[i][2] = []

for i in range(N-1):
    u[i], v[i], w[i] = list(map(int, input().split()))
    n[u[i]-1][1].append(v[i]-1)
    n[v[i]-1][1].append(u[i]-1)
    n[u[i]-1][2].append(w[i]%2)
    n[v[i]-1][2].append(w[i]%2)

# n[][3] 探索済フラグ
def dfs(num):
    n[num][3] = 1
    for i in range(len(n[num][1])):
        if n[n[num][1][i]][3] == 0:
            if n[num][2][i] == 0:
                n[n[num][1][i]][0] = n[num][0]
                dfs(n[num][1][i])
            else:
                n[n[num][1][i]][0] = -1*n[num][0] + 1
                dfs(n[num][1][i]) 

dfs(u[0]-1)

for i in n:
    print(i[0])

### FIXED CODE ###

N = int(input())
u, v, w = [0]*(N-1), [0]*(N-1), [0]*(N-1)
n = [-1] * N
# n[][0] 色　n[][1] 連結先一覧リスト n[][2] mod2 
for i in range(N):
    n[i] = [0]*4
    n[i][1] = []
    n[i][2] = []

for i in range(N-1):
    u[i], v[i], w[i] = list(map(int, input().split()))
    n[u[i]-1][1].append(v[i]-1)
    n[v[i]-1][1].append(u[i]-1)
    n[u[i]-1][2].append(w[i]%2)
    n[v[i]-1][2].append(w[i]%2)

stack = [u[0]-1]

while True:
    num = stack.pop()
    n[num][3] = 1
    for i in range(len(n[num][1])):
        if n[n[num][1][i]][3] == 0:
            stack.append(n[num][1][i])
            if n[num][2][i] == 0:
                n[n[num][1][i]][0] = n[num][0]
            else:
                n[n[num][1][i]][0] = -1 * n[num][0] + 1
    if len(stack) == 0:
        break

for i in n:
    print(i[0])
n = int(input())
a = [input() for i in range(n)]
for i in range(3):
    m = max(a)
    a.remove(m)
    print (m)


### FIXED CODE ###

import sys
e = [int(i) for i in sys.stdin.readlines()]
for i in range(3):
    m = max(e)
    e.remove(m)
    print (m)
def sieve(N, limit):
    primes = []
    data = [i + 1 for i in range(1, N)]
    while True:
        p = data[0]
        if limit <= p:
            return primes + data
        primes.append(p)
        data = [e for e in data if e % p != 0]


A, B = map(int, input().split())
max_num = max(A, B)
limit = int(max_num ** 0.5)
primes = sieve(max_num, limit)
a_prime = {i for i in primes if A % i == 0}
b_prime = {i for i in primes if B % i == 0}

common = a_prime.intersection(b_prime)
print(len(common) + 1)

### FIXED CODE ###

def prime_facorize(N):
    res = {1}
    for i in range(2, int(N ** 0.5) + 1):
        while N % i == 0:
            res.add(i)
            N /= i

        if N <= 1:
            break
    if N > 1:
        res.add(N)
    return res


A, B = map(int, input().split())
commons = prime_facorize(A) & prime_facorize(B)
print(len(commons))
import math

N = int(input())

aa = list(map(int, input().split()))

bb = aa[:]

i = math.floor(N / 2)

while i >= 0:
    bai = (i + 1) * 2 - 1
    if aa[i] == 1:  # 自分が奇数
        if aa[bai] == 0:  # 2倍が偶数
            bb[i] = 1
        else:  # 2倍が奇数
            bb[i] = 0
    else:  # 自分が偶数
        if aa[bai] == 0:  # 2倍が偶数
            bb[i] = 0
        else:  # 2倍が奇数
            bb[i] = 1
    i -= 1

bbKisu = filter(lambda n: n % 2 == 1, bb)
count = len(list(bbKisu))

print(count)
for i in range(N):
    if bb[i] == 1:
        print(i + 1)






### FIXED CODE ###

import math

N = int(input())

aa = list(map(int, input().split()))

bb = aa[:]

i = N

while i > 0:

    total = 0
    j = i * 2

    while j <= N:
        total ^= bb[j - 1]
        j += i

    bb[i - 1] = total ^ aa[i - 1]
    i -= 1

bbKisu = list(filter(lambda n: n % 2 == 1, bb))
count = len(bbKisu)

print(count)
for i in range(N):
    if bb[i] == 1:
        print(i + 1)