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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


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


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


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

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


if __name__ == '__main__':
    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())

ans = 1e9

# (a+K) ^ 2 > a^2 + K
for i in range(N+1):
    ans = min(ans, 1*(2**i) + K * (N-i))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
a=1
for _ in[0]*n:a+=min(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 + k, ans * 2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# cook your dish here
n=int(input())
k=int(input())
ass = 1

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

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())
p = 1
for i in range(N) :
    if p*2 <= p+K :
        p = p*2
    else :
        p = p+K
print(p)

Submission status: Accepted

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

Submission status: Accepted

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

def main():
	n = int(input())
	k = int(input())
	
	ans_list = []
	
	for i in range(2 ** n):
		a = "list('{:0" + str(n) + "b}'.format(i))"
		temp = 1
		lists = [int(x) for x in eval(a)]
		for j in lists:
			if j == 0:
				temp += k
			else:
				temp *= 2
		ans_list.append(temp)

	print(min(ans_list))

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 += K
	else:
		ans *= 2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(re)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
n = int(input())
k = int(input())
print(reduce(lambda a, x: min(a * 2, a + k), range(n), 1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    k = int(input())


    ans = 1
    for i in range(n):
        if ans < k:
            ans += ans
        else:
            ans += k

    print(ans)


if __name__ == "__main__":
        main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict 
import sys,heapq,bisect,math,itertools,string

sys.setrecursionlimit(10**8)

#N:頂点数   M:辺数
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())
ans = 1
for i in range(0,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:
N = int(input())
K = int(input())
x = 1
for i in range(N):
	if x * 2 >= x + K:
		x = x + K
	else:
		x = x * 2

print(x)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
"""
https://abc076.contest.atcoder.jp/tasks/abc076_b
"""
a=1
n=int(input())
k=int(input())
for i in range(n):
    if a*2>a+k:
        a=a+k
    else:
        a=a*2
print(a)

Submission status: Accepted

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

print(x)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
n = 0
i = 1
while n < N:
  if i <= K:
    n += 1
    i = i*2
  elif i > K:
    n += 1
    i = i + K
print(i)

Submission status: Accepted

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

Submission status: Accepted

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

a=1

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

Submission status: Accepted

Solution code:

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


min_ans = 1 + K*N

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

print(min_ans)

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:
A=int(input())
B=int(input())
C=1
for i in range(A):
    if C<B:
        C*=2
    else:
        C+=B
print(C)

Submission status: Accepted

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

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

ans = 1
for i 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())

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

Submission status: Accepted

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

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

print(m)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    K = int(input())
    out = 1
    for _ in range(N):
        out = min(out*2, out+K)
    return out

if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 2 ** N

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

print(ans)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Dis = 1

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

print(Dis)

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('{}'.format(a))

Submission status: Accepted

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

result = 1

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

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

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


print(number)

Submission status: Accepted

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

Submission status: Accepted

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

now = 1

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

print(now)

Submission status: Accepted

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

print(now)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = int(input()), int(input())
s = 1
while(n):
    s += min(s, k)
    n -= 1
print(s)

Submission status: Accepted

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

def dfs(i, s):
  if i == N:
    return s
  else:
    if (i, s) in memo:
      return memo[(i, s)]
    tmp = min(dfs(i + 1, s * 2), dfs(i + 1, s + K))
    memo[(i, s)] = tmp
    return tmp

print(dfs(0, 1))

Submission status: Accepted

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

def ans(i,x):
    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: Accepted

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

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

Submission status: Accepted

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

ans = 1

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

print ans

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

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

Submission status: Accepted

Solution code:
n=int(raw_input())
k=int(raw_input())
ip=1

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

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:
y=int(input())
y1=int(input())
s=1
for i in range(y):
  if s*2<s+y1:
    s*=2
  else:
    s+=y1


print(s)

Submission status: Accepted

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


print(s)

Submission status: Accepted

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

count=1

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

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = int(input()),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())

sum=1
for i in range(N):
    if sum<K:
        sum += sum
    else:
        sum += K
        
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = 1
for k 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 _ in range(n):
    ans=min(2*ans,ans+k)
print(ans)

Submission status: Accepted

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()


def valuecheck(x, k):
    
    
    if (x * 2) <= (x + k):
    
        return x * 2
    
    else:
        
        return x + k

n = int(arr_data[0][0])
k = int(arr_data[1][0])


#print(n, k)

cnt = 0

x = 1

while cnt < n:

    x = valuecheck(x, k)
    
    cnt += 1


print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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())
num = 1

def plus(num, k):
    return num + k

def double(num):
    return num * 2

for i in range(n):
    if plus(num, k) < double(num):
        num = plus(num, k)
    else:
        num = double(num)
print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
ans=1
c=0
while c<N:
	if ans<K:
		ans=ans*2
	else:
		ans=ans+K
	c+=1
print(ans)

Submission status: Accepted

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

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 _ in range(n):
    ans += min(ans, k)
print(ans)

Submission status: Accepted

Solution code:
n, k, ans = int(input()), int(input()), 1
for _ in range(n):
    ans += min(ans, k)
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:
from collections import deque

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

Q = deque([(1, 0)])
H = []
while Q:
    q = Q.popleft()
    if q[1] == N:
        H.append(q[0])
    else:
        Q.append((q[0] * 2, q[1] + 1))
        Q.append((q[0] + K, q[1] + 1))

print(min(H))

Submission status: Accepted

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

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:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
k = ni()

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())
answer = 1
for i in range(n):
	if answer < k:
		answer = answer*2
	else:
		answer += k
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k,b=int(input()),int(input()),1
for _ in [0]*n:b+=min(b,k)
print(b)

Submission status: Accepted

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

i = 1

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

print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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 + 1):
        result = 2 ** i + (operation_count - i) * incremental_value
        candidates.append(result)

    print(min(candidates))

Submission status: Accepted

Solution code:
n, k = int(input()), int(input())
dis = 1

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

print(dis)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(input().split())
    return li

# --------------------------------------------

dp = None

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


    minimum_value = 10**9
    for seq in itertools.product("01", repeat=N):
        value = 1
        for binary in seq:
            if binary == "0":
                value *= 2
            else:
                value += K
        minimum_value = min(value, minimum_value)

    print(minimum_value)

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

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

print(r)

Submission status: Accepted

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

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())
 
cnt = 0
ans = 1
while cnt < N:
    if ans*2 <= ans+K:
        ans *= 2
    else:
        ans += K
    cnt += 1
print(ans)

Submission status: Accepted

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

cnt = 0
ans = 1
while cnt < N:
    if ans*2 <= ans+K:
        ans *= 2
    else:
        ans += K
    cnt += 1
print(ans)

Submission status: Accepted

Solution code:
import math
N=int(input())
K=int(input())
P = int(math.log2(K)//1+1)
if P >= N:
    print(int(2**N))
else:
    a=int(2**P)
    a += (N-P)*K
    print(int(a))

Submission status: Accepted

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

Submission status: Accepted

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

v = 1
while v < k and n > 0:
    v = v*2
    n -= 1

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

print(v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
n = int(input())
k = int(input())
arr = ["plus","double"]
ans = []
tmp = 1

for i in itertools.product(arr,repeat=n):
    for j in i:
        if j == "double":
            tmp *= 2
        else:
            tmp += k
    ans.append(tmp)
    tmp = 1
print(min(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = int(input()), int(input())
ans = 1

for i 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())
c = 0
r = 1
for i in [1, 2, 4, 8, 16]:
    if i <= k: c += 1
for i in range(n):
    if i <= (c-1):
        r *= 2
    else:
        r += k
print(r)

Submission status: Accepted

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

T=1

for i in range(N):
    T=T*2
    if T>K:
        break

for j in range(N-(i+1)):
    T+=K

print(T)

Submission status: Accepted

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

D = int(1)

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

print(D)

Submission status: Accepted

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

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


print(num)

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())
ans=[0]*(n+1)
ans[0]=1
for i in range(1,n+1):
    ans[i]=min(ans[i-1]*2,ans[i-1]+k)
print(ans[-1])

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
N = int(input())
K = int(input())

def ev(bi):
    ret = 1
    for b in bi:
        if b == "0":
            ret *= 2
        else:
            ret += K
    return ret

INF = 100000000000000000
ans = INF
for i in range(N):
    bi = list(format(2 ** i - 1, "0{}b".format(N)))
    ans = min(ans, ev(bi))
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

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

# calculate
def calc(a):
    if a <= k:
        a *= 2
    else:
        a += k
    return a

# main
result = 1
for i in range(n):
    result = calc(result)

# output
print(result)

Submission status: Accepted

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

ans = []

for i in range(N+1):
    ans.append(2**i+(N-i)*K)
    
print(min(ans))

Submission status: Accepted

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

X = 1

while N > 0:
    X *= 2
    N -= 1
    if X > K:
        break

X += K * N

print(X)

Submission status: Accepted

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

now = 1

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

print(now)

Submission status: Accepted

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

ans = 2**20
for mask in range(1<<n):
    t = 1
    for i in range(n):
        if (mask>>i)&1:
            t *= 2
        else:
            t += k
    ans = min(ans,t)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
k = input()
num = 1
b = lambda x, y: x+y if x > y else x*2
for _ in xrange(n):
    num = b(num, k)
print num

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    if b * 2 >= b + a:
        b += a
    else:
        b *= 2

print(b)

Submission status: Accepted

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

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())
ans = 1
for i in range(n):
  if ans * 2 <= ans + k:
    ans = ans * 2
  else:
    ans += k

print(ans)

Submission status: Accepted

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

num = 1
for i in range(n):
    if num*2 > num+k:
        num = num+k
    elif num*2 <= num+k:
        num = num*2
print(num)

Submission status: Accepted

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

N = int(input())
K = int(input())
num = 1

for i in range(N):
    if num <= K:
        num *= 2

    else:
        num += K

print(num)

Submission status: Accepted

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

print(x)