Problem:


Score : 400 points

Problem Statement

Caracal is fighting with a monster.

The health of the monster is H.

Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:

If the monster's health is 1, it drops to 0.

If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor.

(\lfloor r \rfloor denotes the greatest integer not exceeding r.)

Caracal wins when the healths of all existing monsters become 0 or below.

Find the minimum number of attacks Caracal needs to make before winning.

Constraints

1 \leq H \leq 10^{12}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

H

Output

Find the minimum number of attacks Caracal needs to make before winning.

Sample Input 1

2

Sample Output 1

3

When Caracal attacks the initial monster, it disappears, and two monsters appear, each with the health of 1.

Then, Caracal can attack each of these new monsters once and win with a total of three attacks.

Sample Input 2

4

Sample Output 2

7

Sample Input 3

1000000000000

Sample Output 3

1099511627775



Sample input:
2


Sample output:
3

Submission status: Wrong Answer

Solution code:
n = int(input())

num = n // 2
ans = 1
for i in range(num+1):
    ans = ans * 2
print(ans-1)

Submission status: Wrong Answer

Solution code:
n = int(input())

num = n // 2
ans = 0
for i in range(1,num+1):
    ans += 2 ** i
print(ans)

Submission status: Wrong Answer

Solution code:
H = int(input())
now = 1
for i in range(1,100):
  if H< now:
    print(2**i-1)
    break
  else:
    now *= 2

Submission status: Wrong Answer

Solution code:
def myfunc(N):
	if(N  <= 1):
		return 1
	return 2 * myfunc(N/2) + 1

if __name__ == "__main__":
	N = int(input())
	print(myfunc(N))

Submission status: Wrong Answer

Solution code:
h = int(input())
count = 0
for i in range(40):
    count += 2**i
    if h >= 2 ** i and h < 2 ** i+1:
        break
print(count)

Submission status: Wrong Answer

Solution code:
H=int(input())
s=1 #sはモンスターの数
t=0
while H>1:
    H=H//2
    s=s*2
    t=t+1

list=[]
u=1
while u<=t:
    list.append(u)
    u=u+1

z=0
for i in list:
    z=z+i

print(str(z+s))

Submission status: Wrong Answer

Solution code:
H = int(input())

i = 0
while True:
  if H < 2 ** i:
    n = i-1
    break
  i += 1

print(2**n -1)

Submission status: Wrong Answer

Solution code:
H = int(input())
count = 0
answer = 0
while(H > 1):
  H //= 2
  count += 1
  answer += 2**count
answer += 2**count
print(answer)

Submission status: Wrong Answer

Solution code:
H = int(input())

if H == 1:
  print(1)
  exit(0)

import math as m
n = m.ceil(m.log2(H))
ans = (2**n) - 1

print(ans)

Submission status: Wrong Answer

Solution code:
H = int(input())

ans = 1
for i in range(1, 40):
    if int(H/2) >= 1:
        ans += 2**i
        H = int(H/2)
    else:
        ans += 2**(i-1)
        break

print(ans)

Submission status: Wrong Answer

Solution code:
H = int(input())

ans = 1
for i in range(1, 40):
    if int(H/2) >= 1:
        ans += 2**i
        H = int(H/2)
#        print(i, H)
    else:
        ans += 2**(i-1)
        break

print(ans)

Submission status: Wrong Answer

Solution code:
H = int(input())
SUM = 0
cn = 1

for i in range(10000):
    H = H // 2
    cn = cn + 1
    if H == 1:
        break

for i in range(cn):
    SUM = SUM + (2**i)
    
print(SUM)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 1
while ans < n:
  ans *= 2
print(ans -1)

Submission status: Wrong Answer

Solution code:
H = int(input())
Ans = 0
n = 1
while True:
    if H != 1:
        H = H//2
        Ans += 2**n
        n += 1
    else:
        break
print(Ans)

Submission status: Wrong Answer

Solution code:
import math
H=int(input())
print(int(2**(math.log(H,2)+1)-1))

Submission status: Wrong Answer

Solution code:
H=int(input())

print(2*H-1)

Submission status: Wrong Answer

Solution code:
a=int(input())
import math
total=0
total2=1
while True:
    if a>1:
        a=math.ceil(a/2)
        total+=total2
        total2=total2*2
    elif a==1:
        print(total+total2)
        break

Submission status: Wrong Answer

Solution code:
H = int(input())

cnt = 0

while True:
    H //= 2
    cnt += 1

    if H == 0:
        break

print(cnt)
print(2**cnt-1)

Submission status: Wrong Answer

Solution code:
h=int(input())
c=0
while h>0:
  h=(h//2)
  c+=1
print((c*2)+1)

Submission status: Wrong Answer

Solution code:
h=int(input())
c=0
while h==0:
  h==h//2
  c=+1
print(c*2-1)

Submission status: Wrong Answer

Solution code:
import math
h=int(input())

cnt=0
print(h//2)
while h>1:
    h=math.ceil(h/2)
    cnt+=1
    
print(2**(cnt)+-1)

Submission status: Wrong Answer

Solution code:
print(2**len(input())-1)

Submission status: Wrong Answer

Solution code:
print(int(input()).bit_length()+1)

Submission status: Wrong Answer

Solution code:
print(int(input()).bit_length())

Submission status: Wrong Answer

Solution code:
h = int(input())
ans = 0
i = 0
while True:
  if(2**i>=h):
    break
  i+=1
if(i == 0):
  print(1)
else:
  print(2**(i+1)-1)

Submission status: Wrong Answer

Solution code:
h = int(input())
ans = 0
i = 0
while True:
  if(i>=h):
    break
  i+=1
if(i == 0):
  print(1)
else:
  print(2**(i+1)-1)

Submission status: Wrong Answer

Solution code:
import math

n=int(input())

ans=0
cnt=1
while n!=1:
  n=math.ceil(n/2)
  ans+=1*cnt
  cnt=cnt*2

ans+=1*cnt

print(ans)

Submission status: Wrong Answer

Solution code:
H =int(input())

h= 1
while 2**(h+1) <= H:
    h += 1

n=2**(h+1) - 1
print(n)

Submission status: Wrong Answer

Solution code:
H=int(input())
A=1
while H>A:
    A*=2
print(A-1)

Submission status: Wrong Answer

Solution code:
h = int(input())

power = 0
while True:
  if 2**power < h:
    power += 1
  else:
    break
    
layer = power + 1
ans = int(2**layer - 1)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
div = N//2 + 1
ans = (2**div-1)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
H = int(input())
t = 1
c = 1
while H > 1:
  H = math.floor( H // 2)
  c = 2 * c
  t = t + c
t += c * 2
print(t)

Submission status: Wrong Answer

Solution code:
import math
H = int(input())
t = 1
c = 1
while H > 1:
  H = math.floor( H // 2)
  c = 2 * c
  t = t + c
  print(H, t)
t += c * 2
print(t)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(1)

for i in range(114514):
  a = a // 2
  b = b + 1
  if a == 1:
    break
  else:
    pass

print(2 ** b - 1)

Submission status: Wrong Answer

Solution code:
import math
print(2**math.ceil(math.log2(int(input())))-1)

Submission status: Wrong Answer

Solution code:
h=int(input())

ans=1
while(1<h):
  h//=2
  ans*=2
  if h==1:
    ans+=ans

print(ans-1)

Submission status: Wrong Answer

Solution code:
import bisect

H=int(input())
A=[2**x for x in range(51)]

if H==1:
  print(0)
elif H==2:
  print(3)
else:
  index=bisect.bisect_right(A,H) 
  print(sum(A[:index]))

Submission status: Wrong Answer

Solution code:
import bisect

H=int(input())
A=[2**x for x in range(51)]

if H==1:
  print(0)
elif H==2:
  print(3)
else:
  index=bisect.bisect_left(A,H) 
  print(sum(A[:index]))

Submission status: Wrong Answer

Solution code:
import bisect

H=int(input())
A=[2**x for x in range(51)]

if H==1:
  print(0)
elif H==2:
  print(3)
else:
  if H%4==0:
    H+=1
  index=bisect.bisect_left(A,H) 
  print(sum(A[:index]))

Submission status: Wrong Answer

Solution code:
import bisect

H=int(input())
A=[2**x for x in range(51)]
if H%4==0:
  H+=1
index=bisect.bisect_left(A,H)
if H==1:
  print(0)
elif H==2:
  print(3)
else:
  print(sum(A[:index]))

Submission status: Wrong Answer

Solution code:
import bisect

H=int(input())
A=[2**x for x in range(51)]
if H%4==0:
  H+=1
index=bisect.bisect_left(A,H)
print(sum(A[:index]))

Submission status: Wrong Answer

Solution code:
N = int(input())

for i in range(100000):
    if 2**i <= N and N<2**(i+1):
        print(2**(i+1))
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
m = n
count = 0
for i in range(n): 
    m = m - 1
    if m == 1: 
        n = n//2
    else:
        count += 1
for i in range(n): 
    count += 2

print(count)

Submission status: Wrong Answer

Solution code:
H = int(input())

i = 1
ans = 1
while H:
    H //= 2
    ans += 2 ** i
    i += 1
    if H <= 1:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import math
h=int(input())

cnt=0
for i in range(1,100):
  h=math.floor(h/2)
  cnt+=2**i
  if h==1:
    break
print(cnt+1)

Submission status: Wrong Answer

Solution code:
h = int(input())
layer = 1
branch_set = 0
while True :
    h //= 2
    if h > 1 :
        layer += 1
        continue
    else :
        break

for i in range(0, layer) :
    branch_set += 2 ** i

print(branch_set + 2**layer)

Submission status: Wrong Answer

Solution code:
import sys
H = int(input())
if H == 1:
    sys.exit()
cnt = 1
i = 1
H //= 2
while H > 0:
    i <<= 1
    cnt += i
    H //= 2
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
m=1
while n>1:
  n=n//2
  ans+=1
  m*=2
print(ans+m)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D
# CreatedDate:  2020-06-27 15:43:54 +0900
# LastModified: 2020-06-27 15:55:13 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    h = int(input())
    depth = h//2
    print(2**(depth+1)-1)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
H=int(input())

H_list=[]
while H > 1:
    if H % 2 != 0:
        H=H-1
    H_list.append(H)
        
    H = H//2
    
H_list.sort()

ans_list=[]
for h in H_list:
    if h == 2:
        ans = 3
    else :
        ans = 2*ans+1
    ans_list.append(ans)
    
if H == 1:
  ans=1
    
print(ans)

Submission status: Wrong Answer

Solution code:
h = int(input())
from math import log
d = int(log(h,2)+0.0000000001)
ans = 0
for i in range(d+1):
    ans += 2**i
print(ans)

Submission status: Wrong Answer

Solution code:
from math import ceil
H = int(input())
print(2**(ceil(H/2)+1)-1)

Submission status: Wrong Answer

Solution code:
H = int(input())
n = 0

while H >= 4:  # H < 4 になったときに抜ける
    H = H // 2
    n += 1

print(4 * (2 ** n) - 1)

Submission status: Wrong Answer

Solution code:
# H=int(input())
H=1000000000000
m=1
a=0

while H>1:
    a=m
    H=H//2
    _m=2*m
    m=_m

print(2*m-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
while(2**ans < n):
  ans += 1
print(2**(ans+1)-1)

Submission status: Wrong Answer

Solution code:
H = int(input())

cnt = 0
att = 1
while H > 1:
    H //= 2
    cnt += att
    att *= 2
    if H == 1:
        cnt += att
    
print(cnt)

Submission status: Wrong Answer

Solution code:
h = int(input())

n = h // 2
ans = 0
for i in range(n+1):
	ans += 2**i
print(ans)

Submission status: Wrong Answer

Solution code:
#153d
h = int(input())

# (10 ** 12) / (1024 ** 4) < 1

for i in range(1, 41):
  h //= 2
  if h == 1:
    print(2 ** (i + 1) - 1)
    break

Submission status: Wrong Answer

Solution code:
h=int(input())
a=0
b=0
if h%2 != 0:
	h=h-1
c=h
while h > 1:
	h=int(h/2)
	a+=1
print(a)
for i in range(a):
	b+=2**i
print(2**a+b)

Submission status: Wrong Answer

Solution code:
H = int(input())
m = 1
at = 0
for i in range(H):
    at += m
    H //= 2
    m *= 2
    if H <= 1:
        at += m
        print(at)
        exit()

Submission status: Wrong Answer

Solution code:
H = int(input())
m = 1
at = 0
for i in range(H):
    at += m
    H //= 2
    m *= 2
    if H == 1:
        at += m
        print(at)
        exit()

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(1,100):
    n = n // 2
    count = count + 1
    if n <= 1:
        break
print(2**(count+1)-1)

Submission status: Wrong Answer

Solution code:
h = int(raw_input())

def f(h):
	if h == 1:
		return 1
	return 2 * f(h/2)

print f(h)

Submission status: Wrong Answer

Solution code:
h = int(input())
k = h // 2
if k == 0:
    print(1)
else:
    print(2**k + 2*k - 1)

Submission status: Wrong Answer

Solution code:
h = int(input())

add = 1
ans = 0
while(h!=1):
    h = (h+1)//2
    ans += add
    add *= 2
ans += add
print(ans)

Submission status: Wrong Answer

Solution code:
h = int(input())

add = 1
ans = 0
while(h!=1):
    h = (h+1)//2
    ans += add
    add *= 2
    print(h,ans)

ans += add
print(ans)

Submission status: Wrong Answer

Solution code:
import math
def py():
    print("yes")
def pn():
    print("no")
def iin():
    x = int(input())
    return x

neko = 1
nya = 1
nuko = 0

h = iin()
while h%2 == 0:
    h //= 2
    neko += 1
print(2**neko-1)

Submission status: Wrong Answer

Solution code:
import math
def py():
    print("yes")
def pn():
    print("no")
def iin():
    x = int(input())
    return x

neko = 0
nya = 1
nuko = 0

h = iin()
h = int(h/2+1)
print(2**h-1)

Submission status: Wrong Answer

Solution code:
import fractions
print(int(fractions.math.log2(int(input()))))

Submission status: Wrong Answer

Solution code:
h = int(input())
for i in range(40):
    if h < 2 ** i:
        print(2 ** i - 1)
        exit()

Submission status: Wrong Answer

Solution code:
# input
H = int(input())

M = [H]
cnt = 0

print(M)

while [1] * len(M) != M:

    target = [(idx, m) for idx, m in enumerate(M) if m > 1]
    for idx, m in target:
        M += [m // 2, m // 2]
        M.remove(m)
        cnt += 1

    print(M)

print(cnt + len(M))

Submission status: Wrong Answer

Solution code:
# input
H = int(input())

M = [H]
cnt = 0
while [1] * len(M) != M:
    for idx, m in [(idx, m) for idx, m in enumerate(M) if m > 1]:
        del M[idx]
        M += [m // 2, m // 2]
        cnt += 1

print(cnt + len(M))

Submission status: Wrong Answer

Solution code:
# input
H = int(input())

M = [H]
cnt = 0
while [1] * len(M) == M:
    for idx, m in [(idx, m) for idx, m in enumerate(M) if m > 1]:
        del M[idx]
        M += [m // 2, m // 2]
        cnt += 1

print(cnt + len(M))

Submission status: Wrong Answer

Solution code:
import sys
from io import StringIO
import unittest


def resolve():
    h = int(input())

    cnt = int(h ** 0.5)
    ans = 0

    for num in range(cnt + 1):
        ans += 2 ** num

    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4"""
        output = """7"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1000000000000"""
        output = """1099511627775"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

Solution code:
HP = int(input())
if HP == 1:
  print("1")

else:
  #print(bin(HP))
  print(pow(2,len(bin(HP))-3))

Submission status: Wrong Answer

Solution code:
h = int(input()).bit_length()
print(h**2-1)

Submission status: Wrong Answer

Solution code:
h = int(input())
print(h**2-1)

Submission status: Wrong Answer

Solution code:
import math

h = int(input())

def f(hp):
    if(hp == 1):
        return 1
    else:
        return (2 * f(math.ceil(hp / 2)) + 1)

print(f(h))

Submission status: Wrong Answer

Solution code:
h=int(input())
a=1
while True:
 h=h//2
 a += 1
 if h//2==0:
  break

print(2**a-1)

Submission status: Wrong Answer

Solution code:
import math
k=int(input())
ans=0
if k==1:
  print(ans)
i=0
while True:
  k=math.floor(k/2)
  ans+=2**i
  i+=1
  if k<=1:
    print(ans)
    exit()

Submission status: Wrong Answer

Solution code:
import math
k=int(input())
ans=0
if k==1:
  print('1')
i=0
while True:
  k=math.floor(k/2)
  ans+=2**i
  i+=1
  if k<1:
    print(ans)
    exit()

Submission status: Wrong Answer

Solution code:
import math
k=int(input())
ans=0
if k==1:
  print(ans)
i=0
while True:
  k=math.floor(k/2)
  ans+=2**i
  i+=1
  if k<1:
    print(ans)
    exit()

Submission status: Wrong Answer

Solution code:
h = int(input())
ans = -1

for i in range(100000000):
    if h+1<2**i:
        ans += 2**i
        break

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
H = int(input())
H = [H]
ATK = 0
RUI = 1
while 1:
    nxtH = []
    for i in range(len(H)):
        if H[i]%2 == 0 and H[i] > 1:
            nxtH.append(int(H[i]/2))
            nxtH.append(int(H[i]/2))
            ATK += 2
        if H[i]%2 == 1 and H[i] > 1:
            nxtH.append(int(H[i]/2-0.5))
            nxtH.append(int(H[i]/2-0.5))
            ATK += 2
        if H[i] == 1:
            ATK += 1     
    if nxtH == []:
        break
    H = nxtH
    RUI += 1
print(ATK)

Submission status: Wrong Answer

Solution code:
h = int(input())
s = 1
for i in range(h):
  h = h // 2
  s += 1
  if h <= 1:
    break
print((2**s)-1)

Submission status: Wrong Answer

Solution code:
h = int(input())
a = i = 1
while True:
    a = 2 * a + 1
    i *= 2
    if i * 2 > h:
        break
print(a)

Submission status: Wrong Answer

Solution code:
h = int(input())

for i in range(2,41):
    if h < 2**i:
        print(2**i-1)
        quit()

Submission status: Wrong Answer

Solution code:
import math
H = int(input())

p = math.ceil(math.log2(H))
print(2**p - 1)

Submission status: Wrong Answer

Solution code:
H = int(input())

cnt = 0

ans = 1
while True:
    H = -(-H // 2)
    cnt += 1
    ans *= 2
    if H ==1:
        break
cnt += 1
ans *= 2

print(ans-1)

Submission status: Wrong Answer

Solution code:
def f(H):
    if H==1:
        return 1
    elif H>1:
        return 2*(H//2) +1
h=int(input())
print(f(h))

Submission status: Wrong Answer

Solution code:
def f(h):
    return 0 if h==0 else 1 + 2*f(int(h/2))

h = int(input())
f(h)

Submission status: Wrong Answer

Solution code:
H = int(input())


n = 1
ans = 1
dH = H
while True:
    dH = dH // 2
    ans += 2**n
    n += 1
    if dH <= 1:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h = int(readline())
cnt = 0
for i in range(h):
    if h < 2 ** i:
        print(cnt)
        exit()
    else:
        cnt += 2 ** i

Submission status: Wrong Answer

Solution code:
def atk(H):
    if H == 1:
        return(H)
    else:
        global count
        count += 1
        return(atk(H//2))
count = 0
atk(int(input()))
print(-1*(1-(2**(count))))

Submission status: Wrong Answer

Solution code:
print(2**len(bin(int(input())))/4-1)

Submission status: Wrong Answer

Solution code:
h = int(input())
print(2 ** (h - 1) - 1)

Submission status: Wrong Answer

Solution code:
def attack(num, cnt):
    cnt+=1
    if num==1:
        return cnt
    else:
        return attack(num//2, cnt)

    
H = int(input())
cnt=0
cnt = attack(H, cnt)
tmp = [2**x for x in range(cnt)]
sum(tmp)

Submission status: Wrong Answer

Solution code:
H = int(input())

from collections import deque

d = deque([H])

count = 0
sm = 0
while 1:
    H //= 2
    count += 1
    sm += 2**count

    if H <= 1:
        break

print(sm+1)

Submission status: Wrong Answer

Solution code:
h = int(input())

print(2**h - 1)

Submission status: Wrong Answer

Solution code:
h = int(input())

c = 1
s = 0
for _ in range(h):
    s += c
    c *= 2

print(s)

Submission status: Wrong Answer

Solution code:
def a(x):
    if x == 1: return 1
    if x > 1: return a((x + 1) // 2) * 2 + 1

print(a(int(input())))

Submission status: Wrong Answer

Solution code:
import math
def a(x):
    if x == 1: return 1
    if x > 1: return a(math.ceil(x/2)) * 2 + 1

print(a(int(input())))

Submission status: Wrong Answer

Solution 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()))

h = ii()
count = 0
while h >= 2:
    h = (h+1)//2
    count += 1
#print(count)
if count == 0:
    print(1)
else:
    print(2**(count)-1)

Submission status: Wrong Answer

Solution code:
h = int(input())
print(h.bit_length())
print(2 ** (h.bit_length()) -1)

Submission status: Wrong Answer

Solution code:
import math
H = int(input())

a = int(math.log(H,2))

print((2**a)-2 + (2**a))

Submission status: Wrong Answer

Solution code:
h = int(input())
dep = 0
def log_num(n):
    global dep
    if n == 1:
        return dep
    else:
        dep += 1
        log_num(n//2)
log_num(h)
ans = 1
for i in range(dep+1):
    ans *= 2
print(ans)

Submission status: Wrong Answer

Solution code:
import math
h=int(input())
m=math.ceil(math.log2(h))
print(2**m-1)

Submission status: Wrong Answer

Solution code:
import math

l = math.log(int(input()) + 1, 2)
print(pow(2, math.ceil(l)) - 1)

Submission status: Wrong Answer

Solution code:
import math

h = int(input())

l = math.log(h + 1, 2)
print(pow(2, math.ceil(l)) - 1)

Submission status: Wrong Answer

Solution code:
h = int(input())
ans, i = 0, 1
while h >= i:
    ans += 1
    i *= 2
print(ans)

Submission status: Wrong Answer

Solution code:
h = int(input())
if(h == 1):
  print(1)
  exit()
cnt = 1
point = 0
list = [0 for i in range(100)]
list[1] = 1
while True:
  list[cnt] = ((list[cnt-1] * 2) +1)
  point += 2**cnt
  cnt += 1
  if(point>h):
    break
print(list[cnt-1]*2+1)

Submission status: Wrong Answer

Solution code:
h = int(input())
if(h == 1):
  print(1)
  exit()
cnt = 1
point = 0
list = [0 for i in range(100)]
list[1] = 1
while True:
  list[cnt] = ((list[cnt-1] * 2) +1)
  point += 2**cnt
  cnt += 1
  if(point>=h):
    break
print(list[cnt-1]*2+1)

Submission status: Wrong Answer

Solution code:
h = int(input())
cnt = 1
point = 0
list = [0 for i in range(100)]
list[1] = 1
while True:
  list[cnt] = ((list[cnt-1] * 2) +1)
  point += 2**cnt
  cnt += 1
  if(point>=h):
    break
print(list[cnt-1]*2+1)

Submission status: Wrong Answer

Solution code:
H = int(input())
n = 0
while H//2 != 0:
    H = H//2
    n += 1

print((2**(n+1)-1))
print(2**(n+1))

Submission status: Wrong Answer

Solution code:
import math
 
n = int(input())
kaisu = math.log2(n)
ans = 0
 
for i in range(int(kaisu)):
  ans += 2 ** i
 
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
i = 0

while n > 0:
  ans += n * 2 ** i
  i += 1
  n = n // 2

print(ans)

Submission status: Wrong Answer

Solution code:
H = int(input())
 
def calc(H):
  if H == 0:
    return 1
  else:
    return calc(H//2)*2+1
  
print(calc(H))

Submission status: Wrong Answer

Solution code:
H = int(input())

def calc(H):
  if H == 0:
    return 1
  else:
    return calc(H//2)*2
  
print(calc(H))

Submission status: Wrong Answer

Solution code:
import sys

def s(d, i=1, a=1):
    a += i*2
    if d <= 1:
        return a
    return s(d-1,i=i*2, a=a)

H = int(input())

count = 0

while True:
    count += 1
    
    H = H // 2
    
    if H <= 1:
        break

print(s(count))

Submission status: Wrong Answer

Solution code:
def hel(h):
  if h==0:
    return 1
  else:
    return (2*hel(int(h/2))+1)
health=int(input())
print(hel(health))

Submission status: Wrong Answer

Solution code:
def hel(h):
  if h==0:
    return 1
  else:
    return (hel(int(h/2))+hel(int(h/2)))
health=int(input())
print(hel(health))

Submission status: Wrong Answer

Solution code:
h=int(input())
for i in range(41):
  if h<pow(2,i):
    print(pow(2,i)-1)

Submission status: Wrong Answer

Solution code:
H = int(input())
ene = 0
count = 0
while H >= 1:
  H //= 2
  count += ene
  ene *= 2
print(count)

Submission status: Wrong Answer

Solution code:
H = int(input())
ene = 0
count = 0
while H >= 1:
  H //= 2
  count += ene
print(count)

Submission status: Wrong Answer

Solution code:
#D
import numpy as np
h=int(input())
def f(h):
    if h<=1:
        return 1
    else:
        return 2*f(np.ceil(h/2))+1
print(f(h))

Submission status: Wrong Answer

Solution code:
H=int(input())
ans=1
num=1
while H>0:
  ans+=num
  num*=2
  H//=2
print(ans)

Submission status: Wrong Answer

Solution code:
import math
print(2**(math.ceil(math.log(float(input())+1,2)))-1)

Submission status: Wrong Answer

Solution code:
import math
print(2**(math.ceil(math.log(float(input()),2)))-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
H = int(input())

print(2 ** (int(np.log2(1000000000000)) + 1) - 1)

Submission status: Wrong Answer

Solution code:
H, ans, n = int(input()), 0, 1
while H == 0:
    ans, n, H = ans + n, n ** 2, H // 2
print(ans)

Submission status: Wrong Answer

Solution code:
# モンスターの体力H
H = int(input())
monster = []
monster.append(H)
print(monster)

# HP1ならヤる.1より大きいならHP半分にして分裂
count = 0
while True:
  if monster == []:
    break
  if monster[0] > 1:
    a = monster[0] // 2
    monster.pop(0)
    monster.append(a)
    monster.append(a)
    count += 1
  elif monster[0] == 1:
    monster.pop(0)
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import math
h=int(input())
k=math.ceil(math.log2(h))
if h%2:
  print(2**k-1)
else:
  print(2**(k+1)-1)

Submission status: Wrong Answer

Solution code:
import math
h=int(input())
k=math.ceil(math.log2(h))
print(2**k-1)

Submission status: Wrong Answer

Solution code:
H = int(input())

ans = H
count = 0
while H != 1:
    count += 1
    H = H // 2
    ans += H

print(ans)

Submission status: Wrong Answer

Solution code:
H = float(input())

cnt = int(H**(0.5))
ans = 0

for num in range(cnt):
    ans += 2 ** num

print(ans)

Submission status: Wrong Answer

Solution code:
h = input()
q = int(h) // 2 + 1
ans = 2**q
print(ans-1)

Submission status: Wrong Answer

Solution code:
H = int(input())

if H == 1:
  print(1)

else:
  sp = 0
  count = 1
  while H != 1:
    H = H // 2
    count *= 2
    sp += count
  print(count*2)

Submission status: Wrong Answer

Solution code:
import math

H = float(input())

print(int(math.pow(2, math.log2(H)+1)-1))

Submission status: Wrong Answer

Solution code:
H=int(input())
import math
j=(math.log2(H))//1

print(2**(j+1)-1)

Submission status: Wrong Answer

Solution code:
val=int(input())
ans=0
while val>1:
  val/=2
  ans+=1
ans=2**ans-1
print(ans)

Submission status: Wrong Answer

Solution code:
h = int(input())
count = 0
def dfs(h):
    global count
    count += 1
    if h == 1:
        quit()
    else:
            dfs(h//2)
            dfs(h//2)

dfs(h)
print(count)

Submission status: Wrong Answer

Solution code:
H = int(input())
print(H)
def ref(H,d):
  d = d+1
  if 1 < H:
  	H, d = ref(H/2,d*2)
  return H, d

_, d = ref(H,0)

print(d)

Submission status: Wrong Answer

Solution code:
import math
H = map(int,input().split())

ans=sum([2**int(1+math.ceil(math.log2(s)))-1 for s in H])

print(ans)

Submission status: Wrong Answer

Solution code:
H = int(input())

c = 1
while H >= 2**c:
    c += 2

print(2 ** c - 1)

Submission status: Wrong Answer

Solution code:
h = int(input())
c = 0
i = 0
while True:
  c+=1
  h = h//2
  if h <= 1:
    break
print(sum(2**y for y in range(c+1)))

Submission status: Wrong Answer

Solution code:
import math
h = int(input())
k = (math.log2(h))
print((2**(k+1)-1))

Submission status: Wrong Answer

Solution code:
def attack_count(N):
    if N == 1:
        return 1
    else:
        return 2 * attack_count(N//2)

H = int(input())
print(attack_count(H))

Submission status: Wrong Answer

Solution code:
import math
H = int(input())
k = math.log(H,2)
print(int((2**(k+1)-1)))

Submission status: Wrong Answer

Solution code:
h = int(input())
num = 1
cnt = 0
while True:
    cnt += num
    h >>= 1
    num *= 2
    if h:
        continue
    print(num)
    break

Submission status: Wrong Answer

Solution code:
j = 1
a = 1
i = int(input())

while i > 1:
    i /= 2
    j *= 2
    a += j

print(a)

Submission status: Wrong Answer

Solution code:
a = int(input())

def Rec(a):
  if a == 1: 
    print("1になった")
    return 1
  print("今から再帰関数呼ぶ:{}".format(a))
  return 1 + Rec(a//2)*2

print(Rec(a))

Submission status: Wrong Answer

Solution code:
h = int(input())
v = 1
t = v

while True:
    if t > h:
        break
    v *= 2
    t += v

print(t)

Submission status: Wrong Answer

Solution code:
h = int(input())
v = 1
t = v

for i in range(1000):
    if t > h:
        break
    v *= 2
    t += v

print(t)

Submission status: Wrong Answer

Solution code:
H=int(input())

ans=1
while H>0:
    H=int(H//2)*ans
    ans+=H
print(ans)

Submission status: Wrong Answer

Solution code:
import math
cnt = 1
n = 2
h = int(input())
if h == 1:
  print(cnt)
else:
  h = int(math.log2(h))
  for i in range(h+1):
    cnt += 2**i
  print(cnt)

Submission status: Wrong Answer

Solution code:
import numpy as np
import math 

def resolve():
    n = input()
    m = math.ceil(np.log2(int(n)))

    ans = 0
    for i in range(m + 1):
        ans += np.power(2, i)

    print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
def car(n):
  if n==1:
    return 1
  elif n%2==0:
    return car(n//2)*2
  else:
    return car((n-1)//2)*2
  
N=int(input())
print(car(N))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
h = int(input())
cnt = 0
while h >= 1:
  cnt += h
  h = int(h / 2)
print(cnt)

Submission status: Wrong Answer

Solution code:
HP=int(input())

def Caracal(x):
  if x>1:
    ans=1+Caracal(x//2)*2
  elif x==1:
    ans=1
  else:
    ans=-1
  print(x,ans)
  return ans

print(Caracal(HP))

Submission status: Wrong Answer

Solution code:
h=int(input())
if h==1:
    print(1)
else:
    if h%2==0:
        n=h//2
    else:
        n=(h-1)//2
    print(2**(n+1)-1)

Submission status: Wrong Answer

Solution code:
import math
print(2**int(math.log2(int(input())))-1)

Submission status: Wrong Answer

Solution code:
def res(n):
	if n == 1:
		return 1
	else :
		return 2*res(n//2)+1
		
print(res(2))

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

#入力
H = np.array([int(input())])
s = 0
X = H
counter = 1

while counter>0:
    for i in range(len(X)):
        if X[i]>1:
            X = np.insert(X, i, [math.floor(X[i]/2), math.floor(X[i]/2)] )
            X = np.delete(X, i + 2)
            s = s + 1
            counter = counter
        else:
            X[i] = 0
            s = s + 1
            counter = counter - 1
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())

count = 1

while True:
    if n > 1:
        n = n//2
        count += 1
    else:
        break

print(count)
value = 0
factional = 0.5
for i in range(count):
    factional = factional * 2
    print(factional)
    value += factional

print(int(value))

Submission status: Wrong Answer

Solution code:
n = int(input())

count = 1

while True:
    if n > 1:
        n = -(-n//2)
        count += 1
    else:
        break

print(count)
value = 0
factional = 0.5
for i in range(count):
    factional = factional * 2
    print(factional)
    value += factional

print(int(value))

Submission status: Wrong Answer

Solution code:
import math
H=int(input())
sum([2**x for x in range(math.floor(math.log2(H))+1)])

Submission status: Wrong Answer

Solution code:
h = int(input())
count = 0

while h >= 2:
  h //= 2
  count += 1
  
print(2**count)

Submission status: Wrong Answer

Solution code:
def rec_count(num):
    if num == 0:
        return 0
    elif num == 1:
        return 1
    elif num == 2:
        return 3
    elif num == 3:
        return 3
    else:
        split = num // 2
        return 1 + 2 * rec_count(split)

h = int('1026')
print(rec_count(h))