Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())
b = [False]*(m+1)
dp = [None]*(n+1)
M = 10**9+7
dp[0] = 1
dp[1] = 1

def up(x):
    if b[x] == True:
        return 0
    res = 0
    if dp[x-1] == None:
        dp[x-1] = up(x-1)
    res += dp[x-1]
    if dp[x-2] == None:
        dp[x-2] = up(x-2)
    res += dp[x-2]
    return (res%M)

for i in range(m):
    a = int(input())
    b[a] = True
if b[1] == True:
    dp[1] = 0
if n == 1:
    if b[1] == True:
        print(0)
    else:
        print(1)
    exit()
print(up(n))

### FIXED CODE ###

n, m = map(int, input().split())
b = [False]*(n+2)
for _ in range(m):
    i = int(input())
    b[i] = True
M = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
for i in range(1, n+1):
    if b[i] == False:
        dp[i] = (dp[i-1] + dp[i-2])%M
print(dp[n])
first = s.find("A")
last = s.rfind("Z")
print(last - first+1)

### FIXED CODE ###

s = input()
a = s.find("A")
b = s.rfind("Z")
print(b - a + 1)
a,b,k=map(int,input().split())
l=list(range(a,b+1))
l1=[]
for i in range(k):
    print(l[i])
    l1.append(l[i])
for j in range(b-k+1,b+1):
    if l[j] not in l1:print(l[j])
    else:pass

### FIXED CODE ###

a,b,k=map(int,input().split())
if k <= (b-a+1)//2:
  for i in range(a, a+k):
    print(i)
  for i in range(b-k+1,b+1):
    print(i)
else:
  for i in range(a,b+1):
    print(i)
s1 = input()
s2 = input()
s3 = input()

s1.upper()
s2.upper()
s3.upper()

print(s1[0] + s2[0] + s3[0])

### FIXED CODE ###

s1, s2, s3 = input().split()
print((s1[0]+s2[0]+s3[0]).upper())
x = intZ(input())

print(0 if x else 1)


### FIXED CODE ###

x = int(input())

print(0 if x else 1)
import functools, math
n, a = input(), list(map(int, input().split()))
print(functools.reduce(math.gcd, a))

### FIXED CODE ###

import functools, fractions
n, a = input(), list(map(int, input().split()))
print(functools.reduce(fractions.gcd, a))
s= [i+1 for i in range(13)]
h= [i+1 for i in range(13)]
c= [i+1 for i in range(13)]
d= [i+1 for i in range(13)]

n=int(input())
for cnt in range(n)
    e,n =input().split()
    if e == 'S':s[int(n)-1]=0
    elif e == 'H':h[int(n)-1]=0
    elif e == 'C':c[int(n)-1]=0
    elif e == 'D':d[int(n)-1]=0

for i in s:
    if i != 0: print('S '+repr(i))
for i in h:
    if i != 0: print('H '+repr(i))
for i in c:
    if i != 0: print('C '+repr(i))
for i in d:
    if i != 0: print('D '+repr(i))

### FIXED CODE ###

s= [i+1 for i in range(13)]
h= [i+1 for i in range(13)]
c= [i+1 for i in range(13)]
d= [i+1 for i in range(13)]
 
n=int(input())
for cnt in range(n):
    e,n =input().split()
    if e == 'S':s[int(n)-1]=0
    elif e == 'H':h[int(n)-1]=0
    elif e == 'C':c[int(n)-1]=0
    elif e == 'D':d[int(n)-1]=0
 
for i in s:
    if i != 0: print('S '+repr(i))
for i in h:
    if i != 0: print('H '+repr(i))
for i in c:
    if i != 0: print('C '+repr(i))
for i in d:
    if i != 0: print('D '+repr(i))
import numpy as np
N=int(input())
H=list(map(int,input().split()))

L=H
#print(H)
le=int(len(H))
#maxh=max(H)
#print(maxh)
maxi=np.argmax(H)
txt="Yes"
# for i in range(maxi+1,le-1):
#     if H[i]<=H[maxi]-1:
#         txt="No"
#         break
# print(txt)

for j in range(0,le-2):
    if maxi==le-1:
        pass
    else:
        for i in range(maxi+1,le-1):
            if H[i]<=H[maxi]-1:
                txt="No"
                flag=1
                break
        if flag==1:
            break
    L[maxi]=0
    maxi=np.argmax(L)
print(txt)


### FIXED CODE ###

import sys
N=int(input())
H=list(map(int,input().split()))

le=int(len(H))

a=0
for i in range(0,N):
    if a-1>H[i]:
        print("No")
        sys.exit()
    if H[i]>a:
        a=H[i]
print("Yes")
N = int(input())
List = [input() for i in range(N)]
from collections import Counter
C = Counter(List)
C = C.most_common()
Newlist = []

for p in range(N):
  if C[p][1] == C[0][1]:
    Newlist.append(C[p][0])
  else:
    break
Newlist.sort()
for i in range(len(Newlist)):
  print(Newlist[i])

### FIXED CODE ###

N = int(input())
List = [input() for i in range(N)]
from collections import Counter
C = Counter(List)
C = C.most_common()
Newlist = []

for p in range(len(C)):
  if C[p][1] == C[0][1]:
    Newlist.append(C[p][0])
  else:
    break
Newlist.sort()
for i in range(len(Newlist)):
  print(Newlist[i])
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k+1):
  if a[i]<a[i+k+1]:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k):
  if a[i]<a[i+k]:
    print('Yes')
  else:
    print('No')
s = [input() for _ in range(int(input()))]
t = [input() for _ in range(int(input()))]
ls = set(s)
temp=0
for l in ls:
    ans=0
    ans += 1 for ss in s if l == ss
    ans-=1 for tt in t if tt == l
    temp = ans if ans>temp
print(temp)


### FIXED CODE ###

n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
N, K = map(int, input().split())
d = []
A = []
safe = []
ubsafe = []
for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

for _ in range(K):
    for p in range(d[K-1]):
        safe.append(A[_][p])
        
L = len(list(set(safe)))
print(N-L)


### FIXED CODE ###

N, K = map(int, input().split())
d = []
A = []

for k in range(K):
    d.append(int(input()))
    A.append(list(map(int, input().split())))

Alist = [e for row in A for e in row]
        
L = len(list(set(Alist)))
print(N-L)
inputs  input()
R = int(inputs)

if R < 1200:
    print("ARC")
elif R < 2800:
    print("ARC")
else:
    print("AGC")

### FIXED CODE ###

inputs = input()
R = int(inputs)

if R < 1200:
    print("ABC")
elif R < 2800:
    print("ARC")
else:
    print("AGC")
inputs = input().split()
N = int(inputs[0])
A = list(map(int, input[1:]))

sum = 0

for i in range(1:N):
  if A[i] < A[i-1]:
    sum += A[i-1] - A[i]
    A[i] = A[i-1]
    
print(sum)


### FIXED CODE ###

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

sum = 0

for i in range(1, len(A)):
  if A[i] < A[i-1]:
    sum += A[i-1] - A[i]
    A[i] = A[i-1]
    
print(sum)
u = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if g[i][j] == '.':
      if j == 0:
        l[i][j] = 1
      else:
        l[i][j] = l[i][j-1]+1
      if i == 0:
        u[i][j] = 1
      else:
        u[i][j] = u[i-1][j]+1
for i in reversed(range(h)):
  for j in reversed(range(w)):
    if g[i][j] == '.':
      if j == w-1:
        r[i][j] = 1
      else:
        r[i][j] = r[i][j+1]+1
      if i == h-1:
        d[i][j] = 1
      else:
        d[i][j] = d[i+1][j]+1
ans = 0
for i in range(h):
  for j in range(w):
    ans = max(l[i][j]+r[i][j]+u[i][j]+d[i][j]-3,ans)
print(ans)

### FIXED CODE ###

h,w = map(int, input().split())
g = []
for _ in range(h):
  g.append(input())
l = [[0 for i in range(w)] for j in range(h)]
r = [[0 for i in range(w)] for j in range(h)]
d = [[0 for i in range(w)] for j in range(h)]
u = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
  for j in range(w):
    if g[i][j] == '#':
      l[i][j] = 0
      u[i][j] = 0
    else:
      if j == 0:
        l[i][j] = 1
      else:
        l[i][j] = l[i][j-1]+1
      if i == 0:
        u[i][j] = 1
      else:
        u[i][j] = u[i-1][j]+1
for i in reversed(range(h)):
  for j in reversed(range(w)):
    if g[i][j] == '#':
      r[i][j] = 0
      d[i][j] = 0
    else:
      if j == w-1:
        r[i][j] = 1
      else:
        r[i][j] = r[i][j+1]+1
      if i == h-1:
        d[i][j] = 1
      else:
        d[i][j] = d[i+1][j]+1
ans = 0
for i in range(h):
  for j in range(w):
    ans = max(l[i][j]+r[i][j]+u[i][j]+d[i][j]-3,ans)
print(ans)
a,b,c=(int,input().split());print('YNEOS'[(b*10+c)%4>0::2])

### FIXED CODE ###

a,b,c=map(int,input().split());print('YNEOS'[(b*10+c)%4>0::2])
k = int(input())
a, b = map(int, input().split())
flag = 0
for i in range(a, b+1)
	if i%k == 0:
    	flag = 1
if flag == 1:
	print("OK")
else:
	print("NG")

### FIXED CODE ###

k = int(input())
a, b = map(int, input().split())
flag = 0
for i in range(a, b+1):
    if i%k == 0:
        flag = 1
if flag == 1:
	print("OK")
else:
	print("NG")
import random
from itertools import accumulate
N = int(input())
As = [int(i) for i in input().split(' ')]

#N = pow(10, 4)
#As = [random.randint(0,1000) for r in range(N)] 
As = list(accumulate(As))


def bsearch(l, ls, rs):
    n = int(len(l)/2)
    if n == 0:
        return [max(l[0]-ls , rs-l[0]), min(l[0]-ls , rs-l[0])]
    lsum = l[n] - ls
    rsum = rs - l[n]
    ll = l[:n]
    rl = l[n:]
    if lsum > rsum:
        return bsearch(ll, ls, rs)
    else:
        return bsearch(rl, ls, rs)

for i in range(N-3):
    cs = bsearch(As[:i+2], 0, As[i+1]) + bsearch(As[i+2:], As[i+1], As[-1])
    if i == 0:
        result = max(cs) - min(cs)
    else:
        if max(cs) - min(cs) < result:
            result = max(cs) - min(cs)
print(result)


### FIXED CODE ###

N = int(input())
As = sorted([int(a)-i for i, a in enumerate(input().strip().split(' '))])

temp1 = 0
temp2 = sum(As)
for i, a in enumerate(As):
    temp1 += As[i]
    temp2 -= As[i]
    r = As[i] * (i+1) - temp1 +\
    temp2 - As[i] * (N-1-i)
    result = min(result, r) if i != 0 else r
print(result)
from math import factorial
n,a,b,k=map(int,input().split())
def gcd(x,y):
  if y==0:
    return x
  else:
    return gcd(y,x%y)
ans=0
p=998244353
x=gcd(a,b)
if K%x==0:
  A=a//x
  B=b//x
  K=k//x
  for i in range(n):
    if (K-A*i)%B==0:
      ans+= (factorial(n)//factorial(n-i)//factorial(i))*(factorial(n)//factorial(n-(K-A*i)//B)//factorial((K-A*i)//B))
print(ans)
  

### FIXED CODE ###

n,a,b,k=map(int,input().split())
p=998244353
def getinv(n):
  inv=[0]*(n+1)
  inv[1]=1
  for i in range(2,n+1):
    inv[i]=(-(p//i)*inv[p%i])%p
  return inv
def getnCr(n):
  inv=getinv(n)
  nCr=[0]*(n+1)
  nCr[0]=1
  for i in range(1,n+1):
    nCr[i]=(nCr[i-1]*(n-i+1)*inv[i])%p
  return nCr
def solve(n,a,b,k):
  ans=0
  nCr=getnCr(n)
  for i in range(n+1):
    if (k-a*i)<0 or (k-a*i)%b!=0:
      continue
    j=(k-a*i)//b
    if a*i+b*j==k and 0<=j<=n:
      ans+= nCr[i]*nCr[j]
      ans%=p
  return ans
print(solve(n,a,b,k))
from sys import stdin, setrecursionlimit
from heapq import heappush, heappop

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


N, M = map(int, input().split())
A = [0] * M
B = [0] * M
G = [[] for _ in range(M)]
for i in range(M):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
    
dist = [INF] * N
prev = [0] * N

pq = [(0, 0)]
while pq:
    d, v = heappop(pq)
    if dist[v] < d:
        continue
    for nv in G[v]:
        if dist[nv] > d + 1:
            dist[nv] = d + 1
            heappush(pq, (dist[nv], nv))
            prev[nv] = v

print('Yes')
for v in prev[1:]:
    print(v+1)




### FIXED CODE ###

from sys import stdin, setrecursionlimit
from collections import deque

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

dist = [-1] * N
dist[0] = 0
prev = [0] * N
q = deque([0])
while q:
    v = q.popleft()
    for nv in G[v]:
        if dist[nv] == -1:
            q.append(nv)
            dist[nv] = dist[v] + 1
            prev[nv] = v
    
print('Yes')
for v in prev[1:]:
    print(v+1)
n = int(input())
a = list(map(int,input().split))
b = list(map(int,input().split))
c = 0

for i in range(0,n):
  if a[i] > b[i]:
    c = c + a[i] - b[i]
  else:
    continue
    
print(c)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0

for i in range(0,n):
  if a[i] > b[i]:
    c = c + a[i] - b[i]
  else:
    continue
    
print(c)
n=int(input())
a=list(map(int,input().split()))
count4=0#4の倍数
count2=0#2の倍数だが4の倍数じゃない
count1=0
for i in range(n):
    if a[i]%4==0:
        count+=1
    elif a[i]%2==0:
        count2+=1
    else:
        count1+=1
if count2==0:
    if count1<=count4+1:
        print("Yes")
    else:
        print("No")
else:
    if count1<count4:
        print("Yes")
    else:
        print("No")

    

    
"""
#print(count2)
if 1<=count2:
    if (n-count2//2)//2<=count or n//2<=count:
        print("Yes")
    elif count2%2==0:
        if   (n-count2)//2<count :
            print("Yes ")
        else:
            print("No")
    elif count2%2==1:
        if  (n-count2)//2<=count :
            print("Yes ")
        else:
            print("No")
else:
    if n//2<=count:
        print("Yes")
    else:
        print("No")

    """
"""    7
    2 2 2 2 3 4 3

    YES になる間違い13晩のテキスト

"""


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
count4=0#4の倍数
count2=0#2の倍数だが4の倍数じゃない
count1=0
for i in range(n):
    if a[i]%4==0:
        count4+=1
    elif a[i]%2==0:
        count2+=1
    else:
        count1+=1
if count2==0:
    if count1<=count4+1:
        print("Yes")
    else:
        print("No")
else:
    if count1<=count4:
        print("Yes")
    else:
        print("No")

    

    
"""
#print(count2)
if 1<=count2:
    if (n-count2//2)//2<=count or n//2<=count:
        print("Yes")
    elif count2%2==0:
        if   (n-count2)//2<count :
            print("Yes ")
        else:
            print("No")
    elif count2%2==1:
        if  (n-count2)//2<=count :
            print("Yes ")
        else:
            print("No")
else:
    if n//2<=count:
        print("Yes")
    else:
        print("No")

    """
"""    7
    2 2 2 2 3 4 3

    YES になる間違い13晩のテキスト

"""
w = input().casefold()
word_count = 0
while True:
    line = input()
    if line == "END_OF_TEXT":
        break
    word = line.split().casefold()
    word_count += word.count(w)
print(word_count)

### FIXED CODE ###


w = input().casefold()
word_count = 0
while True:
    line = input()
    if line == "END_OF_TEXT":
        break
    line = line.casefold()
    word = line.split()
    word_count += word.count(w)
print(word_count)
998244353 99824435

### FIXED CODE ###

import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [A, B] = string_to_int(inputs[0])
    if (A + B) % 2 != 0:
        return "IMPOSSIBLE"
    else:
        return (A+B) // 2


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(n)]
lst = sorted(lst, key=lambda x:x[0], reverse=True)
lst = sorted(lst, key=lambda x:x[1], reverse=True)
#print(lst)
cnt = 0
for i in range(m):
  lst = [j for j in lst if j[0]<=m-i]
  #print(filter(lambda y:y<=m-i, map(lambda x:x[0], lst)))
  #lst2 = list(filter(lambda y:y[1]<=m-i, lst))
  #print(lst_f)
  if lst != []:
    #print(lst)
    cnt += lst[0][1]
    remove(lst[0])
  else:
    break
print(cnt)


### FIXED CODE ###

from heapq import heappop, heappush
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(n)]
lst_f = [[] for i in range(m)]
#lst = sorted(lst, key=lambda x:x[0])
#lst = sorted(lst, key=lambda x:x[1], reverse=True)
cnt = 0
ans = 0
cntup = m
for a, b in lst:
  if a <= m:
    lst_f[a-1].append(b)
  #print(filter(lambda y:y<=m-i, map(lambda x:x[0], lst)))
  #lst2 = list(filter(lambda y:y[1]<=m-i, lst))
avb = [] 
for i in lst_f:
  for j in i:
    heappush(avb, -j)
  if avb != []:
    ans -= heappop(avb)
print(ans)
K,N=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A)
A.append(A[0]+K)
i=0
b=0
for i in range(N):
    if b<A[i+1]-A[i]:
        b=A[i+1]-A[i]
print(K-b)

### FIXED CODE ###

S=list(input())
print('Yes'if S[2]==S[3]and S[4]==S[5] else 'No')
import numpy as np

N, Q = map(int, input().split())
Child = [[] for _ in range(N)]
X = np.zeros(N, np.int64)
Y = np.zeros(N, np.int64)
for _ in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Child[a].append(b)
for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    X[p] += x


def dfs(u, k):
    Y[u] += k
    for v in Child[u]:
        dfs(v, k + X[v])


dfs(0, X[0])
print(' '.join(str(y) for y in Y))


### FIXED CODE ###

N, Q = map(int, input().split())
graph = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

C = [0] * (N + 1)
for _ in range(Q):
    p, x = map(int, input().split())
    C[p] += x

se = set([1])
stack = [1]
while stack:
    # print(C)
    x = stack.pop()
    for y in graph[x]:
        if y in se:
            continue
        stack.append(y)
        se.add(y)
        # 親x, 子y
        C[y] += C[x]

print(' '.join(str(i) for i in C[1:]))
N = int(input())
A =[map(int,input().split())]

ans =1

for i in A:
  ans = i *ans
  if ans > 10**18:
    break
    print(-1)

print(ans)

### FIXED CODE ###

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

limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
  result *= a
  if result > limit:
    print(-1)
    exit()
print(result)
# ABC070D - Transit Tree Path
import sys
input = sys.stdin.readline

def dfs(v: int, p: int) -> None:
    d = dist[v]
    for u, c in G[v]:  # search vertices available from v recursively
        if u != p:  # p: parent
            dist[u] += d + c  # dist(K, v) + dist(v, u) == d + c
            dfs(u, v)


def main():
    global G, dist
    N = int(input())
    E = tuple(tuple(map(int, input().split())) for _ in range(N - 1))
    Q, K = tuple(map(int, input().split()))
    X = tuple(tuple(map(int, input().split())) for _ in range(Q))
    G = [[] for _ in range(N + 1)]  # graph, N+1: 1-idx
    for v, u, c in E:  # construct a graph
        G[v] += [(u, c)]
        G[u] += [(v, c)]
    dist = [0] * (N + 1)  # distance from vertex K
    dfs(K, -1)
    ans = [dist[x] + dist[y] for x, y in X]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC070D - Transit Tree Path
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def dfs(v: int, p: int) -> None:
    d = dist[v]
    for u, c in G[v]:  # search vertices available from v recursively
        if u != p:  # p: parent
            dist[u] += d + c  # dist(K, v) + dist(v, u) == d + c
            dfs(u, v)


def main():
    global G, dist
    N = int(input())
    E = tuple(tuple(map(int, input().split())) for _ in range(N - 1))
    Q, K = tuple(map(int, input().split()))
    X = tuple(tuple(map(int, input().split())) for _ in range(Q))
    G = [[] for _ in range(N + 1)]  # graph, N+1: 1-idx
    for v, u, c in E:  # construct a graph
        G[v] += [(u, c)]
        G[u] += [(v, c)]
    dist = [0] * (N + 1)  # distance from vertex K
    dfs(K, -1)
    ans = [dist[x] + dist[y] for x, y in X]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()
sum = 0
n = int(input())
l = [list(map(int, input().split())) for i in range(3)]

for i in range(n-1):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][i]
sum = sum + l[1][n]
print(sum)

### FIXED CODE ###

sum = 0
n = int(input())
l = [list(map(int, input().split())) for i in range(3)]

for i in range(n-1):
  sum = sum + l[1][i]
  if l[0][i+1] - l[0][i] == 1:
    sum = sum + l[2][l[0][i]-1]
sum = sum + l[1][n-1]
print(sum)
L,R=map(int,input().split())
M=2019;l,r=L%M,R%M
print([min(i*j%M for i in range(l+1,r+1) for j in range(l,i)),0][R//M-L//M>0])

### FIXED CODE ###

mod = 2019
l, r = map(int, input().split())

if r//mod - l//mod > 0:
  print(0)
else:
  l %= mod
  r %= mod
  ans = mod - 1
  for i in range(l+1, r+1):
    for j in range(l, i):
      ans = min(i*j%mod, ans)
  print(ans)
from fractions import gcd
from math import gcd

def lcm(x,y):
    return (x * y) // gcd(x, y)


def get_2(x):
    curr_2 = 0
    curr_x = x
    while curr_x%2 != 0:
        curr_x = curr_x//2
        curr_2 += 1
    return curr_2

n,m = map(int, input().split())
al = list(map(int, input().split()))

a2_set = set()
a2_set.add(get_2(al[0]))
for a in al:
    two_cnt = get_2(a)
    if two_cnt not in a2_set:
        print(0)
        exit()
    a2_set.add(two_cnt)


curr_lcm = 1
for a in al:
    curr_lcm = lcm(curr_lcm, a//2)

if n==1:
    curr_lcm*=2
    lcm_cnt = (m-curr_lcm//2)//curr_lcm
else:

lcm_cnt = m//curr_lcm
lcm_cnt = (lcm_cnt+2-1)//2

# print(curr_lcm)
print(lcm_cnt)





### FIXED CODE ###

from fractions import gcd
from math import gcd

def lcm(x,y):
    return (x * y) // gcd(x, y)


def get_2(x):
    curr_2 = 0
    curr_x = x
    while curr_x%2 == 0:
        curr_x = curr_x//2
        curr_2 += 1
    return curr_2

n,m = map(int, input().split())
al = list(map(int, input().split()))


if n == 1:
    cnt = (m-al[0]//2)//al[0] + 1
    print(cnt)
    exit()



a2_set = set()
a2_set.add(get_2(al[0]))
for a in al:
    two_cnt = get_2(a)
    if two_cnt not in a2_set:
        print(0)
        exit()
    a2_set.add(two_cnt)


curr_lcm = 1
for a in al:
    curr_lcm = lcm(curr_lcm, a//2)

lcm_cnt = m//curr_lcm
lcm_cnt = (lcm_cnt+2-1)//2

# print(curr_lcm)
print(lcm_cnt)
print(len(set([input() for _ in range(int(input()))]))

### FIXED CODE ###

print(len(set([input() for _ in range(int(input()))])))
N=int(input())
temp=input().split()
A=[int(temp[i]) for i in range(N)]

result=[]
for i in range(N):
  result.append(mean(A[i:i+2]))
  
print(result)

### FIXED CODE ###

N=int(input())
temp=input().split()
A=[int(temp[i]) for i in range(N)]
As=[]
As.append(sum([A[i]*pow(-1, i) for i in range(N)]))
for i in range(1, N):
  As.append(A[i-1]-As[i-1])

x1=As[0]/2
print(int(2*x1), end=' ')

for i in range(1, N):
  print(2*int(As[i]-x1*pow(-1, i)), end=' ')
H, W, M = map(int, input().split())

hc = [0] * H
wc = [0] * W
hwc = [[0] * W for _ in range(H)]
for _ in range(M):
    h, w = map(lambda x: int(x) - 1,input().split())
    hc[h] += 1
    wc[w] += 1
    hwc[h][w] += 1

result = 0
for h in range(H):
    for w in range(W):
        result = max(result, hc[h] + wc[w] - hwc[h][w])
print(result)


### FIXED CODE ###

H, W, M = map(int, input().split())

hc = [0] * H
wc = [0] * W
d = {}
for _ in range(M):
    h, w = map(lambda x: int(x) - 1,input().split())
    hc[h] += 1
    wc[w] += 1
    d.setdefault(h, {})
    d[h][w] = 1

result = 0
hm = max(hc)
wm = max(wc)
hi = [i for i in range(H) if hc[i] == hm]
wi = [i for i in range(W) if wc[i] == wm]

for h in hi:
    for w in wi:
        if h in d and w in d[h]:
            result = max(result, hm + wm - 1)
        else:
            result = max(result, hm + wm)
            break
print(result)
import math

a, b, c, d = [int(ch) for ch in input().strip().split()]


# upper 以下で div で割り切れるものの個数
def num_divisor(upper, div):
    return upper // div


# upper 以下で c でも d でも割り切れないものの個数
def num_divisor_c_d(upper, c, d):
    gcd_cd = c * d // math.gcd(c, d)

    n1 = num_divisor(upper, c)
    n2 = num_divisor(upper, d)
    n12 = num_divisor(upper, gcd_cd)

    return upper - (n1 + n2 - n12)


ans = num_divisor_c_d(b, c, d) - num_divisor_c_d(a - 1, c, d)

print(ans)


### FIXED CODE ###

# import math
import fractions

a, b, c, d = [int(ch) for ch in input().strip().split()]


# upper 以下で div で割り切れるものの個数
def num_divisor(upper, div):
    return upper // div


# upper 以下で c でも d でも割り切れないものの個数
def num_divisor_c_d(upper, c, d):
    # gcd_cd = c * d // math.gcd(c, d)
    gcd_cd = c * d // fractions.gcd(c, d)

    n1 = num_divisor(upper, c)
    n2 = num_divisor(upper, d)
    n12 = num_divisor(upper, gcd_cd)

    return upper - (n1 + n2 - n12)


ans = num_divisor_c_d(b, c, d) - num_divisor_c_d(a - 1, c, d)

print(ans)
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

li = list(itertools.permutations(P ,N))

a = 0
b = 0

for i in range(math.factorial(N)):
    if li[i] == P:
        a = i
    elif li[i] == Q:
        b = i
    else:
        a = a
        b = b
        
print(abs(a-b))

### FIXED CODE ###

import math
import itertools

N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

li = list(itertools.permutations(P,N))
li.sort()

a = 0
b = 0

for i in range(math.factorial(N)):
    if li[i] == P:
        a = i
    else:
        a = a

for i in range(math.factorial(N)):
    if li[i] == Q:
        b = i
    else:
        b = b
        
print(abs(a-b))