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

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc076/tasks/abc076_b
N = int(input())
K = int(input())
ans = 1
for i in range(N):
    ans = min(ans*2, ans+K)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import math

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

twice_count = min(N, int(math.log2(K)) + 1)
print(2**twice_count + K*(N - twice_count))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,K=[int(input()) for _ in range(2)]
c=1
for i in range(N):
   if c<K:c*=2
   else: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 *= 2
    else:
        ans += K
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(a):
  res = min(res*2,res+b)

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*a

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n=int(input())
k=int(input())
x=1
cnt=0
while cnt<n:
    while x<k:
        x*=2
        cnt+=1
        if cnt==n:
            print(x)
            sys.exit()
    x+=k
    cnt+=1
print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
ans=[]
for i in range(2**n):
    ln=["a"]*n
    tmp=1
    for j in range(n):
        if ((i>>j)&1):
            ln[n-j-1]="b"
    for m in range(n):
        if ln[m]=="a":
            tmp=tmp*2
        elif ln[m]=="b":
            tmp=tmp+k
    ans.append(tmp)
print(min(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,K=[int(input()) for _ in range(2)]

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
a = []
b = 1
for i in range(n):
    a.append(min(b*2,b+k))
    b = min(b*2,b+k)
print(a[-1])

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

a = 1

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

Submission status: Accepted

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

n = 1

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

Submission status: Accepted

Solution code:


def solve(n,k):
  ret = 1
  while n>0:
    if ret <= k:
      ret *= 2
    else:
      ret += k
    n -= 1
  return ret


if __name__ == "__main__":
  n = int(input())
  k = int(input())
  print(solve(n,k))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def dfs(v, k, n):
    if n == 0:
        return v

    return min(dfs(2 * v, k, n - 1), dfs(v + k, k, n - 1))

def solve(N: int, K: int):
    return dfs(1, K, N)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    result = solve(N, K)
    if isinstance(result, Iterable):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input())
    K = int(input())
    ans = 1
    for i in range(N):
        ans = min(ans*2,ans+K)
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

def read_input():
    n = int(input())
    k = int(input())
    return n, k

def submit():
    n, k = read_input()

    curr = 1
    for i in range(n):
        p1 = curr * 2
        p2 = curr + k

        curr = min(p1, p2)

    print(curr)


if __name__ == '__main__':
    submit()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    k = f()[0]

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

solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

f = [lambda x : x * 2, lambda x : x + K]

o = 1024
for i in range(2**N):
    p = 1
    for j in [(i//(2**x))%2 for x in range(N)]:
        p = (f[j])(p)
    o = min(o,p)

print(o)

Submission status: Accepted

Solution code:
import sys
from collections import Counter

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:
# ABC076B - Addition and Multiplication
n, k = list(map(int, [input().rstrip() for _ in range(2)]))
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):
    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):
    if ans*2>ans+k:
        ans+=k
    else: ans*=2
print(ans)

Submission status: Accepted

Solution code:
def dfs(i,v):
    if i == N:
        return v
    return min(dfs(i+1,2*v),dfs(i+1,v+K))

N = int(input())
K = int(input())
print(dfs(0,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:
# -*- coding utf-8 -*-
n=int(input())
k=int(input())
ans=1

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

Submission status: Accepted

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

Submission status: Accepted

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

s = 1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans=1
n=int(input())
k=int(input())
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())
ans=1
count=0
while ans<=k and count<n:
  ans*=2
  count+=1
print(ans+k*(n-count))

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

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

Submission status: Accepted

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

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

print(now)

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:
a = int(input())
b = int(input())
c = 1

for i in range(a):
    if 2 * c < c + b:
        c += c
    else:
        c += b

print(c)

Submission status: Accepted

Solution code:

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

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

print(x)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while num <= k and n:
    num *= 2
    n -= 1
while n:
    num += k
    n -= 1
print(num)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
i = 0
ans = 1
while i < N:
    ans = min(ans * 2, ans + K)
    i += 1
print(ans)

Submission status: Accepted

Solution code:
N, K = map(int, open(0).read().split())
ans = 1
for i in range(N):
    if ans < K:
        ans = ans << 1
    else:
        ans += K
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
res = 1
for i 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(n):
    if k >= ans:
        ans *= 2
    else:
        ans += k
        
print(ans)

Submission status: Accepted

Solution code:
n,k=map(int,open(0));r=1;exec('r+=min(r,k);'*n);print(r)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
dp = [ [0,0] for i in range(n+1) ]
dp[0][0] = 1
dp[0][1] = 1
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][0],dp[n][1]))

Submission status: Accepted

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

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

print(tmp)

Submission status: Accepted

Solution code:
n = int(raw_input())
k = int(raw_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):
    if k <= val:
        val = val + k
    else:
        val = val * 2

print(val)

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

print(num)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

best = 10**9
for i in range(2**N):
    v = 1
    for j in range(N):
        if (i >> j) & 1:
            v *= 2
        else:
            v += K
    best = min(best, v)
print(best)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def POW(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x
    elif y % 2 == 0:
        return POW(x, y // 2) ** 2 % MOD
    else:
        return POW(x, y // 2) ** 2 * x % MOD
def mod_factorial(x, y): return x * POW(y, MOD - 2) % MOD
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from functools import reduce

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

print(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:
def solve(string):
    n, k = map(int, string.split())
    tmp = 1
    while tmp < k and n > 0:
        tmp <<= 1
        n -= 1
    return str(tmp + n * k)


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


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:
from sys import stdin
n = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())
a = 1
for i in range(n):
    if a*2-a > k:
        a+=k
    else:
        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 = ans * 2
  else:
    ans = ans + K
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
p = 1
ct = 0
while(ct < N):
    p = min(2*p, p+K)
    ct += 1
print(p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#76
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:
# 076 B 
N = int(input())
K = int(input())
ans =1
for i in range(N):
    if ans * 2 < ans+ K:
        ans=2 * ans
    else:
        ans+=K
print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc076/tasks/abc076_b

import itertools
import collections
import bisect

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
K = I()

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

print(cnt)

Submission status: Accepted

Solution code:
def addition_and_multiplication(N: int, K: int)->int:
    min_d = float('inf')
    for i in range(1 << N):
        d = 1
        # i のビットが立っているところでは 2 倍にする。
        # それ以外では K をたす。
        for _ in range(N):
            if i & 1:
                d = d * 2
            else:
                d = d + K
            i >>= 1
        min_d = min(d, min_d)
    return min_d


if __name__ == "__main__":
    N = int(input())
    K = int(input())
    ans = addition_and_multiplication(N, K)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_list_of_int():
    return [int(i) for i in input().split()]


def get_list_of_float():
    return [float(f) for f in input().split()]


def get_list_of_char():
    return list(input().strip())


def get_data(n, order=None, **kwargs):
    if not order:
        order = range(len(kwargs))
    it = iter(order)
    var, fn = zip(*sorted(sorted(kwargs.items()), key=lambda _: next(it)))

    rows = []
    for _ in range(n):
        rows.append(input().split())
    columns = zip(*rows)
    exec("global "+", ".join(var)+"\n"+"\n".join(
        v+"=list(map(fn[{}], data[{}]))".format(i, i)
        for i, v in enumerate(var)),
        globals(),
        {"fn": list(fn), "data": list(columns)}
    )
    return


# inputs
N, K = 0, 0


def set_inputs():
    global N, K
    N = get_int()
    K = get_int()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    p = 1
    for i in range(N):
        p = min(p * 2, p + K)
    print(p)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
number = 1
for i in range(1, N+1):
    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())

ans = 1

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

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    K = int(input())

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

    ans += K * N
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ResMin = float("inf")

for i in range(2**N):
    point = 1
    operate = [1] * N
    for j in range(N):
        if ((i >> j) & 1):
            operate[N - j - 1] = 2
    for k in operate:
        if k == 1:
            point *= 2
        else:
            point += K
    
    if point < ResMin:
        ResMin = point

print(ResMin)

Submission status: Accepted

Solution code:
n,k=eval('int(input()),'*2);r=1;exec('r+=min(r,k);'*n);print(r)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


res+=k*(n-i-1)

print(res)

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:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import itertools
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return list(sys.stdin.readline())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007

#A
"""
r = I()
g = I()
print(2*g-r)
"""

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