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: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(H: int):
    layer = 0
    h = H
    while True:
        h //= 2
        layer += 1
        if h == 0:
            break
    answer = 0 
    for i in range(layer):
        answer += 2**i
    print(answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    solve(H)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
h=int(input())

ans = 0

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

h = onem()
co = 1
c = 0
while h:
    h //= 2
    c += co
    co *= 2

print(c)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

h = ni()

def dfs(h):
    if h == 1:
        return 1
    else:
        return dfs(h//2)*2 + 1

print(dfs(h))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    H=int(input())
    print(2**H.bit_length()-1)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    h = I()
    k = h.bit_length()
    print((1<<k)-1)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(H: int):
    ret = 0
    i = 1
    while H > 0:
        ret += i
        i *= 2
        H //= 2
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    solve(H)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

H = int(sys.stdin.buffer.readline())
ans = 2**H.bit_length() - 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
h = int(input())

cnt = 0
b = 1
while h>1:
    h //= 2
    cnt += b
    b *= 2
print(cnt+b)

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
i=0
while n!=0:
  n//=2
  cnt+=2**(i)
  i+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,*w = [int(i) for i in read().split()]
#n,*t = map(int,read().split())

n = int(input())
#s = input()
#a,b = [int(i) for i in readline().split()]



def get(x):
    if x == 1:
        return 1
        
    return 1+2*get(x//2)




print(get(n))

Submission status: Runtime Error

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: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000)

H = int(input())
ls = [-1]*(H+1)
ls[0] = 0
ls[1] = 1
def battle(h):
  if ls[h] != -1:
    return ls[h]
  else:
    tmp = 2*battle(h//2)
    ls[h] = tmp+1
    return ls[h]
print(battle(H))

Submission status: Runtime Error

Solution code:
H = int(input())
ls = [-1]*(H+1)
ls[0] = 0
ls[1] = 1
def battle(h):
  if ls[h] != -1:
    return ls[h]
  else:
    tmp = 2*battle(h//2)
    ls[h] = tmp+1
    return ls[h]
print(battle(H))

Submission status: Runtime Error

Solution code:
H = int(input())
ls = [-1]*(H+1)
ls[0] = 0
ls[1] = 1
def battle(h):
  if ls[h] != -1:
    return ls[h]
  else:
    tmp = 2*battle(h//2)
    ls[h] = tmp
    return ls[h]
print(battle(H))

Submission status: Runtime Error

Solution code:
H = int(input())

# 体力がHのモンスター1体に勝つために必要な攻撃回数をf(H)とする
# すると、f(H)は以下の漸化式に従って求まる
# f(H)=2*f(floor(H/2)+1) (H>1)
# f(H)=1 (H=1)

def attack_num(x):
  if x == 1: return 1
  else: return 2*f(x // 2) + 1
  
print(attack_num(H))

Submission status: Runtime Error

Solution code:
H = int(input())

import math as m
remain = H % 2
H -= remain
n = round(m.log2(H)+0.5)
ans = (2**n) - 1

print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000)
def rec(n):
    if n == 1: 
        return 1
    return rec(n/2)*2+1

n = int(input())
print(rec(n))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000)
def rec(n):
    if n == 1: 
        return 1
    return rec(n/2)*2+1

n = int(input())
ans = 0
ans += rec(n)
print(ans)

Submission status: Runtime Error

Solution code:
def rec(n):
    if n == 1: 
        return 1
    return rec(n/2)*2+1

n = int(input())
ans = 0
ans += rec(n)
print(ans)

Submission status: Runtime Error

Solution code:
def rec(n):
    if n == 1: return 1
    return rec(n/2)*2+1

n = int(input())
ans = 0
ans += rec(n)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
H = int(input())
dn = [0]*(H//2+1)
dn[0] = 1

for i in range(1,H//2+1):
    dn[i] = dn[i-1]*2
print(sum(dn))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
H = int(input())
import pdb; pdb.set_trace()
def atk(n):
  if n==1: return 1
  return 1 + 2*(atk(n//2))

print(atk(H))

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll kill_monster(ll health){
    if(health == 1)
        return 1;
    return 1 + 2 * kill_monster(health / 2);
}
int main() {
    
   ll H;
   cin >> H;
   cout << kill_monster(H);

   return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(log2(int(input())))

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

Submission status: Runtime Error

Solution code:
memo = [0] * 100000000
memo[1] = 1

def saiki(n):
    global memo
    tmp = 0
    if n <= 1:
        return memo[1]
    else:
        tmp = int(n/2)
        if memo[tmp] == 0:
            memo[tmp] = saiki(tmp)
        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))

Submission status: Runtime Error

Solution code:
memo = [0] * 1000000
memo[1] = 1

def saiki(n):
    global memo
    tmp = 0
    if n <= 1:
        return memo[1]
    else:
        tmp = int(n/2)
        if memo[tmp] == 0:
            memo[tmp] = saiki(tmp)
        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))

Submission status: Runtime Error

Solution code:
memo = [0] * 1000000000000
memo[1] = 1

def saiki(n):
    global memo
    tmp = 0
    if n <= 1:
        return memo[1]
    else:
        tmp = int(n/2)
        if memo[tmp] == 0:
            memo[tmp] = saiki(tmp)
        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
H = INT(input())
count = 0

while True:
  count += 1
  if H == 1:
    print(count)
    break
  else:
    H = H // 2

Submission status: Runtime Error

Solution code:
H = [int(input().split())]

ans = 0
while len(H) == 0:
  ans += 1
  m = H.pop(0)
  if m == 1:
    continue
  else:
    H = H + [m//2, m//2]
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

if N == 1:
    print(1)
else:
    ans = 1
    i = 1
    while N >= 2 ** i:
        ans += 2 ** i
        i += 1

print(ans)

Submission status: Runtime Error

Solution code:
cnt = 0
i = 0
while H > 0:
    H //= 2
    cnt += 2 ** i
    i += 1
print(cnt)

Submission status: Runtime Error

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
import itertools
import math
input = sys.stdin.readline

N = int(input())
list_P = tuple(map(int, input().split()))
list_Q = tuple(map(int, input().split()))

List_All = list(itertools.permutations(list(range(1, N+1))))
# print(List_All)
Pi = List_All.index(list_P)
Qi = List_All.index(list_Q)
print(abs(Pi-Qi))

Submission status: Runtime Error

Solution code:
x=(bin(int(input()))
print(2**(len(x)-2)-1)

Submission status: Runtime Error

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)
    
print(ans)

Submission status: Runtime Error

Solution code:

import sys
sys.setrecursionlimit(1000000000)
def times(h,kp):
    if h==1:
        return 1
    else:
        if h >= 10**9:
            return 1+2*times(int(h//2),kp)
        elif kp[h]==0:
            kp[h]=1+2*times(int(h//2),kp)
            return kp[h]
        else:
            return kp[h]
        
H=int(input())
kp=[0]*10**9
print(times(H,kp))

Submission status: Runtime Error

Solution code:

import sys
sys.setrecursionlimit(1000000)
def times(h,kp):
    if h==1:
        return 1
    else:
        if h >= 10**9:
            return 1+2*times(int(h//2),kp)
        elif kp[h]==0:
            kp[h]=1+2*times(int(h//2),kp)
            return kp[h]
        else:
            return kp[h]
        
H=int(input())
kp=[0]*10**9
print(times(H,kp))

Submission status: Runtime Error

Solution code:
print(~-1<<len(bin(int(input()))-3))

Submission status: Runtime Error

Solution code:
def main():
    h = int(input())

    for i in range(40):
        if 2**(i+1) == h:
            n = i+2
            break
        if 2**(i) < h and h < 2**(i+1):
            n = i+1
            break
    ans = sum([2**i for i in range(n)])
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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


H = int(input())

ans = func(H)
print(ans)

Submission status: Runtime Error

Solution code:
H=input()
count=0
m=1
while H:
  if H==1:
    count+=m
  else:
    m*=2
    H=int(H/2)
print(count)

Submission status: Runtime Error

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

print(2**a-1)

Submission status: Runtime Error

Solution code:
H=int(input())

def rec(h):
  if h==1:
    return 1
  else:
    return rec(h/2)*2 + 1
print(rec(H))

Submission status: Runtime Error

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: Runtime Error

Solution code:
H = int(input())
I = len(bin(H)-3)
Sn = 2**(I+1)-1
print(Sn)

Submission status: Runtime Error

Solution code:
from math import log2
import sys
from collections import Counter
from bisect import bisect_left
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
S = input().strip()
for CASES in range(int(input())):
'''
inf = 100000000000000000  # 1e17
mod = 998244353


n = int(input())
ans = 1
n = log2(n)
n=int(n)
for i in range(n):
    ans = ans * 2 + 1
print(ans)

Submission status: Runtime Error

Solution code:
def main2():
    n, k = list(map(int, input().split()))
    monsters = list(map(int, input().split()))
    monsters.sort(reverse=True)

    for i in range(k):
        monsters[i] = 0
    print(sum(monsters))

if __name__ == '__main__':
    main2()

Submission status: Runtime Error

Solution code:
h=int(input())
def f(n):
  if n==1:
    return 1
  else:
    return 2 * f(n) + 1
hit=f(h)
print(hit)

Submission status: Runtime Error

Solution code:
#D

H = int(input())
c = 1
while H>1:
  H = math.floor(H/2)
  c += 1
print(sum([2**i for i in range(c)]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
H = int(input())
n = math.floor(math.log2(H))
c = 1
for i in range(n):
    c += (2 ** (i+1))
print(c)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
print(a([int(input())]))

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

Submission status: Runtime Error

Solution code:
def resolve():
    H = int(input())
    dp = [0] * (H + 1)
    dp[1] = 1
    for i in range(2, H + 1):
        dp[i] = 1 + 2 * dp[i // 2]
    print(dp[-1])

resolve()

Submission status: Runtime Error

Solution code:
H = int(input())
dp = [0] * (H+1)
dp[1] = 1
for i in range(2, H+1):
  dp[i] = 1 + 2 * dp[i//2]
print(dp[-1])

Submission status: Runtime Error

Solution code:
n =int(input())
ans = 1
for i in range(int(np.log2(n))):
    ans += 2**(i+1)
    
print(ans)

Submission status: Runtime Error

Solution code:
h = int(input())

def dev(n):
    if n == 1:
        retuen 1
    else:
        retuen 1 + dev(n//2) * 2

print(dev(h))

Submission status: Runtime Error

Solution code:
def dev(n):
    if n = 1:
        retuen 1
    else:
        retuen 1 + dev(n//2) * 2

print(dev(h))

Submission status: Runtime Error

Solution code:
h = int(input())

def dev(n):
    if n = 1:
        retuen 1
    else:
        retuen 1 + dev(n//2) * 2

print(def(h))

Submission status: Runtime Error

Solution code:
def attack(x):
  if x==1:
    return 1
  else:
    return (attack(-(-x/2))*2+1)

h=int(input())

print(attack(h))

Submission status: Runtime Error

Solution code:
N=int(input())
a=0
d=1
while d<=N:
  a+=d
  d*=2
print(ans)

Submission status: Runtime Error

Solution code:
N = input()
cnt = 0

while N>1:
    N = int(N/2)
    cnt +=1

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

Submission status: Runtime Error

Solution code:
import math

n = int(input())
kaisu = math.log2(n)
ans = 0

for i in range(kaisu):
  ans += 2 ** i

print(ans)

Submission status: Runtime Error

Solution code:
H = int(input())

def calc(H):
  a = int(H/2)
  return a*2 + 1


def main(H):
  if H == 1:
    return 1
  else:
    return calc(H)

if __name__=='__main__':
  main()

Submission status: Runtime Error

Solution code:
def f(n):
  if n=1:
    return(1)
  else:
    f(n)=2f(n-1)+1
    return f(n)
n=int(input())
print(f(n))

Submission status: Runtime Error

Solution code:
N,K = list(map(int,input().split()))
Ha = list(map(int,input().split()))
Hb = sorted(Ha,reverse=True)
del Hb[:K]
print(sum(Hb))

Submission status: Runtime Error

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: Runtime Error

Solution code:
H = int(input())

def attack(x):
    if H > 0:
        return 2 * attack(int(x/2)) + 1
    else:
        return 1
      
print(attack(H))

Submission status: Runtime Error

Solution code:
n=int(input())
def fune(a):
    if a==1:
        return 1
    else:
        return 2*(fune(a)//2)+1
print(fune(n))

Submission status: Runtime Error

Solution code:
def resolve():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    i = sorted(h, reverse=True)

    if k==0:
        print(sum(i))
        exit()
    else:
        j = i[k:]
        print(sum(j))
resolve()

Submission status: Runtime Error

Solution code:
import math
def main():
    h = int(input())
    cnt = 0
    ans = 0
    tmp = 1
    a = int(math.log2(h))
    cnt = 2 **a
    ans = (1-2**(a+1))//(1-2)
    print(ans)

if __name__=='__main__':
    main()

Submission status: Runtime Error

Solution code:
import math
H=int(input())
n=int(math.log2(H))+1
x=n
for i in range(n-1):
    x+=2**(i)*(n-i-1)
print(x)

Submission status: Runtime Error

Solution code:
H = int(input())

i=1
while True:
    A=2**i
    if H==A:
        jo=i
        break
        
    elif H<A:
        jo=i-1
        break
    i+=1

for j in range(0,jo+1):
    result=result+2**j
print(result)

Submission status: Runtime Error

Solution code:
import math

H, N  = map(int, input().split())
use_mp = 0
use_mp_list = list()
mag = list()
for i in range(N):
  temp = [int(j) for j in input().split()]
  mag.append([temp[0] / temp[1], temp[0], temp[1]])			#(ap, mp, dpm)
mag.sort(reverse=True)

for i in range(N):
  if H == 0:
    break
  t = H // mag[i][1]
  if t > 0:
    H = H - mag[i][1] * t
    use_mp += mag[i][2] * t
  if H == 0:
    abc = 0
  else:
    abc = (mag[i][2] * math.ceil(H / mag[i][1]))
  #print(mag)
  use_mp_list.append(use_mp + abc)
print(min(use_mp_list))

Submission status: Runtime Error

Solution code:
import math

H, N  = map(int, input().split())
use_mp = 0
use_mp_list = list()
mag = list()
for i in range(N):
  temp = [int(j) for j in input().split()]
  mag.append([temp[0] / temp[1], temp[0], temp[1]])			#(ap, mp, dpm)
mag.sort(reverse=True)

for i in range(N):
  if H == 0:
    break
  t = H // mag[i][1]
  if t > 0:
    H = H - mag[i][1] * t
    use_mp += mag[i][2] * t
  if H == 0:
    abc = 0
  else:
    abc = (mag[i][2] * math.ceil(H / mag[i][1]))
  #print(mag)
  print(use_mp + abc, mag[i][1], mag[i][2], H, use_mp)
  use_mp_list.append(use_mp + abc)
print(min(use_mp_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
h = map(int,input().split())

print(2 * h + 1)

Submission status: Runtime Error

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

def func_dame(h):
    if h == 1:
        return 1
    else:
        return 2 * func_dame(h/2) + 1
atack_num = 2 * func_dame(h / 2) + 1
print(atack_num)

Submission status: Runtime Error

Solution code:
H = int(input())

def f(H):
    if H == 1:
        return 1
    if H > 1:
         return 2*f(H/2)+1
print(f(H))

Submission status: Runtime Error

Solution code:
def f(h):
  if h==1:
    return 1
  else:
    return f[h//2]*2+1
  
print(f(int(input())))

Submission status: Runtime Error

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

print(time(H))

Submission status: Runtime Error

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

f[0] = h
  
print(2**a-1)

Submission status: Runtime Error

Solution code:
H = input()

i = 0
while 2 ** i <= H:
  i += 1
print(2 ** i - 1)

Submission status: Runtime Error

Solution code:
def f(x):
    if x == 1:
        return 1
    else:
        return 2 * f(H // 2) + 1   

H = int(input())

min = f(H)

print(min)

Submission status: Runtime Error

Solution code:
from collections import deque

def f(x):
    if x == 1:
        return 1
    else:
        return 2 * f(H // 2) + 1   

H = int(input())

    min = f(H)

print(min)

Submission status: Runtime Error

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

if n == 1:
    print(1)
    exit()

if n % 2 != 0:
    n -= 1

h = math.log2(n)
h = math.floor(h)
print(2**(h+1)-1)

Submission status: Runtime Error

Solution code:
h = input()

def myfunc(hp):
    if(hp == 1):
        return 1
    elif(hp > 1):
        return int(myfunc(hp/2)) + int(myfunc(hp/2)) + 1


if __name__ == '__main__':
    ans = myfunc(int(h))
    print(ans)

Submission status: Runtime Error

Solution code:
h = input()
count = 0
count_1 = 1
count_2 = 1
while True:
    if h == 1:
        print(count_2)
        break
    else:
        h = h // 2
        count_1 = count_1 * 2
        count_2 += count_1

Submission status: Runtime Error

Solution code:
H=int(input())
List=[H]

Ans1=0
Ans2=0
for i in range(100000000000):
    List.sort(reverse=True)
    print(List)
    if List[0]!=1:    
        new=List[0]//2
        List.pop(0)
        new1=new
        List.append(new)
        List.append(new1)
        Ans1+=1
    else:
        Ans2=len(List)
        break
print(Ans1+Ans2)

Submission status: Runtime Error

Solution code:
H = int(input())

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

print(f(H))

Submission status: Runtime Error

Solution code:
h = int(input())


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


print(f(h))

Submission status: Runtime Error

Solution code:
h = int(input())
while 2 ** i <= h:
    i += 1
print(2 ** i - 1)

Submission status: Runtime Error

Solution code:
e

Submission status: Runtime Error

Solution code:
H = int(input())
total = 1
while H > 1:
  H = H // 2
  if H != 0:
    total += 1
number = 0
for i in range(tatal):
  number += 2 ** i
print(number)

Submission status: Runtime Error

Solution code:
H = int(input())
total = 1
while H != 1:
  H = H // 2
  total += 1
for i in range(tatal):
  number += 2 ** i
print(number)

Submission status: Runtime Error

Solution code:
import math
cnt = 1
n = 2
h = int(input())
if h == 1:
  print(cnt)
else:
  h = int(math.log2(h))
  print(sum(list(range(1, 2**h+1))))

Submission status: Runtime Error

Solution code:
H=int(input())
a=1
ans=1
while True:
  if a>H:
    break
   ans=ans+a
  a=a*2

print(ans)

Submission status: Runtime Error

Solution code:
HP=int(input())

print(Caracal(HP))

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

Submission status: Runtime Error

Solution code:
HP=int(input())

print(Caracal(HP))

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

Submission status: Runtime Error

Solution code:
h = map(int, input().split())
monster = list(h)

attack_count = 0
fin_flag = 0

print(monster)

while(fin_flag == 0):

    for i in range(len(monster)) :
        attack_count = attack_count + 1
        if(monster[i] == 1):
            if(i == 0 and monster[0] == 1):
                fin_flag = 1
                break
            monster.pop(i)
        else:
            monster.append(monster[i]//2)
            monster.append(monster[i]//2)
            monster.pop(i)

print(attack_count+1)

Submission status: Runtime Error

Solution code:
2**log2(int(input().split()[0]))-1

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
out = 0
def dev(_):
  if _ < 1:
    out += 1
  else:
    dev(_/2)
    dev(_/2)
num = int(input())
dev(_)
print(out)

Submission status: Runtime Error

Solution code:
import math

H = input()
i = 0

# i回目の攻撃
for j in range(10**12):
  i = i + 1
  H = H - 1

  if H <= 0:
    break
  else:
    H = math.floor(H/2)*2
print(i)

Submission status: Runtime Error

Solution code:
H = int(input())

def Test(m):
    if m == 1:
        return 1
    else:
        return 2 * Test(m/2) + 1

ans = Test(H)

print(ans)

Submission status: Runtime Error

Solution code:
a = int(input())
s = '1' + '0' * (a-1)
print(int(s, 2) -1)

Submission status: Runtime Error

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(input())
print(rec_count(h))

Submission status: Runtime Error

Solution code:
h = int(input)
count = 1
flag=0
while:
    h = h//2
    count += 1
    if h==1:
        print(2**count-1)
        break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
	H = int(input())
	cnt = 0
	while 1:
		if H==1:
			break
		else:
			H = H//2
			cnt += 1
	ans = 0
	for i in range(cnt):
		ans += 2**i
	ans += 2**(i+1)
	print(ans)

if __name__ == '__main__':
	main()

Submission status: Runtime Error

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

num = 1
res = 1

if H > 1:
    while (num * 2) <= H:
        num = num * 2
        res = num * 2 - 1

print(res)

Submission status: Runtime Error

Solution code:
import math

h = float(input())

count = 1
while(h > 1) {
  h = round(h / 2)
  count+=1
}
print(count)

Submission status: Runtime Error

Solution code:
def calc(x):
  return 1 + calc(x // 2)

h = int(input())

print(calc(h))

Submission status: Runtime Error

Solution code:
h = int(input())
def Count(a):
  if a==1:
    return 1
  return 1+2*Count(a//2)
print(Count(a))

Submission status: Runtime Error

Solution code:
h = int(input())
def Count(a):
  if a==1:
    return 1
  return 1+2*count(a//2)
print(Count(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

H = int(input())

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

Submission status: Runtime Error

Solution code:
h = int(input())

split_num = math.floor(math.log2(h)) + 1
attack_num = sum([2**s for s in range(1, split_num+1)])

print(attack_num)

Submission status: Runtime Error

Solution code:
import math
h=int(input())
m=int(math.long(h,2))
print(2**(h+1)-1)

Submission status: Runtime Error

Solution code:
h=int(input())
m=int(math.long(h,2))
print(2**(h+1)-1)

Submission status: Runtime Error

Solution code:
h = int(input())

sum = [0] * (h+1)

#print(sum)

for i in range(1, h+1) :
    sum[i] = 2*sum[i//2] + 1

print(sum[h])

Submission status: Runtime Error

Solution code:
print(2**(len(bin(int(nput()))) - 2) - 1)

Submission status: Runtime Error

Solution code:
H = int(input())
A = []
A.append((A, 1))
ans = 0
while len(A) > 0:
  h, c = A[0]
  A.pop(0)
  ans += c
  A.append((h//2, c*2))
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
cur = 1
while cur <= n:
  a.append(cur)
  cur *= 2
print(sum(cur))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
L=list(map(int,input().split()))
L=sorted(L)
if K==0:
  print(sum(L))
else:
	print(sum(L[:-K]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
L=list(map(int,input().split()))
L=sorted(L)
print(sum(L[:K]))

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
L=list(map(int,input().split()))
L=sorted(L)
sum(L[:K])

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
L=list(map(int,input().split()))
sum(list(sorted(L))[:K])

Submission status: Runtime Error

Solution code:
H = int(input())
s = 1
while H!=0:
    H = divmod(H, 2)[0]
    s *= 2
s = s / 2
print(int(s + p))

Submission status: Runtime Error

Solution code:
h = int(input())

count = 0

def cal(h):
  if h = 1:
    count = count + 1
    return 0
  
  return count + cal(int(h/2))) + 1

print(cal(h))

Submission status: Runtime Error

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