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

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())
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+B=N
#A:C[i]*2 
#B:C[i]+K
  
C=1
for i in range(N):
  if C*2>C+K:
    C=C+K
  else:
    C=C*2
    
print(C)

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

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

print(str(start))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,k = [int(input()) for i in range(2)]

number=1

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
 
num = 1
count = 0
 
while count < n:
    num = min(num * 2, num + k)
    count += 1
  
print(num)

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
mini = 10**10

for i in range(2 ** n):
    x = 1
    for j in range(n):
        if ((i >> j) & 1):
            x *= 2
        else:
            x += k
    mini = min(mini,x)
print(mini)

Submission status: Accepted

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

print(start)

Submission status: Accepted

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

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

result = 10 ** 9

for bit in range(2 ** n):
  
  tmp = 1
  for i in range(n):
    if bit & (1 << i):
      tmp *= 2
    else:
      tmp += k
  
  result = min(result, tmp)
  
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
ans=1000
for i in range(N+1):
    num=1
    for s in range(i):
        num = num*2
    
    for t in range(N-i):
        num += K
    
    if num < ans:
        ans = num

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=int(input()),int(input());a=1
while a<=k:
  if n==0:
    print(a)
    exit()
  a*=2
  n-=1
while n>0:
  a+=k
  n-=1
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:
n,k=int(input()),int(input())
ans=1
i=0
while i!=n:
    if ans>=k:
        ans+=k
    else:
        ans*=2
    i+=1
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k = int(input()),int(input())
# Greedy
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 _ 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())

start = 1

for n in range(N):
    start = min(start*2, start+K)

print(start)

Submission status: Accepted

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

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

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 = 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,K = (int(input()) for T in range(0,2))
Num = 1
for TN in range(0,N):
    Num = min(2*Num,Num+K)
print(Num)

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:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = float('inf')
for i in range(2**N):
  a = 1
  for j in range(N):
    if (i>>j)&1:
      a *= 2
    else:
      a += K
  ans = min(ans, a)
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())
tmp = 1

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

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())
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())
num = 1
for i in range(N):
    if num >= K:
        num += K
    elif num < K:
        num += num
print(num)

Submission status: Accepted

Solution code:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

N = iIn()
K = iIn()

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

print(ans)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

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

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

print(n)

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:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    K=ii()

    ans = INF
    for a in range(N+1):
        b = N-a
        res = 1
        for i in range(a):
            res *= 2

        for j in range(b):
            res += K

        ans = min(ans,res)

    
    print(ans)


    


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def f(current, n,k):
	if n == 0:
		return current
	return min(f(2*current, n- 1,k), f(+k + current, n- 1, k)) 
print f(1,int(raw_input()), int(raw_input()))

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
K = INT()
ans = 1
for _ 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())

ans=float('inf')
for b in range((1<<n)):
  cand=1
  for i in range(n):
    if b>>i&1:
      cand*=2
    else:
      cand+=k
  ans=min(ans,cand)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
ans=float('inf')
for i in range(2**n):
  c=1
  tmp=format(i, '0'+str(n)+'b')
  for j in tmp:
    if j=='0':
      c*=2
    else:
      c+=k
      
  ans=min(c, ans)
  
print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = map(int, read().split())

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

    print(ans)
    return


if __name__ == '__main__':
    main()

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
v=1
for i in range(n):
    v = min(v+k, 2*v)
print(v)

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

Submission status: Accepted

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

N = I()
K = I()

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

Submission status: Accepted

Solution code:
# coding: utf-8
import math
#a, b, c = map(int,input().split())
N = int(input())
K = int(input())
#S = input()
ans = 1
#l = list(map(int,input().split()))

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

print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def main():
    N = int(input())
    K = int(input())
    ans = 10**18
    for i in range(1 << N):
        val = 1
        for j in range(N):
            if i & (1 << j):
                val *= 2
            else:
                val += K
        ans = min(ans, val)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

current = 1

for i in range(N_kai):
    can_1 = current + K
    can_2 = current * 2
    
    current = min(can_1, can_2)

print(current)

Submission status: Accepted

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

ans = 9999999999

for i in range(2 ** N):
    ans_tmp = 1
    for b in format(i, "0%db" %N):
        if b == "0":
            ans_tmp *= 2
        else:
            ans_tmp += K
    ans = min(ans, ans_tmp)
    
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n = I()
k = I()
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 *= 2
    else:
        x += k
print(x)

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

Submission status: Accepted

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

while N > 0:
  tmp1 = cur + K
  tmp2 = cur * 2
  cur = min(tmp1, tmp2)
  N -= 1

print(cur)

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

l = [1]
for _ in range(n):
    l.append(min(l[-1] * 2, l[-1] + k))

print(l[-1])

Submission status: Accepted

Solution code:
mini = 1025
N = int(input())
K = int(input())
for i in range(N+1):
  x = 1
  xx = 2**i
  xxx = K*(N-i) +xx
  
  if xxx < mini:
    mini = xxx
print(mini)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    k = i_input()

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

    print(num)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
v = input()

n = int(s)
k = int(v)

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 = 1000000
 
for bi in range(1<<N):
  cnt = 1
  for i in range(N):
    if bi>>i&1:
      cnt *= 2
    else:
      cnt += K
  ans = min(ans, cnt)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    k = int(input())
    #k > 2*n 2倍
    tmp = 1
    i=0
    while(i<n):
        if(tmp < k):
            tmp += tmp
        else:
            tmp += k
        i+=1
    print(tmp)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

i = 0
ans = 1
while True:
    if i == N:
        break
    if ans < K:
        ans *= 2
        i += 1
    else:
        ans += K
        i += 1

print(ans)

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:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

res = float('inf')
for i in range(n+1):
    num = 1
    for c in range(n):
        if c < i:
            num *= 2
        else:
            num += k
    res = min(res, num)

print(res)

Submission status: Accepted

Solution code:
def actual(N, K):
    # 2つの操作のうち、小さくなる方を選び続ければよい
    op_A = lambda i: i * 2
    op_B = lambda i: i + K

    num = 1

    for _ in range(N):
        num = min(op_A(num), op_B(num))

    return num

N = int(input())
K = int(input())
print(actual(N, K))

Submission status: Accepted

Solution code:
import itertools


def actual(N, K):
    op_A = lambda i: i * 2
    op_B = lambda i: i + K

    patterns = list(itertools.product((op_A, op_B), repeat=N))

    results = []

    for pattern in patterns:
        num = 1

        for op in pattern:
            num = op(num)

        results.append(num)

    return min(results)

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

print(actual(N, K))

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:
def resolve():
    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)
resolve()

Submission status: Accepted

Solution code:

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

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

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())
i = 1
while n>0:
  if (i*2-i) > k: i+=k
  else: i*=2
  n-=1
print(i)

Submission status: Accepted

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


ans = 100000001
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 -*-

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

Submission status: Accepted

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

ans = []
for i in range(1<<N):
    res = 1
    for j in range(N):
        if (1 & (i >> j)):
            res = res*2
        else:
            res = res + K
    ans.append(res)

print(min(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:
def main():
    N = int(input())
    K = int(input())
    result = 1
    for _ in range(N):
        result = min([result * 2, result + K])
    print(result)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# 貪欲法 の解法
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


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

print(ans)

Submission status: Accepted

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


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

print(p)

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)