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

N, Q = map(int, input().split())
C = list(map(int, input().split()))

class SegTree:
    X_unit = set()

    def __init__(self, N):
        self.N = N
        self.X = [self.X_unit] * (N + N)

    def build(self, seq):
        for i, x in enumerate(seq, self.N):
            self.X[i] = {x}
        for i in range(self.N - 1, 0, -1):
            self.X[i] = self.X[i << 1] | self.X[i << 1 | 1]

    #区間積[L, R)
    def fold(self, L, R):
        L += self.N
        R += self.N
        vL = self.X_unit
        vR = self.X_unit
        while L < R:
            if L & 1:
                vL = vL | self.X[L]
                L += 1
            if R & 1:
                R -= 1
                vR = self.X[R] | vR
            L >>= 1
            R >>= 1
        return len(vL | vR)

seg = SegTree(N)
seg.build(C)

for q in range(Q):
  l, r = map(int, input().split())
  print(seg.fold(l-1, r))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
C = list(map(int, input().split()))
query = []

for i in range(Q):
  l, r = map(int, input().split())
  query.append((i, l, r))

query.sort(key = lambda x: x[2])

class BIT:
  from operator import add, sub
  X_unit = 0
  X_f = add
  X_f_rev = sub

  def __init__(self, seq):
    N = len(seq)
    self.N = N
    self.X = seq[:]
    for i in range(self.N):
      j = i + ((i+1) & -(i+1))
      if j < self.N:
        self.X[j] = self.X_f(self.X[i], self.X[j])
  
  def set_val(self, i, x):
    while(i < self.N):
      self.X[i] = self.X_f(self.X[i], x)
      i += (i+1) & -(i+1)

  def cum_val(self, i):
    res = self.X_unit
    while(i > -1):
      res = self.X_f(res, self.X[i])
      i -= (i+1) & -(i+1)
    return res

  def fold(self, L, R):
    return self.X_f_rev(self.cum_val(R-1), self.cum_val(L-1))

GJ = [-1]*N
bit = BIT([0]*N)
ans = [0]*Q
st = 0

for i in range(N):
  if GJ[C[i]-1] != -1:
    bit.set_val(GJ[C[i]-1], -1)
  GJ[C[i]-1] = i
  bit.set_val(i, 1)
  if st < Q:
    while query[st][2] == i+1:
      ans[query[st][0]] = bit.fold(query[st][1]-1, query[st][2])
      st += 1
      if st == Q:
        break

print(*ans, sep="\n")
### BUGGY CODE ###

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


### FIXED CODE ###

a,b,x=map(int,input().split())
if(a%x==0):
  print(b//x-a//x+1)
else:
  print(b//x-a//x)
### BUGGY CODE ###

h, w = map(int, input().split())
dat = []
for i in range(h):
    dat.append(list(input()))

import collections
#print(dat)
def clear_maze(sx, sy, gx, gy, maze):
    INF = 100000000
    field_x_length = len(maze)
    field_y_length = len(maze[0])
    distance = [[INF for i in range(40)] for j in range(40)]
    def bfs():
        queue = collections.deque([])
        queue.appendleft((sx, sy))
        distance[sx][sy] = 0
        while len(queue):
            x, y = queue.pop()
            if x == gx and y == gy:
                break
            #print("seek {0} {1}".format(x, y))
            for i in range(0, 4):
                nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]
                if (0 <= nx and nx < field_x_length and 0 <= ny and ny < field_y_length and maze[nx][ny] != '#' and distance[nx][ny] == INF):
                    queue.appendleft((nx, ny))
                    distance[nx][ny] = distance[x][y] + 1
        return distance[gx][gy]
    return bfs()

res = -1
for yy in range(0, h):
    for xx in range(0, w):
        if dat[yy][xx] == "#":
            continue
        for yyy in range(yy, h):
            for xxx in range(0, w):
                if dat[yyy][xxx] == "#":
                    continue
                step = clear_maze(yy, xx, yyy, xxx, dat)
                #print("s={0},{1} g={2},{3} cost = {4}".format(xx,yy,xxx,yyy,step))
                if step == 100000000:
                    continue
                res = max(res, step)
print(res)


### FIXED CODE ###

from pprint import pprint

INF = 1000000
dx = [1, -1, 0,  0]
dy = [0,  0, 1, -1]

# 入力
h, w = map(int, input().split())
maze = []
for i in range(h):
    maze.append(list(input()))

# ワーシャルフロイド用に枠を作る。
# 2次元マップしてもいいが面倒なので、１次元にする。[0 - x][0 - y]を[0- x * y]にflattenする
wsmap = lambda a, b: (a * w + b)
dp = []
# 辺がない時はINFを入れのでデフォルト値とする
for i in range(h * w):
    dp.append([INF] * (h * w))

# 迷路ををグラフにする。
for y in range(h):
    for x in range(w):
        if maze[y][x] == "#": # そのマスが壁なら何もしない(他のマストの連結はないので)
            continue
        # ワーシャルフロイドでは自分自身へのコストは0にしておく。
        dp[wsmap(y, x)][wsmap(y, x)] = 0
        # ４方向に移動できるかの判定
        for dir in range(len(dx)):
            nx, ny = x + dx[dir], y + dy[dir]
            if -1 < nx and nx < w and -1 < ny and ny < h: # 枠をはみ出ないかチェック
                if maze[ny][nx] != "#": # そのマスが壁でないなら
                    #print(wsmap(y, x))
                    #print("--")
                    #print("y, x {0}, {1}".format(ny, nx))
                    #print(wsmap(ny, nx))
                    dp[wsmap(y, x)][wsmap(ny, nx)] = 1 # コストを1にする

# ワーシャルフロイドする
for kk in range(h * w):
    for ii in range(h * w):
        for jj in range(h * w):
            dp[ii][jj] = min(dp[ii][jj], dp[ii][kk] + dp[kk][jj])

# これで結果が出たので
#print(dp)
res = -1
for i in range(h * w):
    for j in range(h * w):
        if dp[i][j] != INF:
            res = max(res, dp[i][j])
print(res)
### BUGGY CODE ###

N=int(input())
for m in range(N):
  n=m+1
  f=0
  for x in range(1,n+1):
    for y in range(1,n+1):
      for z in range(1,n+1):
        t=x**2 + y**2 + z**2 + x*y + y*z + z*x
        if t==n:
          f += 1
  print(f)

### FIXED CODE ###

N=int(input())
a=[]
for i in range(N):
  a.append(0)
for x in range(1,N+1):
  if x**2>=N:
    break
  for y in range(1,N+1):
    if x**2 + y**2 >= N:
      break
    for z in range(1,N+1):
      if x**2+y**2+z**2>=N:
        break
      t=x**2+y**2+z**2+x*y+y*z+z*x
      if t<=N:
        a[t-1] += 1
for m in range(N):
  print(a[m])
### BUGGY CODE ###

N = int(input())
A = input().split()
O = []
for i in range(1,N+1):
    O.append(A.index(str(i))+1)

for i in range(N):
    print("{} ".format(O[i]),end="")
print("\n")


### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int,input().split()))
    d = {}
    for i,a in enumerate(A):
        d[a]=i
    for i in range(1,N+1):
        print(d[i]+1,end=" ")
    print()

if __name__=='__main__':
    main()
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix
# CreatedDate:  2020-06-21 22:17:03 +0900
# LastModified: 2020-06-21 22:25:13 +0900
#




def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = [0]*100001
    for s in a:
        cnt[s]+=1
    q = int(input())
    for _ in range(q):
        b, c = map(int, input().split())
        spare = cnt[b]
        cnt[b] = 0
        cnt[c] += spare
        print(sum(i*cnt[i] for i in range(len(cnt))))



if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix_2
# CreatedDate:  2020-06-22 17:32:46 +0900
# LastModified: 2020-06-22 17:39:47 +0900
#


import os
import sys
#import numpy as np
#import pandas as pd


def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = [0]*100001
    for a_ in a:
        cnt[a_] += 1

    total = sum(a)
    q = int(input())
    for _ in range(q):
        b, c = map(int, input().split())
        total += (c-b)*cnt[b]
        cnt[c] += cnt[b]
        cnt[b] = 0
        print(total)
        




if __name__ == "__main__":
    main()
### BUGGY CODE ###

while True:
    n,S = map(int, raw_input().split())
    if n == 0 and S == 0:
        break
    r = [input() for i in range(n)]
    ans = 0
    r.sort()
    for i in range(n):
        tmp = S - r[i] + 1
        if (tmp <= 0):
            ans += n - 1
        else:
            d = r[0:i] + r[i + 1:]
            left,right = 0,n - 1
            while (right - left > 1):
                med = (right + left) / 2
                if (d[med] <=  tmp):
                    left = med
                else:
                    right = med
            ans += (len(d) - left) - 1
    print ans / 2

### FIXED CODE ###

import bisect
while True:
    n,S = map(int, raw_input().split())
    if n == 0 and S == 0:
        break
    r = [input() for i in range(n)]
    ans = 0
    r.sort()
    for i in range(n):
        tmp = S - r[i] + 1
        if (tmp <= 0):
            ans += n - 1
        else:
            index = bisect.bisect_left(r, tmp)
            if (index <= i):
                ans += n - index - 1
            else:
                ans += n - index
    print ans / 2
### BUGGY CODE ###

# coding: utf-8
import itertools
A = [0]
N, S = list(map(int, input().split()))
A = A + list(map(int, input().split()))
val = 0
for L in range(1, N+1):
  for R in range(L, N+1):
    A_ = A[L:R+1]
    lists = []
    for n in range(len(A_)):
      for comb in itertools.combinations(A_, n+1):
        lists.append(list(comb))
    for lis in lists:
      _sum = sum(lis)
      if _sum == S:
        val += 1
      if val == 998244353:
        val = 0
print(val)

### FIXED CODE ###

# coding: utf-8
import numpy as np
N, S = list(map(int, input().split()))
A = [0]+list(map(int, input().split()))

dt = np.array([[0 for _ in range(S+1)] for x in range(N+1)])

for n in range(1, N+1):
  if A[n] <= S:
    dt[n,A[n]] += n
  if A[n] < S:
    dt[n, A[n]+1:] += dt[n-1,1:S-A[n]+1] - dt[n-2,1:S-A[n]+1]
  dt[n,:] += dt[n-1,:] * 2 - dt[n-2,:]
  dt[n,:] %= 998244353
print(dt[N,S] % 998244353)
### BUGGY CODE ###

N,K=map(int,input().split())
b=list(map(int,input().split()))
b.sort()
a=[]
for i in range(N):
    if b[i]<K:
        a.append(b[i])
N=len(a)
ans=0
#print(bin((1<<K)>>1))
C=[1]
n=1
for i in range(N):
    n=n|n<<a[i]
    n%=(1<<K)
    C.append(n)
#print(C)
    #print(bin(n))
for i in range(N):
    n=C[i]
    for j in range(i+1,N):
        n=n|n<<a[j]
        n%=(1<<K)
    if n < (1<<K)>>a[i]:
        ans+=1
    else:
        break
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
b=list(map(int,input().split()))
b.sort()
a=[]
for i in range(N):
    if b[i]<K:
        a.append(b[i])
N=len(a)
ans=0
#print(bin((1<<K)>>1))
C=[1]
n=1
for i in range(N):
    n=n|n<<a[i]
    n%=(1<<K)
    C.append(n)
#print(C)
    #print(bin(n))
if N<=10:
    for i in range(N):
        n=C[i]
        for j in range(i+1,N):
            n=n|n<<a[j]
            n%=(1<<K)
        if n < (1<<K)>>a[i]:
            ans+=1
        else:
            break
    print(ans)
else:
    a+=[10**9]
    H=N
    L=0
    
    while abs(H-L)>4:
        Mid=(H+L)//2
        #print(H,Mid,L)
        n=1
        for i in range(N):
            if i==Mid:
                continue
            else:
                n=n|n<<a[i]
                n%=(1<<K)
        if n >= (1<<K)>>a[Mid]:    
            H=Mid
        else:
            L=Mid
    #print(H,L)        
    for j in range(max(0,L-5),N):
        n=1
        for i in range(N):
            if i==j:
                continue
            else:
                n=n|n<<a[i]
                n%=(1<<K)
        if n >= (1<<K)>>a[j]: 
            print(j)
            exit()
    print(N)
### BUGGY CODE ###

from itertools import takewhile

H, W = map(int, input().split())
S = [input() for _ in range(H)]

x = [[0 for _ in range(W)] for _ in range(H)]
y = [[0 for _ in range(W)] for _ in range(H)]

for i, j in ((i, j) for i in range(H) for j in range(W) if S[i][j] == '.'):
    if x[i][j] == 0:
        w = len(list(takewhile(lambda k: S[i][k] == '.', range(j, W))))
        for k in range(j, j + w):
            x[i][k] = w
    if y[i][j] == 0:
        h = len(list(takewhile(lambda k: S[k][j] == '.', range(i, H))))
        for l in range(i, i + h):
            y[l][j] = h

ans = max(
    x[i][j] + y[i][j] - 1
    for i in range(H)
    for j in range(W)
)
# 出力
print(ans)

### FIXED CODE ###

from itertools import takewhile

H, W = map(int, input().split())
S = [input() for _ in range(H)]

x = [[0 for _ in range(W)] for _ in range(H)]
y = [[0 for _ in range(W)] for _ in range(H)]

for i, j in ((i, j) for i in range(H) for j in range(W) if S[i][j] == '.'):
    if x[i][j] == 0:
        w = len(list(takewhile(lambda k: S[i][k] == '.', range(j, W))))
        for k in range(j, j + w):
            x[i][k] = w
    if y[i][j] == 0:
        h = len(list(takewhile(lambda k: S[k][j] == '.', range(i, H))))
        for l in range(i, i + h):
            y[l][j] = h

ans = max(
    x[i][j] + y[i][j] - 1
    for i in range(H)
    for j in range(W)
)
# 出力
print(ans)
### BUGGY CODE ###

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

def main():
  n,a,b=map(int,input().split())
  mod=10**9+7
  cmb_l=[1 for _ in range(b+1)]
  for i in range(b):
    cmb_l[i+1]=(cmb_l[i]*(n-i)%mod*mod_inv(i+1,mod))%mod

  x=cmb_l[a]
  y=cmb_l[b]
  return((2**n-x-y-1) % mod)
print(main())

### FIXED CODE ###

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

def main():
  n,a,b=map(int,input().split())
  mod=10**9+7
  cmb_l=[1 for _ in range(b+1)]
  for i in range(b):
    cmb_l[i+1]=(cmb_l[i]*(n-i)%mod*mod_inv(i+1,mod))%mod

  x=cmb_l[a]
  y=cmb_l[b]
  return((2**n-x-y-1) % mod)
print(main())
### BUGGY CODE ###

def longestRepeatedSubstring(str): 
  
    n = len(str) 
    LCSRe = [[0 for x in range(n + 1)]  
                for y in range(n + 1)] 
  
    res = "" # To store result 
    res_length = 0 # To store length of result 
  
    # building table in bottom-up manner 
    index = 0
    for i in range(1, n + 1): 
        for j in range(i + 1, n + 1): 
              
            # (j-i) > LCSRe[i-1][j-1] to remove 
            # overlapping 
            if (str[i - 1] == str[j - 1] and
                LCSRe[i - 1][j - 1] < (j - i)): 
                LCSRe[i][j] = LCSRe[i - 1][j - 1] + 1
  
                # updating maximum length of the 
                # substring and updating the finishing 
                # index of the suffix 
                if (LCSRe[i][j] > res_length): 
                    res_length = LCSRe[i][j] 
                    index = max(i, index) 
                  
            else: 
                LCSRe[i][j] = 0
  
    # If we have non-empty result, then insert  
    # all characters from first character to  
    # last character of string 
    if (res_length > 0): 
        for i in range(index - res_length + 1, 
                                    index + 1): 
            res = res + str[i - 1] 
  
    return res 
  
# Driver Code 
if __name__ == "__main__": 
  n=int(input())
  str=input()
  print(len(longestRepeatedSubstring(str)))

### FIXED CODE ###

def longestRepeatedSubstring(str): 
  
    n = len(str) 
    LCSRe = [[0 for x in range(n + 1)]  
                for y in range(n + 1)] 
  
    res = "" # To store result 
    res_length = 0 # To store length of result 
  
    # building table in bottom-up manner 
    index = 0
    for i in range(1, n + 1): 
        for j in range(i + 1, n + 1): 
              
            # (j-i) > LCSRe[i-1][j-1] to remove 
            # overlapping 
            if (str[i - 1] == str[j - 1] and
                LCSRe[i - 1][j - 1] < (j - i)): 
                LCSRe[i][j] = LCSRe[i - 1][j - 1] + 1
  
                # updating maximum length of the 
                # substring and updating the finishing 
                # index of the suffix 
                if (LCSRe[i][j] > res_length): 
                    res_length = LCSRe[i][j] 
                    index = max(i, index) 
                  
            else: 
                LCSRe[i][j] = 0
  
    # If we have non-empty result, then insert  
    # all characters from first character to  
    # last character of string 
    if (res_length > 0): 
        for i in range(index - res_length + 1, 
                                    index + 1): 
            res = res + str[i - 1] 
  
    return res 
  
# Driver Code 
if __name__ == "__main__": 
  n=int(input())
  str=input()
  print(len(longestRepeatedSubstring(str)))
### BUGGY CODE ###

from collections import defaultdict
from heapq import heappop, heappush

n, m, s, t = map(int, input().split())
c = 10**15
graph = defaultdict(list)
for _ in range(m):
  u, v, a, b = map(int, input().split())
  graph[u].append((v, a, b))
  graph[v].append((u, a, b))

def dijkstra(s, year):
  d = defaultdict(lambda:float("INF"))
  d[(s, 0)] = 0
  q = []
  heappush(q, (0, (s, 0)))

  while len(q):
    #print(q)
    cost, v = heappop(q)
    cur, m = v[0], v[1]
    used = defaultdict(bool)

    if cur==t and m==1:
      return cost
    if used[v]:
      continue
    used[v]=True

    for to, a, b in graph[cur]:
      if cur>year and m==0 and d[(cur, 1)]>cost:
        d[(cur, 1)]=cost
        heappush(q, (cost, (cur, 1)))
      if m == 0:
        if d[(to, 0)]>cost+a:
          d[(to, 0)]=cost+a
          heappush(q, (cost+a, (to, 0)))
      else:
        if d[(to, 1)]>cost+b:
          d[(to, 1)]=cost+b
          heappush(q, (cost+b, (to, 1)))
  
  return d[(t, 1)]

for i in range(n):
  tt = dijkstra(s, i)
  print(c-tt)

### FIXED CODE ###

from collections import defaultdict
from heapq import heappop, heappush

n, m, s, t = map(int, input().split())
c = 10**15
graph = defaultdict(list)
for _ in range(m):
  u, v, a, b = map(int, input().split())
  graph[u].append((v, a, b))
  graph[v].append((u, a, b))

dyen = defaultdict(lambda:float("INF"))
dsnuuk = defaultdict(lambda:float("INF"))
dyen[s] = 0
dsnuuk[t] = 0

def dijkstra(s, m):
  used = defaultdict(bool)
  q = []
  heappush(q, (0, s))

  while len(q):
    v = heappop(q)
    cost, cur = v[0], v[1]

    if used[v]:
      continue
    used[v]=True

    for to, a, b in graph[cur]:
      if m==0 and dyen[to]>cost+a:
        dyen[to] = cost+a
        heappush(q, (cost+a, to))
      elif m==1 and dsnuuk[to]>cost+b:
        dsnuuk[to] = cost+b
        heappush(q, (cost+b, to))

dijkstra(s, 0)
dijkstra(t, 1)

costs = [float("INF")]*(n+1)
min_ = float("INF")
for i in range(n, 0, -1):
  min_ = min(min_, dyen[i]+dsnuuk[i])
  costs[i] = min_

for i in range(1, n+1):
  print(c-costs[i])
### BUGGY CODE ###

import numpy as np

#1. input
N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

ans = []
ans = [np.sum(np.abs(np.r_[A[:i], A[i+1:], 0] \
                                    - np.r_[0, A[:i], A[i+1:]])) for i in range(N)]
[print(ans[i]) for i in range(N)]

### FIXED CODE ###

#1. input
n = int(input())
a = list(map(int, input().split()))

#2. make distance list
a.append(0)
a.insert(0,0)
costs = []

for i in range(n+1):
    costs.append(abs(a[i+1]-a[i]))

#3. calculate each cost
total = sum(costs)
for i in range(n):
    print(total - costs[i] - costs[i+1] + abs(a[i+2]-a[i]))
### BUGGY CODE ###

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

ans=1
for i in range(n):
  ans*=l[i]

if ans-10**18>0:
  print(-1)
else:
  print(ans)
        
      
        
        
  

### FIXED CODE ###

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

  if 0 in l:
    print(0)
    return
  
  ans=1
  for i in range(n):
    ans*=l[i]
    if ans> 10**18:
      print(-1)
      return
    
  print(ans)
        
main()
### BUGGY CODE ###

N,K = list(map(int,input().split()))
gakki = list(map(int,input().split()))

scores = []


temp = gakki[0]
for i in range(1,K):
    temp *= gakki[i]
scores.append(temp)

for i in range(N - K):
    scores.append(int(scores[i] / gakki[i] * gakki[K + i]))
    

for i in range(N - K):
    if scores[i] < scores[i + 1]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

N,K = list(map(int,input().split()))
gakki = list(map(int,input().split()))


for i in range(N - K):
    temp1 = gakki[i]
    temp2 = gakki[K + i]
    if temp1 < temp2:
        print("Yes")
    else:
        print("No")
    temp1 = temp2
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x=INT()

for i in range(-1*int(x**(1/5))-1,int(x**(1/5))+1):
    for j in range(-1*int(x**(1/5))-1,int(x**(1/5))+1):
        if i**5-j**5==x:
            print(i,j)
            exit()
while True:
    j+=1

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x=INT()

for i in range(-500,501):
    for j in range(-500,501):
        if i**5-j**5==x:
            print(i,j)
            exit()
### BUGGY CODE ###

N = int(input())
tmp = input()
a_list = []
for i in range(N):
    a_list.append(int(tmp.split(' ')[i]))

# print(a_list)


count = 0
for l in a_list:
    tmp_l = l
    while(tmp_l % 2 == 0):
        count += 1
        tmp_l = tmp_l / 2

print(count)


### FIXED CODE ###

import math
N = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(N):
  while a[i] % 2 == 0:
    ans += 1
    a[i] = a[i] // 2
print(ans)
### BUGGY CODE ###

s=input()
l=len(s)
mod=10**9+7
dp=[[0 for j in range(13)] for i in range(l+1)]
dp[0][0]=1 #初期値の設定
for i in range(l):
 if s[i]=='?': #?のときは各値(0～9)について更新する
   for j in range(10):
     for k in range(13):
       dp[i+1][(k*10+j)%13]+=dp[i][k]%mod
 else:
   for k in range(13): #整数のときはその値について更新する
     dp[i+1][(k*10+int(s[i]))%13]+=dp[i][k]%mod
print(dp[-1][5]%mod) #最後まで更新を行ったときのあまりが5となる数の個数が答え

### FIXED CODE ###

s=input()
l=len(s)
mod=10**9+7
dp=[[0 for j in range(13)] for i in range(l+1)]
dp[0][0]=1
for i in range(1,l+1):
  if s[i-1]=='?':
    for j in range(10):
      for k in range(13):
        dp[i][(k*10+j)%13]+=dp[i-1][k]%mod
  else:
    for k in range(13):
      dp[i][(k*10+int(s[i-1]))%13]+=dp[i-1][k]%mod
print(dp[-1][5]%mod)
### BUGGY CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def gcd(n,m):
    if m == 0:
        return n
    else:
        return gcd(m,n%m)

def lcm(n,m):
    return n*m//gcd(n,m)

n,m = LI()
a = LI()
b = [i//2 for i in a]
if n == 1:
    lb = b[0]
else:
    lb = lcm(b[0],b[1])

for i in range(2,n):
    lb = lcm(lb,b[i])

for i in range(n):
    if lb//b[i] % 2 == 0:
        print(0)
        quit()
 
if lb > m:
    print(0)
    quit()

ans = m//lb//2 + (m // lb) %2
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def gcd(n,m):
    if m == 0:
        return n
    else:
        return gcd(m,n%m)

def lcm(n,m):
    return n*m // gcd(n,m)


n,m = LI()
a = LI()
b = [i//2 for i in a]

lb = 1
for i in b:
    lb = lcm(lb,i)
    if lb > m:
        print(0)
        quit()

for i in b:
    if lb//i % 2 == 0:
        ans = 0
        break
else:
    if lb > m:
        ans = 0
    else:
        ans = (m//lb + 1)//2
print(ans)