Problem:


Score : 200 points

Problem Statement

Square1001 has seen an electric bulletin board displaying the integer 1.
He can perform the following operations A and B to change this value:

Operation A: The displayed value is doubled.

Operation B: The displayed value increases by K.

Square1001 needs to perform these operations N times in total.
Find the minimum possible value displayed in the board after N operations.

Constraints

1 \leq N, K \leq 10

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
K

Output

Print the minimum possible value displayed in the board after N operations.

Sample Input 1

4
3

Sample Output 1

10

The value will be minimized when the operations are performed in the following order: A, A, B, B.

In this case, the value will change as follows: 1 → 2 → 4 → 7 → 10.  

Sample Input 2

10
10

Sample Output 2

76

The value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B.

In this case, the value will change as follows: 1 → 2 → 4 → 8 → 16 → 26 → 36 → 46 → 56 → 66 → 76.  

By the way, this contest is AtCoder Beginner Contest 076.



Sample input:
4
3


Sample output:
10

Submission status: Wrong Answer

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

while cnt < n:
    ans += k
    cnt += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
a=1
i=0
while a<=K or i<=N:
    a = a*2
    i = i+1
print(a+K*(N-i))

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
a=1
i=0
while (a*2-a)<=K:
    a = a*2
    i = i+1
print(a+K*(N-i))

Submission status: Wrong Answer

Solution code:
N, K = int(input()), int(input())

num = 1

while num < K:
	num <<= 1
	N -= 1
print(num+K*N)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
p = 0
while (K >= 2**p):
  p += 1
print(2**p+K*(N-p))

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

ans = 1
ind = 0
while ind <= N and ans <= K:
    ans *= 2
    ind += 1

ans += max(0, N - ind)*K
print(ans)

Submission status: Wrong Answer

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

a_num = 0
val = 1
while val < k and a_num <= n:
    val *= 2
    a_num += 1

ans = val + (n - a_num) * k
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
K=int(input())
s=1
c=0
while s<K:
  c+=1
  s*=2
s+=(N-c)*K
print(s)

Submission status: Wrong Answer

Solution code:
c=0
N=int(input())
K=int(input())
s=1
c=0
while s<K:
  c+=1
  s*=2
s+=(N-c)*K
print(s)

Submission status: Wrong Answer

Solution code:
c=0
N=int(input())
K=int(input())
s=1
c=0
while s<=K:
  c+=1
  s*=2
s+=(N-c)*K
print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
A=1
count=0
while A<K:
    count+=1
    A*=2
if N==1 and K==1:
	print(1)
else:
	print(A+K*(N-count))

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
A=1
count=0
while A<=K:
    count+=1
    if A==K:
      break
    else:
    	A*=2

print(A+K*(N-count))

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
A=1
count=0
while A<K:
    A*=2
    count+=1
print(A+K*(N-count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
a = 1
for x in range(n):
    if a * 2 > a + k:
        a + k
    else :
        a * 2
print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
ans = float('inf')
for i in range(11):
    tmp = 2**i + K*(N-i)
    ans = min(tmp,ans)
print(ans)

Submission status: Wrong Answer

Solution code:

N = int(input())
K = int(input())


min_ans = 1 + K*N

for i in range(1, N):
    ans = 2 ** i + K*(N-i)
    if ans<min_ans:
        min_ans = ans

print(min_ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

def ans(i,x):
    print(i)
    if i == 0:
        return min(2*x, x+K)
    else:
        return min(ans(i-1, 2*x), ans(i-1, x+K))

print(ans(N-1, 1))

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

ans = 1
while ans < K:
    ans *= 2
    N -= 1
print(ans+N*K)

Submission status: Wrong Answer

Solution code:
n,k=int(input()),int(input())
import math
a=-~int(math.log2(k))
print((1<<a)+k*(n-a))

Submission status: Wrong Answer

Solution code:
n,k=int(input()),int(input())
import math
a=-~int(math.log2(k))
print(2**a+k*(n-a))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    operation_count = int(input())
    incremental_value = int(input())
    candidates = list()

    for i in range(operation_count):
        result = 2 ** i + (operation_count - i) * incremental_value
        candidates.append(result)

    print(min(candidates))

Submission status: Wrong Answer

Solution code:
n=int(input())
k=int(input())
a=1
for i in range(n):
    if a*2>a+k:
        a=a*2
    else:
        a=a+k
print(a)

Submission status: Wrong Answer

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

v = 1
while v < k:
    v = v*2
    n -= 1

for i in range(n):
    v += k

print(v)

Submission status: Wrong Answer

Solution code:
n=int(input())
k=int(input())
a=1

for i in range (1,n):
    if a < k:
        a=2*a
    else:
        a=a+k	

print(a)

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
c = 0
r = 1
for i in [1, 2, 4, 8, 16]:
    if i <= k: c += 1
for _ in range(c):
    r *= 2
print(r + k * (n - c))

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
c = 0
r = 1
for i in [1, 2, 4, 8, 16]:
    if i < k: c += 1
for _ in range(c):
    r *= 2
print(r + k * (n - c))

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

D = int(1)

for i in range(N):
    if D < N:
        D *= 2
    else:
        D += K

print(int(D))

Submission status: Wrong Answer

Solution code:
a=int(input())

b=int(input())

c=0
d=1

while b>d:
    d=d*2
    c=c+1

f=a-c

h=d+(b*f)

print(h)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
i = 1
for num in range(N):
  if i < K:
    i *= 2
  else:
    i += K
print (K)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
x = 1
for i in range(N):
  if 2 * x < K:
    x *= 2
  else:
    x += K

print(x)

Submission status: Wrong Answer

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

def main():
    N = int(input())
    K = int(input())
    
    ans = 1
    while ans <= K:
        ans = ans * 2
        N = N - 1
    for _ in range(N):
        ans = ans + K
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def main():
    N = int(input())
    K = int(input())
    
    ans = 1
    while ans < K:
        ans = ans * 2
        N = N - 1
    for _ in range(N):
        ans = ans + K
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
R = int(input())
G = int(input())
print(2 * G - R)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

ans = 1
count = 0
while ans <= K:
    ans = 2 * ans
    count += 1
ans = ans + K*(N-count)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

ans = 1
count = 0
while ans < K:
    ans = 2 * ans
    count += 1
ans = ans + K*(N-count)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

n = 1
m = 0
while n < K:
    n *= 2
    m += 1
print(2 ** m + K * (N - m))

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
a = len(bin(k)) - 2
print(2 ** a + (n - a) * k) if a > 1 else print(1 + (n - a) * k)

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
val = 1
t = 1
loop = 0
while t < k:
    val += t
    t *= 2
    loop += 1
val += (n - loop) * k
print(val)

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
a = len(bin(k)) - 2
print(2 ** a + (n - a) * k)

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
num = 2**k
list = [format(i,"b").zfill(n) for i in range(num)]
result = []
for i in list:
    a = 1
    for j in range(len(i)):
        if i[j] == "0":
            a *= 2
        else:
            a += k
    result.append(a)
    print(min(result))

Submission status: Wrong Answer

Solution code:
n = int(input())
k = int(input())
num = 2**k
list = [format(i,"b").zfill(n) for i in range(num)]
result = []
for i in list:
    a = 1
    for j in range(len(i)):
        if i[j] == "0":
            a *= 2
        else:
            a += k
    result.append(a)
print(min(result))

Submission status: Wrong Answer

Solution code:
# Addition and Multiplication

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

for i in range(n):
    if 2**i>k:
        break
print( 2**i + k*(n-i) )

Submission status: Wrong Answer

Solution code:
import re

S = input()
T = input()
lenT = len(T)
can = []
for it in re.finditer(T[0], S):
    a = it.span()[0]
    tmp = S[a+1: a+lenT]
    if len(tmp) == len(T) - 1 and all("?" == h for h in list(tmp)):
        tmp = S[:a] + T + S[a+lenT:]
        can.append(tmp.replace("?", "a"))
print("UNRESTORABLE" if len(can) == 0 else can[-1])

Submission status: Wrong Answer

Solution code:
#ABC076B

n=int(raw_input())
k=int(raw_input())
for x in xrange(10):
 if 2**x>k:
  break
res=2**x+(n-x)*k
if res<0:
 print n*k
else:
 print res

Submission status: Wrong Answer

Solution code:
#ABC076B

n=int(raw_input())
k=int(raw_input())
for x in xrange(10):
 if 2**x>=k:
  break
res=2**x+(n-x)*k
print res

Submission status: Wrong Answer

Solution code:
#ABC076B

n=int(raw_input())
k=int(raw_input())
for x in xrange(10):
 if 2**x>k:
  break
res=2**x+(n-x)*k
print res

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
number = 1
times = 1
while number < K and times <= N:
    number = number*2 
    times += 1
while number > K and times <= N:
    number = number+K
    times += 1
print(number)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
k = int(raw_input())
i = 1
a = 0
while i <= k:
    a += 1
    i *= 2
print i + k * (n - a)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
C = N*K
if K == 0:
 B=0
elif K == 1 or 2:
 B=1
elif K==3:
 B=2
elif K== 4 or 5 or 6 or 7 or 8:
 B=3
elif K==9 or 10:
 B=4
p=0
i=1
while p<B:
 i=i*2
 p=p+1
A=N-B
print(i+A*K)

Submission status: Wrong Answer

Solution code:
ans = 1
n = int(input())
k = int(input())
cnt = 0
while ans * 2 < ans + k:
    if cnt > n:
        break
    ans *= 2
    cnt +=1
for i in range(cnt,n):
    ans += k
    
print(ans)

Submission status: Wrong Answer

Solution code:
ans = 1
n = int(input())
k = int(input())
cnt = 0
while ans * 2 < ans + k:
    if cnt < n:
        break
    ans *= 2
    cnt +=1
for i in range(cnt,n):
    ans += k
    
print(ans)

Submission status: Wrong Answer

Solution code:
num = int( input() )
k = int( input() )
ans = 1
for i in range( num ):
    if ( ans*2 > ans+k ):
        ans = ans * 2
    else:
        ans = ans + k
print( ans )

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    n = int(input())
    k = int(input())

    result=1
    while(n==0):
        if (result+k > result*2):
            result=result*2
        else:
            result=result+k
        n=n-1
    print(result)

Submission status: Wrong Answer

Solution code:
ans = 1
n = int(input())
k = int(input())
cnt = 0
while ans * 2 < ans + k:
    ans *= 2
    cnt +=1
for i in range(cnt,n):
    ans += k
    
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
 
A = 1 + ( N * K )
B = 1 * 2 +(N-1)*K
C = 1 * 2*2 +((N-2)*K)
D = 1 * 2*2*2 +(N-3)*K
E = 1 * 2*2*2*2+(N-4)*K
F = 1 * 2*2*2*2*2+(N-5)*K
if 0<A<B:
    print(A)
elif 0<B<C:
    print(B)
elif 0<C<D:
    print(C)
elif 0<D<E:
    print(D)
elif 0<E<F:
    print(E)
elif 0<F:
    print(F)
else:
    print(A)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())
 
A = 1 + ( N * K )
B = 1 * 2 +(N-1)*K
C = 1 * 2*2 +((N-2)*K)
D = 1 * 2*2*2 +(N-3)*K
E = 1 * 2*2*2*2+(N-4)*K
if 0<A<B:
    print(A)
elif 0<B<C:
    print(B)
elif 0<C<D:
    print(C)
elif 0<D<E:
    print(D)
elif 0<D:
    print(E)
else:
    print(A)

Submission status: Wrong Answer

Solution code:
n=int(input())
k=int(input())
i=1
for _ in range(k):
  if(i<k):
    i*=2
  else:
    i+=k
print(i)

Submission status: Wrong Answer

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

o=1
i=0

while o <=k:
    o=o*2
    i+=1

while i <=n-1:
    o+=k
    i+=1

print(o)

Submission status: Wrong Answer

Solution code:
n=int(input())
k=int(input())
o=1
i=0
while 2**i <=k:
    o+=2**i
    i+=1

while i <=n-1:
    o+=k
    i+=1

print(o)

Submission status: Wrong Answer

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

num = 1000000000000000000000

for i in range(n):
  cost = 1
  for j in range(i):
    cost = cost*2
  for j in range(n-i):
    cost = cost + k

  num = min(cost, num)

print(num)

Submission status: Wrong Answer

Solution code:
def B_Addition_and_Multiplication(N, K):
    multiply = 0  # 掛け算する回数
    add = 0  # 足し算する回数
    tmp = 1
    while tmp < K:
        tmp *= 2
        multiply += 1
    add = N - multiply

    ans = pow(2, multiply) + K * add
    return ans
  
N = int(input())
K = int(input())
print(B_Addition_and_Multiplication(N, K))

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-

N = int(input())
K = int(input())

output_num = 1
while output_num <= K:
    output_num = output_num*2
    N -= 1

if N > 0:
    for i in range(N):
        output_num += K

print(output_num)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-

N = int(input())
K = int(input())

output_num = 1
while output_num <= K:
    output_num = output_num*2
    N -= 1

for i in range(N):
    output_num += K

print(output_num)

Submission status: Wrong Answer

Solution code:
def bin(a):
  return 2*a

def ten(a):
  return a+10

N = int(input())
K = int(input())
value = 1
for i in range(N):
  if bin(value) <= ten(value) :
    value = bin(value)
  else:
    value = ten(value)
print(value)

Submission status: Wrong Answer

Solution code:
def B_Addition_and_Multiplication(N, K):
    multiply = 0  # 掛け算する回数
    add = 0  # 足し算する回数
    tmp = 1
    while tmp <= K:
        tmp *= 2
        multiply += 1
    add = N - multiply

    ans = pow(2, multiply) + K * add
    return ans
  
N = int(input())
K = int(input())
print(B_Addition_and_Multiplication(N, K))

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-

N = int(input())
K = int(input())

output_num = 1
while output_num < K:
    output_num = output_num*2
    N -= 1

for i in range(N):
    output_num += K

print(output_num)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = int(input())

A = 1 + ( N * K )
print(A)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
k = int(input())
s = 1
while n > 0:
  if s < k:
    s = s*2
  else:
    s += k
  n += 1
print(s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
k = int(input())
s = 1
while n > 0:
  if s < k:
    s = s*2
  else:
    s += k
print(s)

Submission status: Time Limit Exceeded

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

x = 1
for _ in range(N):
  x += min(x, K)

print(x)

Submission status: Accepted

Solution code:
def answer(n: int, k: int) -> int:
    current_num = 1
    for _ in range(n):
        current_num = min(current_num * 2, current_num + k)

    return current_num


def main():
    n =int(input())
    k = int(input())
    print(answer(n, k))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())

ans=1
for i in range(N):
    if ans<=K:
        ans*=2
    else:
        ans+=K

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
ans = 1
for _ in range(n):
    if ans < k:
        ans *= 2
    else:
        ans += k
print(ans)

Submission status: Accepted

Solution code:
n = int(input()); k = int(input())
ans = 1
for i in range(n):
    if ans*2 > ans+k:ans += k
    else:ans *= 2
print(ans)

Submission status: Accepted

Solution code:
def main():
        n=int(input())
        k=int(input())
        a=1
        while(n>0):
            a=min(a+k,2*a)
            n-=1
        print(a)
main()

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
ans = 1
for i in range(n):
  ans = min(ans*2,ans+k)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

out =  1
flg = 0
for i in range(N):#Aの回数を数えるためのループ
    if not flg:#フラグが立ってなかったら操作A
        out *= 2
        if out > K:
            flg = 1
    else:#フラグが立ったら操作B
        out += K

print(out)

Submission status: Accepted

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

tmp=1
for _ in range(n):
  x=tmp*2
  y=tmp+k
  tmp=min(x,y)
  
print(tmp)

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
now=1
for i in range(N):
    now=min(now*2,now+K)
print(now)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

ans = 1

def A(n):
   return 2 * n

def B(n):
   return n + K

for i in range(N):
   if A(ans) <= B(ans):
      ans = A(ans)
   else:
      ans = B(ans)

print(ans)

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    K = I()

    ans = 1
    while ans < K and N > 0:
        ans *= 2
        N -= 1
    ans += N * K

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
j = 1
def func(x, y):
    r = (x * 2) if (x * 2) < (x + y) else  (x + y)
    return r

for i in range(N):
    j = func(j, K)
print(j)

Submission status: Accepted

Solution code:
n,k=[int(input()) for i in range(2)]
ans=1
for i in range(n):
  if ans >= k:
    ans += k
  else:
    ans *= 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
num = 1

for i in range(n):
    num = min(num + k, num * 2)
    
print(num)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
i=1
for _ in range(n):
    i = i+min(i,k)
print(i)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
a = 1
for i in range(n):
  a = min(2*a,a+k)
print(a)

Submission status: Accepted

Solution code:
from functools import reduce

def operator(x, K, N):
    res = (lambda x: 2*x if x < K else x+K)(x)
    return res if N == 1 else operator(res, K, N-1)

def main():
    with open(0) as f:
        N, K = map(int, f.read().split())
    ans = operator(1, K, N)
    print(ans)

main()

Submission status: Accepted

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

ans = 1

for i in range (0 , n):
    ans = min(2 * ans, ans + k)
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
k = int(input())
ans = 1
for i in range(n):
    ans = min(ans*2, ans+k)

print(ans)

Submission status: Accepted

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

ans = 1
for i in range(n):
  ans = min(ans * 2, ans + k)
  
print(ans)

Submission status: Accepted

Solution code:
ans=float('inf')
n,k=int(input()),int(input())
for i in range(2**n):
    ans=min(ans,eval('('*n+'1'+"".join('*2)'if (i>>j)%2 else '+'+str(k)+')' for j in range(n))))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = 1

for i in range(N):
  if ans > K:
    ans += K
  else:
    ans *= 2
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
x=1
for _ in range(N):
    x=min(2*x,x+K)
print(x)

Submission status: Accepted

Solution code:
#76B
n=int(input())
k=int(input())
f=1
for i in range(0,n):
    if f*2<f+k:
        f=f*2
    else:
        f=f+k
print(f)

Submission status: Accepted

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

tmp = 1
for i in range(n):
    tmp = min(tmp * 2, tmp + k)
print(tmp)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
given_integer=1
#Option A:-To Increase The Value By double
#Option B:-To Increase Value By K

for i in range(0,n):
	given_integer=min(given_integer*2,given_integer+k)

print(int(given_integer))

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

ans = float("inf")
for i in range(N+1):
  num = 1 * (2 ** i) + K * (N - i)
  ans = min(ans, num)
  
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
ans=1
for _ in range(n):
  ans=min(ans*2,ans+k)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
x = 1
for i in range(n):
  if x + k <= 2*x:
    x += k
  else:
    x *= 2
print(x)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
A = 1
for i in range(N):
  A = min(A * 2, A + K)
print(A)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
s=1
for i in range(n):
  s=min(s*2,s+k)
print(s)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
start = 1
for i in range(N):
    start = min(start*2, start+K)
print(start)

Submission status: Accepted

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

res = 1
for i in range(n):
    if res >= k:
        res += k
    else:
        res *= 2
print(res)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = 1 << 50
for i in range(1 << N):
    x = 1
    for j in range(N):
        if i >> j & 1:
            x *= 2
        else:
            x += K
    ans = min(ans, x)
print(ans)

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())


N,K = I(),I()
print(min(2**i+K*(N-i) for i in range(N+1)))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
K = int(input())
now = 1
for _ in range(N):
    now = min(now*2, now+K)
print(now)

Submission status: Accepted

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

cnt = 1
for _ in range(n):
    if cnt <= k:
        cnt *= 2
    else:
        cnt += k
print(cnt)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
N = int(input())
K = int(input())

c = 0
tmp = 1
while c < N:
    if tmp < K:
        tmp *= 2
    else:
        tmp += K
    c += 1
    # print(tmp)

print(tmp)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
ans=1
for _ in range(n):
  if ans<k:ans*=2
  else:ans+=k
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
ans=1
for i in range(n):
    ans=min(ans+k,ans*2)
print(ans)

Submission status: Accepted

Solution code:
from itertools import product
N = int(input())
K = int(input())
cmin = 10**4
for x in product((0,1),repeat=N):
    cnt = 1
    for i in range(N):
        if x[i]==0:
            cnt = cnt*2
        else:
            cnt += K
    cmin = min(cmin,cnt)
print(cmin)

Submission status: Accepted

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

from itertools import product

pr = list(product([0,1],repeat=n))

ans=float('inf')
for p in pr:

    tmp=1
    for i in p:
        if i==0:
            tmp*=2
        else:
            tmp+=k

    ans= min(ans,tmp)


print(ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
k = inp()
now = 1
for _ in range(n):
    now = min(now+k, now*2)
print(now)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    k = int(input())
    ans = 1
    for i in range(n):
        if ans < k:
            ans *= 2
        else:
            ans += k

    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

INF = 10**10

dp = [INF]*(N+1)
dp[0] = 1

for v in range(1,N+1):
    dp[v] = min(dp[v-1]*2,dp[v-1]+K)
print(dp[N])

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N,K = I(),I()
ans = 10**6
for i in range(N+1):
    a = 2**i
    a += K*(N-i)
    ans = min(ans,a)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

ans = 1
for i in range(N):
  ans = min(ans*2,ans+K)
print(ans)

Submission status: Accepted

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

num=1
for i in range(n):
  num=min(num*2,num+k)

print(num)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = 1
for _ in range(N):
    if ans * 2 <= ans + K:
        ans *= 2
    else:
        ans += K
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
ans=1
for i in range(n):
    ans=min(ans*2,ans+k)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

a = 1
for _ in range(N):
    if a*2 < a+K:
        a *= 2
    else:
        a += K
print(a)

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    k = I()
    num = 1
    for i in range(n):
        num = min(num+k, num*2)
    ans = num
    print(ans)

main()

Submission status: Accepted

Solution code:
def main():
    n, k = int(input()), int(input())
    x = 1

    for _ in range(n):
        x = min(2 * x, x + k)
    print(x)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n, k = int(input()), int(input())
    cnt = 0
    x = 1

    for _ in range(n):
        x *= 2
        cnt += 1
        if x > k:
            break

    print(x + k * (n - cnt))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

value = 1

for i in range(N):
  if(value * 2 <= value + K):
    value = value * 2
  else:
    value = value + K

print(value)

Submission status: Accepted

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

ans = 1

for i in range(n):
    ans = min(ans*2, ans+k)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
a = 1
for i in range(n):
    if a<k:
        a = a*2
    else:
        a+=k
print(a)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
x = 1
for _ in range(N):
	x = min(x * 2, x + K)
print(x)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

ans = 1
for _ in range(N):
  ans = min(ans*2,ans+K)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
display = 1

for i in range(N):
    display = min(display*2, display + K)
print(display)

Submission status: Accepted

Solution code:
# coding: utf-8
import math

ans = 1
count = 0
num1 = int(input())
num2 = int(input())
for i in range(num1):
    if ans < num2:
        ans *= 2
    else:
        ans += num2
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
dis = 1
for i in range(n):
    if dis*2 <= dis+k:
        dis *= 2
    else:
        dis += k
print(dis)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
c = 1
for i in range(n):
  c = min(2*c, c+k)
print(c)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
ref = 1

for i in range(n):
  if ref * 2 < ref + k:
    ref *= 2
  else:
    ref += k

print(ref)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    K = int(readline())

    cur = 1

    for _ in range(N):
        cur = min(2 * cur, cur + K)

    print(cur)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

now = 1
for _ in range(n):
    if now < k:
        now *= 2
    else:
        now += k

print(now)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input()) 
mn = 1
for i in range(n):
    if mn + k  <= mn *2:
      mn += k
    else:
      mn = mn * 2
print(mn)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = 1
for i in range(N):
    ans = min(ans*2, ans+K)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
a=1
for i in range(n):
  if a<=k:
    a*=2
  else:
    a+=k

print(a)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
a = 1
for _ in range(N):
    a = min(a*2, a+K)
print(a)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
ans = 1
for i in range(n):
    ans = min(ans*2,ans+k)
print(ans)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=1
for i in range(a):
  if 2*c<=c+b:
    c=2*c
  else:
    c=c+b
print(c)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
X = 1
for i in range(N):
    if X<K:
        X += X
    else:
        X += K

print(X)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())

res = 1
for i in range(N):
    if(K >= res):
        res *= 2
    else:
        res += K
print(res)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
c = 1
for i in range(n):
  if c > k:
    c += k
  else:
    c *= 2
print(c)

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
res=1
for i in range(N) :
  if res*2<=res+K :
    res*=2
  else :
    res+=K
print(res)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
init = 1
for i in range(N):
    init = min(init*2, init + K)
print(init)

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
a=1
for i in range(N):
  if a < K:
    a *= 2
  else:
    a += K
print(a)

Submission status: Accepted

Solution code:
n, k = [int(input()) for i in range(2)]
a = 1
for i in range(n):
  if a * 2 > a + k:
    a += k
  else:
    a *= 2
print(a)