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

Submission status: Accepted

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

Submission status: Accepted

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

print(i)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(N, K):
    #初期化
    res = 1
    for i in range(N):
        #N回操作を行う
        res = greedy(res, K)
    return res

def greedy(val, K):
    #局所最適解として2つの操作結果の小さい方を返す
    valA = val * 2
    valB = val + K
    return min(valA, valB)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(tmp)

Submission status: Accepted

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

def calc(tmp, kk):
    s1 = 2 * tmp
    s2 = tmp + kk
    if s1 < s2:
        tmp = s1
    else:
        tmp = s2
    return tmp

temp = 1
for i in range(n):
    temp = calc(temp, k)
print(temp)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

N = intinput()
K = intinput()
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())

d = 1

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

print(d)

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    k=INT()
    ct=1
    for i in range(n):
        ct=min(ct*2,ct+k)
    print(ct)
if __name__ == '__main__':
    do()

Submission status: Accepted

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

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

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

print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, K = map(int, read().decode('utf8').split())
ans = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 += (N - i) * K
        break

print(ans)

Submission status: Accepted

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

print(answer)

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

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

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

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

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

Submission status: Accepted

Solution code:
import math

# B_Addition and Multiplication

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

ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
from itertools import product
N, K = int(input()), int(input())
F = lambda x:x*2, lambda x:x+K
ans = 10000
for prod in product(F, repeat=N):
    x = 1
    for f in prod:
        x = f(x)
    ans = min(ans, x)
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())
start=1
for i in range(n):
    if start*2-start<=k:
        start*=2
    else:
        start+=k
print(start)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(point)

Submission status: Accepted

Solution code:


import numpy as np

n=int(input())
k=int(input())
res=1
for a_ in range(n):
    res=min(res+k,res*2)

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

# min_m = 10 ** 10
# for i in range(2 ** N):
#     m = 1
#     for n in range(N):
#         if i & (1 << n):
#             m *= 2
#         else:
#             m += K
#     min_m = min(min_m, m)

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

min_m = 10 ** 10
for i in range(2 ** N):
    m = 1
    for n in range(N):
        if i & (1 << n):
            m *= 2
        else:
            m += K
    min_m = min(min_m, m)

print(min_m)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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())

s = 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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 * 2 < num + k:
        num = num * 2
    else:
        num = num + k

print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
K = int(input())
x = 1
for _ in range(N):
    x += min(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 *= 2
    else:
        ans += k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
num = 1
for i in range(N):
  a = num * 2
  b = num + K
  if a <= b:
    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:
# -*- coding:utf-8 -*-

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


def double(i):
    return i*2

def add_k(i):
    return i+k

ans= 1
for j in range(n):
    if ans <= k:
        ans = double(ans)
#        print(ans)
    else:
        ans = add_k(ans)
#        print(ans)
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())

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

print(v)

Submission status: Accepted

Solution code:
import copy
n = int(input())
k = int(input())
b = [[]]
for i in range(n):
    tmp = len(b)
    for j in range(tmp):
        b.append(copy.copy(b[j]))
        '''
        b.append([])
        for l in range(len(b[j])):
            b[j+tmp].append(b[j][l])
        '''
    for j in range(tmp):
        b[j].append(0)
        b[j+tmp].append(1)
#0: x2, 1: +k
#print(b)
m = 2 ** 11
for i in range(len(b)):
    num = 1
    #print(b[i])
    for j in range(n):
        if b[i][j] == 0:
            num *= 2
        else:
            num += k
        #print(i, j, num, n, k)
    m = min(m, num)
    #print(i, num)
print(m)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
K = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
b = [[]]
for i in range(n):
    tmp = len(b)
    for j in range(tmp):
        b.append([])
        for l in range(len(b[j])):
            b[j+tmp].append(b[j][l])
    for j in range(tmp):
        b[j].append(0)
        b[j+tmp].append(1)
#0: x2, 1: +k
#print(b)
m = 2 ** 11
for i in range(len(b)):
    num = 1
    #print(b[i])
    for j in range(n):
        if b[i][j] == 0:
            num *= 2
        else:
            num += k
        #print(i, j, num, n, k)
    m = min(m, num)
    #print(i, num)
print(m)

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

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

print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(x)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys

n, k = map(int, sys.stdin.read().split())

def main():
    x = 1
    for _ in range(n):
        if x > k:
            x += k
        else:
            x *= 2
    return x

if __name__ == '__main__':
    ans = main()
    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())
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 = int(input())
k = int(input())
result = 1
for i in range(n):
  if result>k:
    result+=k
  else:
    result*=2
print(result)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

b=2**n
ans=999999999999999999
for i in range(b):
    bit_b=bin(i)[2:].zfill(n)
    ans_i=1
    for j in range(len(bit_b)):
        if(bit_b[j]=='0'):
            ans_i*=2
        elif(bit_b[j]=='1'):
            ans_i+=k

    if(ans>ans_i):
        ans=ans_i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a = 1
s = int(input())
d = int(input())
for i in range(s):
    a += min(a,d)
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
#貪欲法
n = int(input())
k = int(input())
ans = 1
#各回で常に答えが最小値になる方の計算を実施する
for i in range(n):
    ans = min(2*ans, 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:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

n=int(input())
k=int(input())
for i in range(2**n):
    tmp=1
    for l in range(n):
        if i>>l & 1:
            tmp+=k
        else:
            tmp*=2
    ans=min(ans,tmp)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

num = 1

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

print(num)

Submission status: Accepted

Solution code:
n, k = map(int, (input(), 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:
n = int(input())
k = int(input())
d = 2**15
for i in range(1 << n):
    c = 1
    for j in range(n):
        if ((i >> j) & 1) == 1:
            c *= 2
        else:
            c += k
    else:
        d = min(c,d)
print(d)

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

Submission status: Accepted

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

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

ls = [1]

for i in range(n):
    ls.append(min(ls[i] * 2, ls[i] + k))

print(ls[n])

Submission status: Accepted

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

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

print(c)

Submission status: Accepted

Solution code:
from math import log
n,k = int(input()), int(input())

a = int(log(k, 2))
if n > a + 1:
    print(2 ** (a + 1) + (n - a - 1) * k)
else:
    print(2 ** n)

Submission status: Accepted

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

Submission status: Accepted

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

print(integer)

Submission status: Accepted

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

dp = [1] * (n+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())

ans = 1

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

def A(n):
    return n*2

def B(n):
    return n+K

ans = 1

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

Submission status: Accepted

Solution code:
n, k = map(int, open(0).read().split())
first = 1 
for i in range(n):
        first = min(first * 2, first + k)
print(first)

Submission status: Accepted

Solution code:
#Addition and Multiplication
N = int(input())
K = int(input())
n = 1

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

print(n)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
n=1 # 最初の整数

# N回繰り返す
for _ in range(N):
    if n<=K: # 2倍した方が小さい場合、2倍する
        n*=2
    else: # Kを足した方が小さい場合、Kを足す
        n+=K

print(n)

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

num = 1

for _ in range(N):
    a = num * 2
    b = num + K
    num = min(a, b)

print(num)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

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

Submission status: Accepted

Solution code:
from sys import stdin
import math
import bisect
import heapq
import numpy as np
from math import factorial

p = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())

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

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(n, k):
    ans = 2

    for _ in range(n - 1):
        if (ans * 2) < ans + k:
            ans *= 2  # A
        else:
            ans += k  # B

    print(ans)


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

    main(n, k)

Submission status: Accepted

Solution code:
def examB():
    N = I(); K = I()
    cur = 1
    for i in range(N):
        cur = min(cur*2,cur +K)
    print(cur)

import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
# ABC 076: B – Addition and Multiplication
n, k = [int(input()) for _ in range(2)]
the_number = 1

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

print(the_number)

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, K = [int(input()) for _ in range(2)]
ans = 1

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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):
    a = 2 * ans
    b = K + ans
    if a <= b:
        ans = a
    else:
        ans = b
print(ans)

Submission status: Accepted

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


def nibai(n):
    return n*2

def tasu_k(n,k):
    return n+k

num=1
for i in range(n):
    if(num>k):
        num=tasu_k(num,k)
    else:
        num=nibai(num)
print(num)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = 10**8
for i in range(2**N):
    temp = 1
    for j in range(N):
        if (i>>j) & 1:
            temp += K
        else:
            temp *= 2
    if temp < ans:
        ans = temp
print(ans)