Harryxun/stf_run huggingface dataset:
#! -*- coding: utf-8-unix -*-
import sys

if __name__=='__main__':
  # lines = [x.strip() for x in sys.stdin.readlines() if x != '' and x != '\n']
  # n = int(lines[0])
  n = int(raw_input())
  for i in xrange(n):
    # x1, y1, x2, y2, x3, y3, x4, y4 = map(float, lines[i+1].split(' '))
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' '))
    if x1 == x2 or x3 == x4:
      if x1 == x2 and x3 == x4:
        print 'YES'
      else:
        print 'NO'
    if y1 == y2 or y3 == y4:
      if y1 == y2 and y3 == y4:
        print 'YES'
      else:
        print 'NO'
    a1 = (y2 - y1) / (x2 - x1)
    b1 = y1 - a1 * x1
    a2 = (y4 - y3) / (x4 - x3)
    b2 = y3 - a2 * x3
    if (a1 == a2) and (b1 != b2):
      print 'YES'
    else:
      print 'NO'

### FIXED CODE ###

#! -*- coding: utf-8-unix -*-
import math

if __name__=='__main__':
  # lines = [x.strip() for x in sys.stdin.readlines() if x != '' and x != '\n']
  # n = int(lines[0])
  n = int(raw_input())
  for i in xrange(n):
    # x1, y1, x2, y2, x3, y3, x4, y4 = map(float, lines[i+1].split(' '))
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' '))
    # if x1 == x2 or x3 == x4:
    #   if x1 == x2 and x3 == x4:
    #     print 'YES'
    #   else:
    #     print 'NO'
    #   continue
    # elif y1 == y2 or y3 == y4:
    #   if y1 == y2 and y3 == y4:
    #     print 'YES'
    #   else:
    #     print 'NO'
    #   continue
    # else:
      # if (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1):
    if math.fabs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < 1e-10:
      print 'YES'
    else:
      print 'NO'
      # a1 = (y2 - y1) / (x2 - x1)
      # b1 = y1 - a1 * x1
      # a2 = (y4 - y3) / (x4 - x3)
      # b2 = y3 - a2 * x3
      # if (a1 == a2):# and (b1 != b2):
      #   print 'YES'
      # else:
      #   print 'NO'
    # except:
    #   break
N=int(input())
A=[map(int,input().split()) for _ in range(N)]

r=0
for i in range(N-1,-1,-1):
    a,b=A[i]
    a+=r
    r+=-(-a//b)*A[i][1]-a
print(r)

### FIXED CODE ###

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

ans=0
for i in range(N-1,-1,-1):
    a,b=A[i]
    a+=ans
    #print(a,-(-a//b)*A[i][1],-(-a//b)*A[i][1]-a)
    ans+=-(-a//b)*A[i][1]-a
print(ans)
n = int(input())

b = list(map(int, input().split()))
a = []
a.append(b[0])
for i in range(0,n):
  a.append(b[i])
  
for i in range(n):
  if(a[i] > a[i+1]):
    a[i] = a[i+1]
    
sum = 0
for i in range(n):
  sum += a[i]
  
print(sum)

### FIXED CODE ###

n = int(input())
 
b = list(map(int, input().split()))
a = []
a.append(b[0])
for i in range(0,n-1):
  a.append(b[i])

for i in range(n-1):
  if(a[i] > a[i+1]):
    a[i] = a[i+1]
    
sum = 0
for i in range(n):
  sum += a[i]
  
print(sum)
import sys
import math
import numpy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
p = int(readline())
if p % 2 == 1:
    print(0)
else:
    p //= 2
    ans = 0
    while p:
        p //= 5
        ans += p
    print(ans)

### FIXED CODE ###

def is_poor(triple_numbers):
    count_map = {}
    for num in triple_numbers:
        if num not in count_map:
            count_map[num] = 1
        else:
            count_map[num] += 1
    
    for key, value in count_map.items():
        if value == 2:
            return True
    return False

is_p = is_poor(list(map(int, input().split())))

if is_p:
    print("Yes")
else:
    print("No")
a = input()
b = input()
c = input()

def LCS(S, T):
    dp = [[0 for _ in range(len(S) + 1)] for _ in range(len(T) + 1)]
    for i in range(len(S)):
        for j in range(len(T)):
            if S[i] == "?" or T[j] == "?" or S[i] == T[j]:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

    return dp[len(S)][len(T)]

ans = 0

ab = LCS(a,b)

ac = LCS(a,c)

bc = LCS(b,c)


if ab == ac == bc == 0:
    print(len(a) + len(b) + len(c))
    exit()

if ac <= ab and ac <= bc:
    ans = (len(a) + len(b) - ab) + (len(c) - bc) 

elif ab <= ac and ab <= bc:
    ans = (len(a) + len(c) - ac) + (len(c) - bc) 

elif bc <= ab and bc <= ac:
    ans = (len(a) + len(b) - ab) + (len(c) - ac)

print(ans) 


### FIXED CODE ###


A = input()
B = input()
C = input()

def match(c1, c2):
    return c1 == "?" or c2 == "?" or c1 == c2

la = len(A)
lb  =len(B)
lc = len(C)

ml = max(la, lb, lc)

# 。a の左端の位置を 0 としたとき、他の文字列の左端の位置は −4000 から 4000 まで動く可能性があることに注意してください  より、４倍
ab = [False for _ in range(ml * 4 + 1)]
ac = [False for _ in range(ml * 4 + 1)]
bc = [False for _ in range(ml * 4 + 1)]

"""
下の２重forで(i,j) = (0,0)と(1,1)で配列のindexが同じになってしまうが、AとBの０文字目どうし、1文字目どうしを比べるのは、
同じところから先頭が始まっている場合なので、あるずれの配置について、全文字比較していることになる
i=0,j=2とかだとBのほうが左にある場合で、i=3,j=0だとAが左にある場合

ab[i - j]のindexに+2mlして、-2ml ~ 2ml 感を出したい気持ちがあるが、意味がないのでしない
"""


def main():

    for i in range(la):
        for j in range(lb):
            # すでにそのずらし方で文字が重ねられないことが分かっている場合はスキップ
            if ab[i - j]:
                continue
            # そのずらし方で重ねられない場合はTrue
            if not match(A[i], B[j]):
                ab[i - j] = True


    for i in range(la):
        for j in range(lc):
            # すでにそのずらし方で文字が重ねられないことが分かっている場合はスキップ
            if ac[i - j]:
                continue
            # そのずらし方で重ねられない場合はTrue
            if not match(A[i], C[j]):
                ac[i - j] = True

    for i in range(lb):
        for j in range(lc):
            # すでにそのずらし方で文字が重ねられないことが分かっている場合はスキップ
            if bc[i - j]:
                continue
            # そのずらし方で重ねられない場合はTrue
            if not match(B[i], C[j]):
                bc[i - j] = True       

    ans = la + lb + lc
    # BCAとかACBみたいにAの前後に並ぶ場合があるので、AとBの位置関係について±2*ml分探索（Aの頭が０の位置にあるとしてBをどこに置くか(それがi)ということ。）
    for i in range(-2*ml, 2*ml+1):
        # a,bについて、あるずらし方で重ねられない場合は飛ばす
        if ab[i]:
            continue
        # CBA,ABCのパターンがあるので～
        for j in range(-2*ml, 2*ml+1):
            if ac[j]:
                continue
            
            # ここでi,jはaの頭をindexの0としたときの位置にあたるので、B基準で見たときのCとの位置関係はj - iとなる
            # で、そのとき重ねられないならスキップ
            if bc[j - i]:
                continue

            # 文字列Sの左端のindex
            l = min(0, i, j)
            # 文字列Sの右端のindex
            r = max(0 + la, i + lb, j + lc)
            ans = min(ans, r - l)

    print(ans)

if __name__ == "__main__":
    main()
n = input()
m = list(map(int,input().split()))
m = m.sorted()
if m[-1] < sum(m) - m[-1]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n = input()
m = list(map(int,input().split()))
m.sort()
if m[-1] < sum(m) - m[-1]:
  print('Yes')
else:
  print('No')
nk = list(map(int,input().split()))
h = np.array(list(map(int,input().split())))
n,k = nk[0], nk[1] #5,3
DP = np.full(n, np.inf, int)
DP[0] = 0
for i in range(1, n):#0~3 -> 1~4
  act = float("inf")
  for k_ in range(1, k+1):#0~2 -> 1~3
    if i-k_ < 0 : continue
    act = min(DP[i-k_] + abs(h[i-k_]-h[i]), act)#
  DP[i] = act#[0,20,]
print(DP[-1])

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
 
DP = [0]
for i in range(N-1):
    act = float("inf")
    for k in range(K):
        if i-k < 0 : continue
        act = min(DP[-1-k] + abs(h[i-k]-h[i+1]) , act)
    DP += [act]
 
print(DP[-1])
x = list(map(int,input().split()))

for i in x:
	IF x[i] == 0:
    	i
    ELSE:
    	pass

### FIXED CODE ###

x = list(map(int,input().split()))
 
for i in range(len(x)):
  if x[i] == 0:
    print(i+1)
    break
# https://atcoder.jp/contests/code-festival-2016-quala/tasks/codefestival_2016_qualA_c

s = input()
k = int(input())
n = len(s)
ans = []
for i in range(n):
    t = (ord('z') - ord(s[i]) + 1) % 26
    if t <= k:
        ans.append('a')
        k -= t
    else:
        ans.append(s[i])
ans[-1] = chr(ord(ans[-1]) + k)
print(''.join(ans))

### FIXED CODE ###

# https://atcoder.jp/contests/code-festival-2016-quala/tasks/codefestival_2016_qualA_c

s = input()
k = int(input())
n = len(s)
ans = []
for i in range(n):
    t = (ord('z') - ord(s[i]) + 1) % 26
    if k - t >= 0:
        ans.append('a')
        k -= t
    else:
        ans.append(s[i])
if k > 0:
    k %= 26
    ans[-1] = chr(ord(ans[-1]) + k)
print(''.join(ans))
import str
S,T=map(chr, input(),split())
A,B map(int, input(),split())
U = chr(input())
if S==U:
  A-1
elif T==U:
  B-1
print(A,B)

### FIXED CODE ###

S, T = input().split()
A, B= map(int, input().split())
U = input()
if S == U:
    print(A - 1, B)
else:
    print(A, B - 1)
import numpy as np;




if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    for a in A:
        ans *= a
    
    if ans > 10 ** 18:
        print(-1)
        quit()
    print(ans)



### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1
for a in A:
    ans *= a
    if ans > 1000000000000000000:
            print(-1)
            quit()
print(ans)
import sys
input = sys.stdin.readlineN,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]
 
root = list(range(N+1))
comp_size = [1] * (N+1)
 
def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z
 
def merge(x,y):
  rx = find_root(x)
  ry = find_root(y)
  if rx == ry:
    return 0
  sx = comp_size[rx]
  sy = comp_size[ry]
  if sx > sy:
    root[ry] = rx
    comp_size[rx] += sy
  else:
    root[rx] = ry
    comp_size[ry] += sx
  return sx * sy
 
answer = []
x = N*(N-1)//2
for a,b in AB[::-1]:
  answer.append(x)
  x -= merge(a,b)
 
for a in answer[::-1]:
  print(a)
import sys
input = sys.stdin.readline

# 逆再生
# 連結成分がくっつくときに加点

N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]

root = list(range(N+1))
comp_size = [1] * (N+1)

def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z

def merge(x,y):
  rx = find_root(x)
  ry = find_root(y)
  if rx == ry:
    return 0
  sx = comp_size[rx]
  sy = comp_size[ry]
  if sx > sy:
    root[ry] = rx
    comp_size[rx] += sy
  else:
    root[rx] = ry
    comp_size[ry] += sx
  return sx * sy

answer = []
x = N*(N-1)//2
for a,b in AB[::-1]:
  answer.append(x)
  x -= merge(a,b)

for a in answer[::-1]:
  print(a)
提出情報



### FIXED CODE ###

import sys
input = sys.stdin.readline
 
N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]
 
root = list(range(N+1))
comp_size = [1] * (N+1)
 
def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z
 
def merge(x,y):
  rx = find_root(x)
  ry = find_root(y)
  if rx == ry:
    return 0
  sx = comp_size[rx]
  sy = comp_size[ry]
  if sx > sy:
    root[ry] = rx
    comp_size[rx] += sy
  else:
    root[rx] = ry
    comp_size[ry] += sx
  return sx * sy
 
answer = []
x = N*(N-1)//2
for a,b in AB[::-1]:
  answer.append(x)
  x -= merge(a,b)
for a in answer[::-1]:
  print(a)
N = int(input())
Nlist = [int(i) for i in input().split()]

sum = 0
cnt = 0
for i in range(N):
    if cnt > 2:
        break

    if Nlist[i] == (i + 1):
        continue
    else:
        sum += Nlist[i]
        cnt += 1

if cnt == 0 or sum == (N + 1):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

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

if a < b:
    A = a
    B = b
else:
    A = b
    B = a

if (B - A) % 2 != 0:
	print("IMPOSSIBLE")
else: 
	K = int(B - (B - A) / 2)
	print(str(K))
def gcd(a,b):
  while b:
    a,b = b,a%b
  return a

a,b,c,d=map(int,input().split())
al = b-a+1

x = int(b/c) -int((a-1)/c)
y = int(b/d) -int((a-1)/d)
lcm_xy = int(c*d/math.gcd(c,d))
xy = int(b/lcm_xy) -int((a-1)/lcm_xy)

print(al-(x+y-xy))

### FIXED CODE ###

def gcd(a,b):
  while b:
    a,b = b,a % b    
  return a

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

a_c = (a-1)//c
a_d = (a-1)//d
a_cd = (a-1)//(c*d//gcd(c,d))

b_c = b//c
b_d = b//d
b_cd = b//(c*d//gcd(c,d))

bb = b - (b_c + b_d - b_cd) 
aa = (a-1) - (a_c + a_d - a_cd)

print(bb - aa)
A=[]
for i in range(6):
  A.append(int(input()))
X=A[4]-A[0]
if X=<A[5]:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

A=[]
for i in range(6):
  A.append(int(input()))
X=A[4]-A[0]
if X<=A[5]:
  print("Yay!")
else:
  print(":(")
a,b,c,d=map(int,input().split())
if abs(a-c) <= d or (abs(a-b)<=d and ans(b-c)<=d):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

a,b,c,d=map(int,input().split())
if abs(a-c) <= d or (abs(a-b)<=d and abs(b-c)<=d):
    print('Yes')
else:
    print('No')
B,W = map(int, input().split())
N = B+W

factorial = [1]
for i in range(N+1):
    factorial.append( factorial[-1] * (i+1) % mod)
# print(factorial)

mod = 10**9+7

de_factorial = [0] * (N+1)
de_factorial[N] = pow(  factorial[N] , mod-2, mod  )

for i in range( N, 0, -1):
    de_factorial[i-1] = de_factorial[i] * i % mod
    
def comb(n,r):
    if n < r: return 0
    if n == r: return 1
    return (factorial[n] * de_factorial[r] * de_factorial[n-r]) % mod


p = [0] * (N+1) # Bを食べきった確率
q = [0] * (N+1) # Wを食べきった確率

de2 = de_factorial[2]
for i in range(1, N+1):
    p[i] = p[i-1] + comb(i-1 ,B-1) * de2 % mod 
    q[i] = q[i-1] + comb(i-1 ,W-1) * de2  % mod 
    de2 = de2 * de_factorial[2] % mod

    tmp = ( q[i-1] + 1-p[i-1] ) * de_factorial[2] % mod
    
    print(tmp)

### FIXED CODE ###

B,W = map(int, input().split())
N = B+W
mod = 10**9+7

factorial = [1]
for i in range(N+1):
    factorial.append( factorial[-1] * (i+1) % mod)
# print(factorial)



de_factorial = [0] * (N+1)
de_factorial[N] = pow(  factorial[N] , mod-2, mod  )

for i in range( N, 0, -1):
    de_factorial[i-1] = de_factorial[i] * i % mod
    
def comb(n,r):
    if n < r: return 0
    if n == r: return 1
    return (factorial[n] * de_factorial[r] * de_factorial[n-r]) % mod


p = [0] * (N+1) # Bを食べきった確率
q = [0] * (N+1) # Wを食べきった確率

de2 = de_factorial[2]
for i in range(1, N+1):
    p[i] = p[i-1] + comb(i-1 ,B-1) * de2 % mod 
    q[i] = q[i-1] + comb(i-1 ,W-1) * de2  % mod 
    de2 = de2 * de_factorial[2] % mod

    tmp = ( q[i-1] + 1-p[i-1] ) * de_factorial[2] % mod
    
    print(tmp)
#coding:utf-8
n = int(input())

if n=0:
    print ('0')
    exit()

i=0
s=''
while(n!=0):
    if n%(2**(i+1))!=0:
        s+='1'
        n-=(-2)**i
    else:
        s+='0'
    i+=1
print (s[::-1])


### FIXED CODE ###

#coding:utf-8
n = int(input())

if n==0:
    print ('0')
    exit()

i=0
s=''
while(n!=0):
    if n%(2**(i+1))!=0:
        s+='1'
        n-=(-2)**i
    else:
        s+='0'
    i+=1
print (s[::-1])
, m = map(int, input().split())
issafe = [True] * 10000
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * 10000
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(1, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

### FIXED CODE ###

n, m = map(int, input().split())
issafe = [True] * (n +1)
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * (n + 1)
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])
N, K = map(int, input().split())
a = list(map(int, input().split()))

sa = [0]
sb = [0]
for i in range(N):
    sa.append(sa[-1] + a[i])
    sb.append(sb[-1] + max(0, a[i]))

ans = 0
for i in range(N - K + 1):
	a = sa[i + K] - sa[i]
	b = sb[i + K] - sb[i]
    ans = max(ans, sb[N] - b + max(a, 0))

print(ans)


### FIXED CODE ###

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

sa = [0]
sb = [0]
for i in range(N):
    sa.append(sa[-1] + a[i])
    sb.append(sb[-1] + max(0, a[i]))

ans = 0
for i in range(N - K + 1):
    a = sa[i + K] - sa[i]
    b = sb[i + K] - sb[i]
    ans = max(ans, sb[N] - b + max(a, 0))
print(ans)
N,D=map(int,input().split())
print((N//(2D+1))+1)

### FIXED CODE ###

import math
N,D=map(int,input().split())
print(math.ceil(N/(2*D+1)))
n = int(input())
f = []

if n > 26:
	while n:
		n -= 1
		n, r = divmod(n, 26)
		f += [r]
else:
	f += [n]

g = ''
s = string. ascii_lowercase
f.reverse()
for i in f:
	g += s[i]

print(g)

### FIXED CODE ###

import string

n = int(input())
f = []

if n > 26:
	while n:
		n -= 1
		n, r = divmod(n, 26)
		f += [r]
else:
	f += [n-1]

g = ''
s = string. ascii_lowercase
f.reverse()
for i in f:
	g += s[i]

print(g)
n=int(input())
d = list(map(int, input().split()))
a=0
for i in range(0,len(d),1):
  if d[i]=d[-1]:
    break
  for j in d[i+1]:
    a+=d[i]*d[j]
print(a)

### FIXED CODE ###

n=int(input())
d = list(map(int, input().split()))
a=0
for i in range(0,n,1):
  if i==n:
     break
  for j in d[i+1:]:
    a+=d[i]*j
print(a)
N,K = input().split(' ')
N = int(N)
K = int(K)
num_list = list(map(int,input().split(' ')))
pivot = 0
ans = 0
while (pivot < len(num_list)):
  flag = 0
  tmp_num = 0
  for i in range(pivot, len(num_list), 1):
    tmp_num += num_list[i]
    if tmp_num >= K:
      ans += (N - i)
      pivot += 1
      break
    elif tmp_num < K and i == len(num_list)-1:
      flag = 1
      break
      
  if flag == 1:
    break
    
for i in range(pivot, len(num_list), 1):
  sum_num = sum(num_list[pivot + 1:])
  if sum_num < K:
    break
  ans += 1
      
print(ans)

### FIXED CODE ###

X,A = map(int,input().split(' '))
if X < A:
  print('0')
else:
  print('10')
## https://atcoder.jp/contests/abc170/submissions/14416787
import heapq
import sys
input=sys.stdin.readline

class SegmentTree():
    def __init__(self,n,init):
        self.offset=2**((n-1).bit_length())
        self.tree=[init]*(2*self.offset)
        self.init=init
    def update(self,pos,val):
        pos+=self.offset
        self.tree[pos]=val
        while pos>1:
            pos=pos//2
            self.tree[pos]=max(self.tree[2*pos],self.tree[2*pos+1])
    def query(self,l,r):
        l+=self.offset
        r+=self.offset
        ret=self.init
        while l<=r:
            ret=max(ret,self.tree[r])
            r=(r-1)//2
            ret=max(ret,self.tree[l])
            l=(l+1)//2
        return ret

import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=[int(input()) for _ in range(n)]

st=SegmentTree(n+1,0)

for ai in a:
    l=max(0,ai-k)
    r=min(n+1,ai+k+1)
    m=st.query(l,r)
    st.update(ai,m+1)

print(st.query(0,n+1))
  

### FIXED CODE ###


## https://atcoder.jp/contests/abc170/submissions/14416787
class SegmentTree():
    def __init__(self,n,init):
        self.offset=2**((n-1).bit_length())
        self.tree=[init]*(2*self.offset)
        self.init=init
    def update(self,pos,val):
        pos+=self.offset
        self.tree[pos]=val
        while pos>1:
            pos=pos//2
            self.tree[pos]=max(self.tree[2*pos],self.tree[2*pos+1])
    def query(self,l,r):
        l+=self.offset
        r+=self.offset
        ret=self.init
        while l<=r:
            ret=max(ret,self.tree[r])
            r=(r-1)//2
            ret=max(ret,self.tree[l])
            l=(l+1)//2
        return ret

import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=[int(input()) for _ in range(n)]

st=SegmentTree(300001,0)
##queryが開区間でない
for ai in a:
    l=max(0,ai-k)
    r=min(300001,ai+k)
    m=st.query(l,r)
    st.update(ai,m+1)

print(st.query(0,300001))
input = open(0).readline
s = {}
s['A'] = list(input().strip())
s['B'] = list(input().strip())
s['C'] = list(input().strip())

play_order = {'A':'B', 'B':'C', 'C':'A'}

def play(player):
    
    if  len(s[player]) == 0:
        play(play_order['A'])
    
    next_play = s[player].pop()
    if len(s[player]) == 0:
        print(player)
        return player
    #print(next_play)
    play(next_play.upper())
        
play('A')
        
        




### FIXED CODE ###

input = open(0).readline

x = [0]*3
for i in range(3):
    x[i] = int(input().strip())
a, b, h = x[0], x[1], x[2]
ans = int(((a + b) * h)/2)
print(ans)
s=list(input())
k=int(input())
ss=[]
for i in range(len(s)):
               ss.append(int(s[i]))
for i in range(len(s)):
  k-=ss[i]*5*(10**15)
  if k<ss[i+1]:
    break
    
print(s[i+1])
    




### FIXED CODE ###

import sys
s=input()
k=int(input())
for i in range(len(s)):
    if s[i]!="1":
        print(s[i])
        sys.exit()
    if s[i]=="1" and i+1==k:
        print(1)
        sys.exit()
i=0
while 1:
    x = raw_index()
    i++
    if x == 0:
        break
    print 'Case %s: %s' % (i,x)

### FIXED CODE ###


i=0
while 1:
    x = raw_input()
    if x == "0":
        break
    i = i+1
    print "Case %s: %s" %(i,x)
import numpy as np
 
N = input()
X = list(map(int, input()))
ans=0
for P in range(max(X)):
  sum = np.sum(map(lambda x: (x-P)**2, X))
    
  if sum >= ans:
    ans = sum
    
print(ans)

### FIXED CODE ###

import numpy as np
 
N = input()
X = list(map(int, input().split()))
ans=9999999
for P in range(0, 101):
  sum = np.sum(list(map(lambda x: (x-P)**2, X)))
  ans = min(ans, sum)
    
print(ans)
n = int(input())
a = [int(input()) for i in range(n)]
dict = {}
for i in a:
    if i in dict:
        dict[i] += 1
    else:
        dict[i] = 1
ans = 0
for i in dict:
    if dict[i]%2==0:
        continue
    else:
        ans += 1
print(ans)

### FIXED CODE ###

n = input()
if "9" in n:
  print("Yes")
else:
  print("No")
import numpy as np

N, K = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = [1<<30]*N
dp[0] = 0

for i in range(1, N):
  dp[i] = min((dp[j]+abs(h[i]-h[j])) for j in range(max(0, i-K), i))

print(dp[N-1])

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
 
dp = [1<<30]*(N)
dp[0] = 0
 
for i in range(1, N):
  dp[i] = min((dp[j]+abs(h[i]-h[j])) for j in range(max(0, i-K), i))
 
print(dp[N-1])
A,B,C = map(int,input())
print(B//A,C)

### FIXED CODE ###

A,B,C = map(int,input().split())
print(min(B//A,C))
N=int(input())
print int((N*800-(N/15)*200))

### FIXED CODE ###

N=int(input())
print (int((N*800-int(N/15)*200)))
N = int(input())
a = list(map(int,input().split()))
q = int(input())
num = []
summ = 0
for i in range(10**5):
  num.append(0)
for i in range(N):
  num[a[i]-1] += 1
  summ += a[i]
for i in range(q):
  b,c = map(int,input().split())
  summ += (c-b)*a[b-1]
  a[c-1] += a[b-1]
  a[b-1] = 0
  print(summ)


### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
q = int(input())
num = []
summ = 0
for i in range(10**5):
  num.append(0)
for i in range(N):
  num[a[i]-1] += 1
  summ += a[i]
for i in range(q):
  b,c = map(int,input().split())
  summ += (c-b)*num[b-1]
  num[c-1] += num[b-1]
  num[b-1] = 0
  print(summ)
x,y = map(int,input().split())
print(int(x*y/gcd(x,y)))


### FIXED CODE ###

import fractions
x,y = map(int,input().split())
print(x*y//fractions.gcd(x,y))
from collections import Counter
import numpy as np
import pandas as pd
N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res= counted.most_common()

res = pd.DataFrame(res)
[print(i) for i in res[0][res[1] == res[1].max()]]


### FIXED CODE ###

from collections import Counter


N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]
ans = []
for k, v in counted.items():
    if v == res_max:
        ans.append(k)

ans.sort()
print(*ans, sep="\n")
# -*- coding: utf-8 -*-
# 整数の入力
A = int(input())
B = int(input())
# 出力
print(A*B)

### FIXED CODE ###

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

print(A*B)
n=int(input())
S=list(map(int,input().split()))
print(len(list(set(S))))


### FIXED CODE ###

n=int(input())
S=[]
for i in range(n):
    S.append(input())
print(len(list(set(S))))
def solve():
    import math
    N,M = [int(i) for i in input().split()]
    A = list(map(int, input().split()))
    lcm = A[0]
    for i in range(1, N):
        lcm = lcm * A[i] // math.gcd(lcm, A[i])
    first = lcm * 0.5
    ans = int((M-first)//lcm + 1)
    print(ans)

if __name__ == "__main__":
    solve()

### FIXED CODE ###

def solve():
    import math
    N,M = [int(i) for i in input().split()]
    A = list(map(int, input().split()))

    lcm = A[0]
    for i in range(1, N):
        lcm = lcm * A[i] // math.gcd(lcm, A[i])
    first = lcm // 2

    ans_exists = True
    for i in range(N):
        if first % A[i] == 0:
            ans_exists = False

    if ans_exists:
        ans = int((M-first) // lcm + 1)
        print(ans)
    else:
        print('0')

if __name__ == "__main__":
    solve()