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


def solve(N: int, K: int):
    ret = 1
    while N:
        N -= 1
        if ret+K < ret*2:
            ret = ret+K
        else:
            ret = ret*2
    
    print(ret)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, k = [int(readline()) for _ in range(2)]
ans = 1
for i in range(n):
    ans = min(ans * 2, ans + k)
print(ans)

Submission status: Accepted

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

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=2*a
print(a)

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
a=1
b=0
while k>a and b<n:
    a=a*2
    b+=1
for i in range(n-b):
    a+=k
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def dfs(i, j):
    global ans
    if i == n:
        ans = min(ans, j)
    else:
        dfs(i + 1, 2 * j)
        dfs(i + 1, j + k)

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

ans = float('inf')
dfs(0, 1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

ans = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans=float("inf")
for i in range(2**N):
    val=1
    for j in range(N):
        if i%2==0:
            val*=2
            i//=2
        else:
            val+=K
            i//=2
    ans=min(ans,val)
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 01:36:42 2020

@author: shinba
"""

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

a = 1
while n:
    a = min(a+k,a*2)
    n -= 1

print(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(2)]
N = a[0]

s = 1
K = a[1]
for i in range(N):
  if (s+K < 2*s):
    s += K
  else:
    s = s*2

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    n = int(input())
    K = int(input())
    i = 1
    cnt = 0
    for _ in range(n):
        if i<K:
            i+=i
        else:
            i+=K
    print(i)

    """while i < K:
        i *= 2
        cnt += 1
    print(i+K*(n-cnt))"""


resolve()

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:

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calc(a, n, k):
	if n == 1:
		return min(a*2, a+k)
	t = calc(a, n-1, k)
	return min(t*2, t+k)

def resolve():
	n, k = [int(input()) for _ in range(2)]
	print(calc(1, n, k))
resolve()

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,k=map(int,open(0));p=1
for _ in range(1,n+1):p=[p+k,p*2][p*2<p+k]
print(p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def search(current, K, count, N):
  if count >= N:
    return current

  a = search(current * 2, K, count + 1, N)
  b = search(current + K, K, count + 1, N)
  return min(a, b)


def main():
  N = int(input())
  K = int(input())
  
  print(search(1, K, 0, N))


if __name__ == '__main__':
  main()

Submission status: Accepted

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

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

print(num)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

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

print(ans)

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

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

Submission status: Accepted

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

Submission status: Accepted

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

N = INT()
K = INT()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def I(): return int(input())
N = I()
K = I()
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())
z = 1
for _ in range(N):
    z = min(z*2, z+K)
print(z)

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

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

print(display)

Submission status: Accepted

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

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

i=1
while i<=N:
    if 2**(i-1)<=K:
        ans*=2
    else:
        ans+=K
    i+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

mi=100000
s=1
for i in range(N+1):
  s=2**i+K*(N-i)
  mi=min(mi,s)
print(mi)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans  = 1
for i in range(N):
    if ans*2<ans+K:
        ans = 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):
  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:
from itertools import product
n = int(input())
k = int(input())
m = float('inf')
for i in product(['*2', '+k'], repeat=n):
    m = min(m, eval('1'+''.join(i)))
print(m)

Submission status: Accepted

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

            

if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

min = float('inf')

def dfs(n, total):
    global N,K,min

    if n==N:
        if min>total:
            min = total
        return

    dfs(n+1, total*2)
    dfs(n+1, total+K)

dfs(0, 1)#n回目の操作で合計がtotal
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())
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 *= 2
    else:
        ans += k

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = 1
for 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):
    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):
    sub = ans  * 2
    sub2 = ans + k
    if sub > sub2:
        ans += k
    else:
        ans *= 2

print(ans)

Submission status: Accepted

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

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

def dfs(t, i):
    if t == n:
        return i
    return min(dfs(t + 1, i * 2), dfs(t + 1, i  + k))

print(dfs(0, 1))

Submission status: Accepted

Solution code:
# solution
import io
import math

nim = int(input())
mike = int(input())
counter = 1
for i in range(nim):
    if counter < mike:
        counter*=2
    else:
        counter+=mike
print(counter)

Submission status: Accepted

Solution code:

url = "https://atcoder.jp//contests/abc076/tasks/abc076_b"

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

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

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

print(x)

Submission status: Accepted

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

def defs(n, k):
    seq = 1
    for i in range(n):
        ar = seq * 2
        br = seq + k
        seq = min(ar, br)
    return seq

print(defs(n, k))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(dis)

Submission status: Accepted

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

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

Submission status: Accepted

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

#初期化
ans=1
counter=0

for counter in range(N):
    #Do A or B
    if ans<=K:
        ans*=2
    else:
        ans+=K

print(ans)

Submission status: Accepted

Solution code:
def add_mult(i, count, N, K):
    if count > N:
        return i
    am1 = add_mult(i*2, count + 1, N, K)
    am2 = add_mult(i+K, count + 1, N, K)
    return min(am1, am2)
    
def main():
    N = int(input())
    K = int(input())
    print(add_mult(1, 1, N, K))
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:
n=int(input())
k=int(input())
kk=n
p=1
while p < k:
    if kk == 0:
        break
    p*=2
    kk-=1
for i in range(kk):
    p+=k
print(p)

Submission status: Accepted

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

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

print(x)

Submission status: Accepted

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

x = 1

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

print(x)

Submission status: Accepted

Solution code:
# ABC 076: B – Addition and Multiplication
n, k = [int(input()) for _ in range(2)]
board = 1

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

print(board)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
ans=1
cnt=0
while cnt<a:
    if ans>b:
        break
    ans=ans*2
    cnt+=1
if cnt<a:
    ans=ans+((a-cnt)*b)
print(ans)

Submission status: Accepted

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

print(t)

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:
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, b= map(int, input().split())
# s = 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
    else:
        ans += k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

tmp = 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import functools as fun

def main():
	N, K = map(int, [input() for _ in range(2)])

	print( fun.reduce(lambda x,_: min(x*2, x+K), range(1, N+2)) )
	return

main()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

a = [1]
b = [1]
x = 10**6
for i in range(n+1):
  for j in range(n-i,n-i+1):
    f = 1*2**i+j*k
    if x > f:
      x = f
      
print(x)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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