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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import itertools

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

ans = 10 ** 10
for ops in itertools.product([True, False], repeat=N):
    val = 1
    for op in ops:
        val = val * 2 if op else val + K
    ans = min(ans, val)

print(ans)

Submission status: Accepted

Solution code:
import itertools

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

ans = 10 ** 10
for ops in itertools.product([True, False], repeat=N):
    val = 1
    for op in ops:
        val = val * 2 if op else val + K
    ans = min(ans, val)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = map(int, (input() for _ in range(2)))
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())

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
def nishinsu(i,n): #iの２進数を文字で返す n桁で
    return str(bin(i)[2:]).zfill(n)
l=[]
for i in range(0,int("1"*n,2)): #n回の操作を行うのに、必要な組み合わせ
    s=1
    for j in nishinsu(i,n): #10001などを左からみていく
        if j=="0":
            s=s*2
        else:
            s=s+k
    l.append(s)
print(min(l))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
k = int(input())
l = int(math.log2(k))
a_count = min(n, l+1)
b_count = max(0, n-a_count)
print(2**a_count + k*b_count)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

print(ret)

Submission status: Accepted

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

def choice(k, n):
    if n == 1:
        return min(1+k, 2)
    else:
        prev = choice(k, n-1)
        return min(prev+k, 2*prev)
print(choice(K, N))

Submission status: Accepted

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

a = 1
#n回分のループを回す
for i in range(n):
  #整数に2倍した数と整数にkを足した数を比較して2倍した方が小さい場合、操作Aを行う
  if 2*a < a + k:
    a = a * 2
  #整数を2倍するよりも整数にkを足した数が小さい場合、操作Bを行う
  else:
    a = a + k
#最小値になる
print(a)

Submission status: Accepted

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

ans=1
t=[]

for i in range(n+1):
    t.append(2**i+k*(n-i))
    ans=1

print(min(t))

Submission status: Accepted

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

ans = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 [0]*n:
  ans += min(ans,k)
print(ans)

Submission status: Accepted

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

ans = float('inf')

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

print(ans)

Submission status: Accepted

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

i = 0
while n < K and i < N:
  n *= 2
  i+=1
print(n + K * (N-i))

Submission status: Accepted

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

Submission status: Accepted

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

ans=1

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

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
ans=1
while ans<K and N>0:
    ans*=2
    N-=1
print(ans+N*K)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
i = 0
a = 1

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

Submission status: Accepted

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

if k == 1:
    print(n + 1)
else:
    i = 0
    a = 1
    while a < k and i < n:
        a *= 2
        i += 1
    print(a + k * (n - i))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    K = int(input())

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

    print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    K = inputInt()
    
    ans = 1
    for _ in range(N):
        if ans <= K:
            ans = ans * 2
        else:
            ans += K
    
    print(ans)
    
            	
if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, K: int):
    ans = 1
    for i in range(N):
        if ans <= K:
            ans *= 2
        else:
            ans += K
    print(ans)
    return


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
    solve(N, K)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
c = 1
n = int(input().split()[0])
k = int(input().split()[0])

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

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

Submission status: Accepted

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

A = []

for n in range(N+1):
  ans = 1
  nm_A = n
  nm_B = N - n
  
  if nm_A > 0:
    for a in range(nm_A):
      ans *= 2
  
  if nm_B > 0:
    for b in range(nm_B):
      ans += K
  
  A.append(ans)

print(min(A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 76, B - addition and multiplication
n = int(input())
k = int(input())

X = []
for i in range(2**n):
    x = 1
    for j in range(n):
        if (i >> j) & 1:
            x = 2*x
        else:
            x = x+k
    X.append(x)

print(min(X))

Submission status: Accepted

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

Submission status: Accepted

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

b = 1

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

print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

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 S_LIST(): return list(input())

# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
K = INT()

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

Submission status: Accepted

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

ans = 10 ** 18
for i in itertools.product('AB', repeat = N):
    tmp = 1
    for j in i:
        if j == 'A':
            tmp *= 2
        else:
            tmp += K
    # print (i, tmp)
    ans = min(ans, tmp)

print (ans)

Submission status: Accepted

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

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

print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC076-B
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:
# ABC076-B
N = int(input())
K = int(input())
ans_list = []
for a in range(N+1):
    tmp = 1
    b = N - a
    for i in range(a):
        tmp  *= 2
    tmp += b * K
    ans_list.append(tmp)   
print(min(ans_list))

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 = []

for i in range(0,n+1):
  x = 1
  x = x * (2**i)
  x = x + (n-i)*k
  tmp.append(x)
print(min(tmp))

Submission status: Accepted

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

min_ans = 10**10
for i in range(2 ** n):
    ans = 1
    for j in range(n):
        if i & 2 ** j:
            ans += k
        else:
            ans *= 2
    min_ans = min(min_ans, ans)
print(min_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:
a,b=[int(input())for i in range(2)]
c=1
for i in range(a):
  if c*2>=c+b:
    c=c+b
  else :
    c=c*2
print(c)

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:
#!/usr/bin/env python3
#ABC76 B

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
count = 0
e = 1
while N > 0:
  if e * 2 < e + K:
    e *= 2
    N -= 1
  else:
    e += K
    N -= 1
print(e)

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

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

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

print(res)

Submission status: Accepted

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

for i in range(a):
  c+=min(b,c)
else:
  print(c)

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N, K = int(input()), int(input())
op_a, op_b, total = 0, 0, 1

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

Submission status: Accepted

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

for i in range(n+1):
    num=1
    j = n-i
    for x in range(i):
        num *= 2
    num += k*j
    
    if i==0:
        ans = num
    elif num < ans:
        ans = num

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
K = n()

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

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

Submission status: Accepted

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

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


abc()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string


if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

#
#
# N = int(sys.stdin.readline())
# print(int(math.sqrt(N)) ** 2)




N, K = [int(sys.stdin.readline()) for _ in range(2)]
ans = 1
for n in range(N):
    ans = min(ans *2, ans+K)
print(ans)

Submission status: Accepted

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())
k = int(input())
a = 1

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

print(a)

Submission status: Accepted

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

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

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

cnt=1
cur=1

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

Submission status: Accepted

Solution code:
# 各時点で最小

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

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

print(answer)

Submission status: Accepted

Solution code:


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

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



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

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

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

print(now)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
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 _ in range(N):
    a1 = ans * 2
    a2 = ans + K
    ans = min(a1, a2)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
i = 1
while n > 0:
    if i <= k:
        i += i
    else:
        i += k
    n -= 1
print(i)

Submission status: Accepted

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

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

print(answer)

Submission status: Accepted

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

def solve(cnt,n,k):
    if n == 0:
        return print(cnt)
    cnt = min(cnt*2,cnt+k)
    return solve(cnt,n-1,k)

solve(1,n,k)

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:
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:
def smaller(x, y):
	if x < y: return x
	return y

N = int(input())
K = int(input())
dp = [1]
for i in range(0, N):
	dp.append(smaller(dp[-1]*2, dp[-1]+K))
print(dp[N])

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

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
from sys import stdin
N=int(stdin.readline().rstrip())
K=int(stdin.readline().rstrip())

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

Submission status: Accepted

Solution code:
from sys import stdin
N=int(stdin.readline().rstrip())
K=int(stdin.readline().rstrip())
num = 1
cnt = 0
while num < K:
    num = num * 2
    cnt += 1
    if cnt >= N:
        break
for _ in range(N-cnt):
    num += K
print(num)

Submission status: Accepted

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

  else:
    ans+=K
print(ans)

Submission status: Accepted

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

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

old = [1]
for i in range(N):
  new = []
  for i in old:
    new.append(i*2)
    new.append(i+K)
  old = new
print(min(old))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def dp_min(a, b):
    if a > b:
        return b
    return a


N = int(input())
K = int(input())
dp = [1] + [0]*N
for i in range(N):
    dp[i+1] = dp_min(dp[i]*2, dp[i]+K)
print(dp[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
# import statistics
import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) 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 MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v):
    # ノードに訪れた
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  # そもそもvとv2が辺でつながっていない
            continue
        if visited[v2] == True:  # もう見た
            continue
        dfs(v2)


n = II()
k = II()
ans = INF
for i in range(2 ** n):
    tmp = [0] * n 
    for j in range(n):
        if (i >> j & 1):
            tmp[j] = 1
    num = 1
    for ope in tmp:
        if ope == 1:
            num *= 2
        else:
            num += k
    ans = min(ans, num)
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())
number = 1

while N > 0:
    if number <= K:
        number *= 2
        N -= 1
    else:
        number += K
        N -= 1
print(number)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
Inf = float("inf")
dp = [Inf]*(N+1)
dp[0] = 1
for i in range(N):
    dp[i+1] = min(dp[i]*2,dp[i]+K)

print(dp[N])

Submission status: Accepted

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

ans = 2**10 +1
for i in range(1,N+1):
    x = 1
    for j in range(i):
        x *= 2
    for k in range(N-i):
        x += K
    ans = min(x,ans)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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