Problem:
 Score : 300 points    Problem Statement Snuke has a fair N -sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:   Throw the die. The current score is the result of the die.  As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.  The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0 .   You are given N and K . Find the probability that Snuke wins the game.      Constraints  1 ≤ N ≤ 10^5  1 ≤ K ≤ 10^5  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  K       Output Print the probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9} .        Sample Input 1 3 10      Sample Output 1 0.145833333333   If the die shows 1 , Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^4 = \frac{1}{48} .  If the die shows 2 , Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^3 = \frac{1}{24} .  If the die shows 3 , Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^2 = \frac{1}{12} .   Thus, the probability that Snuke wins is \frac{1}{48} + \frac{1}{24} + \frac{1}{12} = \frac{7}{48} \simeq 0.1458333333 .       Sample Input 2 100000 5      Sample Output 2 0.999973749998

Solution (Python):
import sys
input = sys.stdin.readline
N,K = map(int, input().split())
bi = []
i = 1
j = 0
while i < K:
    bi.append(i)
    i *= 2
    j += 1
bi.append(i)
ans = max(0,N-K+1)
ite = min(N+1,K)

for i in range(1,ite):
    
    if j > 0 and bi[j-1] * i >= K:
        j -= 1
    
    ans += 0.5**j
print('{:.10f}'.format(ans / N))

Solution (Python):
N,K = map(int, input().split())
bi = []
i = 1
j = 0
while i < K:
    bi.append(i)
    i *= 2
    j += 1
bi.append(i)
ans = max(0,N-K+1)
ite = min(N+1,K)

for i in range(1,ite):
    
    if j > 0 and bi[j-1] * i >= K:
        j -= 1
    
    ans += 0.5**j
print('{:.10f}'.format(ans / N))

Solution (Python):
n, k = map(int, input().split())

result = 0
for i in range(1, n+1):
    j = 0
    while True:
        if 2**j >= k/i:
            result += (1/2)**j
            break

        j += 1

print(result/n)

Solution (Python):
n, k = map(int, raw_input().split())
from math import log, ceil
possibility = 0
ook = 1.0 / n
for d in range(1, n+1):
    if d >= k:
        exponent = 0
    else:
        exponent = int(ceil(log(float(k)/d, 2)))
    
    possibility += ook * (0.5)**exponent
print possibility

Solution (Python):

def bisect(bi, x, target, left, right):
    if left + 1 == right:
        return right
    half = (right + left) // 2
    if bi[half] * x < target:
        half = bisect(bi, x, target, half, right)
    else:
        half = bisect(bi, x, target, left, half)
    return half
N,K = map(int, input().split())
bi = []
i = 1
while i <= 10**5:
    bi.append(i)
    i *= 2
bi.append(i)

ans = 0
for i in range(1,N+1):
    if i >= K:
        ans += 1
    else:
        j = bisect(bi, i, K, 0, len(bi))
        ans += 0.5**j
print('{:.10f}'.format(ans / N))

Solution (Python):

n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    m = 0
    while (i * 2**m) < k:
        m += 1
    ans += 1 / (n * 2**m)
print(ans)

Solution (Python):
n, k = map(int, input().split())

answer = 0

for i in range(1, n + 1):
    score = i
    coin = 0
    while 1 <= score <= k - 1:
        score = score * 2
        coin += 1

    answer += (1 / n) * (0.5 ** coin)

print(answer)

Solution (Python):



N, K = map(int,input().split())
num = 0
total = float(0)
per = float(1)

for i in range(1, N + 1):
    if i < K:
        j = 1
        while True:
            num = i * pow(2, j)
            per = pow(0.5, j)
            if num >= K:
                total += 1.0 / N * per
                break
            else:
                j += 1
    else:
        total +=  1.0 / N
print(total)

Solution (Python):
n, k = list(map(int, input().split()))
p=0
for i in range(1,n+1):
    p0 = 1/n
    cp = i
    while True:
        if cp >= k:
            p += p0
            break
        else:
            cp *= 2
            p0 *= 1/2
print(p)

Solution (Python):
N, K = map(int, input().split())
coin = 0.5
ans = 0
for i in range(1, N+1):
    dice = 1/N
    while i < K:
        i *= 2
        dice *= coin
    ans += dice
print(ans)

Solution (Python):
import math
N,K=(int(x) for x in input().split())
ans=0.0
for i in range(1,N+1):
  c=0 if i>=K else math.ceil(math.log2(K*1.0/i))
  ans+=0.5**c
print(ans/N)

Solution (Python):
import math
n,k = map(int,input().split())
 
pi = 0
for i in range(1,n+1):
  need = math.ceil(math.log(k/i,2))  
  if need > 0:
    pi += (1/2) ** need
  else :
    pi +=1      
print(pi/n)

Solution (Python):
n,k = map(int,input().split())
pro = []
for i in range(1,n+1):
  a = i
  p = 1/n
  while a < k:
    a = a + a
    p = p * 0.5
  pro.append(p)
  
print(sum(pro))

Solution (Python):
def main():
    N, K = map(int, input().split())

    m = [0] * (N+2)
    for i in range(1, N+1)[::-1]:
        me = m[i+1]
        while i * 2 ** me < K:
            me += 1
        m[i] = me

    ans = 0
    for i in range(1, N+1):
        ans += 1 / 2 ** m[i] 
    print(ans / N)


main()

Solution (Python):
n, k= list(map(int,input().split()))
rates = 0
for i in range(1,n+1):
	point = i
	rate = 1
	while(point<k):
		point = point * 2
		rate = rate / 2
	rates = rates + rate
print(rates / n)

Solution (Python):
import math as m
n,k=map(int,input().split())
p=0
for i in range(1,min(n+1,k)):
  r=m.ceil(m.log(k/i,2))
  p+=1/(2**r)
for _ in range(k,n+1):
  p+=1
print(p/n)

Solution (Python):
import math
N,K=map(int,input().split())
anssub=0
for i in range(N,0,-1):
  a=0
  while i*(2**a)<K:
    a+=1
  for i in range(a):
    anssub+=(1/N)*(1/2)**(i+1)
ans=1-anssub
print(ans)

Solution (Python):
import math
import sys
N,K=map(int,input().split())
anssub=0
for i in range(N,0,-1):
  a=0
  while i*(2**a)<K:
    a+=1
  for i in range(a):
    anssub+=(1/N)*(1/2)**(i+1)
ans=1-anssub
print(ans)

Solution (Python):
n, k = map(int, input().split())
ans = 0

for i in range(1, n + 1):
    tmp = 1 / n
    while i < k:
        i *= 2
        tmp /= 2
    ans += tmp
print(ans)

Solution (Python):
import math

n, k = map(int, input().split())
ans = 0

if n >= k:
    ans = n - k + 1
    for i in range(1, k):
        ans += (0.5)**(math.ceil(math.log2(k / i)))

if n < k:
    for i in range(1, n + 1):
        ans += (0.5)**(math.ceil(math.log2(k / i)))

print(ans / n)

Solution (Python):
a, b = map(int, input().split())
e = 0
for i in range(1, a + 1):
    c = i
    d = 0.5
    if c >= b:
        e += 1 / a
    else:
        while True:
            c *= 2
            if c >= b:
                e += 1 / a * d
                break
            d = d * 1 / 2
print(e)

Solution (Python):
def main():
  n, k = map(int, input().split())
  
  rate = 0.0
  
  for i in range(1,n+1):
    count = 0
    score = i
    while score < k:
      count += 1
      score *= 2
      
    rate += 1 / (2 ** count)
    
  
  print(rate/n)
    
main()

Solution (Python):
def resolve():
    n,k = map(int,input().split())
    per=0
    for i in range(1,n+1):
        cnt = 1
        t = i
        while t<k:
            t = t*2
            cnt = cnt*2
        per = per + 1/n/cnt
    print(per)

if __name__ == "__main__":
    resolve()

Solution (Python):
n, k = map(int, input().split())
p = 0
for i in range(1, n+1):
    sum_ = i
    j = 0
    while True:
        if sum_ >= k:
            break
        sum_ *= 2
        j += 1
    q = 1
    for x in range(j):
        q *= 0.5
    p += q
p /= n
print(p)

Solution (Python):
n, k = list(map(int, input().split()))
ans = 0
for i in range(n):
    d = i + 1
    p = 1 / n
    needed = 0
    while d * (2 ** needed) < k:
        needed += 1
    p *= (1 / 2)**needed
    ans += p
print(ans)

Solution (Python):
N, K = map(int, input().split())
ret = 0
for i in range(1, N + 1):
    tmp = 1/N
    now = i
    while now < K:
        now *= 2
        tmp /= 2

    ret += tmp

print(ret)

Solution (Python):
n,k=map(int,input().split())
n_list = n
p = 0
c = 0
while k > 0.5 :
    num = max(int(n_list-k+1),0)
    if num:
        p += num * (0.5**c)
        n_list = int(k) - int(1 - ( k - int(k)))
    k /= 2
    c += 1
print( p / n )

Solution (Python):
N, K = map(int, input().split())

p = 0
for i in range(1, N+1):
    cnt = 0
    tmp = i
    while tmp <= K-1:
        tmp *= 2
        cnt += 1
    p += (1/2)**cnt
print(p/N)

Solution (Python):
def winrate(wn, wk):
    b = 0
    c = wn
    while c < wk:
        b += 1
        c *= 2
    return 1/2 ** b

n, k = map(int,input().split())
ans = 0
for i in range(1, n+1):
    ans += 1/n * winrate(i, k)
print(ans)

Solution (Python):
def winrate(wn, wk):
    b = 0
    while wn * 2**b < wk:
        b += 1
    return 1/2 ** b

n, k = map(int,input().split())
ans = 0
for i in range(1, n+1):
    ans += 1/n * winrate(i, k)
print(ans)

Solution (Python):
N, K = map(int, input().split())

sum_prob = 0
for init_num in range(1, N + 1):
    if init_num < K:
        n_trial_lower = 0
        while init_num * (2**n_trial_lower) < K:
            n_trial_lower += 1
        prob = 1 / N * (0.5**n_trial_lower)
    else:
        prob = 1 / N
    sum_prob += prob

print(sum_prob)

Solution (Python):
N, K = map(int, input().split())


def required_coins(s, K):
    ans = 0
    while s < K:
        s <<= 1
        ans += 1
    return ans

A = [1/(1 << required_coins(i + 1, K)) for i in range(N)]
ans = sum(A) / N
print(ans)

Solution (Python):



""" convenient functions




"""

import sys
sys.setrecursionlimit(10**7)
from itertools import accumulate, combinations, permutations, product 

from math import factorial, ceil, floor
def factorize(n):
    """return the factors of the Arg and count of each factor
    
    Args:
        n (long): number to be resolved into factors
    
    Returns:
        list of tuples: factorize(220) returns [(2, 2), (5, 1), (11, 1)]
    """
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
def combinations_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    
    if n < 0 or r < 0:
        raise Exception('combinations_count(n, r) not defined when n or r is negative')
    if n - r < r: r = n - r
    if r < 0: return 0
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result
def combinations_with_replacement_count(n, r):
    """Return the number of selecting r pieces of items from n kinds of items allowing individual elements to be repeated more than once.
    
    Args:
        n (long): number
        r (long): number
    
    Raises:
        Exception: not defined when n or r is negative
    
    Returns:
        long: number
    """
    if n < 0 or r < 0:
        raise Exception('combinations_with_replacement_count(n, r) not defined when n or r is negative')
    elif n == 0:
        return 1
    else:
        return combinations_count(n + r - 1, r)
from bisect import bisect_left, bisect_right
from collections import deque, Counter, defaultdict 
from heapq import heapify, heappop, heappush, heappushpop, heapreplace,nlargest,nsmallest 
from copy import deepcopy, copy 
from operator import itemgetter


from functools import reduce
def chmin(x, y):
    """change minimum
    if x > y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current minimum value
        y (long): potential minimum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x > y:
        x = y
        return (x, True)
    else:
        return (x, False)
def chmax(x, y):
    """change maximum
    if x < y, x = y and return (x, True).
    convenient when solving problems of dp[i]
    
    Args:
        x (long): current maximum value
        y (long): potential maximum value
    
    Returns:
        (x, bool): (x, True) when updated, else (x, False)
    """
    if x < y:
        x = y
        return (x, True)
    else:
        return (x, False)

from fractions import gcd 
def gcds(numbers):
    return reduce(gcd, numbers)
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcms(numbers):
    return reduce(lcm, numbers, 1)



INF = 10 ** 18
MOD = 10 ** 9 + 7
modpow = lambda a, n, p = MOD: pow(a, n, p) 
def modinv(a, p = MOD):
    
    
    return modpow(a, p-2, p)
def modinv_list(n, p = MOD):
    if n <= 1:
        return [0,1][:n+1]
    else:
        inv_t = [0,1]
        for i in range(2, n+1):
            inv_t += [inv_t[p % i] * (p - int(p / i)) % p]
        return inv_t
def modfactorial_list(n, p = MOD):
    if n == 0:
        return [1]
    else:
        l = [0] * (n+1)
        tmp = 1
        for i in range(1, n+1):
            tmp = tmp * i % p
            l[i] = tmp
        return l
def modcomb(n, k, fac_list = [], p = MOD):
    
    
    from math import factorial
    if n < 0 or k < 0 or n < k: return 0
    if n == 0 or k == 0: return 1
    if len(fac_list) <= n:
        a = factorial(n) % p
        b = factorial(k) % p
        c = factorial(n-k) % p
    else:
        a = fac_list[n]
        b = fac_list[k]
        c = fac_list[n-k]
    return (a * modpow(b, p-2, p) * modpow(c, p-2, p)) % p
def modadd(a, b, p = MOD):
    return (a + b) % MOD
def modsub(a, b, p = MOD):
    return (a - b) % p
def modmul(a, b, p = MOD):
    return ((a % p) * (b % p)) % p
def moddiv(a, b, p = MOD):
    return modmul(a, modpow(b, p-2, p))

""" initialize variables and set inputs

    
    

    
    
    
    
    

    
    
    
    

    
    
"""


r = lambda: sys.stdin.readline().strip()
r_int = lambda: int(r())
R = lambda: list(map(int, r().split()))
Rfloat = lambda: list(map(float, r().split()))
Rtuple = lambda: tuple(map(int, r().split()))
Rmap = lambda: map(int, r().split())

""" how to treat input







"""





N, K = R()
ans = 0
for i in range(N):
    s = i + 1
    deno = N
    while s < K:
        s *= 2
        deno *= 2
    ans += 1/deno
print(ans)

"""memo: how to use defaultdict of list

Dic = defaultdict(list)

Dic[x].append(y)

for k, v in Dic.items():
"""

Solution (Python):
N,K=map(int,input().split())
l=[]
for i in range(1,N+1):
  score=i
  while 1<=score<=(K-1):
    score*=2
  prob=(1/N)*i/score
  l.append(prob)
print(sum(l))

Solution (Python):
import math
n, k = map(int, input().split())

ans = 0
for i in range(1, n+1):
  x = max(math.ceil(math.log2(k)-math.log2(i)), 0)
  
  ans += (1/n) * ((1/2)**x)
print(ans)

Solution (Python):
n, k = map(int, input().split())

p = 0




for i in range(1, n + 1):
    s = i
    tmp = 1 / n
    while s < k:
        s *= 2
        tmp /= 2
    p += tmp

print(p)

"""
2**3 = 8
3 = np.log2(8)

n * 2**x = k
2**x = k / n
x = np.log2(k / n)
"""

Solution (Python):
N, K = map(int, input().split())
ans = 0.0
for i in range(1, N + 1):
    
    w = i
    s = 0
    while w < K:
        w *= 2
        s += 1

    
    ans += (1 / N) * (1 / 2) ** s

print(ans)

Solution (Python):
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    count=0
    while i<k:
        i*=2
        count+=1
    ans+=float(1)/(n*2**count)
print(ans)

Solution (Python):
N,K=map(int,input().split())
ans=0
total=0
count=0
for i in range(1,N+1):
  total=i
  count=0
  while K>total:
    total*=2
    count+=1
  ans+=(1/N)*(1/2)**count
print(ans)

Solution (Python):
Dataset = [2**i for i in range(18)]
def kakuritsu(n, K):
    for i, data in enumerate(Dataset):
        if n*data >= K:
            return (1/2)**i

N, K = map(int, input().split())
total = 0
for i in range(1, N+1):
    total += kakuritsu(i, K)
print(total/N)

Solution (Python):
count = 0
p, s = 0, 0
n, k = map(int, input().split())
for i in range(n):
    p = i + 1
    count = 0
    while(p < k):
        p = p * 2
        count += 1
    s += ((1 / n ) * ((1 / 2) **  count))
print(s)

Solution (Python):
N, K = map(int, input().split())

ans = max(N-K+1, 0) / N

up_bound = K-1
low_bound = up_bound // 2
now_zoom = 1/2
while up_bound != 0:
    if up_bound <= N:
        ans += now_zoom * (up_bound - low_bound) / N
    elif low_bound <= N:
        ans += (N-low_bound)*now_zoom/N
    up_bound = low_bound
    low_bound = up_bound // 2
    now_zoom *= 1/2
print(ans)

Solution (Python):
inf = input().split()
N = int(inf[0])
K = int(inf[1])
ans = 0

for n in range(1,N+1):
  p = 1
  while n<K:
    n *= 2
    p *= 0.5
  ans += (p/N)

print('{:.12f}'.format(ans))

Solution (Python):
from math import log2
N, K = map(int, input().split())
p = 0.0
if N >= K:
    p1 = (N-K+1)/N
    p2 = 1.0
    p += p1
    temp = 0.0
    for i in range(1, K): 
        n = int(log2(K-1)-log2(i))+1
        temp += (0.5)**n
    p2 *= temp*(1/N)
    p += p2
else:
    temp = 0
    for i in range(1, N+1): 
        n = int(log2(K-1)-log2(i))+1
        temp += (0.5)**n
    p = temp*(1.0/N)
print(p)

Solution (Python):
N, K = map(int, input().split())
A=N
total=0
count=1
flag=0
if N>=K:
   total=(N-K+1)/N
   
   N=K-1
if N<K:
    while(flag==0):
        if(K/2<1):
            flag=1
        if K%2==1:
            K = K//2+1
        elif K%2==0:
            K = K // 2
        if N>=K:

            total += (N-K+1)*1/(A*2**count)
            N=N-(N-K+1)

        count += 1
    print(total)

Solution (Python):
import math
N, K = map(int,input().split())

prob=0
for i in range(1,N+1):
  if K/i > 1:
     prob += 1/N*math.pow(1/2,math.ceil(math.log(K/i,2)))
  else:
     prob += 1/N
print(prob)

Solution (Python):
import math
N, K = map(int,input().split())

prob=0
for i in range(1,N+1):
  if K/i > 1:
     prob += 1/N*math.pow(1/2,math.ceil(math.log(K/i,2)))
  else:
     prob += 1/N
print(prob)

Solution (Python):
n, k = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
    tmp=1
    while i * tmp < k:
        tmp=tmp*2
    ans+=1/tmp
print(ans/n)

Solution (Python):
import math

def main():
    N, K = map(int, input().split())

    size = int(math.log2(K)+2)
    table = [1 / 2 ** i for i in range(size)]
    p = 0
    for i in range(1, N+1):
        point = i
        j = 0
        while point < K:
            point *= 2
            j += 1
        p += table[j]
    print(p/N)

    

main()

Solution (Python):
import numpy as np

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

ans = np.zeros(n)

for i in range(n):
    ans[i] = 1.0

for i in range(n):
    tmp = i+1
    while(tmp < k):
        ans[i]*=0.5
        tmp*=2


print(np.sum(ans)/n)

Solution (Python):

import bisect
from collections import defaultdict
import math

def main():
    N, K = map(int, input().split())

    prob = 0
    for n in range(N):
        n += 1
        if n >= K:
            p = 1.0
        else:
            min_val = math.ceil(math.log2(K / n))
            p = 0.5 ** min_val
        prob += p

    print(prob / N)

if __name__ == '__main__':
    main()

Solution (Python):
N,K = map(int, input().split())
cnt = 0
while 2**cnt < K:
    cnt += 1
result = ((1/2)**cnt)/N
for i in range(2,N+1):
    while (2**cnt)+(2**cnt)*(i-1) >= K and cnt >= 0:
        cnt -= 1
    if cnt == -1:
        result += (N-i+1)/N
        break
    cnt += 1
    result += ((1/2)**cnt)/N
print(result)

Solution (Python):
inf = input().split()
N = int(inf[0])
K = int(inf[1])
ans = 0

for n in range(1,N+1):
  p = 1
  while n<K:
    n *= 2
    p *= 0.5
  ans += (p/N)

print('{:.12f}'.format(ans))

Solution (Python):
import sys
input = sys.stdin.readline

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

j = 0
for i in range(N, 0, -1):
  while i*2**j < K:
    j += 1
  ans += 1/N * (1/2)**j
print(ans)

Solution (Python):
import math
n, k = map(int, input().split())  
ans = 0
num = int(math.log2(k)+1)    

for i in range(1, n+1):
    if i>=k:
        ans += 1
    else:
    
        ans += 1/(2 ** max(math.ceil(math.log2(k/i)), 1) )

print(ans/n)

Solution (Python):
from math import log2, ceil

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

if N <= K:
	lis = [0]*N
	cnt = N + 1
	score = 0
else:
	lis = [0]*(K-1)
	cnt = K
	score = (N-K+1)/N

for i in range(1, cnt):
	lis[i-1] = (1/N) * pow(1/2, ceil(log2(K/i)))
print(sum(lis)+score)

Solution (Python):
N, K = map(int,input().split())

index = []

for i in range(N):
    sum_num = i+1
    cnt = 0
    while sum_num < K:
        sum_num *= 2
        cnt += 1
    index.append(cnt)

ans = 0
for i in range(N):
    ans += ((1/N)*(0.5**index[i]))

print(ans)

Solution (Python):
import math

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

v=0
prev_num=0
for i in range(N):
    if i+1==K:
        v+=N-K+1
        break
    KK=K/(i+1)
    num=math.ceil(math.log2(KK))
    if i==0:
        term=0.5**num
    else:
        term*=2**(prev_num-num)
    
    v+=term
    prev_num=num
v/=N
print(v)

Solution (Python):
import math

N,K = map(int,input().split())
ans = 0
for i in range(1,N+1):
    beki = math.ceil(math.log2(K/i))
    if beki<0:beki=0
    ans += 1/(N*(2**beki))

print(ans)

Solution (Python):
N, K = map(int,input().split())
ans = 0
for n in range(1,N+1):
	a = N
	while(n < K):
		a *= 2
		n *= 2
	ans += 1 / a
print(ans)

Solution (Python):
N,K = map(int,input().split())

def log2(n):
    res = 0
    while n > 1:
        n /= 2
        res += 1
    return res

def ceil(n): 
    if n > int(n):
        return(int(n)+1)
    else:
        return(int(n))

a = []
for i in range(1,N+1):
    k = ceil(log2(K/i))
    if i < K:
        a.append(k)
    else:
        a.append(0)
m = max(a)
s = sum([2**(m-a[i]) for i in range(len(a))])
print(s/(N*(2**m)))

Solution (Python):
n,k=map(int,input().split())

ps=0.0
for i in range(n):
    p=1/n
    score=i+1
    while score < k:
        p*=0.5
        score*=2
    ps+=p

print(ps)

Solution (Python):
n, k = map(int, input().split())
import math

def get_p(nums,k):
    p=1/(2**math.ceil(max(math.log(k/nums,2),0)))
    return p

ans=0
for nums in range(n):
    ans+=get_p(nums+1,k)
    
print("{0:.20f}".format(ans/n))

Solution (Python):
import sys
import math
input = sys.stdin.readline

n, k = map(int, input().split())
tmp = float(k)
need = [] 
while tmp > 1:
    need.append(math.ceil(tmp))
    tmp /= 2
need.append(1)



bunsi = max(0, n-k+1)
bunbo = 1
for i in range(len(need) - 1):
    bunsi *= 2
    bunbo *= 2
    if need[i+1] > n:
        continue
    elif need[i] > n:
        l = len(range(need[i+1], n+1))
    else:
        l = len(range(need[i+1], need[i]))
    bunsi += l

print("{0:.12f}".format(bunsi/bunbo/n))

Solution (Python):




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

ans=0
for i in range(1,N+1):
    pow=0
    while i*2**pow<K:
        pow+=1
    ans+=(1/N)*0.5**pow

print(ans)

Solution (Python):
n, k = list(map(int, input().split()))
sum = 0
for i in range(1,n + 1):
    p = 1/n
    temp = i
    while temp < k:
        temp *= 2
        p /= 2
    sum += p
print(sum)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b



def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2



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



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


def main():
    N, K = map(int, input().split())
    ans = 0.0
    for i in range(1, N + 1):
        if i < K:
            num = 0
            while i < K:
                i *= 2
                num += 1
            ans += (1 / (2**num)) * (1 / N)

        else:
            ans += 1 / N

    print("{0:.10f}".format(ans))


if __name__ == '__main__':
    main()

Solution (Python):
n,k = map(int, input().split())
t = [[0]*20 for i in range(n)]
count = 0
A = [0 for i in range(n)]
for i in range(n):
    t[i][0] = i+1

for i in range(n):
    for j in range(19):
        t[i][j+1] =t[i][j]*2 
        if t[i][j+1]>=k and t[i][j]<k:
            A[i] = j+1

for i in range(n):
    count = count + (0.5)**A[i]/n

print(count)

Solution (Python):
n,k = map(int,input().split())
p=0
sun=1
answer=0
count=0
for i in range(1,n+1):
  add = 1/n
  ima = i
  while(ima<k):
    ima*=2
    add/=2
  answer+=add
print(answer)

Solution (Python):
n,k = map(int,input().split())
p=0
sun=1
answer=0
count=0
for i in range(1,n+1):
  if i < k:
    if i == 1:
      while(sun<k):
        sun *= 2
        count+=1
    else:
      while(sun>=k):
        sun /= 2
        count-=1
      sun *= 2
      count +=1
    answer+=1/n*1/pow(2,count)
    sun = sun/i*(i+1)
  else:
    answer+=1/n
print(answer)

Solution (Python):
N, K = map(int, input().split())

p = 0
for i in range(1, N + 1):
    t = 1 / N
    while i < K:
        i *= 2
        t *= 1 / 2
    p += t
print(p)

Solution (Python):
import math
 
n, k = list(map(int, input().split()))
 
ans = 0
 
"i点の時、k点以上になるためにはlog2(k/i)回連続で表を出す必要がある"
for i in range (1, n + 1):
  if i < k:
    omote = math.ceil(math.log(k/i, 2))
    ans += (1/2) **(omote)
  else :
    ans += 1
print(ans/n)

Solution (Python):
from math import (log, ceil)
N, K = map(int,input().split())
total = 0.0
for i in range(1,N+1):
    if i < K:
        a = ceil(log(K/i,2))
        total += 2.0**(-a)
    else:
        total += 1.0
print(total/N)

Solution (Python):
import numpy as np
n, k = list(map(int, input().split()))
ndewaru = 0
for p in range(n) :
    if p+1 < k :
        kata = np.floor(np.log2((p+1)/k))
        ndewaru += 2**kata
    else :
        ndewaru += 1
print(ndewaru/n)

Solution (Python):
n, k = map(int, input().split())
prob = 0
for x in range(1, n + 1):
    value = x
    for y in range(k):
        if (value >= k):
            prob += 1.0/n * (0.5 ** y)
            break
        value *= 2
print(prob)

Solution (Python):
def count_doubled(i, n):
	count=0
	while(i<n):
		count+=1
		i = i<<1
	return count

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

result = 0

for i in range(1, N+1):
	result += pow(0.5, count_doubled(i, K))/N

print("{:.12f}".format(result))

Solution (Python):
s=list(map(int,input().split()))
a=0
d=0
list = []
for i in range(s[0]):
  c=0
  b=2
  e=i+1
  for l in range(17):
    if e<s[1]:
      e=b*e
      c=c+1
  list.append(c)
for j in range(len(list)):
  d=d+1/(s[0]*2**list[j])
print(d)

Solution (Python):
N, K = map(int, input().split())

percentage = 0

for appear in range(1, N + 1):
	i = 0
	while  K / appear > 2 ** i:
		i += 1
	percentage += (1 / N) * (1/2) ** i
	
print(percentage)

Solution (Python):
N,K=(int(x) for x in input().split())
answer = 0
for i in range(N):
  p = 1
  point = i + 1
  while point < K:



    point = point * 2
    p = p / 2 
    answer = answer + p / N

print(1 - answer)

Solution (Python):
import math
n,k=map(int,input().split())
if n < k:
  ans = 0
  for i in range(1,n+1):
    j = math.ceil(math.log2(k)-math.log2(i))
    ans += (0.5)**j / n
else:
  ans = 1
  for i in range(1,k+1):
    j = math.ceil(math.log2(k)-math.log2(i))
    ans -= (1 - (0.5)**j) / n
print(ans)

Solution (Python):
n,k=map(int,input().split())
answer=0
for i in range(n):
  j=1
  while (i+1)*j<k:
    j*=2
  answer+=1/j*1/n
print(answer)

Solution (Python):
n, k = list(map(int, input().rstrip().split()))
ans = 0
for i in range(1, n + 1):
    if i >= k:
        ans += 1 / n
    else:
        m = 1
        while i * 2 ** m < k:
            m += 1
        ans += 1 / n * 0.5 ** m
print(ans)

Solution (Python):
N, K = map(int, input().split())
p = [0] * N
p[0] = len(bin(K)) - 2
if 2 ** p[0] >= 2 * K:
    p[0] = p[0] - 1
for i in range(N - 1):
    if 2 ** p[i] * (i + 2) >= 2 * K:
        p[i + 1] = p[i] - 1
    else:
        p[i + 1] = p[i]
    if p[i + 1] == 0:
        break
ans = float(0)
for n in range(1, N + 1):
    ans += 1 / N * ((1/2) ** p[n-1])
print(ans)

Solution (Python):
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
  f=0
  sum1=i
  while sum1<k:
    sum1*=2
    f+=1
  ans+=(1/n)*(0.5)**f
print(ans)

Solution (Python):
N, K = map(int, input().split())

result = 0
for n in range(1, N + 1):
	d, x = 0, n
	while x < K:
		d += 1
		x *= 2
	result += (1 / N) * (1 / 2)**d
print(result)

Solution (Python):
N, K = map(int, input().split())

result, md = 0, len("{:b}".format(K))
for n in range(1, N + 1):
	d, x = 0, n
	while x < K:
		d += 1
		x *= 2
	
	result += (1 / N) * (1 / 2)**d
print(result)

Solution (Python):
import math

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

ans = 0
for i in range(1,N+1):
    ans += 1/N*(1/2)**(max(math.ceil(math.log2(K/i)),0))

print(ans)

Solution (Python):
N, K  = map(int,input().split())

prb = 0
ans = 0
for i in range(1,N+1):
  
  tokuten = i
  cnt =0 
  while tokuten < K:
    tokuten = tokuten *2
    cnt += 1
  prb += 1/N * pow(0.5, cnt)
print(prb)

Solution (Python):
n, m = map(int, input().split())
ans = 0
for i in range(1,n+1):
    tmp = 1 / n
    while (i < m):
        i *= 2
        tmp /= 2
    ans += tmp  
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
ri = lambda: int(input())


rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

N,K=rl()
""" M=[0]*(max(N,K)+2)
k = K
M[k] = 1
while k > 1:
    k = k / 2.0
    ind = int(k//1)
    if k%1 == 0:
        ind -= 1
    M[ind] = 1
for i in range(K,0,-1):
    M[i] += M[i+1]
ans = 0
for i in range(1,N+1):
    ans += (1/2)**(M[i])/N
print(ans)
 """
ans = 0
for i in range(1,N+1):
    ex = 0
    point = i
    while point < K:
        ex += 1
        point *= 2
    ans += (1/2)**ex/N
print(ans)

Solution (Python):
import math

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

prob = 0
for n in range(1, N+1):
    i = int(math.log2(K/n))
    if n > K:
        i = 0
    elif not n * 2**i == K:
        i += 1
    prob += 1 / N / (2**i)

print(prob)

Solution (Python):
n,k = map(int, input().split())
x=0
i=0
pro=0.0
ans=0.0

for i in range(1,n+1):
    x=i
    j=0
    while x<k:
        j=j+1
        x=x*2
    pro=(1/n)*((1/2)**j)
    ans=ans+pro

print(ans)

Solution (Python):
N,K = map(int,input().split())
res = 0
for i in range(1,N+1):
    prob = 1/N
    while i < K:
        i *= 2
        prob *= 0.5
    res += prob
print(res)