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

Submission status: Accepted

Solution code:
x = int(raw_input())
y = int(raw_input())
d = 1
for i in range(0, x):
 if y > d:
  d += d
 else:
  d += y
print(d)

Submission status: Accepted

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

val = 1

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

print(val)

Submission status: Accepted

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

best = int(1e100)
for i in range(2**N):
    v = i
    v2 = 1
    for j in range(N):
        if (v % 2 == 0): v2 *= 2
        else: v2 += K
        v /= 2
    best = min(best, v2)
print(best)

Submission status: Accepted

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

D=1
N=int(input())
K=int(input())

for i in range(0, N):
    if(D+K > D*2):
        D*=2
    else:
        D+=K

print(D)

Submission status: Accepted

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

a = 1

for _ in range(N):
    add = a + K
    multi = a * 2
    if add > multi:
        a = multi
    else:
        a = add
print(a)

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lis1 = [1]
lis2 = []
lis3 = []

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

for i in range(N):
	lis2.append(2*lis1[i])
	lis3.append(lis1[i] + K)
	if lis2[i] >= lis3[i] :
		lis1.append(lis1[i] + K)
		
	elif lis2[i] < lis3[i] :
		lis1.append(2*lis1[i])
		
print(lis1[N])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def addition_and_multiplication(N, K):
	initial = 1
	for i in range(N):
		if initial * 2 < initial + K:
			initial *= 2
		else:
			initial += K
	print(initial)


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

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

n = 1

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

print(n)

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
i = 0
p= 1
while i < a:
 if p > b:
  p = p+b
  i = i+1
 else:
  p = 2*p
  i = i+1
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*ans
    else:
        ans = ans + K

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys


def main():

    # Get Args
    args = _input_args()  # get arguments as an array from console/script parameters.

    # Call main Logic
    result = _main(args)

    # Output a result in a correct way.
    _output_result(result)


def _main(args):
    """Write Main Logic here for the contest.

    :param args: arguments
    :type args: list
    :return: result
    :rtype: depends on your logic.
    """
    # Extract arguments.
    N = int(args[0])
    K = int(args[1])

    # Write main logic here.
    now = 1
    for i in range(N):
        if now < K:
            now = now * 2
        else:
            now = now + K

    # Return something.
    return now


def _input_args():
    # Comment-out appropriate pattern depends on subject.

    # arguments = sys.argv[1:]  # ptn1: get args from script parameters.
    # arguments = _input().split()  # ptn2: get args from 1 line console prompt with space separated.

    # for multi-line console input, use this.
    arguments = _get_args_from_multiple_lines(end_of_lines_char=[''], limit=2)

    # Cast elements If you need.
    # arguments = list(map(int, arguments))  # cast elements to int for example.

    return arguments  # This will be array.


def _input():
    # If Subject requires interactive input, use this and patch mock in unittest.
    return input()  # Change if necessary.


def _get_args_from_multiple_lines(end_of_lines_char=[''], limit=2):
    """Get arguments from multiple lines standard input.

    :param end_of_lines_char: Strings that indicate the end of lines.
    :type end_of_lines_char: list of str
    :param limit: If a number of the input line are certain, you can use this param to close prompt immediately.
    :type limit: int
    :return: args
    :rtype list of str
    """
    args = []
    for i in range(limit):
        try:
            arg = _input()
            if arg in end_of_lines_char:
                break
            args.append(arg)
        except EOFError:  # Supports EOF Style. (Very Rare case)
            break
    return args


def _output_result(result):
    # Comment-out appropriate output pattern depends on subject.

    # sys.stdout.write(result)  # No Line Feed, and an result must be string (not useful). for single value output.
    print(result)  # The result will cast to strings. Line feed will be appended to the end. for single value output.
    # print(result, end='')  # Same as above except Line Feed won't be appended. for single value output.
    # print(','.join(map(str, result)))  # Print array elements as comma separated strings. for multi-value.
    # print('ans={}'.format(str(result)))  # Same as above, but more versatile.


if __name__ == '__main__':
    main()

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:
def calcA(x):
    return x*2

def calcB(k, x):
    return x + k

def main():
    n = int(input())
    k = int(input())
    start = 1
    for i in range(n):
        start1 = calcA(start)
        start2 = calcB(k, start)
        if start1 < start2:
            start = start1
        else:
            start = start2
    print(start)
main()

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")
 
 
def main():
    N = int(input())
    K = int(input())
    ans = INF
    for a in range(N + 1):
        b = N - a
        ans = min(ans, 2 ** a + b * K)
    print(ans)
 
 
if __name__ == '__main__':
    main()

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

ita = 1

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

    else:
        ita += K

print(ita)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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:
# coding: utf-8

if __name__ == "__main__":
    def A(now):
        return 2*now

    def B(now, K):
        return now + K

    N = int(input())
    K = int(input())
    now = 1

    for i in range(N):
        if A(now) < B(now, K):
            now = A(now)
        else:
            now = B(now, K)

    print(now)

Submission status: Accepted

Solution code:
a=input()
b=input()
c=1
for _ in xrange(a):
 c=min(c*2,c+b)
print c

Submission status: Accepted

Solution code:
n = input()
k = input()
x = 1

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

print x

Submission status: Accepted

Solution code:
#coding: utf-8

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
num = 2**n
list = [format((i),"b").zfill(n) for i in range(num)]
result = []
for i in list:
    a = 1
    for j in range(n):
        if i[j] == "0":
            a *= 2
        else:
            a += k
    result.append(a)
print(min(result))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())
K = int(input())
result = 1

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

print(result)

Submission status: Accepted

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

def f(N, K):
    b = min(K.bit_length(), N)
    return 2**b + (N-b)*K


def test():
    assert f(4,3) == 10
    assert f(10,10) == 76


def main():
    N = int(input())
    K = int(input())
    print(f(N, K))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    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 itertools
N, K = (int(input()), int(input()))
num = 1
for tmp in range(N):
    a = 2*num
    b = num+K
    num = min(a,b)
print(num)

Submission status: Accepted

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

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:
#ABC076B

n=int(raw_input())
k=int(raw_input())
x=1
for i in xrange(n):
 if x*2<x+k:
  x*=2
 else:
  x+=k
print x

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
Ans = 1
def dowhich(x):
    if Ans*2 >= Ans+x:
        return Ans+x
    elif Ans*2 < Ans+x:
        return Ans*2
for _ in range(N):
    Ans = dowhich(K)

print(Ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
k = (int(input()))
a = [(1<<x)+k*(n-x) for x in range(n+1)]
print(min(a))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N = int(input())
    K = int(input())
    ans = INF
    for a in range(N + 1):
        b = N - a
        ans = min(ans, 2 ** a + b * K)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(raw_input())
k = int(raw_input())
i = 1
a = 0
while a < n and i <= k:
    a += 1
    i *= 2
print i + k * (n - 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())
min_t = 2**11

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

dfs(1,0)

print(min_t)

Submission status: Accepted

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

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

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
K = int(input())
x = 1
n = 0
while x < K and n < N:
    x *= 2
    n += 1
while n < N:
    x += K
    n += 1
print(x)

Submission status: Accepted

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

Submission status: Accepted

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

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

print a

Submission status: Accepted

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

x = 1

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

print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def operationA(num):
    number = num * 2
    return number


def operationB(num, k):
    number = num + k
    return number


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

for i in range(n):
    if start * 2 > start + k:
        start = operationB(start, k)

    else:
        start = operationA(start)


print(start)

Submission status: Accepted

Solution code:
#!/usr/bin/python

# AtCoder Beginner Contest 076
# B - Addition and Multiplication

from sys import stdin

def solve(N, K):
  x = 1
  for i in range(N):
    x = min(2 * x, x + K)
  return x

N = int(stdin.readline())
K = int(stdin.readline())
print(solve(N, K))

Submission status: Accepted

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

    total = 1
    for _ in range(N):
        hoge = total * 2
        fuga = total + K
        if hoge < fuga:
            total = hoge
        elif hoge >= fuga:
            total = fuga

    print(total)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = 0
K = 0

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

solve()

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
a=[1]
b=[]
for x in range(N):
    for i in a:
        b.append(i*2)
        b.append(i+K)
    a=b
    b=[]

print(min(a))

Submission status: Accepted

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

print num

Submission status: Accepted

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

Submission status: Accepted

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

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

print(number)

Submission status: Accepted

Solution code:
#coding: utf-8
D = 1
N = int(input())
K = int(input())
array =[1]

for i in  range(N):
	X = array[i]*2
	Z = array[i]+K
	if X >= Z:
		array.append(Z)
	else:
		array.append(X)

print(array[N])

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:
# -*- coding:utf-8 -*-

D=1
N=int(input())
K=int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n = int(raw_input())
k = int(raw_input())

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

print str(ans)

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
M = []
def dfs(num, k):
    if k == N:
        M.append(num)
    else:
        dfs(num + K, k + 1)
        dfs(num * 2, k + 1)
dfs(1, 0)
print(min(M))

Submission status: Accepted

Solution code:
n, k = int(input()), int(input())
# O(2^N)??
m = 1
def f(m, n, k):
    if n==0:
        return m
    else:
        return min(f(m*2, n-1, k), f(m+k, n-1, k))

print(f(m, n, k))

Submission status: Accepted

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

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

output_num = 1
while output_num <= K and N > 0:
    output_num = output_num*2
    N -= 1

if N > 0:
    for i in range(N):
        output_num += K

print(output_num)

Submission status: Accepted

Solution code:
import itertools
n = int(input())
k = int(input())
result = []
for seq in list(itertools.combinations_with_replacement([2, 1], n)):
    current = 1
    for i in seq:
        if i == 1:
            current += k
        else:
            current *= 2
    result.append(current)
print(min(result))

Submission status: Accepted

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

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

print(cur)

Submission status: Accepted

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

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

print(now)

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline())
K = int(sys.stdin.readline())

curVal = 1
for i in range(0, N):
    if curVal < K:
        curVal = curVal + curVal
    else:
        curVal = curVal + K
print(curVal)

Submission status: Accepted

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

k = 1

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

print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
cnt = 1
cur = 1
n = int(input())
k = int(input())
while cnt <= n:
  cnt += 1
  opeA = cur * 2
  opeB = cur + k

  if opeA < opeB :
    cur = opeA
  else:
    cur = opeB
print (cur)

Submission status: Accepted

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

x = 1

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

print(x)

Submission status: Accepted

Solution code:
import sys

num = 1
n = int(sys.stdin.readline().strip())
k = int(sys.stdin.readline().strip())

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

print(num)

Submission status: Accepted

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

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

print(S)

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

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

print(a)

Submission status: Accepted

Solution code:
def A(n,k):
    return 2*n
def B(n,k):
    return n+k
def square(n,k):
    a=A(c[0],k)
    b=B(c[0],k)
    i[0]-=1
    if i[0]==-1:
        return n
    else: 
        if a>=b:
            """
            print("A")
            print(a)
            print("B")
            print(b)
            """
            c[0]=b
            return square(c[0],k)
        else:
            """
            print("B")
            print(b)
            """
            c[0]=a
            return square(c[0],k)
c=[1]
n=int(input())
i=[n]
k=int(input())
print(square(n,k))

Submission status: Accepted

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

Submission status: Accepted

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

a = 1

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

print (a)

Submission status: Accepted

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

o=1
i=0

while o <=k and i <=n-1:
    o=o*2
    i+=1

while i <=n-1:
    o+=k
    i+=1

print(o)

Submission status: Accepted

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

ans = float("inf")
# 長さN, 0と1の全ての組み合わせのリストを作る

# N<=10だからbrute forceでも1024通りで済む．
# ビット演算がシンプル?
for i in range(2**N):
    curr_num = 1
    for _ in range(N):
        checker = i & 1
        if checker == 0:
            curr_num = curr_num * 2
        else:
            curr_num += K
        i >>= 1
    ans = min(ans, curr_num)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(raw_input())
k = int(raw_input())
s = 1
for x in xrange(n):
	if(  s*2-s < k):
		s = s*2
	else:
		s = s+k
print s

Submission status: Accepted

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

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

print(keiji)

Submission status: Accepted

Solution code:
def B_Addition_and_Multiplication(N, K):
    if N==1:
        return 2
    multiply = 0  # 掛け算する回数
    add = 0  # 足し算する回数
    tmp = 1
    while tmp < K:
        tmp *= 2
        multiply += 1
    add = N - multiply

    ans = pow(2, multiply) + K * add
    return ans
  
N = int(input())
K = int(input())
print(B_Addition_and_Multiplication(N, K))

Submission status: Accepted

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

print(p)

Submission status: Accepted

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

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

    print(v)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = []

def DFS(num=1, cnt = 1):
    
    if cnt==N+1:
        ans.append(num)
        return False
        
    if DFS(num*2, cnt+1):
        return True
    
    if DFS(num+K, cnt+1):
        return True

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

Submission status: Accepted

Solution code:
def bin(a):
  return 2*a

def ten(a):
  return a+K

N = int(input())
K = int(input())
value = 1
for i in range(N):
  if bin(value) <= ten(value) :
    value = bin(value)
  else:
    value = ten(value)
print(value)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys, re, copy, math, itertools
from copy import *
from collections import deque, defaultdict
from heapq import *
from bisect import *
#import numpy as np
#import scipy as sp

# 読み込み
N = int( input() )
K = int( input() )

min_x = 2147483647 // 2

for A in range(N):
    x = 1
    for a in range(A):
        x *= 2
    for b in range(N-A):
        x += K
    
    if x < min_x:
        min_x = x

for B in range(N):
    x = 1
    for b in range(B):
        x += K
    for a in range(N-B):
        x *= 2
    
    if x < min_x:
        min_x = x

print(min_x)

Submission status: Accepted

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

x=1

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

Submission status: Accepted

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

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

print(min)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
if __name__ == '__main__':
    N = input()
    K = input()
    result = 2**N
    for i in range(N):
        result = min(result, 2**i + K * (N - i))
    print result

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
n = int(input())
k = int(input())

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

print(now)

Submission status: Accepted

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

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

Submission status: Accepted

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

import itertools


def compute_min_num(n, k):
    res = float("inf")
    seqs = itertools.product((True, False), repeat=n)
    for ops in seqs:
        x = 1
        for is_a in ops:
            if is_a:
                x *= 2
            else:
                x += k
        res = min(res, x)
    return res


def main():
    n = int(input())
    k = int(input())
    print(compute_min_num(n, k))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(result)

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

m = 1

while n:
    n -= 1
    t1 = 2*m
    t2 = m + k

    if t1 < t2:
        m = t1
    else:
        m = t2

print (m)

Submission status: Accepted

Solution code:
#!/usr/bin/python

import sys

def main(argv):
    line = sys.stdin.readline()
    while line:
        N = int(line)
        K = int(sys.stdin.readline())
        value = 1
        for i in xrange(N):
            value = min(2 * value, value + K)
        print(value)

        line = sys.stdin.readline()

if __name__ == "__main__":
    main(sys.argv)

Submission status: Accepted

Solution code:
n , k = int(input()), int(input())
res = 1 << 63

def getAns(now, step):
    global res
    if step == n:
        res = min(res, now)
    if step <= n and now < res:
        getAns(now + k, step + 1)
        getAns(now * 2, step + 1)
getAns(1, 0)
print(res)