stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<cstdio>

#include<vector>



using namespace std;



int main(void){

	while(1){

		vector<vector<int> > kek[31];

		

		int n;

		scanf("%d",&n);

		if(n==0){break;}

		

		for(int i=1;i<=n;i++){

			vector<int> hn;

			hn.push_back(i);

			kek[i].push_back(hn);

			

			for(int j=i-1;j>0;j--){

				

				for(int k=0;k<kek[i-j].size();k++){

					int flg=0;

					

					for(int p=0;p<kek[i-j][k].size();p++){

						if(kek[i-j][k][p]>j){

							flg=1;

							break;

						}

					}

					

					if(flg==1){

						continue;

					}

					

					vector<int> u;

					u.push_back(j);

					

					for(int p=0;p<kek[i-j][k].size();p++){

						u.push_back(kek[i-j][k][p]);

					}

					kek[i].push_back(u);

				}

			}

		}

		

		for(int j=0;j<kek[n].size();j++){

			printf("%d",kek[n][j][0]);

			for(int k=1;k<kek[n][j].size();k++){

				printf(" %d",kek[n][j][k]);

			}

			puts("");

		}

	}

}

// Faster C++ solution for the same problem (measured speedup: 3.442637728178613x):
#include<cstdio>



using namespace std;



int syutu[30];



void saiki(int m,int n,int atnum){

	

	int flg=0;

	//printf("%d %d %d\n",m,n,atnum);

	

	for(int i=n;i>0;i--){

		if(i>m){

			continue;

		}

		

		syutu[atnum]=i;

		saiki(i,n-i,atnum+1);

		syutu[atnum]=-1;

		flg=1;

	}

	

	if(flg==0){

		printf("%d",syutu[0]);

		for(int i=1;i<30;i++){

			if(syutu[i]==-1){

				break;

			}

			printf(" %d",syutu[i]);

		}

		puts("");

	}

}



int main(){

	

	while(1){

		int n;

		scanf("%d",&n);

		

		if(n==0){

			return 0;

		}

		

		for(int i=0;i<30;i++){

			syutu[i]=-1;

		}

		saiki(n,n,0);

	}

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.253577787293342x):
#include<stdio.h>

int main()

{

    int n,k;

    scanf("%d %d",&n,&k);

    int op= 1;

    for(int i = 0;i<n;i++)

    {

        if(op< k) op *= 2    ;

        else{

            op +=k;

        }

    }

    printf("%d\n",op);

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.194670987478621x):
#include<stdio.h>

int main()

{

    int n,k;

    scanf("%d %d",&n,&k);

    int op= 1;

    for(int i = 0;i<n;i++)

    {

        if(op< k) op *= 2    ;

        else{

            op +=k;

        }

    }

    printf("%d\n",op);

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2357794829795425x):
#include <stdio.h>



int main(){

	int N, K, res=1;

	scanf("%d", &N);

	scanf("%d", &K);

	int *ptrK = &K;

	for(int i=1; i<=N; i++){

		if(res*2<res+K){

			res *= 2;

		}else{

			res += K;

		}

	}

	printf("%d\n", res);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.1770722502392434x):
#include <stdio.h>



int main(){

	int N, K, res=1;

	scanf("%d", &N);

	scanf("%d", &K);

	int *ptrK = &K;

	for(int i=1; i<=N; i++){

		if(res*2<res+K){

			res *= 2;

		}else{

			res += K;

		}

	}

	printf("%d\n", res);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.24682459397331x):
#include <stdio.h>



int main()

{

	int n,k,t=1, ans;

	scanf("%d %d", &n, &k);

	for (int i=1;i<=n;i++)

	{

		if (t<k)

		{

			t=t*2;

		}

		else

		{

			t=t+k;

		}

	}

	printf("%d", t);

	

	

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.187993515699818x):
#include <stdio.h>



int main()

{

	int n,k,t=1, ans;

	scanf("%d %d", &n, &k);

	for (int i=1;i<=n;i++)

	{

		if (t<k)

		{

			t=t*2;

		}

		else

		{

			t=t+k;

		}

	}

	printf("%d", t);

	

	

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.246881634754218x):
#include <stdio.h>

int main(){

	

	int n,k,bank = 1;

	

	scanf("%d" , &n);

	scanf("%d" , &k);

	

	for(int i = 0 ; i < n ; i++){

		if(bank * 2 > bank + k){

			bank += k;

		}

		else{

			bank *= 2;

		}		

	}

	printf("%d" , bank);

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.188049916899472x):
#include <stdio.h>

int main(){

	

	int n,k,bank = 1;

	

	scanf("%d" , &n);

	scanf("%d" , &k);

	

	for(int i = 0 ; i < n ; i++){

		if(bank * 2 > bank + k){

			bank += k;

		}

		else{

			bank *= 2;

		}		

	}

	printf("%d" , bank);

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.246881634754218x):
#include<stdio.h>



int main(){

    int A, B;

    int start = 1;

    

    scanf("%d", &A);

    scanf("%d", &B);

    

    for(int i=0;i<A;i++) {

    	if ((start*2)<(start+B)) {

    		start*=2;

		} else {

			start+=B;

		}

	}

    printf("%d", start);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.188049916899472x):
#include<stdio.h>



int main(){

    int A, B;

    int start = 1;

    

    scanf("%d", &A);

    scanf("%d", &B);

    

    for(int i=0;i<A;i++) {

    	if ((start*2)<(start+B)) {

    		start*=2;

		} else {

			start+=B;

		}

	}

    printf("%d", start);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.258621843680306x):
#include <stdio.h>



int main (){

	

	int n, k;

	scanf("%d %d", &n, &k);

	int z = 1;

	

for (int i = 0; i < n; i++) {

        if (2 * z <= z + k) {

            z *= 2;

        } else {

            z += k;

        }

    }

    printf("%d", z);

	

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.199658486366701x):
#include <stdio.h>



int main (){

	

	int n, k;

	scanf("%d %d", &n, &k);

	int z = 1;

	

for (int i = 0; i < n; i++) {

        if (2 * z <= z + k) {

            z *= 2;

        } else {

            z += k;

        }

    }

    printf("%d", z);

	

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.252973789979889x):
#include<stdio.h>

int main()

{

int N,K;

scanf("%d",&N);   

scanf("%d",&K);    

int total = 1;        

for(int i = 0;i<N;i++) 

{

    if(total < K)     

    {

        total = total * 2; 

    }

    else{

        total = total + K; 

    }

}

printf("%d\n",total);

return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.194073762606783x):
#include<stdio.h>

int main()

{

int N,K;

scanf("%d",&N);   

scanf("%d",&K);    

int total = 1;        

for(int i = 0;i<N;i++) 

{

    if(total < K)     

    {

        total = total * 2; 

    }

    else{

        total = total + K; 

    }

}

printf("%d\n",total);

return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.246760368436708x):
#include<stdio.h>

int main(){

	int N,K,i;

	scanf("%d", &N);

	scanf("%d", &K);

	int total= 1;

	for(i=0;i<N;i++){

		if(total<K){

			total= total*2;

		}else{

			total= total+K;

		}

		

	}

	printf("%d", total);

	

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.1879300103049895x):
#include<stdio.h>

int main(){

	int N,K,i;

	scanf("%d", &N);

	scanf("%d", &K);

	int total= 1;

	for(i=0;i<N;i++){

		if(total<K){

			total= total*2;

		}else{

			total= total+K;

		}

		

	}

	printf("%d", total);

	

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.23690454878073x):
#include <stdio.h>

int main(){

	//jadi soalnya tu

	//selama hasilnya blm > dari k

	//jalanin program A

	//kalo udah baru tambahin

	int jalan, k;

	scanf("%d", &jalan);

	scanf("%d", &k);

	

	int dariSoal=1;

	

	for(int i=0; i<jalan; i++){

		if(dariSoal<k){

			dariSoal *= 2;

		} else {

			dariSoal += k;

		}

	}

	printf("%d\n", dariSoal);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.178184701013375x):
#include <stdio.h>

int main(){

	//jadi soalnya tu

	//selama hasilnya blm > dari k

	//jalanin program A

	//kalo udah baru tambahin

	int jalan, k;

	scanf("%d", &jalan);

	scanf("%d", &k);

	

	int dariSoal=1;

	

	for(int i=0; i<jalan; i++){

		if(dariSoal<k){

			dariSoal *= 2;

		} else {

			dariSoal += k;

		}

	}

	printf("%d\n", dariSoal);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.246760368436708x):
#include <stdio.h>

int main(){

	int a, b; 

	scanf("%d", &a);

	scanf("%d", &b);

	int ans=1;

	for (int i = 0; i<a; i++){

		if(ans<b){

			ans= ans*2;

		}else{

			ans= ans + b;

		}

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.1879300103049895x):
#include <stdio.h>

int main(){

	int a, b; 

	scanf("%d", &a);

	scanf("%d", &b);

	int ans=1;

	for (int i = 0; i<a; i++){

		if(ans<b){

			ans= ans*2;

		}else{

			ans= ans + b;

		}

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.253577787293342x):
#include <stdio.h>



int main(){

int N, K;

scanf("%d %d", &N, &K);

int operations=1;



for(int i=0;i<N;i++){

if(operations<K){

operations*=2;

}

else

operations+=K;

}



printf("%d\n", operations);

return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.194670987478621x):
#include <stdio.h>



int main(){

int N, K;

scanf("%d %d", &N, &K);

int operations=1;



for(int i=0;i<N;i++){

if(operations<K){

operations*=2;

}

else

operations+=K;

}



printf("%d\n", operations);

return 0;

}
// Slower C++ solution:
#include <iostream>

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

    int n,k;

    cin>>n>>k;

    int x=1;

    while(n--)

    {

        if(x<=k)

        {

            x*=2;

        }

        else

        {

            x+=k;

        }

    }

    cout<<x;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.253577787293342x):
#include <stdio.h>



int main() {

	int n, k, x = 1;

	scanf("%d %d", &n, &k);

	

	for (int i = 0; i < n; i++) {

		if (x < k) {

			x *= 2;

		} else {

			x += k;

		}

	}

	printf("%d\n", x);

	

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

int n,m;

long long sum,ans,a,k;

int main(){

	scanf("%lld%lld",&a,&k);

	ans=1;

	while(a--)

		ans=min(ans*2,ans+k);

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.194670987478621x):
#include <stdio.h>



int main() {

	int n, k, x = 1;

	scanf("%d %d", &n, &k);

	

	for (int i = 0; i < n; i++) {

		if (x < k) {

			x *= 2;

		} else {

			x += k;

		}

	}

	printf("%d\n", x);

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int no=1,n,k;

    cin>>n>>k;

    for(int i=0;i<n;i++)

    {

        if(no*2<=no+k)no*= 2;

        else no+=k;

    }

    cout<<no<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.26232153185572x):
#include<stdio.h>



int main(){

	int n, k;

	scanf("%d %d", &n, &k);

	int tot=1;

	for(int i=1; i<=n; i++){

		if((tot*2)<=(tot+k)){

		tot*=2;

		}

		else{

			tot+=k;

		}

	}

	printf("%d\n", tot);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n, k, x=1;

int main (){

	cin >> n>> k;

	for(int i=1;i<=n;i++){

		if(x+k<=2*x) x=x+k;

		else if(x+k>2*x) x=x*2;

	}

	cout << x;

}


// Faster C++ solution for the same problem (measured speedup: 5.253285924215643x):
#include<stdio.h>



int main(){

	int n, k;

	scanf("%d %d", &n, &k);

	int tot=1;

	for(int i=1; i<=n; i++){

		if((tot*2)<=(tot+k)){

		tot*=2;

		}

		else{

			tot+=k;

		}

	}

	printf("%d\n", tot);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int N,K,i,sum;



int main(){

	cin>>N>>K;

	sum = 1;

	for (i = 1;i <= N;i ++){

		if ((sum + K) > (sum * 2)){

			sum = sum * 2;

		}

		else {

			sum = sum + K;

		}

	}

	cout<<sum<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.262133896599116x):
#include<stdio.h>



int main(){

	int n, k;

	scanf("%d %d", &n, &k);

	int tot=1;

	for(int i=1; i<=n; i++){

		if((tot*2)<=(tot+k)){

		tot*=2;

		}

		else{

			tot+=k;

		}

	}

	printf("%d\n", tot);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int no=1,n,k;

    cin>>n>>k;

    for(int i=0;i<n;i++)

    {

        if(no*2<=no+k)no*= 2;

        else no+=k;

    }

    cout<<no<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.261587363930031x):
//h

#include <stdio.h>



int main(){

	int n, k, result = 1;

	

	scanf ("%d %d", &n, &k);

	for (int i = 0; i<n; i++)

	{

		if (result*2 < result +k)

		{

			result = result*2;

		}

		else if (result*2 > result +k)

		{

			result= result+k;

		}

		else if (result*2 == result+k)

		{

			result = result+k;

		}

	}

	printf ("%d\n",result);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n, k, x=1;

int main (){

	cin >> n>> k;

	for(int i=1;i<=n;i++){

		if(x+k<=2*x) x=x+k;

		else if(x+k>2*x) x=x*2;

	}

	cout << x;

}


// Faster C++ solution for the same problem (measured speedup: 5.252553016884403x):
//h

#include <stdio.h>



int main(){

	int n, k, result = 1;

	

	scanf ("%d %d", &n, &k);

	for (int i = 0; i<n; i++)

	{

		if (result*2 < result +k)

		{

			result = result*2;

		}

		else if (result*2 > result +k)

		{

			result= result+k;

		}

		else if (result*2 == result+k)

		{

			result = result+k;

		}

	}

	printf ("%d\n",result);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int N,K,i,sum;



int main(){

	cin>>N>>K;

	sum = 1;

	for (i = 1;i <= N;i ++){

		if ((sum + K) > (sum * 2)){

			sum = sum * 2;

		}

		else {

			sum = sum + K;

		}

	}

	cout<<sum<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.261399754851185x):
//h

#include <stdio.h>



int main(){

	int n, k, result = 1;

	

	scanf ("%d %d", &n, &k);

	for (int i = 0; i<n; i++)

	{

		if (result*2 < result +k)

		{

			result = result*2;

		}

		else if (result*2 > result +k)

		{

			result= result+k;

		}

		else if (result*2 == result+k)

		{

			result = result+k;

		}

	}

	printf ("%d\n",result);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int no=1,n,k;

    cin>>n>>k;

    for(int i=0;i<n;i++)

    {

        if(no*2<=no+k)no*= 2;

        else no+=k;

    }

    cout<<no<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.261906878820175x):
#include<stdio.h>



int main()

{

	int n, k;

	scanf("%d %d", &n, &k);

	

	int i, res = 1;

	for (i = 1; i <= n; i++)

	{

		if (res + k <= res * 2)

		{

			res += k;

		}

		

		else

		{

			res *= 2;

		}

	}

	

	printf("%d\n", res);

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n, k, x=1;

int main (){

	cin >> n>> k;

	for(int i=1;i<=n;i++){

		if(x+k<=2*x) x=x+k;

		else if(x+k>2*x) x=x*2;

	}

	cout << x;

}


// Faster C++ solution for the same problem (measured speedup: 5.2528719831552415x):
#include<stdio.h>



int main()

{

	int n, k;

	scanf("%d %d", &n, &k);

	

	int i, res = 1;

	for (i = 1; i <= n; i++)

	{

		if (res + k <= res * 2)

		{

			res += k;

		}

		

		else

		{

			res *= 2;

		}

	}

	

	printf("%d\n", res);

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int N,K,i,sum;



int main(){

	cin>>N>>K;

	sum = 1;

	for (i = 1;i <= N;i ++){

		if ((sum + K) > (sum * 2)){

			sum = sum * 2;

		}

		else {

			sum = sum + K;

		}

	}

	cout<<sum<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.26171925834859x):
#include<stdio.h>



int main()

{

	int n, k;

	scanf("%d %d", &n, &k);

	

	int i, res = 1;

	for (i = 1; i <= n; i++)

	{

		if (res + k <= res * 2)

		{

			res += k;

		}

		

		else

		{

			res *= 2;

		}

	}

	

	printf("%d\n", res);

	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

    int no=1,n,k;

    cin>>n>>k;

    for(int i=0;i<n;i++)

    {

        if(no*2<=no+k)no*= 2;

        else no+=k;

    }

    cout<<no<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.245263178370233x):
#include <stdio.h>

 

int main() {

	int n;

	int k;

	int hitung=1;

	scanf("%d", &n);

	scanf("%d", &k);

	for(int i=0;i<n;i++){

		if(hitung<k){

			hitung*=2;

		}else{

			hitung+=k;

		}

	}

	

	printf("%d\n", hitung);

	

	return 0;	

}