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

for i in range(N):
    if num + K >= num * 2:
        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):
    a += min(a,k)
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Submission status: Accepted

Solution code:
# ABC076 B - Addition and Multiplication
# 2019/11/07

N, K = map(int, open(0).read().split())
# print(N, K)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin
n, k = (int(x) for x in stdin.read().split())

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

print(displayed)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=map(int,open(0).read().split())
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())
ans = 1
for n 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 _ in range(n):
    if num >= k:
        num += k
    else:
        num *= 2

print(num)

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


def checker(num):	
	if num > k: # 変化する量はkかnumなので，そのその大小で区別すればよい
		return num+k
		
	else:
		return num*2
		

num = 1
for var in range(0,n):
	num = checker(num)
print(num)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# 貪欲法で解く貪欲法とは次の状態の値を最適にすることだけを考えること
n = int(input())
k = int(input())
shown = 1
def manA(x):
  return 2 * x

def manB(x):
  return k + x

for _ in range(n):
  shown = min(manA(shown),manB(shown))

print(shown)

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())
count = 0
result = 1
while count < n:
  result = min(result * 2, result + k)
  count += 1
print(result)

Submission status: Accepted

Solution code:
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    N = inputs[0]
    K = inputs[1]

    current = 1
    for i in range(N):
        if current < K:
            current += current
        else:
            current += K
    return current


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(int_inputs(2))
    print(ret)

Submission status: Accepted

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

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

print(num)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for n 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 = 1
for i in range(N):
    cnt = min(2*cnt,cnt+K)
print(cnt)

Submission status: Accepted

Solution code:
# ABC076 B - Addition and Multiplication
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())

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

print(a)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#電光掲示板に整数 1 が表示されているのを見ました。
#彼は、電光掲示板に対して、以下の操作 A, 操作 B をすることができます。
#操作 A： 電光掲示板に表示する整数を「今の電光掲示板の整数を 2倍にしたもの」に変える。
#操作 B： 電光掲示板に表示する整数を「今の電光掲示板の整数に Kを足したもの」に変える。
#操作 A, 操作 B 合計で N回 行わなければなりません。 
#そのとき、N 回の操作後の、電光掲示板に書かれている整数として考えられる最小の値を求めなさい。
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:
# coding: utf-8
N = int(input())
K = int(input())
a=1
for i in range(N):
    a = min(a+K,2*a)
print(a)

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

Submission status: Accepted

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

ans=2**N

for i in range(2**N):
  tmp=1
  for j in range(N):
    if (i>>j) %2==1:
      tmp*=2
    else:
      tmp+=K     
  ans=min(ans,tmp)
print(ans)

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())
i=1
for n in range(N):
    i=min(i*2,i+K)
print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    k = int(input().rstrip('\n'))
    t = 1
    for _ in range(n):
        if t >= k:
            t += k
        else:
            t *= 2
    print(t)


if __name__ == '__main__':
    slove()

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 = int(input())
k = int(input())

res = 1

for _ in range(n):
    res += min(res, k)

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

def dfs(rank, now):
  if rank == N:
    return now
  return min(dfs(rank+1, now*2), dfs(rank+1, now+K))

print(dfs(0,1))

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())
M = 1
for _ in range(N):
    M = min(M+K,M*2)
print(M)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = int(input()), 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())
c=1
for i in range(n):
    c+=min(c,k)
print(c)

Submission status: Accepted

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

ans=1

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

print(ans)

Submission status: Accepted

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

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

ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


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

    ans = float('inf')
    for i in range(2**N):
        num = 1
        for j in range(N):
            if (i>>j)&1:
                num *= 2
            else:
                num += K
        ans = min(ans, num)
    
    print(ans)
                


if __name__ == '__main__':
    main()

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):
    if ans < K:
        ans *= 2
    else:
        ans += K * (N - i)
        break

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
candidates = [1]
for i in range(N):
    new_candidates = []
    for c in candidates:
        new_candidates.append(c * 2)
        new_candidates.append(c + K)
    candidates = new_candidates
    
print(min(candidates))

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

M=[0]*(N+1)
M[0]=1

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

Submission status: Accepted

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

ans=10**10
for i in range(2**N):
  tmp=1
  for j in range(N):
    if (i>>(N-j-1)&1)==1:
      tmp*=2
    else:
      tmp+=K
  ans=min(ans,tmp)
print(ans)

Submission status: Accepted

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

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

print(result)

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

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

Submission status: Accepted

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

cnt = 1

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

print(cnt)

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

tmp = 1

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

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())
now = 1
for _ in range(N):
    now = min(now*2,now+K)
print(now)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

op=[[0],[1]]

for i in range(n-1):
    tmp=[]
    for j in op:
        tmp.append(j+[0])
        tmp.append(j+[1])
    op=tmp
ans=1e10

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

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


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

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

Submission status: Accepted

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

max = 0
maxcounter = 0
j = 1

for i in range(N):
  # counter = 0
  # while j > 1:
  if j * 2 <= j + R:
    j = j * 2
    # counter += 1
  else:
    j = j + R
 
print(j)

Submission status: Accepted

Solution code:
n,k=map(int,open(0))
a=1
while a<k and n:a*=2;n-=1
print(a+k*n)

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 = 10**9
for i in range(N+1):
  num = 1
  for j in range(i):
    num *= 2
  for j in range(N-i):
    num += K
  if ans > num:
    ans = num
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

K = int(input())

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


for i in range(1, N+1, 1):

    dp[i] = min(dp[i-1]+K, dp[i-1]*2)

print(dp[N])

Submission status: Accepted

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

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

print(now)

Submission status: Accepted

Solution code:
N,K=map(int,open(0));L=1
for i in range(N):L+=min(L,K)
print(L)

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=int(input())
k=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(a)

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

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

count = 1

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

print(count)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    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__":
    main()

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:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

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

Submission status: Accepted

Solution code:
# ABC076b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

ans = 10**4

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
cnt = 0
ans = 1
while cnt < n:
    ans += min(ans, k)
    cnt += 1
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:
def test():
    n = int(input())
    k = int(input())
    x = 1
    for i in range(n):
        if x*2 > x+k:
            x += k
        else:
            x *= 2
    print(x)


if __name__ == "__main__":
    test()

Submission status: Accepted

Solution code:
import sys
import  math
import bisect
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
k = ni()
ans = 1000000000000000
for i in range(1 << n):
    tmp = 1
    for j in range(n):
        if i>>j&1:
            tmp *= 2
        else:
            tmp += k
    ans = min(ans, tmp)
print(ans)

Submission status: Accepted

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

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

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

# output
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
    if ans[i]*2 >= ans[i]+k:
        ans.append(ans[i]+k)
    else:
        ans.append(ans[i]*2)

print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

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 = 10**10
for i in range(2**n):
    m = 1
    for j in range(n):
        if (i>>j)&1 == 1:
            m *= 2
        else:
            m += k
    ans = min(m,ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
ans = 100000000000000000000000

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

for i in range(2**n):
    con = format(i,"b").zfill(n)
    temp = 1
    for c in con:
        if c == "1":
            temp += k
        else:
            temp *= 2
    if temp < ans:
        ans = temp

print(ans)

Submission status: Accepted

Solution code:
def add(x, y):
  ans = x + y
  return ans

def mux(x,y):
  ans = x * y
  return ans

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

ans = 1
min_ans = 1
cnt = 0

for i in range(n):
  min_ans = add(min_ans,k)


for i in range(n):
  ans = 1
  for j in range(n):
    if cnt < j:
      ans = add(ans, k)
    else:
      ans = mux(ans,2)
    
    #print(ans)

  if min_ans > ans:
    min_ans = ans
    
  cnt +=1
  
print(min_ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans=1
for i in range(n):
  tmp1=ans*2
  tmp2=ans+k
  if tmp1>tmp2:
    ans=tmp2
  else:
    ans=tmp1
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,k=[int(input()) for _ in range(2)]
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 _ in range(n):
    if ans * 2 < ans + k:
        ans *= 2
    else:
        ans += k
print(ans)

Submission status: Accepted

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

    v = 1
    for _ in range(N):
        v = min(v*2, v+K)
    return v
if __name__ == '__main__':
    print(main())

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

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

Submission status: Accepted

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

# processing
## definition of function
def opeA(num):
    return num*2

def opeB(num, K = K):
    return num + K

## initial
num = 1

for i in range(N):
    if opeA(num) < opeB(num):
        num = opeA(num)
    else:
        num = opeB(num)

# output
print(num)

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 = ans+k

print(ans)

Submission status: Accepted

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

x=1
for i in range(n):
    x+=min([x,k])

print(x)

Submission status: Accepted

Solution code:

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

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

print(num)

Submission status: Accepted

Solution code:
# N回操作した時の最小値を求める
# ただし、前回の値にしか操作は影響されないから、
# 各回で小さくなる操作を選べば良い

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

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

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:
n = int(input())
k = int(input())
t = 1
for i in range(n):
    t += min(k, t * 2 - t)
print(t)