Harryxun/stf_run huggingface dataset:
a,b,c,k=map(int,input().split())
print(min(k,a)+min(max(k-a,0),abs(k-a-b))+min(max(k-a-b,0),abs(k-a-b-c))

### FIXED CODE ###

a,b,c,k=map(int,input().split())
d=k-a
if d<0:
  print(k)
else:
  ans=a
  d-=b
  if d<0:
    print(ans)
  else:
    print(ans-d)
import sys
N=int(input())
if N=1:
    print("1")
elif N=2:
    print("2")
else:
    for i in range(N):
        if i**2>N:
            print((i-1)**2)
            sys.exit()
        else:
            pass


### FIXED CODE ###

import sys
N=int(input())
if N==1:
    print("1")
elif N==2:
    print("1")
else:
    for i in range(N):
        if i**2>N:
            print((i-1)**2)
            sys.exit()
        else:
            pass
#include <iostream>
#include <vector>
#include<algorithm>
#define intt long long
const intt NUM = 1000000007;

int main(){
	intt N, K, initi, initi2{}; std::cin >> N >> K;
	std::vector<intt> A(N); for (auto& r : A) { std::cin >> r; }
	for (intt i = 0; i < N - 1; ++i) for (intt j = i + 1; i < N; ++i) if (A[i] > A[j]) {++initi; initi %= NUM;}
	for (intt i = 0; i < N; ++i) for (intt j = 0; j < N; ++j) if (A[i] > A[j]) { ++initi2; initi2 %= NUM; }
	std::cout << ((((initi % NUM) * K) % NUM) + ((initi2 % NUM) * (((K * (K - 1)) % NUM) / 2) ) % NUM)<< std::endl;
	return 0;
}

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
total_1 = 0
for i in range (n - 1):
    for j in range (i + 1, n):
        if a[i] > a[j]:
            total_1 += 1
total_2 = 0
for i in range (n):
    for j in range (n):
        if a[i] > a[j]:
            total_2 += 1
print((total_1 * k + (total_2 * k * (k - 1)) // 2) % (10 ** 9 + 7))
A, B = map(int, raw_input().split()
print (A + B) % 23


### FIXED CODE ###

A, B = map(int, raw_input().split())
print (A + B) % 24
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,*A = map(int, readline().split())
A.sort()
print(A[-1]-A[0])


### FIXED CODE ###

"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,*A = map(int, read().split())
A.sort()
print(A[-1]-A[0])
import math
a,b = map(int,input().split())
if a % b == 0:
    print("-1")
else:
    c =  math.gcd(a,b)
    print(c * a)

### FIXED CODE ###

import math
a,b = map(int,input().split())
if a % b == 0:
    print("-1")
else:
    k = 1
    while ( a * k ) % b == 0:
        k += 1
    print(a * k)
import sys
import math


def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


fin = sys.stdin.readline
N, K = [int(elem) for elem in fin().split()]

for i in range(1, K):
    result = int(permutations_count(N-K+1, i) / math.factorial(i-1))
    print(int(result % 1000000007))

result = int(combinations_count(N-K+1, K))
print(int(result % 1000000007))


### FIXED CODE ###

import sys
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


fin = sys.stdin.readline
N, K = [int(elem) for elem in fin().split()]

for i in range(1, K+1):
    if (N-K+1) < i:
        print(0)
    else:
        result = int(combinations_count(N-K+1, i) * combinations_count(K-1, i-1))
        print(int(result % 1000000007))
# coding: utf-8
# Your code here!
import math

n,m,l = map(int,input().split())
adj = [[float('inf') for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a,b,c = map(int,input().split())
    if c <= l:
        adj[a-1][b-1] = c
        adj[b-1][a-1] = c
    
import heapq

class Dijkstra(object):
    def dijkstra(self, adj, start):
        num = len(adj)          # グラフのノード数
        dist = [[float('inf'), float('inf')] for i in range(num)] # 始点から各頂点までの最短距離を格納する
        
        dist[start] = (0, 0)
        q = []                  # プライオリティキュー．各要素は，(startからある頂点vまでの仮の距離, 頂点vのID)からなるタプル
        heapq.heappush(q, (0, 0, start)) # 始点をpush

        while len(q) != 0:
            prov_cost, prov_fuel, src = heapq.heappop(q) # pop
            
            # 他の頂点の探索
            for dest in range(num):
                cost = adj[src][dest]
                if cost != float('inf'):
                    if prov_fuel + cost <= l:
                        new_cost = prov_cost
                        new_fuel = prov_fuel + cost
                    else:
                        new_cost = prov_cost + 1
                        new_fuel = cost
                    if dist[dest][0] > new_cost or (dist[dest][0] == new_cost and dist[dest][1] > new_fuel):
                        dist[dest] = (new_cost, new_fuel)
                        heapq.heappush(q, (new_cost, new_fuel, dest))
                        
        return dist



ans = []
for i in range(n):
    ans.append(Dijkstra().dijkstra(adj, i))
q = int(input())
for _ in range(q):
    s,t = map(int,input().split())
    if ans[s-1][t-1][0] == float('inf'):
        print(-1)
    else:
        print(ans[s-1][t-1][0])

### FIXED CODE ###

# coding: utf-8
# Your code here!

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

c = a - 2 * b
if c > 0:
    print(c)
else:
    print(0)
n = input()
m = input()
if m == n:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n,m = map(int, input().split())

if m == n:
  print('Yes')
else:
  print('No')
answer = {
    "1":[1,2,3,4,5,6,7,8,9],
    "2":[2,4,6,8,10,12,14,16,18],
    "3":[3,6,9,12,15,18,21,24,27],
    "4":[4,8,12,16,20,24,28,32,36],
    "5":[5,10,15,20,25,30,35,40,45],
    "6":[6,12,18,24,30,36,42,48,54],
    "7":[7,14,21,28,35,42,49,56,63],
    "8":[8,16,24,32,40,48,56,64,72],
    "9":[9,18,27,36,45,54,63,72,81]
}

N = int(input())
a = 0
for value in answer.values():
	if N in value:
    	a = 1

if a == 1:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

answer = {
    "1":[1,2,3,4,5,6,7,8,9],
    "2":[2,4,6,8,10,12,14,16,18],
    "3":[3,6,9,12,15,18,21,24,27],
    "4":[4,8,12,16,20,24,28,32,36],
    "5":[5,10,15,20,25,30,35,40,45],
    "6":[6,12,18,24,30,36,42,48,54],
    "7":[7,14,21,28,35,42,49,56,63],
    "8":[8,16,24,32,40,48,56,64,72],
    "9":[9,18,27,36,45,54,63,72,81]
}

N = int(input())
a = 0
for value in answer.values():
  if N in value:
    a = 1

if a == 1:
	print("Yes")
else:
	print("No")
R = int(input())
G = int((input))
peform = 

### FIXED CODE ###

R = int(input())
G = int(input())
p = G * 2 - R
print(p)
N = int(input())
A = [input() for _ in range(N)]

max_A = max(A)
Second = A.copy()
Second.remove(max(max_A))
Second_A = max(Second)


max_index = [i for i, v in enumerate(A) if v == max_A]

one_max = (len(max_index) == 1)

answer = [max_A] * N
if one_max:
    for i in max_index:
        answer[i] = Second_A
for i in range(N):
    print(answer[i])

### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
max_A = max(A)

# 複数の最大値のインデックスを全て取得
max_index = [i for i, v in enumerate(A) if v == max_A]

# 最大値は1個か?
one_max = (len(max_index) == 1)
answer = [max_A] * N

if one_max:
    Second = A.copy()
    Second.remove(max_A)
    Second_A = max(Second)
    for i in max_index:
        answer[i] = Second_A
for i in range(N):
    print(answer[i])
n = input()
s = int(input())
k = int(input())

char = s[k-1]
ans=''
for i in s:
    if i!=char:
        ans+='*'
    else:
        ans+=char
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
k = int(input())

char = s[k-1]
ans=''
for i in s:
    if i!=char:
        ans+='*'
    else:
        ans+=char
print(ans)
length=list(map(int, input().split()))
lenght.sort()
print ("Yes" if length==[5,5,7] else "No")

### FIXED CODE ###

abc = list(map(int, input().split()))
abc.sort()
print('YES' if [5, 5, 7]==abc else 'NO')
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
A=[0]*m
B=[0]*m
C=[[] for _ in range(m)]
for i in range(m):
    a,b=map(int,input().split())
    A[i]=a
    B[i]=b
    c=list(map(int,input().split()))
    C[i]=c
#dp[i][s], i番目までの鍵を使ってSを作る最小コスト
infi=10**20
dp=[[infi for i in range(2**(n)+1)]for _ in range(m+1)]
dp[0][0]=0
for i in range(m):
    for s in range(2**(n-1)):
        ni=i+1
        ns=s
        #使わないとき
        dp[ni][ns]=min(dp[i][s], dp[ni][ns])
        #使うとき
        for c in C[i]:
            ns = s | 1<<(c-1)
        dp[ni][ns]=min(dp[ni][ns], dp[i][s]+A[i])
ans=dp[n][2**n-1]
print(ans if ans<infi else -1)

### FIXED CODE ###

import sys
input=sys.stdin.readline
n, m = map(int, input().split())
A = [0] * m
B = [0] * m
C = [[] for _ in range(m)]
for i in range(m):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b
    c = list(map(int, input().split()))
    C[i] = c
D = [0] * m
for i in range(m):
    d = 0
    for j in C[i]:
        d |= 1 << (j - 1)
    D[i] = d
# dp[i][s], i番目までの鍵を使ってSを作る最小コスト
infi = 10 ** 20
dp = [[infi for i in range(2 ** n + 1)] for _ in range(m + 1)]
dp[0][0] = 0
for i in range(m):
    for s in range(2 ** n):
        ni = i + 1
        ns = s
        # 使わないとき
        dp[ni][ns] = min(dp[i][s], dp[ni][ns])
        # 使うとき
        ns = s | D[i]
        dp[ni][ns] = min(dp[ni][ns], dp[i][s] + A[i])
ans = dp[m][2 ** n - 1]
print(ans if ans < infi else -1)
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,k = map(int, input().split())
a = [0] + list(map(int, input().split()))

import numpy as np
c = np.cumsum(a)
b = c.reshape(-1,1) - c
l = len(bin(b.max())[2:])
s = set()
for i in range(1,n+1):
    for j in range(i):
        s.add(bin(b[i,j])[2:].rjust(l, "0"))
ans = 0
for i in range(l):
    count = 0
    tmp = set()
    for item in s:
        if item[i]=="0":
            pass
        else:
            count += 1
            tmp.add(item)
    if count>=k:
        ans+= 2**(l-i-1)
    s = tmp
print(ans)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n,k = map(int, input().split())
a = [0] + list(map(int, input().split()))

import numpy as np
c = np.cumsum(a)
b = c.reshape(-1,1) - c
l = int(np.log2(b.max())) + 1
s = set()
for i in range(1,n+1):
    for j in range(i):
        s.add(bin(b[i,j])[2:].rjust(l, "0"))
ans = 0
for i in range(l):
    count = 0
    tmp = set()
    for item in s:
        if item[i]=="0":
            pass
        else:
            count += 1
            tmp.add(item)
    if count>=k:
        ans+= 2**(l-i-1)
        s = tmp
print(ans)
import sys
sa=input()
sb=input()
sc=input()
ss={'a':sa,'b':sb,'c':sc}
t='a'
while True:
  t=ss[t][0]
  if len(ss[t])==0:
    print(t.upper())
    sys.exit()
  ss[t]=ss[t][1:]


### FIXED CODE ###

s={i:list(input())for i in'abc'}
i='a'
while s[i]:i=s[i].pop(0)
print(i.upper())
from math import factorial
import math
def cmb(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def main():
    N, M = map(int, input().split())
    A = [-1] + [int(input()) for i in range(M)] + [N + 1]

    d = [0] * (len(A) - 1)
    for i in range(len(A) - 1):
        if A[i+1] - A[i] == 1:
            print(0)
            exit(0)
        d[i] = A[i+1] - 1 - (A[i] + 1)

    ans = 1
    for dd in d:
        if dd > 1:
            tmp = 0
            for j in range(math.ceil(dd/2) + 1):
                tmp += cmb(dd - j, j)
            ans *= tmp

    print(ans % 1000000007)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
def cmb(n, r, mod, g1, g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

def main():
    N, M = map(int, input().split())
    A = [-1] + [int(input()) for i in range(M)] + [N + 1]

    mod = 10**9+7 #出力の制限
    N = 10**5
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    d = [0] * (len(A) - 1)
    for i in range(len(A) - 1):
        if A[i+1] - A[i] == 1:
            print(0)
            exit(0)
        d[i] = A[i+1] - 1 - (A[i] + 1)

    ans = 1
    for dd in d:
        if dd > 1:
            tmp = 0
            for j in range(dd//2 + 1):
                tmp += cmb(dd - j, j, mod, g1, g2)
            ans *= tmp

    print(ans % 1000000007)

if __name__ == '__main__':
    main()
N, K = map(int, input().split())
X = list(map(int, input().split()))
zero = 0
for i in range(N):
    if X[i] >= 0:
        break
    zero += 1
p = len(X[zero:])
m = len(X[:zero])
pl = X[zero:]
mi = X[:zero]
mi = mi[::-1]
num = float("inf")
if m == 0:
    num = min(num, pl[K - 1])
elif p == 0:
    num = min(num, mi[K - 1])
else:
    for i in range(K + 1):
        j = K - i
        if 0 < j <= m and 0 < i:
            rec1 = pl[i - 1] * 2 + abs(mi[j - 1])
            rec2 = pl[i - 1] + 2 * abs(mi[j - 1])
            num = min(num, rec1)
            num = min(num, rec2)
        elif j == 0 and K - 1 < p:
            num = min(num, pl[K - 1])
        elif i == 0 and K - 1 < m:
            num = min(num, mi[K - 1])


print(num)





### FIXED CODE ###

n, k = map(int, input().split())
x = list(map(int, input().split()))
pl, mi = 0, 0
recp, recm = [], []
for i in range(n):
    if x[i] >= 0:
        pl += 1
        recp.append(x[i])
    else:
        mi += 1
        recm.append(x[i])

num = float("inf")
recm = recm[:: -1]
for i in range(pl + 1):
    if i == 0:
        if k <= mi:
            num = min(num, abs(recm[k - 1]))
        else:
            continue
    else:
        if k - i == 0:
            num = min(num, recp[k - 1])
        elif 0 < k - i <= mi:
            num = min(num, recp[i - 1] + 2 * abs(recm[k - i - 1]))
            num = min(num, 2 * recp[i - 1] + abs(recm[k - i - 1]))

print(num)
N = int(input())
d = list(map(int,input().split()))
d.sort()
a = d[N/2-1]
b = d[N/2]
print(b-a)

### FIXED CODE ###

N = int(input())
d = list(map(int,input().split()))
d.sort()
a = d[N//2-1]
b = d[N//2]
if a != b:
  print(b-a)
if a == b:
  print(0)
s = int(input())
def func(n):
  if n%2 == 1:
    return 3n+1
  else:
    return n//2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a

b=[]
for i in range(1,1000001):
  tmp = prog(i)
  if tmp in b:
    print(i)
    break
  else:
    b.append(tmp)
  



### FIXED CODE ###

s = int(input())
def func(n):
  if n%2 == 1:
    return 3*n+1
  else:
    return n//2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a

b=[]
for i in range(1,1000000):
  tmp = prog(i)
  if tmp in b:
    print(i)
    break
  else:
    b.append(tmp)
def solve():
  N = int(input())
  A = [int(input()) for _ in range(N)]
  if A[0]>0 or A[1]>1:
    return -1
  ans = N - A.count(0)
  for i in range(1,N-1):
    if A[i]+1<A[i+1]:
      return -1
    if A[i]>=A[i+1] and A[i+1]>1:
      ans += 1
  return ans
print(solve())

### FIXED CODE ###

def solve():
  N = int(input())
  A = [int(input()) for _ in range(N)]
  if N==1:
    if A[0]==0:
      return 0
    return -1
  if A[0]>0 or A[1]>1:
    return -1
  ans = N - A.count(0)
  for i in range(1,N-1):
    if A[i]+1<A[i+1]:
      return -1
    if A[i]>=A[i+1] and A[i+1]>0:
      ans += A[i+1]-1
  return ans
print(solve())
s = list(str(input()))
s[3] = 8

ss = ''
 
for i in s:
  ss = ss + i
  
print(ss)

### FIXED CODE ###

s = list(str(input()))
 
s[3] = '8'
 
t = ''
for i in range(len(s)):
  t = t + s[i]
  
print(t)
N, Q = map(int,input().split())
T = [[] for k in range(N)]
V = [0]*N
for _ in range(N-1):
    a, b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
for q in range(Q):
    p, x = map(int,input().split())
    V[p-1] += x

def dfs(mae,ima):
    for tsugi in T[ima]:
        if tsugi != mae:
            V[tsugi] += V[ima]
            dfs(ima,tsugi)
dfs(-1,0)
print(*V)


### FIXED CODE ###

import sys
sys.setrecursionlimit(200010)

def main():
    input = sys.stdin.readline
    N, Q = map(int,input().split())
    G = [[] for k in range(N+1)]
    for k in range(N-1):
        a, b = map(int,input().split())
        G[a].append(b)
    kyori = [0 for k in range(N+1)]
    for k in range(Q):
        p, x = map(int,input().split())
        kyori[p] -= x
    def dfs(now, dist):
        for tsugi in G[now]:
            if kyori[tsugi] <= 0:
                kyori[tsugi] = -kyori[tsugi]
                kyori[tsugi] += dist
                dfs(tsugi, kyori[tsugi])
    kyori[1] = -kyori[1]
    dfs(1,kyori[1])
    print(*kyori[1:], sep = " ")

if __name__ == '__main__':
    main()
import numpy as np

#initialization
nmatch = [2,5,5,4,5,6,3,7,6]
f = input()
f = f.split()
N = int(f[0])
M = int(f[1])
dp = [-1]*(N+1) # contains the number of digits it can make
dp[0] = 0
ff = input()
ff = ff.split()
Atemp = [] #contains the number that can be used and the number of matches needed to make the match
for number in ff:
    temp = [int(number),nmatch[int(number)-1]]
    Atemp.append(temp)
Atemp = np.array(Atemp)
index0 = np.argsort(Atemp[:,0])
index1 = np.argsort(Atemp[:,1])
A = Atemp[index1] #sorted by the number of matches: ascending
B = Atemp[index0]
B = B[::-1] #sorted by the number: descending

for i in range(1,N+1):
    #dp(i)を求める
    for k in range(M):
        j = A[k,1]
        i_old = i - j #available matches
        if (i-j) < 0:
            break
        if (i-j) == 0 and dp[i] == -1:
            dp[i] = 1
        if dp[i_old] != -1 and dp[i_old]+1 > dp[i]:
            dp[i] = dp[i_old] + 1
ndigits = dp[N]
j = N
final_number = ''
for l in range(ndigits,0,-1):
    #桁を求めていく
    index = 0
    while True:
        temp_j = j - B[index,1]
        if dp[temp_j] + 1 == dp[j]:
            final_number  += str(B[index,0])
            j = temp_j
            break
        else:
            index += 1
        if index > 4:
            print('smth is wrong')
            break
print(int(final_number))

### FIXED CODE ###

import numpy as np

#initialization
nmatch = np.array([0,2,5,5,4,5,6,3,7,6])
N,M = map(int,input().split())
dp = [-1]*(N+1) # contains the number of digits it can make
dp[0] = 0
ff = np.array(list(map(int,input().split()))).reshape(-1,1)
fg = nmatch[ff].reshape(-1,1)
Atemp = np.concatenate([ff,fg],axis=1)
index0 = np.argsort(Atemp[:,0])
index1 = np.argsort(Atemp[:,1])
A = Atemp[index1] #sorted by the number of matches: ascending
B = Atemp[index0]
B = B[::-1] #sorted by the number: descending
for i in range(1,N+1):
    for k in range(M):
        j = A[k,1]
        i_old = i - j #available matches
        if (i-j) < 0:
            break
        if (i-j) == 0 and dp[i] == -1:
            dp[i] = 1
        if dp[i_old] != -1 and dp[i_old]+1 > dp[i]:
            dp[i] = dp[i_old] + 1
#print(dp)
ndigits = dp[N]
j = N
final_number = ''
for l in range(ndigits,0,-1):
    index = 0
    while True:
        temp_j = j - B[index,1]
        if temp_j < 0:
            index += 1
            continue
        if dp[temp_j] + 1 == dp[j]:
            final_number += str(B[index,0])
            j = temp_j
            break
        else:
            index += 1
        if index > M:
            break
print(int(final_number))
a,b,c=map(int,input().split())

if (a+b+C)-max(a,b,c)==max(a,b,c):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

if (a+b+c)-max(a,b,c)==max(a,b,c):
  print("Yes")
else:
  print("No")
s = list(input())
for i in range[3]:
  if (s[i] == s[i+1]):
  	print('Bad')
  	exit()
else:
  print('Good')


### FIXED CODE ###

S = list(input())
for i in range(3):
    if(S[i]==S[i+1]):
        print('Bad')
        exit()
else:
    print('Good')
n,m = map(int,input().split())

A = [[input()] for i in range(n)]
B = [[input()] for i in range(m)]
ans = 0
for i in range(n-m):
    for j in range(n-m):
        temp=0
        for k in range(m):
            for l in range(m):
                if B[k][l]==A[i+k][j+l]:
                    temp+=1
                    ans = max(ans,temp)
                                    
print('Yes' if ans==m*m else 'No')

### FIXED CODE ###

import sys

n,m = map(int,input().split())
A = [list(input()) for i in range(n)]
B = [list(input()) for i in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if k == 0:
                C = [A[i][j:m+j]]
            else:
                C += [A[i+k][j:m+j]]
        if B == C:
            print('Yes')
            sys.exit()
print('No')
import math

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

n, m = map(int, input().split())

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

x = 1

for y in a:
    x = lcm(x, y//2)

for y in a:
    if (x//(y//2)) % 2 == 0:
        print(0)
        exit()

max_n = (m-x)//(2*x)

print(max_n+1)


### FIXED CODE ###


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

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

n, m = map(int, input().split())

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

x = 1

for y in a:
    x = lcm(x, y//2)

for y in a:
    if (x//(y//2)) % 2 == 0:
        print(0)
        exit()

max_n = (m-x)//(2*x)

print(max_n+1)
N = int(input())
sum = 0
for i in range(1, N+1):
    if any(i%3 == 0, i%5 == 0):
        pass
    else:
        sum += i

print(sum)

### FIXED CODE ###

N = int(input())
sum = 0
for i in range(1, N+1):
    if (i%3 != 0 and i%5 != 0):
        sum += i

print(sum)
# -*- coding: utf-8 -*-
for c in range(3000):
    l = input().strip().split()
    x = int(l[0])
    y = int(l[1])
    if(x < 1 and y < 0):
        break
    elif(x > y):
        print("Case {0}: {1}".format(y,x))
    else:
        print("Case {0}: {1}".format(x,y))

### FIXED CODE ###

# -*- coding: utf-8 -*-
for c in range(3000):
    l = input().strip().split()
    x = int(l[0])
    y = int(l[1])
    if((x < 1) and (y < 1)):
        break
    elif(x > y):
        print("{0} {1}".format(y,x))
    else:
        print("{0} {1}".format(x,y))
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
#print(n,m,l)
def bin_search(a,li):
    max_len=len(li)
    min_len=0
    while max_len>=min_len:
        mid=(max_len+min_len)//2
        if li[mid]==a:
            return True
        elif li[mid]<a:
            min_len=mid+1
        else:
            max_len=mid-1
s=[]
g=[]
for i in l:
    if i[0]==1:
        s.append(i[1])
    if i[1]==n:
        g.append(i[0])
g.sort()
for i in s:
    if bin_search(i,g):
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
#print(n,m,l)
def bin_search(a,li):
    max_len=len(li)-1
    min_len=0
    while max_len>=min_len:
        mid=(max_len+min_len)//2
        if li[mid]==a:
            return True
        elif li[mid]<a:
            min_len=mid+1
        else:
            max_len=mid-1
s=[]
g=[]
for i in l:
    if i[0]==1:
        s.append(i[1])
    if i[1]==n:
        g.append(i[0])
g.sort()
for i in s:
    if bin_search(i,g):
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')
N = input()
if N % 2 == 0:
  print(N)
else:
  print(N*2)

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
    print(N)
else:
    print(N * 2)
import math
r = [int(x) for x in input().split()]
print("{0:f} {1:f}".format(r[0] * r[0] * math.pi, r[0] * 2 * math.pi))

### FIXED CODE ###

import math
r = [float(x) for x in input().split()]
print("{0:f} {1:f}".format(r[0] * r[0] * math.pi, r[0] * 2 * math.pi))