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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int maxn=4000;

const int mod=1e9+7;

int n,k;



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if(k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

	if (k&1)

	    sum=1ll*sum*a%mod;

    return sum;

}



int fac[maxn+10],ifac[maxn+10],inv[maxn+10];



int C(int a,int b){return (a<0)||(b<0)||(a<b)?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}



int F(int i,int j){return 1ll*C(i+j,i)*(i-j+1)%mod*inv[i+1]%mod;}



int main()

{

    fac[0]=inv[0]=inv[1]=ifac[0]=1;

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

	{

	    fac[i]=1ll*fac[i-1]*i%mod;

	}

    for(int i=2; i<=maxn; ++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

    for(int i=1; i<=maxn; ++i) ifac[i]=1ll*ifac[i-1]*inv[i]%mod;

    n=read(),k=read();

    printf("%lld\n",1ll*F(n-1,k-1)*power(2,n-k-1)%mod);

    return 0;

}


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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=2000;

int n,k;

int f[maxn+8][maxn+8],g[maxn+8][maxn+8];



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if (k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

	if (k&1)

	    sum=1ll*sum*a%mod;

    return sum;

}



int main()

{

    n=read(),k=read();

    for (int i=1;i<=n;i++) g[0][i]=1;

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

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

	        g[i][j]=(g[i-1][j]+g[i][j-1])%mod;

    printf("%lld\n",1ll*g[k-1][n]*power(2,n-k-1)%mod);

    return 0;

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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int maxn=4000;

const int mod=1e9+7;

int n,k;



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if(k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

	if (k&1)

	    sum=1ll*sum*a%mod;

    return sum;

}



int fac[maxn+10],ifac[maxn+10],inv[maxn+10];



int C(int a,int b){return (a<0)||(b<0)||(a<b)?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}



int F(int i,int j){return 1ll*C(i+j,i)*(i-j+1)%mod*inv[i+1]%mod;}



int main()

{

    fac[0]=inv[0]=inv[1]=ifac[0]=1;

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

	{

	    fac[i]=1ll*fac[i-1]*i%mod;

	}

    for(int i=2; i<=maxn; ++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

    for(int i=1; i<=maxn; ++i) ifac[i]=1ll*ifac[i-1]*inv[i]%mod;

    n=read(),k=read();

    printf("%lld\n",1ll*F(n-1,k-1)*power(2,n-k-1)%mod);

    return 0;

}


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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=2000;

int n,k;

int f[maxn+8][maxn+8],g[maxn+8][maxn+8];



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if (k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

    if (k&1)

        sum=1ll*sum*a%mod;

    return sum;

}



int main()

{

    n=read(),k=read();

    for (int i=1;i<=n;i++) g[0][i]=1;

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

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

	    g[i][j]=(g[i-1][j+1]+g[i][j-1])%mod;

    printf("%lld\n",1ll*g[k-1][n-k+1]*power(2,n-k-1)%mod);

    return 0;

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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int maxn=4000;

const int mod=1e9+7;

int n,k;



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if(k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

	if (k&1)

	    sum=1ll*sum*a%mod;

    return sum;

}



int fac[maxn+10],ifac[maxn+10],inv[maxn+10];



int C(int a,int b){return (a<0)||(b<0)||(a<b)?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}



int F(int i,int j){return 1ll*C(i+j,i)*(i-j+1)%mod*inv[i+1]%mod;}



int main()

{

    fac[0]=inv[0]=inv[1]=ifac[0]=1;

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

	{

	    fac[i]=1ll*fac[i-1]*i%mod;

	}

    for(int i=2; i<=maxn; ++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

    for(int i=1; i<=maxn; ++i) ifac[i]=1ll*ifac[i-1]*inv[i]%mod;

    n=read(),k=read();

    printf("%lld\n",1ll*F(n-1,k-1)*power(2,n-k-1)%mod);

    return 0;

}


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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=2000;

int n,k;

int f[maxn+8][maxn+8],g[maxn+8][maxn+8];



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if (k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

    if (k&1)

        sum=1ll*sum*a%mod;

    return sum;

}



int main()

{

    n=read(),k=read();

    g[1][0]=1;

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

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

	    g[i][j]=(g[i-1][j+1]+g[i][j-1])%mod;

    printf("%lld\n",1ll*g[k][n-k+1]*power(2,n-k-1)%mod);

    return 0;

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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int maxn=4000;

const int mod=1e9+7;

int n,k;



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if(k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

	if (k&1)

	    sum=1ll*sum*a%mod;

    return sum;

}



int fac[maxn+10],ifac[maxn+10],inv[maxn+10];



int C(int a,int b){return (a<0)||(b<0)||(a<b)?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}



int F(int i,int j){return 1ll*C(i+j,i)*(i-j+1)%mod*inv[i+1]%mod;}



int main()

{

    fac[0]=inv[0]=inv[1]=ifac[0]=1;

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

	{

	    fac[i]=1ll*fac[i-1]*i%mod;

	}

    for(int i=2; i<=maxn; ++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

    for(int i=1; i<=maxn; ++i) ifac[i]=1ll*ifac[i-1]*inv[i]%mod;

    n=read(),k=read();

    printf("%lld\n",1ll*F(n-1,k-1)*power(2,n-k-1)%mod);

    return 0;

}


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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=2000;

int n,k;

int f[maxn+8][maxn+8],g[maxn+8][maxn+8];



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if (k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

    if (k&1)

        sum=1ll*sum*a%mod;

    return sum;

}



int main()

{

    n=read(),k=read();

    g[0][0]=1;

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

	{

	    f[i][0]=g[i-1][0];

	    g[i][0]=f[i][0];

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

		{

		    f[i][j]=g[i-1][j];

		    g[i][j]=(g[i][j-1]+f[i][j])%mod;

		}

	}

    //for (int i=0;i<n;i++) printf("%d ",g[n-1][i]);

    int ans=g[n-1][k-1];

    ans=1ll*ans*power(2,n-k-1)%mod;

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

    return 0;

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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int maxn=4000;

const int mod=1e9+7;

int n,k;



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if(k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

    if (k&1)

        sum=1ll*sum*a%mod;

    return sum;

}



int fac[maxn+10],ifac[maxn+10],inv[maxn+10];



int C(int a,int b){return (a<0)||(b<0)||(a<b)?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}



int F(int i,int j){return (C(i+j,i)-C(i+j,i+1)+mod)%mod;}



int main()

{

    fac[0]=inv[0]=inv[1]=ifac[0]=1;

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

    {

        fac[i]=1ll*fac[i-1]*i%mod;

    }

    for(int i=2; i<=maxn; ++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

    for(int i=1; i<=maxn; ++i) ifac[i]=1ll*ifac[i-1]*inv[i]%mod;

    n=read(),k=read();

    printf("%lld\n",1ll*F(n-1,k-1)*power(2,n-k-1)%mod);

    return 0;

}


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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=2000;

int n,k;

int f[maxn+8][maxn+8],g[maxn+8][maxn+8];



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if (k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

    if (k&1)

        sum=1ll*sum*a%mod;

    return sum;

}



int main()

{

    n=read(),k=read();

    g[0][0]=1;

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

	{

	    f[i][0]=g[i-1][0];

	    g[i][0]=f[i][0];

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

		{

		    f[i][j]=g[i-1][j];

		    g[i][j]=(g[i][j-1]+f[i][j])%mod;

		}

	}

    //for (int i=0;i<n;i++) printf("%d ",g[n-1][i]);

    int ans=g[n-1][k-1];

    ans=1ll*ans*power(2,n-k-1)%mod;

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

    return 0;

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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int maxn=4000;

const int mod=1e9+7;

int n,k;



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if(k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

	if (k&1)

	    sum=1ll*sum*a%mod;

    return sum;

}



int fac[maxn+10],ifac[maxn+10],inv[maxn+10];



int C(int a,int b){return (a<0)||(b<0)||(a<b)?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}



int F(int i,int j){return 1ll*C(i+j,i)*(i-j+1)%mod*inv[i+1]%mod;}



int main()

{

    fac[0]=inv[0]=inv[1]=ifac[0]=1;

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

	{

	    fac[i]=1ll*fac[i-1]*i%mod;

	}

    for(int i=2; i<=maxn; ++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

    for(int i=1; i<=maxn; ++i) ifac[i]=1ll*ifac[i-1]*inv[i]%mod;

    n=read(),k=read();

    printf("%lld\n",1ll*F(n-1,k-1)*power(2,n-k-1)%mod);

    return 0;

}


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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=2000;

int n,k;

int f[maxn+8][maxn+8],g[maxn+8][maxn+8];



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if (k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

    if (k&1)

        sum=1ll*sum*a%mod;

    return sum;

}



int main()

{

    n=read(),k=read();

    g[0][0]=1;

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

	{

	    g[i][0]=g[i-1][0];

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

		    g[i][j]=(g[i][j-1]+g[i-1][j])%mod;

	}

    int ans=g[n-1][k-1];

    ans=1ll*ans*power(2,n-k-1)%mod;

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

    return 0;

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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int maxn=4000;

const int mod=1e9+7;

int n,k;



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if(k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

    if (k&1)

        sum=1ll*sum*a%mod;

    return sum;

}



int fac[maxn+10],ifac[maxn+10],inv[maxn+10];



int C(int a,int b){return (a<0)||(b<0)||(a<b)?0:1ll*fac[a]*ifac[b]%mod*ifac[a-b]%mod;}



int F(int i,int j){return (C(i+j,i)-C(i+j,i+1)+mod)%mod;}



int main()

{

    fac[0]=inv[0]=inv[1]=ifac[0]=1;

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

    {

        fac[i]=1ll*fac[i-1]*i%mod;

    }

    for(int i=2; i<=maxn; ++i) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;

    for(int i=1; i<=maxn; ++i) ifac[i]=1ll*ifac[i-1]*inv[i]%mod;

    n=read(),k=read();

    printf("%lld\n",1ll*F(n-1,k-1)*power(2,n-k-1)%mod);

    return 0;

}


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

#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=2000;

int n,k;

int f[maxn+8][maxn+8],g[maxn+8][maxn+8];



int read()

{

    int x=0,f=1;char ch=getchar();

    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;

    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';

    return x*f;

}



int power(int a,int k)

{

    if (k<0) return 1;

    int sum=1;

    for (;k;k>>=1,a=1ll*a*a%mod)

    if (k&1)

        sum=1ll*sum*a%mod;

    return sum;

}



int main()

{

    n=read(),k=read();

    g[0][0]=1;

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

	{

	    g[i][0]=g[i-1][0];

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

		    g[i][j]=(g[i][j-1]+g[i-1][j])%mod;

	}

    int ans=g[n-1][k-1];

    ans=1ll*ans*power(2,n-k-1)%mod;

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

    return 0;

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



#define debug(x) cout << #x" = " << x;



#define st first

#define nd second



using namespace std;

using namespace placeholders;



typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> PII;

typedef pair<ll, ll> PLL;



const int MAXN = 2E3 + 10;

const int MOD = 1E9 + 7;



ll inv[MAXN], fac[MAXN], facinv[MAXN];



ll modExp(ll e, ll n, ll m = MOD){

	ll ret = 1;

	for (; n; n >>= 1, e = e * e % m)

		if (n & 1)

			ret = ret * e % m;

	return ret;

}



void getInv(int n = MAXN - 1, int m = MOD){

	inv[0] = 0, inv[1] = 1;

	fac[0] = fac[1] = 1;

	facinv[0] = facinv[1] = 1;

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

		inv[i] = inv[m % i] * (m - m / i) % m;

		fac[i] = fac[i - 1] * i % m;

		facinv[i] = facinv[i - 1] * inv[i] % m;

	}

}



ll C(int n, int m){

	return m < 0 || n < m ? 0 : fac[n] * facinv[m] % MOD * facinv[n - m] % MOD;

}



inline void update(int &x, int y){

	if ((x += y) >= MOD)

		x -= MOD;

}



int f[MAXN][MAXN];



int main(){

	getInv();



	int n, k;

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

	f[0][0] = 1;

	for (int i = 1; i <= k - 1; ++i){

		int s = f[i - 1][i - 1];

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

			update(f[i][j], s);

			update(f[i][j], f[i - 1][j]);

			update(s, f[i - 1][j]);

//			printf("%d %d %d\n", i, j, f[i][j]);

		}

	}

	int ans = 0;

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

		update(ans, f[k - 1][i]);

	printf("%d\n", (int)(ans * modExp(2, max(0, n - k - 1)) % MOD));

	return 0;

}


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



typedef long long ll;



const int MAXN = 2E3 + 10;

const int MOD = 1E9 + 7;



ll modExp(ll e, ll n, ll m = MOD){

	ll ret = 1;

	for (; n; n >>= 1, e = e * e % m)

		if (n & 1)

			ret = ret * e % m;

	return ret;

}



inline void update(int &x, int y){

	if ((x += y) >= MOD)

		x -= MOD;

}



int f[MAXN][MAXN];



int main(){

	int n, k;

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

	f[0][0] = 1;

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

		int s = f[i - 1][i - 1];

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

			update(f[i][j], s);

			update(f[i][j], f[i - 1][j]);

			update(s, f[i - 1][j]);

		}

	}

	int ans = 0;

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

		update(ans, f[k - 1][i]);

	printf("%d\n", (int)(ans * modExp(2, n == k ? 0 : n - k - 1) % MOD));

	return 0;

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

#include<iomanip>

#include<stack>

#include<queue>

#include<list>

#include<vector>

#include<set> 

#include<map>

#include<string>

#include<algorithm>

#include<cmath>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<ctime>

#define ll long long

#define db double

#define inf 2001

#define INF (int)2e9 

#define mod (ll)(1e9+7)

#define pi acos(-1)

#define mxbit 30

#define rd(n) {n=0;char ch;int f=0;do{ch=getchar();if(ch=='-'){f=1;}}while(ch<'0'||ch>'9');while('0'<=ch&&ch<='9'){n=(n<<1)+(n<<3)+ch-48;ch=getchar();}if(f)n=-n;}

using namespace std;

//#define int long long



int Qpow2(int k){

	if (k==-1){

		return 1;

	}

	ll x=2,ans=1LL;

	while (k){

		if (k&1){

			ans=(ans*x)%mod;

		}

		x=(x*x)%mod;

		k/=2;

	}

	return (int)ans;

}



int dp[inf][inf];



main(){

	int n,k;

	rd(n) rd(k)

	dp[0][n+1]=1;

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

		int sum=dp[i-1][n+1];

		for (int j=n;j>=1;j--){

			sum=(sum+dp[i-1][j])%mod;

			if (j<=n-i+1){

				dp[i][j]=sum;

			}

		}

	}

	ll ans=(dp[k][1]-dp[k-1][1]+mod)%mod*Qpow2(n-k-1)%mod;

	printf("%lld\n",ans);

	return 0;

}

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

using namespace std;

const int mod=1e9+7;

int n,k;

long long f[2005][2005],s[2005],ans;

long long ksm(long long a,long long b)

{

  long long ans=1;

  while(b)

  {

  	if(b&1)  ans=ans*a%mod;

  	a=a*a%mod;b>>=1;

  }

  return ans;

}

int main()

{

  //FILE *fi,*fo;

  //fi=fopen("forget.in","r");

  //fo=fopen("forget.out","w"); 

  scanf("%d%d",&n,&k);f[0][n+1]=1;

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

  {

	s[n+1]=f[i-1][n+1];  

	for(int j=n;j>=1;j--)  s[j]=(f[i-1][j]+s[j+1])%mod;

	for(int j=1;j<=n-i+1;j++)  f[i][j]=s[j];

  }

  if(n>k)  ans=(((f[k][1]-f[k-1][1]+mod)%mod)*ksm(2,n-k-1))%mod;

  else  ans=(f[k][1]-f[k-1][1]+mod)%mod;

  printf("%lld",ans);

  return 0;

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

const long long P=1000000007ll;

long long n,k,f[10001];

inline long long qpow(long long a,int x){

    if(x<0)return 1;

    long long s=1ll;

    while(x){if(x&1)(s*=a)%=P;(a*=a)%=P;x>>=1;}

    return s;

}

int main(){

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

    f[0]=1ll;

    for(int i=1;i<n;++i){for(int j=i;j;--j)f[j]=(f[j+1]+f[j-1])%P;f[0]=f[1];}

    printf("%lld",f[n-k]*qpow(2ll,n-k-1)%P);

}

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

using namespace std;

const int mod=1e9+7;

int n,k;

long long f[2005][2005],s[2005],ans;

long long ksm(long long a,long long b)

{

  long long ans=1;

  while(b)

  {

  	if(b&1)  ans=ans*a%mod;

  	a=a*a%mod;b>>=1;

  }

  return ans;

}

int main()

{

  //FILE *fi,*fo;

  //fi=fopen("forget.in","r");

  //fo=fopen("forget.out","w"); 

  scanf("%d%d",&n,&k);f[0][n+1]=1;

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

  {

	s[n+1]=f[i-1][n+1];  

	for(int j=n;j>=1;j--)  s[j]=(f[i-1][j]+s[j+1])%mod;

	for(int j=1;j<=n-i+1;j++)  f[i][j]=s[j];

  }

  if(n>k)  ans=(((f[k][1]-f[k-1][1]+mod)%mod)*ksm(2,n-k-1))%mod;

  else  ans=(f[k][1]-f[k-1][1]+mod)%mod;

  printf("%lld",ans);

  return 0;

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

#include<cstdio>

using namespace std;

const long long P=1000000007;

long long n,k,f[10001];

long long qpow(long long a,int x)

{

    if(x<0)return 1;

    long long s=1;

    while(x)

	{

		if(x&1) s=(s*a)%P;

		a=(a*a)%P;

		x>>=1;

	}

    return s;

}

int main()

{

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

    f[0]=1;

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

	{

		for(int j=i;j;--j)

			f[j]=(f[j+1]+f[j-1])%P;

		f[0]=f[1];

	}

    printf("%lld",f[n-k]*qpow(2,n-k-1)%P);

    return 0;

}

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

using namespace std;

const int mod=1e9+7;

int n,k;

long long f[2005][2005],s[2005],ans;

long long ksm(long long a,long long b)

{

  long long ans=1;

  while(b)

  {

  	if(b&1)  ans=ans*a%mod;

  	a=a*a%mod;b>>=1;

  }

  return ans;

}

int main()

{

  //FILE *fi,*fo;

  //fi=fopen("forget.in","r");

  //fo=fopen("forget.out","w"); 

  scanf("%d%d",&n,&k);f[0][n+1]=1;

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

  {

	s[n+1]=f[i-1][n+1];  

	for(int j=n;j>=1;j--)  s[j]=(f[i-1][j]+s[j+1])%mod;

	for(int j=1;j<=n-i+1;j++)  f[i][j]=s[j];

  }

  if(n>k)  ans=(((f[k][1]-f[k-1][1]+mod)%mod)*ksm(2,n-k-1))%mod;

  else  ans=(f[k][1]-f[k-1][1]+mod)%mod;

  printf("%lld",ans);

  return 0;

}
// Slower C++ solution:
// luogu-judger-enable-o2

#include<iostream>

#include<cstring>

#include<cstdio>

#define ll long long

using namespace std;

const int maxn=2005;

const int mod=1e9+7;

int n,k;

ll dp[maxn][maxn],f[maxn];

ll kuai(ll a,int k)

{

	ll ans=1;

	while(k)

	{

		if(k&1)(ans*=a)%=mod;

		(a*=a)%=mod;k>>=1;

	}

	return ans%mod;

} 

int main()

{

//	freopen("forget.in","r",stdin);

//	freopen("forget.out","w",stdout);

	cin>>n>>k;

	dp[0][n+1]=1;ll ans=0;

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

	{

		f[n+1]=dp[i-1][n+1];

		for(int j=n;j>=1;j--)f[j]=(f[j+1]+dp[i-1][j])%mod;

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

			dp[i][j]=f[j];

	}

	dp[k][1]=(dp[k][1]-dp[k-1][1]+mod)%mod;

	if(n==k)ans=dp[k][1];

	else ans=dp[k][1]*kuai(2,n-k-1)%mod;

	cout<<ans<<endl;

}

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

using namespace std;

const int mod=1e9+7;

int n,k;

long long f[2005][2005],s[2005],ans;

long long ksm(long long a,long long b)

{

  long long ans=1;

  while(b)

  {

  	if(b&1)  ans=ans*a%mod;

  	a=a*a%mod;b>>=1;

  }

  return ans;

}

int main()

{

  //FILE *fi,*fo;

  //fi=fopen("forget.in","r");

  //fo=fopen("forget.out","w"); 

  scanf("%d%d",&n,&k);f[0][n+1]=1;

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

  {

	s[n+1]=f[i-1][n+1];  

	for(int j=n;j>=1;j--)  s[j]=(f[i-1][j]+s[j+1])%mod;

	for(int j=1;j<=n-i+1;j++)  f[i][j]=s[j];

  }

  if(n>k)  ans=(((f[k][1]-f[k-1][1]+mod)%mod)*ksm(2,n-k-1))%mod;

  else  ans=(f[k][1]-f[k-1][1]+mod)%mod;

  printf("%lld",ans);

  return 0;

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

using namespace std;

int main()

{

    char c;

    int ans = 700;

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

        scanf("%c", &c);

        ans += (c == 'o' ? 100 : 0);

    }

    printf("%d", ans);

    return 0;

}

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

int main()

{

    char c;

    int ans = 700;

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

        scanf("%c", &c);

        ans += (c == 'o' ? 100 : 0);

    }

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

    return 0;

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

using namespace std;

int main()

{

   long long int  n,i,s=0;

    cin>>n;

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

    {

        if(i % 3!=0 && i % 5!=0)

        {

            s=s+i;

        }

    }cout<<s;

}


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





int main(){

    long a;

    scanf("%ld", &a);



    long sum = 0;

    for (long i=1; i<=a; i++){

        if (i%15 == 0 || i%3 == 0 || i%5 == 0){

            continue;

        }

        else{

            sum += i;

        }

    }

    

    printf("%ld\n", sum);

    return 0;

}