Harryxun/stf_run huggingface dataset:
import numpy as np

N = int(input())
B = [int(i)*2 for i in input().split()]

#a = [[0]*N for i in range(N)]
A = np.identity(N)
for i in range(N-1):
    #A[i][i] += 1
    A[i][i+1] += 1

A[-1][0] += 1
#A[-1][-1] += 1
#A = np.array(a)
b = np.array(B)

x = np.linalg.solve(A, b)

print(*x.astype(int))

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

s = sum(a)
x = [None]*N
x[0] = s - 2 * (sum(a[1::2]))

for i in range(1,N):
    x[i] = 2 * a[i-1] - x[i-1]

print(*x)
n,x=map(int,input().split())
a=list(input().split())
count=0
d=0
i=0
while d<=x:
    if i==0:
        d=0
        if d<=x:
            count=1
        i+=1
    elif count<=n+1:
        d=d+int(a[i-1])
        if d<=x:
            count+=1
            i+=1
    else:
        break;
print(count)

### FIXED CODE ###

n,x=map(int,input().split())
a=list(input().split())
count=0
d=0
i=0

while d<=x:
    if i==0:
        d=0
        count=1
        i+=1
    elif count<=n+1 and i<n+1:
        d=d+int(a[i-1])
        if d<=x:
            count+=1
            i+=1
        else:
            break;
    else:  
        break;
print(count)
a = input())
b = input())
a = int(a)
b = int(b)
print(a*b, 2*(a+b), end='')

### FIXED CODE ###

(a,b) = list(map(int, input().split()))
print ("%d %d" % (a * b, a * 2 + b * 2))
import itertools

def findRoot(uf,value):
  if uf[value]==None:
    return value
  else:
    uf[value]=findRoot(uf,uf[value])
    return uf[value]

n,m=[int(x) for x in input().split(' ')]

uf=[None]*n
b=[]
s=[1]*n
r=[]

for x in range(0,m):
  b.append([int(x)-1 for x in input().split(' ')])

for x in b[::-1]:
  r1=findRoot(uf,x[0])
  r2=findRoot(uf,x[1])

  if r1==r2:
    r.append(0)
  else:
    r.append(s[r1]*s[r2])
#木の結合
    uf[r2]=r1
    s[r1]+=s[r2]


for x in itertools.accumulate(r[::-1]):
  print(x)

### FIXED CODE ###

import itertools
import sys

def findRoot(uf,value):
  if uf[value]==None:
    return value
  else:
#経路圧縮
    uf[value]=findRoot(uf,uf[value])
    return uf[value]


sys.setrecursionlimit(50000)
n,m=[int(x) for x in input().split(' ')]

uf=[None]*n
b=[]
s=[1]*n
r=[]

for x in range(0,m):
  b.append([int(x)-1 for x in input().split(' ')])

for x in b[::-1]:
  r1=findRoot(uf,x[0])
  r2=findRoot(uf,x[1])

  if r1==r2:
    r.append(0)
  else:
    r.append(s[r1]*s[r2])
#木の結合
    uf[r2]=r1
    s[r1]+=s[r2]

for x in itertools.accumulate(r[::-1]):
  print(x)
R = input(str())

print R * π

### FIXED CODE ###

import math

pi = math.pi

R = int(input())

print(2 * R * pi)
from collections import Counter
abc = input().rstrip()
c = COunter(abc)
if c['5'] == 2 and c['7'] == 1:
  print('YES')
else:
  print('NO')
  

### FIXED CODE ###

from collections import Counter
abc = input().rstrip()
c = Counter(abc)
if c['5'] == 2 and c['7'] == 1:
  print('YES')
else:
  print('NO')
N = int(input())
A = list(map(int, input().split()))

from functools import lru_cache
@lru_cache(maxsize = None)
def gcd(x, y):
    if x == 0 or y == 0:
        return max(x, y)
    if y == 0:
        return x
    return gcd(y, x % y)


def L(x):
    if x <= 0:
        return 0
    else:
        return gcd(L(x-1), A[x-1])

def R(x):
    if x >= N - 1:
        return 0
    else:
        return gcd(A[x+1], R(x+1))

for i in range(N-1, -1, -1):
    R(i)

w = 1
for i in range(N):
    w = max(w, gcd(L(i), R(i)))

print(w)


### FIXED CODE ###

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

def gcd(x, y):
    if x == 0 or y == 0:
        return max(x, y)
    g = x % y
    if g == 0:
        return y
    return gcd(y, g)

R = [0] * N
R[N-1] = w = 0
for i in range(N-2, -1, -1):
    R[i] = w = gcd(w, A[i+1])

L = [0] * N
L[0] = w = 0
for i in range(1, N):
    L[i] = w = gcd(w, A[i-1])

w = 1
for i in range(N):
    w = max(w, gcd(L[i], R[i]))

print(w)
dict = { 'b' : 'd', 'd' : 'b', 'p' : 'q', 'q' : 'p' }
s = raw_input()
t = ''.join(map(lambda x : dict[x], list(S[::-1])))
print ['No', 'Yes'][s == t]

### FIXED CODE ###

dict = { 'b' : 'd', 'd' : 'b', 'p' : 'q', 'q' : 'p' }
s = raw_input()
t = ''.join(map(lambda x : dict[x], list(s[::-1])))
print ['No', 'Yes'][s == t]
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

from fractions import Fraction
mod = 1e9+7
n = ii()
cnd = {}
azero = 0
bzero = 0
for _ in range(n):
    a,b = iim()
    if a*b == 0:
        if a == 0 and b != 0:
            azero += 1
        elif a != 0 and b == 0:
            bzero += 1
    else:
        ratio = Fraction(a,b)
        before = cnd.get(ratio,False)
        check = cnd.get(-1*Fraction(1,ratio),False)
        if before:
            cnd[ratio] = [before[0]+1,before[1]]
        elif check:
            cnd[-1*Fraction(1,ratio)] = [check[0],check[1]+1]
        else:
            cnd[ratio] = [1,0]

cnd[0] = [azero,bzero]
noreg = 0
ans = 1
#print(cnd)
for item in cnd.values():
    if item[0] == 0  or item[1] == 0:
        noreg += max(item[0],item[1])
    else:
        ans *= (2**item[0]+2**item[1]-1)
        ans %= mod
#print(ans,noreg)
print(int((ans*((2**noreg)%mod)-1)%mod))

### FIXED CODE ###

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

#from fractions import Fraction
from math import gcd

mod = int(1e9+7)
n = ii()
cnd = {}
azero = 0
bzero = 0
allzero = 0
for _ in range(n):
    a,b = iim()
    if a == 0:
        if b != 0:
            azero += 1
        else:
            allzero += 1
    elif b == 0:
        bzero += 1            
    else:
        '''
        ratio = Fraction(a,b)
        before = cnd.get(ratio,False)
        if before:
            cnd[ratio] = [before[0]+1,before[1]]
        else:
            invratio = Fraction(-b,a)
            check = cnd.get(invratio,False)
            if check:
                cnd[invratio] = [check[0],check[1]+1]
            else:
                cnd[ratio] = [1,0]
        '''
        g = gcd(a,b)
        a //= g
        b //= g
        if a < 0:
            a *= -1
            b *= -1
        cnd[(a,b)] = cnd.get((a,b),0)+1


noreg = 0
if azero == 0 or bzero == 0:
    noreg += max(azero,bzero)
    ans = 1
else:
    ans = (2**azero%mod + 2**bzero%mod - 1)%mod
#print('ans block')
#print(ans,noreg)
#print(cnd)
for k,item in cnd.items():
    a,b = k
    if b>0:
        m = cnd.get((b,-a),False)
        if m:
            ans *= (2**item%mod+2**m%mod-1)%mod
        else:
            noreg += item
    else:
        m = cnd.get((-b,a),False)
        if not m:
            noreg += item
#print('hoge')
print(int((ans*((2**noreg)%mod)-1+allzero)%mod))
s = input()
n = len(s)
X = x*n
print(X)

### FIXED CODE ###

s = input()
n = len(s)
X = "x" *n
print(X)
while True:
  count = int(input())
  for a in range(count):
    q,w =int(input()),int(input())
    t=q+w
    if t >10**80:
      print "overflow"
    else:
      print t

### FIXED CODE ###

count =int(input())
for a in range(count):
  x,y=int(input()),int(input())
  ans = str(x+y)
  if len(ans) >80:print "overflow"
  else:
    print ans
a, b = map(int, input().split())

print("{0} {1} {2:.8f}".format(a // b, a % b, a / b))




### FIXED CODE ###

import math

r = float(input())

print(f'{math.pi * r ** 2} {2 * math.pi * r}')
n = int(input())
l1 = 2
l2 = 1
for i in range(1, n):
    l3 = l1 + l2
    l1 = l2
    l2 = l3
print(l3)


### FIXED CODE ###

n = int(input())
l1 = 2
l2 = 1
for i in range(1, n):
    l3 = l1 + l2
    l1 = l2
    l2 = l3
print(l2)
import math
n = int(input())
leng = int(math.log(n, 26))
res = []
for i in reversed(range(leng)):
    leng = int(math.log(n, 26))
    num = n // 26**leng
    res.append(chr(96+num))
    n -= 26**leng*num

if n%26 != 0:
    res.append(chr(96+n%26))

print(''.join(res))

### FIXED CODE ###

n = int(input())
ans = ''
while n != 0:
    n -= 1
    ans += chr(ord('a') + n % 26)
    n //= 26
print(ans[::-1])
N = int(input())
pl = list(map(int, input().split()))

cnt = 0
for i in range(1,N+1):
    if pl[i-1] == i:
        a = pl[i - 1]
        pl[i - 1] = pl[i]
        pl[i] = a
        cnt += 1
print(cnt)


### FIXED CODE ###

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

cnt = 0
for i in range(1,N):
    if pl[i-1] == i:
        a = pl[i - 1]
        pl[i - 1] = pl[i]
        pl[i] = a
        cnt += 1
if pl[N-1] == N:
    cnt += 1
print(cnt)
a,b=map(int(input().split())
if a%2==0 or b%2==0:print("Even")
else:print("Odd")


### FIXED CODE ###

a,b=map(int,input().split())
if a%2==0 or b%2==0:print("Even")
else:print("Odd")
N = int(input())
A = array.array('L', list(map(int, input().split())))
MAX = 10**5
X = array.array('L', [0]) * MAX
Y = array.array('L', range(MAX))

for i in range(len(A)): X[A[i]] += 1
    
Q = int(input())
cur = sum(array.array('L', (X[i]*Y[i] for i in range(len(X)))))

for i in range(Q):
    [b, c] = list(map(int, input().split()))
    cur = cur - X[b]*b + X[b]*c
    print(cur)
    X[c] += X[b]
    X[b] = 0


### FIXED CODE ###

import array

N = int(input())
A = array.array('L', list(map(int, input().split())))
MAX = 10**5+1
X = array.array('L', [0]) * MAX
Y = array.array('L', range(MAX))

for i in range(len(A)): X[A[i]] += 1
    
Q = int(input())
cur = sum(array.array('L', (X[i]*Y[i] for i in range(len(X)))))

for i in range(Q):
    [b, c] = list(map(int, input().split()))
    cur = cur - X[b]*b + X[b]*c
    print(cur)
    X[c] += X[b]
    X[b] = 0
A, B, C = map(int, input().split())
if (A+B)>=C:
print('Yes')
else:
print('No')

### FIXED CODE ###

A, B, C = map(int, input().split())
if (A+B) >= C:
    print('Yes')
else:
      print('No')
b = input()
if b = 'A':
  print('T')
elif b = 'T':
  print('A')
elif b = 'C':
  print('G')
elif b = 'G':
  print('C')

### FIXED CODE ###

b = input()
if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'C':
  print('G')
elif b == 'G':
  print('C')
S = set(input())
Alp = "abcdefghijklmnopqrstuvwxyz"
L = []
for i in Alp:
    if i not in S:
        L.append(i)
if L == S:
    print("None")
else:
    print(min(L))

### FIXED CODE ###

S = set(input())
Alp = list("abcdefghijklmnopqrstuvwxyz")
MM = []
for i in Alp:
    if i not in S:
        MM.append(i)
if MM == []:
    print("None")
else:
    print(min(MM))
import sys

ans = 0
input = sys.stdin.readline
N = int(input())
S = input().rstrip()

list_S = list(S)

for i in range(N):
    if list_S[i] == 'A':
        if list_S[i + 1] == 'B':
            if list_S[i + 2] == 'C':
                ans += 1
print(ans)

### FIXED CODE ###

import sys

ans = 0
input = sys.stdin.readline
N = int(input())
S = input().rstrip()

list_S = list(S)

for i in range(N - 2):
    if list_S[i] == 'A':
        if list_S[i + 1] == 'B':
            if list_S[i + 2] == 'C':
                ans += 1
print(ans)
import math
a,b,c=map(int,input().split())

if c==0:
    print("YES")
elif c%math.gcd(a,b)==0 and c!=0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

a,b,c=map(int,input().split())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
if c==0:
    print("YES")
elif c%gcd(a,b)==0 and c!=0:
    print("YES")
else:
    print("NO")
import math
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))

print(math.ceil(n/min(l))-1+5)



### FIXED CODE ###

import math
n = int(input())
l = [int(input()) for i in range(5)] 
print(math.ceil(n/min(l))-1+5)
n,a,b = map(int,input().split())
if n%2 == 0
	if a == 1:
		if b == n or b == 2:
			print('Borys')
		else:
			print('Alice')
	if b == n
		print('Alice')
else:
	if a == 1:
		if b == n-1:
			print('Borys')
		else:
			print('Alice')
	elif b == n:
		if a == n-1:
			print('Alice')
		else:
			print('Borys')
	else:
		if (b-a)%2 == 1:
			print('Borys')
		else:
			print('Alice')

### FIXED CODE ###

n,a,b = map(int,input().split())
if n%2 == 0:
	if (b-a)%2 == 1:
		print('Borys')
	else:
		print('Alice')
else:
	if (b-a)%2 == 1:
		print('Borys')
	else:
		print('Alice')
S,T = map(int,input().split())
print(T+S)

### FIXED CODE ###

S,T = map(str,input().split())
print(T+S)
import math
a, b, x = list(map(int,input().split()))

if 2*x < a*a*b:
    hatena = 2*x/a/b
    print(90-math.degrees(math.atan(hatena/b)))
else:
    hatena = 2*x/a/a - b
    print(90-math.degrees(math.atan(a/(b-hatena))))
    

### FIXED CODE ###

import math
a,b,x=list(map(int,input().split()))
maxv=a*a*b
sukima=maxv-x
teimenseki=sukima/a
y=teimenseki*2/a
 
if x > (maxv/2):
    print(math.degrees(math.atan(y/a)))
else:
    tei=x/a
    z=tei*2/b
    print(math.degrees(math.atan(b/z)))
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	#a = int(input())
	x, y, a, b, c = IN()
	al = list(IN())
	al.sort(reverse=True)
	bl = list(IN())
	bl.sort(reverse = True)
	cl = list(IN())
	cl.sort(reverse=True)
	#s = input()
	tx=x-1
	ty=y-1
	tc=0
	while True:
		if tc == len(cl):
			break
		al_min=al[tx] if tx >= 0 else 10**10
		bl_min=bl[ty] if ty >= 0 else 10**10
		cl_max=cl[tc]
		if al_min >= cl_max and bl_min >= cl_max:
			break
		elif al_min <= bl_min and al_min < cl_max:
			tx -= 1
			rc += 1
		elif bl_min<= al_min and bl_min < cl_max:
			ty -= 1
			tc += 1
		else:
			break
	ret=sum(al[:tx+1])+sum(bl[:ty+1])+sum(cl[:tc])
	print(ret)
			
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

### FIXED CODE ###

import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	#a = int(input())
	x, y, a, b, c = IN()
	al = list(IN())
	al.sort(reverse=True)
	bl = list(IN())
	bl.sort(reverse = True)
	cl = list(IN())
	cl.sort(reverse=True)
	#s = input()
	tx=x-1
	ty=y-1
	tc=0
	while True:
		if tc == len(cl):
			break
		al_min=al[tx] if tx >= 0 else 10**11
		bl_min=bl[ty] if ty >= 0 else 10**11
		cl_max=cl[tc]
		if al_min >= cl_max and bl_min >= cl_max:
			break
		elif al_min <= bl_min and al_min < cl_max:
			tx -= 1
			tc += 1
		elif bl_min<= al_min and bl_min < cl_max:
			ty -= 1
			tc += 1
		else:
			break
	ret=sum(al[:tx+1])+sum(bl[:ty+1])+sum(cl[:tc])
	print(ret)
			
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
A1,A2,A3=map(int,input().split())
A=A1+A2+A3
if　A>=22:
  print("bust")
else
	print("win")


### FIXED CODE ###

li = list(map(int,input().split()))
if li[0]+li[1]+li[2]>=22:
  print('bust')
else:
	print('win')
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.append(x)
a=sorted(a)
b=[0]*n
for i in range(n):
  b[i]=(a[i+1]-a[i])
import fractions
x1=(b[0]*b[1]) // fractions.gcd(b[0],b[1])
i=2
while i<=n-1:
  lcm=(x1*b[i])//fractions.gcd(x1,b[i])
  x1=lcm
  i+=1
print(x1)

### FIXED CODE ###

n,x=map(int,input().split())
a=list(map(int,input().split()))
a.append(x)
a.sort(reverse=True)
b=[]
for i in range(n):
    b.append(a[i]-a[i+1])
import fractions as f
maxi=float('inf')
if len(b)==1:
    print(b[0])
    exit()
for i in range(n-1):
    tmp=f.gcd(b[i],b[i+1])
    maxi=min(maxi,tmp)
print(maxi)
A = int(input())
B = int(input())

rist = [ A+B , A-B , A*B]

rist.sort()

print(rist[3])

### FIXED CODE ###

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

rist = [ A+B , A-B , A*B]

print(max(rist))
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

def sunuke(ai, bi, ci):
    global ans

    if ai > N-1:
        print(ans)
    elif bi > N-1:
        sunuke(ai+1, 0, 0)
    elif ci > N-1:
        sunuke(ai, bi+1, 0)

    elif A[ai] >= B[bi]:
        sunuke(ai,bi+1,ci)
    elif B[bi] >= C[ci]:
        sunuke(ai, bi, ci+1)
    else:
        ans += 1
        sunuke(ai, bi, ci+1)

ans = 0
sunuke(0,0,0)


### FIXED CODE ###

import bisect

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

A.sort()
C.sort()
#ある一つのBについて、それ以下のAの個数とそれ以上のCの個数を二分探索で求める
ans = 0
for i in range(N):
    lw_a = bisect.bisect_left(A, B[i])
    up_c = N - bisect.bisect_right(C, B[i])
    ans += lw_a * up_c
print(ans)
a =  map(int,intpu().split())
if len(set(a)) == 2:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = map(int,input().split())
if len(set(a)) == 2:
  print("Yes")
else:
  print("No")
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())
S = list(input())

if S[0]!='B' or S[-1]!='B':
    print(0)
    exit()

mod = 10**9 + 7
cnt_l = 1
cnt_r = 0
pre_s = 'B'
pre_d = 1 #1がleft
ans = 1

for i in range(1,N*2):
    s = S[i]

    if pre_s==s:
        if pre_d==1:
            d = 0
            ans *= cnt_l - cnt_r #ここまでに出てきたLeftの総数 - ここまでに出てきたrightの総数
            cnt_r += 1
        else:
            d = 1
            cnt_l += 1
    else:
        if pre_d==1:
            d = 1
            cnt_l += 1
        else:
            d = 0
            ans *= cnt_l - cnt_r #ここまでに出てきたLeftの総数 - ここまでに出てきたrightの総数
            cnt_r += 1
    pre_s = s
    pre_d = d

for i in range(1,N+1):
    ans *= i
    ans %= mod
if cnt_l!=N:
    print(0)
    exit()

print(ans)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
M,D = map(int,input().split(' '))

cnt = 0
for i in range(1,M+1):
    for j in range(1,D+1):
        dd = j // 10
        d  = j % 10
        if dd>=2 and d>=2 and d*dd==i:
            cnt += 1
print(cnt)
n=input()
l=list(map(int,input().split))
l.sort()
count=0
for i in range(n):
    if i%2==1 and l[i]%2==1:
        count += 1
print(count)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
count=0
for i in range(n):
    if i%2==0 and l[i]%2==1:
        count += 1
print(count)
N = int(input())
A = list(map(int,input().split()))
if A[0] == 0 or A[N-1] == 0:
  A_tmp = A[0]
  A_ = A[1:N]
  A_.append(A_tmp)
  A = A_
  flag = 1
else:
  flag = 0
if A[0]<A[N-1]:
  start = A[0]
else:
  start = A[N-1]
for i in range(2,2*start+1,2):
  ans = [i]
  A_tmp = A[:]
  A_tmp[0] -= ans[0]//2
  A_tmp[N-1] -= ans[0]//2 
  for j in range(1,N):
    if A_tmp[j-1]<A_tmp[j]:
      ans.append(A_tmp[j-1]*2)
      A_tmp[j] -= ans[j]//2
      A_tmp[j-1] -= ans[j]//2
    else:
      ans.append(A_tmp[j]*2)
      A_tmp[j] -= ans[j]//2
      A_tmp[j-1] -= ans[j]//2
  if sum(A_tmp)==0:
    break
if flag == 1:
  tmp = [0]*N
  tmp[1:] = ans[:N-1]
  tmp[0] = ans[N-1]
  ans = tmp
ans = map(str,ans)
print(' '.join(ans))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
S = sum(A)//2
S = 2*(S - sum(A[1::2]))
ans = [S]
for i in range(1,N):
  ans.append(2*A[i-1]-ans[i-1])
print(' '.join(map(str,ans)))
import copy
import sys
sys.setrecursionlimit(10**7)

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

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

def main():
    n, m = map(int, input().split())
    # これだと72がREになる
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    # Aの要素が複数ならlcmを計算する
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    # 元のAの値とlcmの半分の値を割り切れるものがあったら0
    #for i in A_:
    for i in A:
        if (a_lcm / 2) % i == 0:
        # if (a_lcm / i) % 2 == 0: 
            print(0)
            exit()
        # else:
        #     continue
    print(2)
    # # mがlcmの半分よりも小さかったら0
    # if (a_lcm / 2) > m:
    # # if a_lcm > m * 2:
    #     print(0)
    #     exit()
    # else:
    #     # # あとは定数倍の数調べて終わり
    #     ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    #     print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
q = deque([])

for i in range(N):
    if B[i]>A[i] and B[i]>B[(i-1)%N]+B[(i+1)%N]:
        q.append(i)

ans = 0

while q:
    i = q.popleft()
    sub = B[(i-1)%N]+B[(i+1)%N]
    
    if B[i]%sub>=A[i]:
        ans += (B[i]-B[i]%sub)//sub
        B[i] %= sub
    else:
        if (B[i]-A[i])%sub==0:
            ans += B[i]-A[i]//sub
            B[i] = A[i]
        else:
            print(-1)
            exit()
            
    for j in [i-1, i+1]:
        if B[j]>A[j] and B[j]>B[(j-1)%N]+B[(j+1)%N]:
            q.append(j)

if A==B:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
q = deque([])

for i in range(N):
    if B[i]>A[i] and B[i]>B[(i-1)%N]+B[(i+1)%N]:
        q.append(i)

ans = 0

while q:
    i = q.popleft()
    sub = B[(i-1)%N]+B[(i+1)%N]
    
    if B[i]%sub>=A[i]:
        ans += (B[i]-B[i]%sub)//sub
        B[i] %= sub
    else:
        if (B[i]-A[i])%sub==0:
            ans += (B[i]-A[i])//sub
            B[i] = A[i]
        else:
            print(-1)
            exit()
            
    for j in [(i-1)%N, (i+1)%N]:
        if B[j]>A[j] and B[j]>B[(j-1)%N]+B[(j+1)%N]:
            q.append(j)

if A==B:
    print(ans)
else:
    print(-1)
n = raw_input()
print("%d %d" % (int(n[0]) * int(n[2]), 2 * (int(n[0]) + int(n[2])) ))

### FIXED CODE ###

a, b = map(int, raw_input().split())
print ("%d %d" % (a * b, 2 * (a + b)))
A=input()
B=input()
print(A*B)

### FIXED CODE ###

a,b = (int(x) for x in input().split())
print(a*b)
import sys

values = [int(input()) for i in range(int(input()))]
maxv = - sys.maxsize - 1
minv = values[0]

for value in enumerate(values):
    maxv = max(maxv, value - minv)
    minv = min(minv, value) 
print(maxv)



### FIXED CODE ###

values = [int(input()) for _ in range(int(input()))]
maxv = values[1] - values[0]
minv = values[0]

for val in values[1:]:
    maxv = max(maxv, val - minv)
    minv = min(minv, val)         # 今までの最小値を保持(自分と自分を比較しない様に、最大値の評価後に計算)
print(maxv)