stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

/*

#define mod 7

typedef long long ll;



ll fact[1000006], inv[1000006];



ll fp(ll base, ll exp)

{

    if (exp == 0)

        return 1;

    ll ans = fp(base, exp / 2);

    ans = (ans * ans) % mod;

    if (exp % 2 != 0)

        ans = (ans * (base % mod)) % mod;

    return ans;

}



void calcFacAndInv(ll n)

{

    fact[0] = inv[0] = 1;

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

    {

        fact[i] = (i * fact[i - 1]) % mod;

        inv[i] = fp(fact[i], mod - 2);

    }

}



ll ncr(ll n, ll r)

{

    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;

}



ll npr(ll n, ll r)

{

    return (fact[n] * inv[n - r]) % mod;

}



int main()

{

    calcFacAndInv(100000);

     cout<<inv[3];

    return 0;

}

*/





// GCD



int gcd(long long a,long long b)

{

    if (b==0)

        return a;

    return gcd (b,a%b);

}

//fast power

/*

#define mod 1000000007

long long fp(long long  base, long long exp)

{

    if (exp == 0)

        return 1;

    long long  ans = fp(base, exp / 2);

    ans = (ans * ans);

    if (exp % 2 != 0)

        ans = (ans * (base )) ;

    return ans;

}

*/

//prime factoriation

/*

set<int >s;

bool prime factorization (int x)

{

    for (int j=2; j*j<=x; ++j)

    {

        while (x%j==0)

        {

            s.insert(j);

            x/=j;

        }

    }

    if (x>1)

    {

        s.insert(x);

    }

    if (s.size()==2)

        return true ;

    else

        return false ;

}



#define ll long long

int a,b,q,p,n;

int countDivisorss(int x,int y)

{

    ll cnt = 0;

    for (int i = min(x,y); i <= sqrt(n); i++)

    {

        if (x % i == 0&&y%i==0)

        {

            if (x / i == i||y / i == i)

                cnt++;



            else

                cnt = cnt + 2;

        }

    }

    return cnt;

}

int countDivisors(int x)

{

    ll cnt = 0;

    int tmp=n;

    if (n-x>10000000)  tmp=sqrt(n);

    for (int i = x; i <= tmp; i++)

    {

        if (x % i == 0)

        {

         if (x/i==i)

            cnt++;

         else

            cnt = cnt + 2;

        }

    }

    return cnt;

}

*/



/*

        int s =n/2,e=n-1;

        while (s<=e&&e<=n-1)

        {

            int mid =s+e/2;



            if (arr[mid]==arr[n/2])

            {

                s=mid;

                num +=mid -s;

            }

            else

                e=mid-1;

        }

        */









const int N = 1e5 + 5;



vector<int> adj[N];

bool visited[N];

int nodesNum;

void dfs(int node)

{

   if (visited[node])

       return;

   visited[node] = true;

   for (int child: adj[node])

       dfs(child);

}



int main()

{

   int n;

   cin>>n;

   if (n%2==0)

    cout<<n/2;

   else 

    cout<<n/2+1;

   return 0;

}






// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int a, b;

	scanf("%d", &a);

	

	b = a / 2;

	

	if(a % 2 == 1) {

		printf("%d", b + 1);

	} else {

		printf("%d", b);

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define ll long long

#define ld long double

#define ull unsigned long long

#define endl "\n"

#define MohamedMotaz ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);



using namespace std;



















int main()

{

	MohamedMotaz;

	ll x;

	cin >> x;

	cout << ceil(x / 2.0);





}








































// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int a, b;

	scanf("%d", &a);

	

	b = a / 2;

	

	if(a % 2 == 1) {

		printf("%d", b + 1);

	} else {

		printf("%d", b);

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

typedef long long ll;   



int main()

{

    ll num;

    cin>>num;

    cout<<num/2 + num %2;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int a, b;

	scanf("%d", &a);

	

	b = a / 2;

	

	if(a % 2 == 1) {

		printf("%d", b + 1);

	} else {

		printf("%d", b);

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#define ll long long

using namespace std;



int main()

{ ll n;

cin>>n;

if(n%2==0)

    cout << n/2;

else

    cout << (n/2)+1 << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int a, b;

	scanf("%d", &a);

	

	b = a / 2;

	

	if(a % 2 == 1) {

		printf("%d", b + 1);

	} else {

		printf("%d", b);

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    int n;

    cin>>n;

    if(n%2==0){

        cout<<n/2;

    }

    else{

        cout<<n/2+1;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int a, b;

	scanf("%d", &a);

	

	b = a / 2;

	

	if(a % 2 == 1) {

		printf("%d", b + 1);

	} else {

		printf("%d", b);

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

	int n;

	cin>>n;

	cout<<(n+1)/2;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int a, b;

	scanf("%d", &a);

	

	b = a / 2;

	

	if(a % 2 == 1) {

		printf("%d", b + 1);

	} else {

		printf("%d", b);

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int n;

int saiki(int ima)

{

	if(ima == n)

		return 1;

	if(ima > n)

		return 0;



	int res = 0;

	res += saiki(ima + 1) + saiki(ima + 2) + saiki(ima + 3);

	return res;

}



int main() {

	while (true){

		cin >> n;

		if (n == 0)

			break;

		

		int ans,a;

		ans = saiki(0);

		a = ans;

		ans /= 3650;

		a %= 3650;

		if( a == 0 )

		{

			cout << ans << endl;

		}

		else if( a != 0 )

		{

			ans++;

			cout << ans << endl;

			

		}

	}

}

// Optimized solution to the same problem (faster):
#include <iostream>

using namespace std;



int main()

{

	int n, cnt, y;

	int c[31];



	c[0] = 1;

	c[1] = 1;

	c[2] = 2;

	for( int i=3; i<=30; i++ )

		c[i] = c[i-1] + c[i-2] + c[i-3];



	while( cin >> n, n != 0 ){

		y = c[n]/(365*10);

		y += !( c[n]%(365*10) == 0 );

		cout << y << endl;

	}



	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



long long int kaidan (int n) {

	if (n == 0) {

		return 1;

	} else {

		if (n >= 3) {

			return kaidan(n-3)+kaidan(n-2)+kaidan(n-1);

		} else if (n > 1) {

			return kaidan(n-2)+kaidan(n-1);

		} else {

			return kaidan(n-1);

		}

	}

}





int main() {

	int n;

	while (cin >> n) {

		if (n == 0) {

			break;

		}

		long long int a = kaidan(n);

		long long int b;

		b = a / 10;

		if (a % 10 != 0) {

			b++;

		}

		a = b / 365;

		if (b % 365 != 0) {

			a++;

		}

		cout << a << endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <cmath>

#include <vector>



using namespace std;



int main() {

	int n;

	while (cin >> n) {

		if (n == 0) {

			break;

		}

		vector<int> dp(31, 0);

		dp[0] = 1;

		dp[1] = 1;

		dp[2] = 2;

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

			dp[j] = dp[j-1]+dp[j-2]+dp[j-3];

		}

		int y = dp[n]/3650;

		if (dp[n] % 3650 > 0) {

			y++;

		}

		cout << y << endl;

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;



class Answer

{

public:

	Answer(){day = 10; year = 365;}

	

	int N;	//??\???

	int day;

	int year;

	unsigned long long count(int cnt);	//??¨??¢?´¢(???)

	void set();	//??\???

	void OutPut();	//???????????????

	

	bool empty();	//???????????¶?????????

	bool ans();	//?§£???

};



unsigned long long Answer::count(int cnt)

{

	if( cnt < 0)

		return 0;

	

	else if(cnt == 0)

		return 1;

	

	return count(cnt - 1) + count(cnt - 2) + count(cnt - 3);

}



void Answer::OutPut()

{

	if( N == 0 )

		return;

	int ans_ = 1;	//??????????????´???

	ans_ += (count( N )) / (day * year);	//??\???

	

	cout << ans_ << endl;;

}



void Answer::set()

{

	cin >> N;

}



bool Answer::empty()

{

	if( N == 0 )return false;

	else return true;

}



bool Answer::ans()

{

	set();

	OutPut();

	return empty();

}



int main()

{

	Answer ans;



	while( ans.ans() );

	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;



#define MEMO_MAX 100

typedef unsigned long long ULL;



bool Flag_memo_g = true;	//?????¢??????????????????



class Answer

{

public:

	Answer()

	{

		day = 10; year = 365;

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

		{

			memo[i] = 0;

			Flag_memo[i] = false;

		}

	}

	

	int N;	//??\???

	int day;

	int year;



	ULL memo[MEMO_MAX];

	bool Flag_memo[MEMO_MAX];

	

	ULL count(int cnt);	//??¨??¢?´¢(??±???)

	ULL count_memo(int cnt);	//??¨??¢?´¢(??±???)(?????¢???ver.)

	void set();	//??\???

	void OutPut();	//???????????????

	

	bool empty();	//???????????¶?????????

	bool ans();	//?§£???

};



ULL Answer::count(int cnt)

{

	if( cnt < 0 )

		return 0;

	

	else if( cnt == 0 )

		return 1;

	

	return count(cnt - 1) + count(cnt - 2) + count(cnt - 3);

}





ULL Answer::count_memo(int cnt)

{

	if( cnt < 0 )return 0;

	else if( cnt == 0 )return 1;

	

	if( !(Flag_memo[cnt]) )

	{

		memo[cnt] = count_memo(cnt - 1) + count_memo(cnt - 2) + count_memo(cnt - 3);

		Flag_memo[cnt] = true;

	}

	

	return memo[cnt];

}



void Answer::OutPut()

{

	if( N == 0 )

		return;

	int ans_ = 1;	//??????????????´???

	if( Flag_memo_g )

		ans_ += count_memo( N ) / (day * year);

	

	else if( !Flag_memo_g )

		ans_ += (count( N )) / (day * year);	//??\???

	

	cout << ans_ << endl;

}



void Answer::set()

{

	cin >> N;

}



bool Answer::empty()

{

	if( N == 0 )return false;

	else return true;

}



bool Answer::ans()

{

	set();

	OutPut();

	return empty();

}



int main()

{

	Answer ans;



	while( ans.ans() );

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <algorithm>

#include <stack>

#include <queue>

using namespace std;



int func(int kaidan,int now){

	int a=0,b=0,c=0;

	

	if(now==kaidan){

		return 1;

	}else if(now>kaidan){

		return 0;

		}else{

		a+=func(kaidan,now+1);

		b+=func(kaidan,now+2);	

		c+=func(kaidan,now+3);

		}

	

	return a+b+c;

	

}



int main(){

	int n,ans;



	while(cin>>n){

		if(n==0)break;

		ans=func(n,0);

		cout<<ans/10/365+1<<endl;

		

		

		

	}

	

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

using namespace std;



int memo[31];



int main(){

	int n,ans;

	

	memo[0]=1;

	memo[1]=1;

	memo[2]=2;

	

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

		memo[i]=memo[i-1]+memo[i-2]+memo[i-3];

	}

	

	while(cin>>n){

		if(n==0)break;

		cout<<memo[n]/(365*10)+1<<endl;

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



int n;

int cmb;

int dp[30];



int func(int now){

  if(now > n)

    return 0;

  if(now == n){

    dp[now] = 1;

    return 1;

  }





  return func(now+1) + func(now+2) + func(now+3);

}



int main(void){

  while(1){

    int ans;

    std::cin >> n;



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

      dp[i] = -1;

    }



    if(n == 0){

      return 0;

    }



    cmb = 0;

    ans = func(0);



    std::cout << ans / 10 / 365 + 1 << std::endl;

  }

}

// Optimized solution to the same problem (faster):
#include <iostream>



int n;

int cmb;

int dp[31];



/*

int func(int now){

  if(now > n)

    return 0;

  if(now == n){

    dp[now] = 1;

    return 1;

  }





  return func(now+1) + func(now+2) + func(now+3);

}

*/



int func(int now){

  int a[3];

  if(now < 0){

    return 0;

  }

  if(now == 0){

    return 0;

  }

  if(now == 1){

    return 1;

  }

  if(now == 2){

    return 2;

  }

  if(now == 3){

    return 4;

  }



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

    if(dp[now-i] != -1){

      a[i-1] = dp[now-i];

    }else{

      a[i-1] = func(now-i);

      dp[now-i] = a[i-1];

    }

  }



  return a[0] + a[1] + a[2];



}



int main(void){

  while(1){

    int ans;

    std::cin >> n;



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

      dp[i] = -1;

    }



    if(n == 0){

      return 0;

    }



    cmb = 0;

    ans = func(n);



    std::cout << ans / 10 / 365 + 1 << std::endl;

  }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int a[200005];

int main(int argc, char** argv) {

	int n,m;

	cin >> n >> m;

	if(m==1||m==2*n-1)

	{

		puts("No");

		return 0;

	}

	puts("Yes");

	a[n]=m;

	a[n-1]=m-1;

	a[n+1]=m+1;

	int now=0;

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

	{

		if(i==n||i==n-1||i==n+1)

			continue;

		++now;

		if(now==m-1)

			now=m+2;

		a[i]=now;

	}

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

		cout << a[i] << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <algorithm>

#include <cstdio>

using namespace std;



int main() {

	int n, x; scanf("%d%d", &n, &x);

	if(x == 1 || x == 2 * n - 1) return puts("No"), 0;

	puts("Yes"); int t = 1;

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

		while(abs(t - x) <= 1) t ++;

		printf("%d\n", t ++);

	}

	printf("%d\n%d\n%d\n", x - 1, x, x + 1);

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

		while(abs(t - x) <= 1) t ++;

		printf("%d\n", t ++);

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

using namespace std;

typedef long long ll;



int a[200005];

vector<int> v[200005];

int l[200005];

int re[200005];

int cnt[200005];

int c[200005];



int main()

{

    ll n, k;

    cin >> n >> k;

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

        cin >> a[i];

        cnt[a[i]]++;

        re[i] = cnt[a[i]];

        v[a[i]].push_back(i);

    }

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

        l[a[i]] = v[a[i]].size();

    }

    int now = 0;

    int i;

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

        while(l[a[now]] != re[now]){

            now = v[a[now]][re[now]] + 1;

            if(now == n){

                break;

            }

        }

        c[i] = now;

//        cout << i << " " << c[i] << endl;

        if(l[a[now]] == 1 && now == n - 1){

            i++;

            c[i] = n;

            break;

        }

        if(now == n) break;

        now = (v[a[now]][0] + 1) % n;

    }

    int cir = i + 1;

//    cout << cir << endl;

    int p = (k + cir - 1) % cir;

    for(int i = c[p]; i < n; i++){

        while(l[a[i]] != re[i]){

            i = v[a[i]][re[i]] + 1;

            if(i == n){

                break;

            }

        }

        if(i >= n) break;

        cout << a[i] << " ";

    }

    cout << endl;

}

// Optimized solution to the same problem (faster):
#include <algorithm>

#include <iostream>

using namespace std;

typedef long long ll;



int main()

{

    ll n, k;

    cin >> n >> k;

    int a[200005], r[200005], b[200005];

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

    for(int i = 0; i <= 200000; i++) b[i] = -1;

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

        cin >> a[i];

        if(b[a[i]] != -1){

            r[b[a[i]]] = i;

        }

        b[a[i]] = i;

    }

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

        if(r[b[a[i]]] == -1) r[b[a[i]]] = i;

        b[a[i]] = i;

    }

    int u = 0;

    ll s = 0;

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

        if(r[u] == u) s += n + 1;

        else s += (r[u] + n - u) % n + 1;

        u = (r[u] + 1) % n;

        if(u == 0) break;

    }

    k = k * n % s;

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

        ll c;

        if(r[u] == u) c = n + 1;

        else c = (r[u] + n - u) % n + 1;

        if(k >= c){

            k -= c;

            u = (r[u] + 1) % n;

        }

        else{

            int ans[200005];

            int l = 0;

            while(k){

                ll c;

                if(r[u] == u) c = n + 1;

                else c = (r[u] + n - u) % n + 1;

                if(k >= c){

                    k -= c;

                    u = (r[u] + 1) % n;

                }

                else{

                    k--;

                    ans[l] = a[u];

                    u = (u + 1) % n;

                    l++;

                }

            }

            for(int j = 0; j < l; j++) cout << ans[j] << " ";

            cout << endl;

            return 0;

        }

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <cmath>

#include <vector>

#include <string>

#include <iomanip>

//#include <string.h>

#include <bits/stdc++.h>

#define INF 999999999

using namespace std;

#define ll long long

#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

struct shi

{

    int x=0;

    int T;

}s[1000000];

int cmd(shi a,shi b)

{

    return a.x<b.x;

}

/*long long cmd(long long a, long long  b)

{

    return a > b;

}*/



int main()

{

    boost;

    int N;

    cin >>N;

    int   hh[100000];

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

        cin >>hh[i];

    }

    sort(hh,hh+N);

    int kk[105000];

    int ma=0;

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

        if(i!=0&&i!=N-1){

            kk[i]+=abs(hh[i]-hh[N-1])*2;

            kk[i]+=abs(hh[i]-hh[0]);

        }

        else

            kk[i]+=abs(hh[0]-hh[N-1]);



    }



    sort(kk,kk+N);

    cout<<kk[0]<<endl;

    return 0;



}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

int main()

{

   int x;

   cin>>x;

    int a[x];

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

        cin>>a[i];

    sort(a,a+x);

    cout<<a[x-1]-a[0];

   return 0;

   }


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define fbo find_by_order

#define ook order_of_key



typedef long long ll;

typedef pair<ll,ll> ii;

typedef vector<int> vi;

typedef long double ld; 

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

typedef set<int>::iterator sit;

typedef map<int,int>::iterator mit;

typedef vector<int>::iterator vit;

const int MOD = 1e9 + 7;

int dp[3011][3011][2];



void add(int &a, int b)

{

	a+=b;

	while(a>=MOD) a-=MOD;

}



int main()

{

	ios_base::sync_with_stdio(0); cin.tie(0);

	ll n, m; cin>>n>>m;

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

	{

		dp[0][i][i==0] = 1;

	}

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

	{

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

		{

			for(int k=0;k<2;k++)

			{

				int v=dp[i][j][k];

				if(v==0) continue;

				//RR

				if(j>=1)

				{

					add(dp[i+1][j-1][k|(j-1==0)],v);

				}

				//BB

				if(j+1<=n)

				{

					add(dp[i+1][j+1][k|(j==0)],v);

				}

				//RB

				if(j-1>=0)

				{

					add(dp[i+1][j][k|(j-1==0)],v);

				}

				//BR

				if(j+1<=n)

				{

					add(dp[i+1][j][k|(j==0)],v);

				}

			}

		}

	}

	int ans=0;

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

	{

		add(ans,dp[m][i][1]);

	}

	cout<<ans<<'\n';

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int MAXN=3005,MOD=1e9+7;

int n,m;

int dp[MAXN][MAXN][2];

int main()

{

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

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

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

	dp[0][0][1]=1;

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

	{

		dp[0][i][0]=1;

	}

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

	{

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

		{

			for(int k=0;k<2;k++)

			{

				if(j>0)

				{

					dp[i+1][j-1][k|(j==1)]+=dp[i][j][k];

					dp[i+1][j-1][k|(j==1)]%=MOD;

				}

				if(j>0)

				{

					dp[i+1][j][k|(j==1)]+=dp[i][j][k];

					dp[i+1][j][k|(j==1)]%=MOD;

				}

				if(j<n)

				{

					dp[i+1][j][k]+=dp[i][j][k];

					dp[i+1][j][k]%=MOD;

					dp[i+1][j+1][k]+=dp[i][j][k];

					dp[i+1][j+1][k]%=MOD;

				}

			}

		}

	}

	int ans=0;

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

	{

		ans+=dp[m][i][1];

		ans%=MOD;

	}

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

	fclose(stdin);

	fclose(stdout);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//#pragma GCC optimize(3)

#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 unsigned long long

#define db double

#define inf 3001

#define INF (int)1e8 

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

#define pi acos(-1)

#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;

int f[2][inf*2];



int DP(int n,int m){

    memset(f,0,sizeof(f));

	int now=0;

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

		f[now][i]=1;

	}

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

		now^=1;

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

			f[now][j]=0;

		}

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

			if(j>0){

                f[now][j-1]=(f[now][j-1]+f[now^1][j])%mod;

                f[now][j]=(f[now][j]+f[now^1][j])%mod;

            }

            if(j<n){

                f[now][j+1]=(f[now][j+1]+f[now^1][j])%mod;

                f[now][j]=(f[now][j]+f[now^1][j])%mod;

            }

		}

	}

	int ans=0;

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

		ans=(ans+f[now][i])%mod;

	}

	return ans;

}



int n,m;



int main(){

	rd(n) rd(m)

	printf("%d\n",(DP(n,m)-DP(n-1,m)+mod)%mod);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cmath>

#include<cstdio>

#include<cstring>

#include<algorithm>

#define gt getchar()

#define ll long long

#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)

typedef std::pair<int,int> P;

#define mk std::make_pair

#define fr first

#define sc second

inline int in()

{

	int k=0;char ch=gt;bool p=1;

	while(ch<'-')ch=gt;if(ch=='-')ch=gt,p=0;

	while(ch>'-')k=k*10+ch-'0',ch=gt;

	return p?k:-k;

}

const int N=3005,YL=1e9+7;

inline int MO(const int &x){return x>=YL?x-YL:x;}

inline void add(int &x,int y){if((x+=y)>=YL)x-=YL;}

int f[2][N][2],now;

int main()

{

	int n=in(),m=in();f[now][0][1]=1;

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

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

	{

		now^=1;memset(f[now],0,sizeof f[now]);

		for(int j=1;j<=n;++j)add(f[now][j][0],f[now^1][j-1][0]);//WW

		for(int j=1;j<=n;++j)add(f[now][j][1],f[now^1][j-1][1]);

		for(int j=1;j< n;++j)add(f[now][j][0],f[now^1][j+1][0]);//BB

		for(int j=1;j< n;++j)add(f[now][j][1],f[now^1][j+1][1]);

		add(f[now][0][1],f[now^1][1][1]),add(f[now][0][1],f[now^1][1][0]);

		for(int j=0;j< n;++j)add(f[now][j][0],f[now^1][j][0]);//WB

		for(int j=0;j< n;++j)add(f[now][j][1],f[now^1][j][1]);

		for(int j=2;j<=n;++j)add(f[now][j][0],f[now^1][j][0]);//BW

		for(int j=2;j<=n;++j)add(f[now][j][1],f[now^1][j][1]);

		add(f[now][1][1],f[now^1][1][1]),add(f[now][1][1],f[now^1][1][0]);

	}

	int ans=0;

	for(int i=0;i<=n;++i)add(ans,f[now][i][1]);

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

	return 0;

}


// Fastest known solution for this problem: