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

N, C = map(int, input().split())
time = [0 for i in range(100010)]
CTS = []
for i in range(N):
    S, T, C = map(int, input().split())
    CTS.append([C, S, T])

CTS.sort()

i = 1
while i < len(CTS):
    if CTS[i][0] == CTS[i - 1][0]:
        if CTS[i][1] == CTS[i - 1][2]:
            CTS[i - 1][2] = CTS[i][2]
            del CTS[i]
            i -= 1
    i += 1
    
for i in range(len(CTS)):
    S = CTS[i][1]
    T = CTS[i][2]
    time[S - 1] += 1
    time[T] -= 1   
for i in range(1, 100010):
    time[i] += time[i - 1]


print(max(time))


### FIXED CODE ###

N, c = map(int, input().split())
time = [0 for i in range(100001)]
time_c = [[0 for i in range(100001)] for j in range(c)]
          
for i in range(N):
    S, T, C = map(int, input().split())
    time_c[C - 1][S] += 1
    time_c[C - 1][T] -= 1
    
for i in range(100001):
    for j in range(c):
        if time_c[j][i] > 0:
            time[i - 1] += time_c[j][i]
        if time_c[j][i] < 0:
            time[i] += time_c[j][i]

for i in range(1, 100001):
    time[i] += time[i - 1]

print(max(time))
### BUGGY CODE ###

N, M = map(int, input().split())
P = [0] * M
Y = [0] * M
check = [[] for i in range(N)]

for i in range(M):
    P[i], Y[i] = map(int, input().split())
    check[P[i]-1].append(Y[i])

for i in range(N):
    check[i].sort()

for i in range(M):
    tmp1 = ('000000' + str(P[i]))[-6:]
    tmp2 = ('000000' + str(check[P[i]-1].index(Y[i])+1))[-6:]
    tmp = tmp1 + tmp2
    print(tmp)




### FIXED CODE ###

N, M = map(int, input().split())
P = [0] * M
Y = [0] * M
X = [0] * M
check = [[] for i in range(N)]

for i in range(M):
    P[i], Y[i] = map(int, input().split())
    X[i] = [Y[i], P[i], i]

X.sort()
#print(X)

count = [0] * (N+1)
ans_list = [[] for _ in range(M)]

for i in range(len(X)):
    count[X[i][1]] += 1
    tmp = ('000000'+ str(X[i][1]))[-6:] + ('000000'+ str(count[X[i][1]]))[-6:]
    ans_list[X[i][2]] = tmp

for i in range(len(ans_list)):
    print(ans_list[i])
### BUGGY CODE ###

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

p = [int(e) for e in input().split()]

windows = []

for i in range(0,N-K+1):
    windows.append(sum(p[i:i+K]))

print((K + max(windows))/2)

### FIXED CODE ###

from copy import copy
N, K = map(int, input().split())

p = [int(e) for e in input().split()]

now_sum = sum(p[0:K])
now_max = copy(now_sum)


for i in range(K,N):
    now_sum = now_sum - p[i - K] + p[i]
    if now_sum > now_max:
        now_max = copy(now_sum)

print((K + now_max)/2)
### BUGGY CODE ###

N=int(input())
A=[int(i) for i in input().split()]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


mat = [1]
divs_set = set()
divs_powers = {}
tmp=[0]*len(A)
for j,a in enumerate(A):
    tmp[j] = factorization(a)
    for div in tmp[j]:
        if div[0] not in divs_set:
            divs_set.add(div[0])
            divs_powers[div[0]] = div[1]
        else:
            if divs_powers[div[0]] < div[1]:
                divs_powers[div[0]] = div[1]

all_dict = []
all_set = []
for i,t in enumerate(tmp):
    each_dict = {}
    each_set = set()
    for tt in t:
        each_dict[tt[0]] = tt[1]
        each_set.add(tt[0])
    all_dict.append(each_dict)
    all_set.append(each_set)

B = [1] * N
for i, a in enumerate(A):
    for k in divs_set:
        if k in all_set[i]:
            B[i] = B[i]*(k**(divs_powers[k]-all_dict[i][k]))
        else:
            B[i] = B[i]*(k**divs_powers[k])

print(int(sum(B)) % (10 ** 9 + 7))

### FIXED CODE ###

import math
from collections import defaultdict

n = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

divisor_primes = defaultdict(int)

def prime_factrizer(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

for a in A:
    factrized_a = prime_factrizer(a)
    for prime in factrized_a:
        divisor_primes[prime[0]] = max(divisor_primes[prime[0]],prime[1])

invs = [1] * (max(A) + 1)
for i in range(2, max(A) + 1):
    invs[i] = mod - invs[mod % i] * (mod//i) % mod

lcm = 1
for key in divisor_primes.keys():
    power = divisor_primes[key]
    div = 1
    for i in range(power):
        div *= key
        div %= mod
    lcm *= div

ans = 0

for a in A:
    ans += invs[a]
    ans %= mod
ans *= lcm
ans %= mod
print(ans)
### BUGGY CODE ###

# modulo:mod

# inverse x^(-1)
def inv(x):
    global mod
    return pow(x,mod-2,mod)

# factorial x!
def fact(x):
    global mod
    res=1
    for i in range(2,x+1):
        res=res*i%mod
    return res

# combination nCr
def combi(n,r):
    if r<0 or r>n:
        return 0
    else:
        return fact(n)*inv(fact(r))*inv(fact(n-r))%mod

mod=10**9+7

N,K=map(int,input().split())
A=[-10**10] # 1-ind
A.extend(list(map(int,input().split())))
A.sort()

# print(A)

ans=0
# min
for i in range(1,N-K+2):
    temp=combi(N-i,K-1)%mod
    '''
    print(i,A[i])
    print(N-i,K-1)
    print('min',temp)
    '''
    ans=(ans-temp*A[i])%mod
# max
for j in range(K,N+1):
    temp=combi(j-1,K-1)
    '''
    print(j)
    print(j-1,K-1)
    print('max',temp*A[j])
    '''
    ans=(ans+temp*A[j])%mod

print(ans)



### FIXED CODE ###

# modulo:mod

# inverse x^(-1)
def inv(x):
    global mod
    return pow(x,mod-2,mod)

# factorial x!
def fact(x):
    global mod
    res=1
    for i in range(2,x+1):
        res=res*i%mod
    return res

# combination nCr
def combi(n,r):
    if r<0 or r>n:
        return 0
    else:
        return fact(n)*inv(fact(r))*inv(fact(n-r))%mod

mod=10**9+7

N,K=map(int,input().split())
A=[-10**10] # 1-ind
A.extend(list(map(int,input().split())))
A.sort()

# print(A)

ans=0
# min
p=1
for i in range(N-K+1,0,-1):
    # print(i,A[i],p)
    temp=A[i]*p%mod    
    ans=(ans-temp)%mod
    # print((N-i+1)*inv(N-K-i+2))
    p=p*(N-i+1)*inv(N-K-i+2)%mod
# max
p=1
for j in range(K,N+1):
    # print(j,A[j],p)
    temp=A[j]*p%mod
    ans=(ans+temp)%mod
    p=p*j*inv(j-K+1)%mod

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

N = int(input())
A = list(map(int, input().split()))
dictA = {}
for x in A:
    dictA[x] = 0
for x1 in A:
    dictA[x1] += 1

for x2 in A:
    dictB = dictA.copy()
    combisum = 0
    dictB[x2] -= 1
    for x3 in dictB.values():
        combisum += x3 * (x3 - 1) // 2
    print(combisum)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
dictA = {}
for x in A:
    dictA[x] = 0
for x1 in A:
    dictA[x1] += 1

combisum = 0
for y in dictA.values():
    combisum += y * (y - 1) // 2

for z in range(N):
    print(combisum - dictA[A[z]] + 1)
### BUGGY CODE ###

n = int(input())
li = [sorted(list(input())) for i in range(n)]

li2 = []
for i in range(len(li)):
    li2.append(li.count(li[i]))

li3 = list(set(li2))

from functools import lru_cache

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
    
num = 0   
for i in range(len(li3)):
    if li3[i] >= 2:
        num += cmb(li3[i],2)

print(num)

### FIXED CODE ###

n = int(input())
from collections import Counter
li = []
for i in range (n):
    li.append(sorted(input()))
li.sort()
for i in range(n):
    li[i]="".join(li[i])

d = Counter(li)
L = list(d.values())

cnt = 0
for i in range(len(L)):
    cnt += L[i]*(L[i]-1)//2
print(cnt)
### BUGGY CODE ###

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

pos = 0
saidai = 0
for i in range(N-K+1):
  temp = sum(p[i:i+K])
  if saidai < temp:
    saidai = temp
    pos = i
    
kitaichi = 0
for i in range(K):
  temp = (p[pos+i]+1)*p[pos+i]/2
  kitaichi = kitaichi + float(temp/p[pos+i])
  
print('{:.12f}'.format(kitaichi))

### FIXED CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
 
now = sum(p[:K])
saidai = now
for i in range(K, N):
  now -= p[i-K]
  now += p[i]
  if now > saidai:
    saidai = now
 
print('{:.12f}'.format((saidai + K)/2))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)
 
def dfs(now, prev):
    ans[now]+=(h[now]+ans[prev])
    # 今いる頂点から行ける頂点を順に next に入れてループ
    for next in g[now]:
        if next != prev:
            if memo[next]==True:
                # 過去に訪れていれば終わらせる
                return False
            else:
                memo[next] = True
                dfs(next, now)
 
#木構造の取り込み 
n, q = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(n-1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)

#操作の取り込み
h=[0]*n
for i in range(q):
    u, v = map(int, input().split())
    u -= 1
    h[u]+=v

#初期のカウンター
ans=[0]*n
memo = [False for i in range(n)]

#DFSでカウンターを動かす
dfs(0,0)
 
print(' '.join(map(str, ans)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def dfs(now, prev):
    ans[now]+=(h[now]+ans[prev])
    # 今いる頂点から行ける頂点を順に next に入れてループ
    for next in g[now]:
        if next != prev:
            if memo[next]==True:
                # 過去に訪れていれば終わらせる
                return False
            else:
                memo[next] = True
                dfs(next, now)
 
#木構造の取り込み 
n, q = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(n-1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)
 
#操作の取り込み
h=[0]*n
for i in range(q):
    u, v = map(int, input().split())
    u -= 1
    h[u]+=v
 
#初期のカウンター
ans=[0]*n
memo = [False for i in range(n)]
 
#DFSでカウンターを動かす
dfs(0,0)
 
print(' '.join(map(str, ans)))
### BUGGY CODE ###

import math
S = input()
Q = int(input())

def reverse_list(S):
    S = list(S)
    S.reverse()
    return ''.join(S)

def moji_tuika(S, f, c):
    if f == 1:
        return c + S
    else:
        return S + c

q = []
for i in range(Q):
    temp = input().split()
    if len(temp) == 1:
        q.append(1)
    else:
        q.append(temp)

for i in q:
    if type(i) == int:
        S = reverse_list(S)
    elif int(i[0]) == 2:
        S = moji_tuika(S,int(i[1]),i[2])

print(S)


### FIXED CODE ###

from collections import deque

S = input()
Q = int(input())

lr = 'left'

def reverse_list(lr):
    if lr == 'right':
        return 'left'
    else:
        return 'right'

def moji_tuika(S, f, c, lr):
    if f == 1 and lr == 'left':
        S.appendleft(c)
    elif f == 1 and lr == 'right':
        S.append(c)
    elif f == 2 and lr == 'left':
        S.append(c)
    else:
        S.appendleft(c)
    return S

q = []
for i in range(Q):
    temp = input().split()
    if len(temp) == 1:
        q.append(1)
    else:
        q.append(temp)

S = deque(list(S))
for i in q:

    if type(i) == int:
        lr = reverse_list(lr)
    elif int(i[0]) == 2:
        S = moji_tuika(S,int(i[1]),i[2],lr)
if lr == 'right':
    S.reverse()

S = ''.join(S)
print(S)
### BUGGY CODE ###

n, m = map(int, input().split())
S = [None]*m

for i in range(m):
    l, r = map(int, input().split())
    S[i] = set(range(l, r+1))

ans = S[0]
for i in range(1, m):
    ans = ans & S[i]

print(len(ans))


### FIXED CODE ###

n, m = map(int, input().split())
S = [None]*m
L = 0
R = n

for i in range(m):
    l, r = map(int, input().split())
    L = max(l, L)
    R = min(r, R)

ans = R-L+1
if ans < 0:
    ans = 0
print(ans)
### BUGGY CODE ###

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

#output
import fractions
import  functools
import numpy as np

mod = 10**9 + 7

gcd = functools.reduce(fractions.gcd, A)

def lcm_base(x, y):
    return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

lcm =  lcm_list(A)

answer = 0
for i in range(N):
    answer += lcm//A[i]

print(answer % mod)

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
#input
N = int(input())
A = list(map(int, input().split()))
 
#output
import fractions, functools
 
def lcm_base(x, y):
    return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)
 
lcm = lcm_list(A)
 
answer = 0
for i in range(N):
    answer += lcm//A[i]
 
print(answer % (10**9 + 7))
### BUGGY CODE ###

h,w,m=map(int,input().split())
bomb=[]
x=[0]*(h+1)
y=[0]*(w+1)
for i in range(m):
    h1,w1=map(int,input().split())
    x[h1]+=1
    y[w1]+=1
    bomb.append((h1,w1))
maxx=max(x)
maxy=max(y)
r=[]
c=[]
for i in range(1,h+1):
    if x[i]==maxx:
        r.append(i)
for j in range(1,w+1):
    if y[j]==maxy:
        c.append(j)
for j in r:
    for k in c:
        if (j,k) not in bomb:
            print(maxx+maxy)
            exit()
print(maxx+maxy-1)

### FIXED CODE ###

h,w,m=map(int,input().split())
bomb=[]
x=[0]*(h+1)
y=[0]*(w+1)
for i in range(m):
    h1,w1=map(int,input().split())
    x[h1]+=1
    y[w1]+=1
    bomb.append((h1,w1))
maxx=max(x)
maxy=max(y)
r=[]
c=[]
bomb=set(bomb)
for i in range(1,h+1):
    if x[i]==maxx:
        r.append(i)
for j in range(1,w+1):
    if y[j]==maxy:
        c.append(j)
for j in r:
    for k in c:
        if (j,k) not in bomb:
            print(maxx+maxy)
            exit()
print(maxx+maxy-1)
### BUGGY CODE ###

import sys

i1 = input().split(' ')
a=int(i1[0])
b=int(i1[1])

r = 0
if a>b:
  r=a
else:
  r=b

aa = abs(a)
ba = abs(b)

for i in range(r):
  aa = a-i
  ba = b-i
  if aa == ba:
    print(i)
    sys.exit()
    
  if aa==ba * -1:
    print(i)
    sys.exit()

print("IMPOSSIBLE")


### FIXED CODE ###

i1 = input().split(' ')
a=int(i1[0])
b=int(i1[1])

aa = abs(a)+abs(b)
if aa%2 == 0:
  print(int(aa/2))
  exit()

print("IMPOSSIBLE")
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
P=10**9+7
ans=0
BIN=[0]*N
for h in range(N):
    BIN[h]=bin(A[h])[2:].zfill(60)

for i in range(60):
    inc=0
    one=0
    zero=0
    for j in range(N):
        if BIN[j][59-i]=="0":
            zero+=1
        else:
            one+=1
    ans+=zero*one*2**i
print(ans%P)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
P=10**9+7
ans=0
BIN=[0]*N
for h in range(N):
    BIN[h]=bin(A[h])[2:].zfill(60)

for i in range(60):
    inc=0
    one=0
    zero=0
    for j in range(N):
        if BIN[j][59-i]=="0":
            zero+=1
        else:
            one+=1
    ans+=zero*one*2**i
print(ans%P)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
res = 1
for i in range(n):
    res = res * a[i]
if(res > 10**18):
    print(-1)
else:
    print(res)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
res = 1
if(0 in a):
    print(0)
else:
    for i in a:
        res = res * i
        if(res > 10**18):
            res = -1
            break
    print(res)
### BUGGY CODE ###

N = int(input())
import collections 
S = [collections.Counter(input()) for i in range(N)]
counter = 0
for i in range(N):
    for j in range(i+1, N):
        if S[i] == S[j]:
            counter += 1
print(counter)




### FIXED CODE ###

N = int(input())
#N = 100000
#S = [input() for i in range(N)]
S = [input() for i in range(N)]
#S = ['zabcdefghi']*100000

#groups = {i: [] for i in range(26)}
sort_str = {}

counter = 0
for i in range(N):
    s = ''.join(sorted(S[i]))
    if s in sort_str:
        counter += sort_str[s]
        sort_str[s] += 1 
    else:
        sort_str[s] = 1
print(counter)
#
#
#    groups[int(s[0], 36) - 10].append(s)
#
#counter = 0
#for group in groups.values():
#    for i in range(len(group)):
#        for j in range(i+1, len(group)):
#            print(i, j)
#            if group[i] == group[j]:
#                counter += 1
#
#print(counter)
#
#
### BUGGY CODE ###

import re

class Node:
  key = None
  left = None
  right = None
  def __init__(self, k):
    self.key = k

class BST:
  root = None
  def insert(self, k):
    x = self.root
    y = None
    z = Node(k)
    while x is not None:
      y = x
      if z.key < y.key:
        x = x.left
      elif y.key < z.key:
        x = x.right
    
    if y is None:
      # 初回値
      self.root = z
    else:
      if z.key < y.key:
        y.left = z
      elif y.key < z.key:
        y.right = z
        
  def inorder(self, r):
    # 中間巡回順で出力
    if r != None:
      self.inorder(r.left)
      print(" {}".format(r.key), end="")
      self.inorder(r.right)
      

  def preorder(self, r):
    # 先行巡回順で出力
    if r != None:
      print(" {}".format(r.key), end="")
      self.preorder(r.left)
      self.preorder(r.right)

    
n = int(input())
bst = BST()
for _ in range(n):
  # query = [int(x) if re.match('[+|-]?\d', x) else x for x in input().split()]
  query = input().split()
  if query[0] == 'insert':
    bst.insert(int(query[1]))
  elif query[0] == 'print':
    root = bst.root
    bst.inorder(root)
    print()
    bst.preorder(root)
    print()


### FIXED CODE ###

class Node:
  key = None
  left = None
  right = None
  def __init__(self, k):
    self.key = k

class BST:
  root = None
  def insert(self, k):
    x = self.root
    y = None
    z = Node(k)
    while x is not None:
      y = x
      if z.key < y.key:
        x = x.left
      elif y.key < z.key:
        x = x.right
    
    if y is None:
      # 初回値
      self.root = z
    else:
      if z.key < y.key:
        y.left = z
      elif y.key < z.key:
        y.right = z

  def inorder(self, r, lis):
    # 中間巡回順で出力
    if r != None:
      self.inorder(r.left, lis)
      lis.append(r.key)
      self.inorder(r.right, lis)


  def preorder(self, r, lis):
    # 先行巡回順で出力
    if r != None:
      lis.append(r.key)
      self.preorder(r.left, lis)
      self.preorder(r.right, lis)

    
n = int(input())
bst = BST()
for _ in range(n):
  # query = [int(x) if re.match('[+|-]?\d', x) else x for x in input().split()]
  query = input().split()
  if query[0] == 'insert':
    bst.insert(int(query[1]))
  elif query[0] == 'print':
    root = bst.root
    in_lis = []
    pre_lis = []
    bst.preorder(root, pre_lis)
    bst.inorder(root, in_lis)
    print(" " + " ".join(list(map(str, in_lis))))
    print(" " + " ".join(list(map(str, pre_lis))))
### BUGGY CODE ###

n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    if i in a: dp[i]=0
    else: dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
print(dp[n])

### FIXED CODE ###

n,m=map(int,input().split())
a=set([int(input()) for _ in range(m)])
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    if i in a: dp[i]=0
    else: dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
print(dp[n])
### BUGGY CODE ###

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

ans =0
for i in range(N-1):
    count =0
    for j in range(i,N-1,1):
        if arr[j] >= arr[j+1]:
            count +=1
        else:
            break
    if count>ans:
        ans =count
print(ans)

### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
jump_flg = [0]*N

for i in range(N-1):
    if arr[i] >= arr[i+1]:
        jump_flg[i] =1

ans = 0
count = 0
for i in range(N):
    if jump_flg[i] == 1:
        count +=1
        if ans<count:
            ans =count
    else:
        count =0

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

n,k = map(int,input().split())
h = []
for i in range(n):
  h.append(int(input()))
h.sort()
g = []
for i in range(n-k+1):
  g.append(max(h[i:i+k]) - min(h[i:i+k]))
print(min(g))

### FIXED CODE ###

n,k = map(int,input().split())
h = []
for i in range(n):
  h.append(int(input()))
h.sort()
g = float('inf')
for i in range(n-k+1):
  g = min(g, h[i+k-1] - h[i])
print(g)
### BUGGY CODE ###

def solve():
    A, B = map(int, input().split())

    C = max(A, B) // 2

    cnt = 1
    primeNum = []
    for i in range(3, C + 1, 2):
        if A % i == 0 and B % i == 0:
            if isPrime(i, primeNum):
                primeNum.append(i)
                cnt += 1

    if A % 2 == 0 and B % 2 == 0:
        cnt += 1
    
    print(cnt)
        

def isPrime(num, primeNum):
    for n in primeNum:
        if num % n == 0:
            return False
        
    
    return True


if __name__ == '__main__':
    solve()


### FIXED CODE ###

def solve():
    A, B = map(int, input().split())

    primeFactorA = prime_factorize(A)
    primeFactorB = prime_factorize(B)

    commonFactor = [1]
    for f in primeFactorB:
        if f in primeFactorA:
            commonFactor.append(f)
    
    print(len(commonFactor))


def prime_factorize(num):
    a = set() 
    while num % 2 == 0:
        a.add(2)
        num //= 2
    
    f = 3
    while f * f <= num:
        if num % f == 0:
            a.add(f)
            num //= f
        else:
            f += 2
    if num != 1:
        a.add(num)
    
    return a

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

S = input()
Q = int(input())
for i in range(Q):
    q = list(map(str,input().split()))
    if q[0]=='1':
        S = S[::-1]
    else:#q[0]=='2'
        if q[1]=='1':
            S = q[2] + S
        else:#q[1]=='2'
            S = S + q[2]
print(S)

### FIXED CODE ###

from collections import deque
S = deque(input())
Q = int(input())
Query = [[] for _ in range(Q)]
for i in range(Q):
    Query[i] = list(map(str,input().split()))

fl = False
for q in Query:
    if q[0]=='1':
        fl = not fl
    else:#q[0]=='2'
        if (q[1]=='1') ^ fl:
            S.appendleft(q[2])
        else:#q[1]=='2'
            S.append(q[2])
T = ''.join(S)
if fl:
    T = T[::-1]
print(T)
### BUGGY CODE ###

N = int(input())
d = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    d[a][b] = c
    d[b][a] = c
Q,K = map(int,input().split())
#p is parent
#pcd is parent-child distance
reached = [0 for i in range(N+1)]
def f(p,pcd):
    global d,K,reached
    reached[p] = 1
    d[K][p] = pcd
    for c in range(N+1):
        if d[p][c]>0 and reached[c] == 0:
            f(c,pcd+d[p][c])
f(K,0)
for i in range(Q):
    x,y = map(int,input().split())
    print(d[K][x]+d[K][y])


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
N = int(input())
T = [[]for i in range(N+1)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    T[a].append((b,c))
    T[b].append((a,c))
Q,K = map(int,input().split())
D = [0]*(N+1)
def f(v,p,cost):
    global T,K,D
    for C in T[v]:
        if C[0]!=p:
            D[C[0]] = cost+C[1]
            f(C[0],v,cost+C[1])
f(K,0,0)
for i in range(Q):
    x,y = map(int,input().split())
    print(D[x]+D[y])
### BUGGY CODE ###

from fractions import gcd

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = list(set(A))
AA = [a//2 for a in A]
K = [1 for i in range(len(AA))]
'''
def gcd(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        x, y = y, x % y
    return(y)
'''
def lcm(x, y):
    ans = (x * y) // gcd(x, y)
    return(ans)
l = 1
g = AA[0]

for i in range(len(AA)):
    g = gcd(g, AA[i])
    l = lcm(l, AA[i])
AAA = [a // g for a in AA]
C = [a % 2 for a in AAA]

if C == K:
    ans = M // l
    print((ans+1)//2)
else:
    print(0)


### FIXED CODE ###


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

def gcd(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        x, y = y, x % y
    return(y)

def lcm(x, y):
    ans = (x * y) // gcd(x, y)
    return(ans)
l = 1
cnt = [0 for i in range(len(A))]
for i in range(len(A)):
    a = A[i]
    l = lcm(l, a)
    count = 0
    while True:
        if a % 2 == 0:
            a //= 2
            count += 1
        else:
            cnt[i] = count
            break
count = cnt[0]
flag = True
for i in range(len(A)):
    if cnt[i] != count:
        flag = False
        break
if flag:
    l = l // 2
    ans = M // l
    print((ans+1)//2)
else:
    print(0)