peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
MOD = 10**9 + 7
n, m = map(int, input().split())
dp = [0] * (n + 10)
a = [True] * (n + 10)
for _ in range(m):
    a[int(input())] = False
dp[0] = 1
for i in range(n):
    if a[i + 1]:
        dp[i + 1] = (dp[i + 1] + dp[i]) % MOD
    if a[i + 2]:
        dp[i + 2] = dp[i]
print(dp[n])
# Judge status: Accepted
N = int(input())
#a,b = map(int,input().split())
P = list(map(int,input().split()))
#A = [int(input()) for i in range(N)]
#A = [list(map(int,input().split())) for i in range(N)]
mina = P[0]
count = 1
for i in range(1,N):
    mina = min(mina,P[i])
    if mina >= P[i]:
        count += 1

print(count)
# Judge status: Accepted
s = str(input())
n = len(s)

for i in range(1, n):
    m = n - i
    if m % 2 != 0:
        continue
    #print(s[0:m//2], s[m//2:m])
    if s[0:m//2] == s[m//2:m]:
        break
print(m)
# Judge status: Wrong Answer
n = int(input())
lst = []
flag = True
tmp = input()
lst.append(tmp)
for i in range(n-1):
    w = input()
    if w in lst:
        flag = False
    if tmp[-1] != w[0]:
        flag = False
    lst.append(w)
    tmp = w

print('yes' if flag == True else 'No')
# Judge status: Accepted
s1, s2, s3 = input().split()

print("{}{}{}".format(s1[0], s2[0], s3[0]))
# Judge status: Accepted
n,a,b=map(int,input().split())
print(max(0,(n-2)*(b-a)+1))
# Judge status: Wrong Answer
x=int(input())
if x>=2000:
    print(1)
else:
    if (x//100)*100<=x<=(x//100)*105:
        print(1)
    else:
        print(0)
# Judge status: Wrong Answer
s = input()
cnt = 0
if s[0] == s[1] and s[1] == s[2] and s[1] =='R':
    print('3')
elif s[0] == s[1] or s[1] == s[2] and s[1]=='R':
    print('2')
elif s[0] == 'R' or s[1] =='R' or s[2] == 'R':
    print('1')
else:
    print('0')
# Judge status: Accepted
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())

visit = set()
now = 1
for i in range(1, n + 10):
    if now not in visit:
        visit.add(now)
        now = a[now - 1]
    else:
        print(-1)
        break
    if now == 2:
        print(i)
        break
# Judge status: Accepted
a, b = input().split()
num = int(a + b)
flag = "No"

for i in range(1000):
    if i ** 2 == num:
        flag = "Yes"
        break

print(flag)
# Judge status: Accepted
n = int(input())
list_A = list(map(int, input().split()))
list_N = [0]*n

for i in range(n, 0, -1):
    k, cnt = 0, 0
    while True:
        if k+i > n:
            break
        if list_N[k+i-1] == 1:
            cnt += 1
        k += i
    list_N[i-1] = (list_A[i-1]+cnt) % 2

ans = []
for i in range(n):
    if list_N[i] == 1:
        ans.append(i+1)
print(len(ans))
print(*ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
C = [0]*(10**5)
for ai in A:
    C[ai] += 1

ans = 0
for i in range(10**5-2):
    ans = max(C[i] + C[i+1] + C[i+2], ans)
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
p = list(map(int, input().split()))
rui = [0]
for tmp in p:
    tmp = (tmp + 1) / 2
    rui.append(tmp + rui[-1])

ans = 0
for i in range(0, N-K+1):
    ans = max(ans, rui[i+K] - rui[i])
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
x_s = list(map(int, input().split()))



if n >= m:
    print(0)
else:
    x_s.sort()
    b=[]
    for i in range(m-1):
        b.append(x_s[i+1]-x_s[i])
    b.sort()
    ans = 0
    for i in range(m-n):
        ans += b[i]
    print(ans)
# Judge status: Accepted
def f(yen, coin, cnt=0):
    while yen > 0: yen,r=divmod(yen,coin); cnt+=r
    return cnt

ans = n = int(input())
for yen6 in range(0, n+1):
    ans = min(ans, f(n-yen6, 9, f(yen6, 6)))
print(ans)
# Judge status: Wrong Answer
N=int(input())
A=[]
B=[]
x=dict()
for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
t=0
bm=max(B)
sa=sum(A)
if sa<=bm:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, m = map(int, input().split())
lx = []
ly = []

for i in range(n + m):
    x, y = map(int, input().split())
    lx.append(x)
    ly.append(y)

for i in range(n):
    r = []
    for j in range(n, m + n):
        r.append(abs(lx[i] - lx[j]) + abs(ly[i] - ly[j]))
    print(r.index(min(r)) + 1)
# Judge status: Accepted
k,a,b = map(int, input().split())
res = 1
if b <= a + 1:
  print(res + k)
else:
  if k < a - 1 + 2:
    print(res + k)
  else:
    res += b - 1
    k -= a + 1
    print(res + k//2 * (b - a) + k % 2)
# Judge status: Accepted
N = int(input())

bt, bx, by = 0, 0, 0

for _ in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist or time%2!=dist%2:
        print('No')
        break
    bt, bx, by = t, x, y
else:
    print('Yes')
# Judge status: Accepted
from fractions import gcd
a,b,c,d = map(int,input().split())
 
e = c*d//gcd(c,d)
A = (a-1)//c + (a-1)//d - (a-1)//e
B = b//c + b//d -b//e
print(b - a + 1 + A - B)
# Judge status: Accepted
n, d = map(int,input().split())
print((n-1)//(2*d+1)+1)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

lis = [0]*N
for a in A:
    lis[a-1] += 1
for num in lis:
    print(num)
# Judge status: Accepted
s=input()
s+=(s[-1]=='s')*'e'
print(s+'s')
# Judge status: Accepted
N, M = map(int, input().split())
height = list(map(int, input().split()))
bridge = [1]*N

for i in range(M):
    X, Y = map(int, input().split())
    if height[X-1] >= height[Y-1]:
        bridge[Y-1] =0
    if height[Y-1] >= height[X-1]:
        bridge[X-1] =0

print(bridge.count(1))
# Judge status: Accepted
H1, M1, H2, M2, K = map(int,input().split())
HM1 = H1*60 + M1
HM2 = H2*60 + M2 - K
print(HM2 - HM1)
# Judge status: Accepted
n = int(input())
lst = list(map(int, input().split()))
lst2 = sorted(lst)
for i in lst:
    print(lst2[n//2] if i<=lst2[n//2-1] else lst2[n//2-1])
# Judge status: Accepted
A, B, C, D = map(int, input().split())
ans = 'Yes'
AB = abs(A-B)
AC = abs(A-C)
BC = abs(B-C)

if AC > D:
  if AB > D or BC > D:
    ans = "No"
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    x, n = map(int, input().split())
    if n >= 1:
        p_set = set(map(int, input().split()))
    else:
        p_set = set()

    print(f(x, p_set))


def f(x, p_set):
    for i in range(101):
        if (x - i) not in p_set:
            return x - i
        elif (x + i) not in p_set:
            return x + i


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)

next_max_node = 1

for leaf in a:
    if leaf > next_max_node:
        print(-1)
        exit()
    next_max_node = (next_max_node - leaf) * 2

num_sum = 0

for i in range(1, n+2):
    tmp = a[-i]
    b[-i] = a[-i] + num_sum
    num_sum += a[-i]

ret = 0
next_max_node = 1

for i in range(n+1):
    leaf = a[i]
    ret += min(b[i], next_max_node)
    next_max_node = (next_max_node - leaf) * 2

print(ret)
# Judge status: Wrong Answer
H_str, A_str = input().split(' ')

print(int(H_str) // int(A_str) + 1)
# Judge status: Accepted
n=int(input())
s=input()
accuml=[0]*n
accumr=[0]*n
for i in range(1,n):
    accuml[i]+=accuml[i-1]
    accumr[n-i-1]+=accumr[n-i]
    if s[i-1]=="W":
        accuml[i]+=1
    if s[n-i]=="E":
        accumr[n-i-1]+=1
ans=10**18
for i in range(n):
    ans=min(ans,accuml[i]+accumr[i])
print(ans)
#print(accuml)
#print(accumr)
# Judge status: Wrong Answer
n,m = map(int,input().split())
action = [list(input().split()) for _ in range(m)]
answer_dict = {}
score = 0
penalty = 0

for a in action:
    if a[1] == 'WA' and a[0] not in answer_dict:
        penalty += 1
    elif a[1] == 'AC' and a[0] not in  answer_dict:
        score += 1
        answer_dict[a[0]] = True


print(score,penalty)
# Judge status: Accepted
n=int(input())
X=[[0]*3 for i in range(n)]
for i in range(n):
  a,b=map(int,input().split())
  X[i]=[a+b,a,b]
X=sorted(X)
l=X[0][0]
ans=1
for i in range(n):
  if X[i][1]-X[i][2]>=l:
    ans+=1
    l=X[i][0]
print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())

sum = 0

for n in range(1, N+1):
    nsum = 0
    m = n
    while m != 0:
        nsum += m % 10
        m = m//10
    if nsum >= A and nsum <= B:
        sum += n
print(sum)
# Judge status: Accepted
D, N = map(int, input().split())
if N == 100:
    print(N * 100 ** D + 100 ** D)
else:
    print(N * 100 ** D)
# Judge status: Wrong Answer
n,m = map(int,input().split())
A = list(map(int,input().split()))
C = []
for _ in range(m):
  b,c = map(int,input().split())
  C.append((c,b))
C.sort()

count = 0
for c,b in C:
  A.extend([c for _ in range(b)])
  count += b
  if count > n:
    break
A.sort(reverse = True)

print(sum(A[:n]))
# Judge status: Wrong Answer
n = int(input())
ans = 0
if n % 2 != 0:
  print(ans)
else:
  m = n // 2
  e = 1
  while 5 ** e < m:
    ans += m // (5 ** e)
    e += 1
  print(ans)
# Judge status: Accepted
A = map(int, input().split())
if len(set(A) ) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
l=input()

if "A" or "G" or "C" or "T" in l:
  ans=0
  num=0
  for i in l:
    if i=="A" or i=="G" or i=="C" or i=="T":
      num+=1
      if num==len(l):
        print(num)
    else:
      ans=max(num,ans)
      num=0
    
  print(ans)
else:
  print(0)
# Judge status: Accepted
n, y = map(int, input().split())
judge = "no value"

for i in range(n+1):
    if judge == "Found it!":
        break
    for j in range(n+1):
        z = n - i - j
        value = z * 10000 + i * 5000 + j *1000
        if value == y and z >= 0:
            print(z, i , j)
            judge = "Found it!"
            break

if judge == "no value":
    print(-1, -1, -1)
# Judge status: Wrong Answer
import sys
N = int(input())

ans = []

if N == 1:
    print(1)
    sys.exit()

for i in range(1, N):
    n = N - i
    if n > 0 and n <= i:
        continue
    N = n
    ans.append(i)
    if n == 0:
        break

print(*ans, sep='\n')
# Judge status: Accepted
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

if n == 1:
    print(times[0])
else:
    prev_lcm = times[0]
    for t in times[1:]:
        tmp = gcd(prev_lcm, t)
        lcm = prev_lcm * (t // tmp)
        prev_lcm = lcm
    print(lcm)
# Judge status: Accepted
a,b = map(int, input().split())
print(a) if b >= a else print(a-1)
# Judge status: Wrong Answer
s = input()
d = {}
st = set()
for c in s:
    if(c not in d): d[c] = 0
    else: d[c] += 1
    st.add(c)

if(len(st) == 1):
    if(len(s) == 1): print("YES")
    else: print("NO")

elif(len(st) == 2):
    if(d[list(st)[0]] == d[list(st)[1]]): print("YES")
    else: print("NO")

else:
    mx = 0
    no = False
    for k in d:
        mx = max(mx, d[k])
        if(d[k]+1 < mx): flg = True
    if(no): print("NO")
    else: print("YES")
# Judge status: Accepted
n, k, *aa = map(int, open(0).read().split())

imp = 0
psbl = 10**9

while psbl - imp > 1:
    mid = (psbl + imp) // 2
    cost = sum(0--a//mid - 1 for a in aa)
    if cost <= k:
        psbl = mid
    else:
        imp = mid

print(psbl)
# Judge status: Wrong Answer
p,q,r=map(int, input().split())
print(min(p+q,p+r,q,r))
# Judge status: Accepted
def main():
    n,k = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [0] * n

    def cost(i,j):
        return abs(h[i]-h[j])

    for i in range(1,n):
        if i <= k:
            dp[i] = cost(0,i)
        else:
            dp[i] = min([dp[i-j] + cost(i,i-j) for j in range(1,k+1)])
    print(dp[n-1])

if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
A, B, C = map(int,input().split())
ans = float("inf")
S = A * B * C
ans = min(ans,abs((A // 2 * B * C ) - (math.ceil(A / 2) * B * C)))
ans = min(ans,abs((B // 2 * C * A ) - (math.ceil(B / 2) * C * A)))
ans = min(ans,abs((C // 2 * A * B ) - (math.ceil(C / 2) * A * B)))
print(ans)
# Judge status: Accepted
import sys

def solve():
    input = sys.stdin.readline
    A, B, K = map(int, input().split())
    count = 1
    for i in reversed(range(1, 101)):
        if A % i == 0 and B % i == 0:
            if count == K: 
                print(i)
                break
            else: count += 1
    


    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
import math
n,m = map(int,input().split())
if abs(n-m) >= 2:
    print(0)
elif abs(n-m) == 1:
    print((math.factorial(n)*math.factorial(m))%(10**9+7))
else:
    print((2*(math.factorial(n)*math.factorial(m)))%(10**9+7))
# Judge status: Accepted
s = input()
ans = 999
for i in range(len(s)-2):
    lun = int(s[i] + s[i+1] + s[i+2])
    ans = min(abs(753-lun), ans)
print(ans)
# Judge status: Accepted
s = input().split()
print('A'+s[1][0]+'C')
# Judge status: Wrong Answer
# ABC1４５C 

import itertools, math

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

length = 0
sum_ = 0
for num, val in enumerate(itertools.permutations(city_list, n)):
    for i in range(len(val) - 1):
        length =  math.sqrt((val[i][0] - val[i + 1][0]) ** 2 +  (val[i][1] - val[i + 1][1]) ** 2)
        length += length
    sum_ += length
    length = 0
        
ans = sum_ / (num + 1)
print(ans)
# Judge status: Accepted
S=input()
if len(S)==len(set(S)):
  print("yes")
else:
  print("no")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0
for i in range(n):
  ans += b[a[i]-1]
  if(i > 0) and  (a[i-1]+1 == a[i]):
    ans += c[a[i-1]-1]
print(ans)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
t=int(len(a)-(len(a)/3))
a.sort(reverse=True)
a_cutlist=a[:t+1]
a_cutlist_ans=a_cutlist[1::2]
print(sum(a_cutlist_ans))
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
AC = [0] * (N)
for i in range(1, N):
    if S[i] == "C" and S[i - 1] == "A":
        AC[i] = AC[i - 1] + 1
    else:
        AC[i] = AC[i-1]
for _ in range(Q):
    l,r = map(int,input().split())
    l-=1
    r-=1
    print(AC[r]-AC[l])
# Judge status: Accepted
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))

X = input_one_number()

m = 100

cnt = 0
while True:
	if X <= m:
		print(cnt)
		exit(0)

	m = (m * 1.01)//1
	cnt +=1
# Judge status: Accepted
N = int(input())
print(10 - N//200)
# Judge status: Accepted
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
C = [0 for i in range(N)]
A.sort()
i = 0
while i < N - 1:
    C[A[i] - 1] = C[A[i] - 1] + 1
    i += 1

for i in C:
    print(i)
# Judge status: Accepted
import fractions
def count(n, m, l):
    c_m = n // m
    c_l = n // l
    c_ml = n // (m * l // fractions.gcd(m, l))
    return n - (c_m + c_l - c_ml)

a, b, c, d = map(int, input().split())
b_tar = count(b, c, d)
a_tar = count(a, c, d)
is_plus_a = not(bool(a % c == 0 or a % d == 0))
ans = b_tar - a_tar
if is_plus_a: ans += 1
print(ans)
# Judge status: Wrong Answer
n = int(input())
d = list(map(int,input().split()))
MOD = 998244353
if d[0] != 0:
    print(0)
    exit()

else:
    cnt = [0]*n
    for i in range(1, n):
        cnt[d[i]] += 1

ans = 1
for i in range(2, n):
    ans *= pow(cnt[i-1], cnt[i], MOD) % MOD
print(ans)
# Judge status: Accepted
n=int(input())
a=[int(input()) for i in range(n)]
max1=1
m=0
for i in range(n):
  if max1<a[i]:
    max1=a[i]
    m=i
a.pop(m)
max2=max(a)
a.insert(m,max1)
for i in range(n):
  if i!=m:
    print(max1)
  else:
    print(max2)
# Judge status: Wrong Answer
x=list(map(int, input().split()))
if x[2]+x[1]+x[0]>21:
	print('bust')
else:
	print('Win')
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))
ans = "Yes"
H[0] = H[0] - 1
base = 0
for i in range(1, N):
    if H[i] > H[i-1] :
        H[i] = H[i] -1
    elif H[i] < H[i-1] :
        ans = "No"
print(ans)
# Judge status: Wrong Answer
N,W=map(int,input().split())
v=[0]*N
w=[0]*N
for i in range(N):
    v[i],w[i]=map(int,input().split())
dp=[[0]*(W+1) for _ in range(N)]
for i in range(N):
    for j in range(1,W+1):
        if w[i]>j:
            dp[i][j]=dp[i-1][j]
        else:
            dp[i][j]=max(dp[i-1][j],v[i]+dp[i-1][j-w[i]])
print(dp[N-1][W])
# Judge status: Wrong Answer
A,B,C = list(map(int,input().split()))
if 10*B + C % 4 == 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
x = int(input())
if x >= 30:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, c, d = map(int, input().split())
print("YNeos"[(abs(a-b)>d or abs(b-c)>d) and abs(a-c)>d::2])
# Judge status: Accepted
a, b = map(int, input().split())
print(a + b) if a + b < 24 else print(a + b - 24)
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))

ll = []
ll.append(l[0])

for i in range(len(l)-1):
  if ll[i] > l[i+1]:
    ll.append(l[i+1])
  else:
    ll.append(l[i])

count = 0
for i in range(len(ll)):
  if l[i] <= ll[i]:
    count+=1
print(count)
# Judge status: Wrong Answer
a, b ,c = map(int, input().split())
count = 0
if a!=b:
  count+=1

if b!=c:
  count+=1

if a!=c:
  count+=1
  
print(count)
# Judge status: Accepted
g = [0,1,2,1,3,1,3,1,1,3,1,3,1]
x,y = map(int,input().split())
print('Yes' if g[x]==g[y] else 'No')
# Judge status: Accepted
l, r, d = map(int, input().split())
cnt = 0
for i in range(l, r + 1):
    if i % d == 0:
        cnt+=1
print(cnt)
# Judge status: Accepted
from fractions import gcd
n = int(input())
t = list(int(input()) for _ in range(n))


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


ans = 1
for i in t:
    ans = lcm(ans, i)

print(ans)
# Judge status: Accepted
def main():
    S=input()
    ans=0
    Si=''
    tmp=''
    for s in S:
        tmp += s
        if Si != tmp:
            ans += 1
            Si = tmp
            tmp = ''
    print(ans)

main()
# Judge status: Accepted
n=int(input())
a=[0]+list(map(int,input().split()))
b=[0]*(n+1)
for i in reversed(range(1,n+1)):
    if sum(b[i::i])%2!=a[i]:
        b[i]=1
print(sum(b))
for i,j in enumerate(b):
    if j==1:
        print(i,end=" ")
# Judge status: Wrong Answer
A, B, C, X, Y = map(int, input().split())
sum = 0
min_num = 10**10
num = [0]*3
if min(A/2, B/2) > C:
    print(C*Y*2)
    exit()
for c in range(min(X, Y)+1):
    sum += C*c*2
    num[0] = c*2
    for a in range(X-c):
        sum += A
        num[1] = a
    for b in range(Y-c):
        sum += B
        num[2] = b
    if min_num > sum:
        min_num = sum
    print(sum, num)
    sum = 0
print(min_num)
# Judge status: Accepted
n, k = map(int, input().split())
p = list(map(int, input().split()))

ansl = 0
ansr = k-1
ans = 0
tmp = sum(p[:k])
# print(tmp)
for i in range(1,n - k+1):
    tmp = tmp - p[i-1] + p[i + k-1]
    # print(i,i+k-1,tmp)
    if tmp > ans:
        ansl = i
        ansr = i + k - 1
        ans = tmp
# print(ansl, ansr)
ans2 = 0
for i in range(ansl, ansr + 1):
    ans2 += (p[i] + 1) / 2
print(ans2)
# Judge status: Accepted
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
qx = [list(map(int, input().split())) for i in range(q)]

ans = 0

for i in combinations_with_replacement(range(1, m + 1), n):
    s = 0
    for a, b, c, d in qx:
        s += d if (i[b-1] - i[a-1] == c) else 0
    ans = max(ans, s)

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
from itertools import product, permutations, combinations
N=int(input())
dp = [N for i in range(N+1)]
dp[0] = 0
for i in range(1, N+1):
    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power] + 1)
        power *= 6
    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power] + 1)
        power *= 9
print(dp[N])
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
#N = I()
#A = [LI() for _ in range(N)]

a, b = list(map(int,sys.stdin.readline().rstrip().split()))

if a > 0:
    print('Positive')
elif a <= 0 and b >= 0:
    print('Zero')
else:
    if (a+b)%2 == 0:
        print('Negative')
    else:
        print('Positive')
# Judge status: Accepted
N,M=map(int,input().split())
a=list(map(int,input().split()))

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

l=lcm_list(a)

for s,t in enumerate(a):
    if (l//t)%2==0:
      print("0")
      exit()

print((2*M//l+1)//2)
# Judge status: Accepted
n = int(input())
ans = 0
ary = []
i = 1
ary.append(1)
while 9**i < n+1:
    ary.append(9**i)
    i += 1

i = 1
while 6**i < n+1:
    ary.append(6**i)
    i += 1
ary.sort()

dp = [100002] * (n+1)
dp[0] = 0

for i in range(1,n+1):
    tmp = dp[i] + 1
    for j, aa in enumerate(ary):
        if i >= aa:
            tmp = min(tmp, dp[i-aa] + 1)
        else:
            break
    dp[i] = tmp
print(dp[n])
# Judge status: Accepted
import sys
from collections import Counter

input = sys.stdin.readline


def main():
    N = int(input())
    a = list(map(int, input().split()))

    c = Counter(a)
    ans = 0
    for k, v in c.items():
        if k < v:
            ans += (v - k)
        elif v < k:
            ans += v

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n, m = [sorted(list(input())) for i in range(2)]
print("Yes" if n < m[::-1] else "No")
# Judge status: Accepted
from math import ceil
n, a, b, c, d, e = [int(input()) for i in range(6)]
print(ceil(n / min([a, b, c, d, e])) + 4)
# Judge status: Accepted
import math
A,B,H,M = map(int,input().split())
t1 = (30*H+M/2)*math.pi/180
x1 = A*math.cos(t1)
y1 = A*math.sin(t1)
t2 = M*math.pi/30
x2 = B*math.cos(t2)
y2 = B*math.sin(t2)
d = ((x1-x2)**2+(y1-y2)**2)**0.5
print(d)
# Judge status: Wrong Answer
import math
import collections
import fractions
import itertools

def solve():
    n, m = map(int, input().split())
    if n == m == 1:
        print(1)
    elif n == 1:
        print(m-2)
    elif m == 1:
        print(n-1)
    elif n == 2 or m == 2:
        print(0)
    else:
        print((n-2)*(m-2))
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
first = input()
second = input()
third = input()

d = {}
d["a"]=first
d["b"]=second
d["c"]=third


flag = False
run = "a"
while flag != True:
 
  if d[run] == "":
    flag = True
    print(run)
  else:
    l = len(d[run])
    temp = d[run][0]
    
    d[run] = d[run][1:l]
    
    run = temp
# Judge status: Accepted
s = input()
t = len(s)

x = []
y = 0

while 10 ** y % 2019 not in x:
    x.append(10 ** y % 2019)
    y += 1

z = len(x)

m = [0 for i in range(2019)]
m[0] = 1
a = 0
for i in reversed(range(0, t)):
    a += x[(t-i-1) % z] * (int(s[i]) % 2019)
    a = a % 2019
    m[a] += 1

def triangle(n):
    if n > 1:
        return n * (n-1) // 2
    else:
        return 0

p = list(map(triangle, m))
# print(p)
print(sum(p))
# Judge status: Accepted
n = int(input())
MAXN = 110000

f_inf = float('inf')
dp = [f_inf] * (MAXN+n)

dp[0] = 0

for i in range(1, n+2):
    for j in range(7):
        dp[i] = min(dp[i], dp[i-pow(6, j)]+1)
    for k in range(6):
        dp[i] = min(dp[i], dp[i-pow(9, k)]+1)

print(dp[n])
# Judge status: Accepted
def main():
    N,K = (int(x) for x in input().split())
    h = list(map(int, input().strip().split()))
    H = sorted(h, reverse=True)
    del H[:K]
    print(sum(H))


if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
tmp=a[0]
for i in range(1,n):
    tmp=tmp^a[i]
for i in range(n):
    print(tmp^a[i],end=' ')
# Judge status: Wrong Answer
import sys
read = lambda: sys.stdin.readline().rstrip()
 
def main():
    INF = 10 ** 20
 
    n,k = map(int,input().split())
    height = tuple(map(int,read().split()))
    dp = [INF]*(n+1)
    dp[0] = 0
 
    
    for step in range(1, k + 1):
    	for target in range(n-1, 0, -1):
            if target-step >= 0: dp[target] = min(dp[target], dp[target - step] + abs(height[target] - height[target - step]))
 
    print(dp[n-1])
 
if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b = map(int, input().split())
if a >= 13:
    print(b)
elif 6 <= a <= 12:
    print(b // 2)
else:
    print(0)