stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#define REP(i, n) for (int i = 0; i < (n); i++)

#define RREP(i, a, b) for (int i = a; i < (b); i++)

#define FOR(i, n) for (int i = n; i >= 0; i--)

#include <algorithm>

#include <cmath>

#include <cstdio>

#include <iomanip>

#include <iostream>

#include <map>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <vector>

#define SIZE 100001

#define MOD 1000000007

#define INF 100000000

#define ll long long

using namespace std;

long long c[51][51];



int main() {

  int n, p;

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

  int a[51];

  bool flag = false;

  REP(i, n) {

    scanf("%d", &a[i]);

    if (a[i] % 2) flag = true;

  }

  ll ans = 1;

  if (flag) {

    REP(i, n - 1) ans *= 2;

    cout << ans << endl;

  } else {

    REP(i, n) ans *= 2;

    if (p == 0)

      cout << ans << endl;

    else

      cout << 0 << endl;

  }



  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.253965451659313x):
#define REP(i, n) for (int i = 0; i < (n); i++)

#include <cstdio>

#define ll long long



int main() {

  int n, p;

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



  bool flag = false;

  REP(i, n) {

    int a;

    scanf("%d", &a);

    if (a % 2) {

      flag = true;

      break;

    }

  }



  ll ans = 1;

  if (flag) {

    REP(i, n - 1) ans *= 2;

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

  } else {

    REP(i, n) ans *= 2;

    if (p == 1) ans = 0;

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

  }

  return 0;

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

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)

#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)

#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)

#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)

#define all(x) (x).begin(), (x).end()

#define sz(x) ((int)(x).size())

#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    

    int N, P;

    cin >> N >> P;

    vector<int> A(N);

    int total = 0;

    ll ans = 0;

    

    rep(i, N) {

        cin >> A[i];

        total += A[i];

    }

    

    vector<vector<ll>> dp(N + 1, vector<ll>(total + 1, INT_MIN));

    dp[0][0] = 1;

    

    rep(i, N) {

        rep(ii, total - A[i] + 1) {

            if (dp[i][ii] == INT_MIN) {

                continue;

            }

            

            dp[i + 1][ii] = ((dp[i + 1][ii] == INT_MIN) ? dp[i][ii] : dp[i][ii] + dp[i + 1][ii]);

            

            if (dp[i + 1][ii + A[i]] == INT_MIN) {

                dp[i + 1][ii + A[i]] = dp[i][ii];

            }

            else {

                dp[i + 1][ii + A[i]] = dp[i + 1][ii + A[i]] + dp[i][ii];

            }

        }

    }

    

    rep(i, total + 1) {

        if (((i % 2) == P) && (dp[N][i] != INT_MIN)) {

            ans += dp[N][i];

        }

    }

    

    cout << ans << endl;

    return 0;

}


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

using namespace std;

typedef long long ll;

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)

#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)

#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)

#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)

#define all(x) (x).begin(), (x).end()

#define rall(x) (x).rbegin(), (x).rend()

#define sz(x) ((ll)(x).size())

#define len(x) ((ll)(x).length())

#define endl "\n"



int main() {

    cin.tie(0);

    ios::sync_with_stdio(false);

    // ifstream in("input.txt");

    // cin.rdbuf(in.rdbuf());

    ll n, p;

    cin >> n >> p;

    vector<ll> dp(2, 0);

    dp[0] = 1;

    rep(i, n) {

        ll a;

        cin >> a;

        if (a % 2 == 1) {

            ll tmp = dp[0] + dp[1];

            dp[1] += dp[0];

            dp[0] = tmp;

        }

        else {

            dp[0] *= 2;

            dp[1] *= 2;

        }

    }

    cout << dp[p] << endl;

    return 0;

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



using namespace std;



#define EACH(i,a) for (auto& i : a)

#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)

#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)

#define REP(i,n) FOR(i,0,n)

#define RREP(i,n) RFOR(i,0,n)

#define ALL(a) (a).begin(),(a).end()

#define debug(x) cerr << #x << ":" << x << endl;

#define OK(ok) cout << (ok ? "Yes" : "No") << endl;

typedef long long ll;



void CINT(){}

template <class Head,class... Tail>

void CINT(Head&& head,Tail&&... tail) {

  cin >> head; CINT(move(tail)...);

}

#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)

#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)

#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)



const int INF = 1e9 + 1;

const int MOD = 1e9 + 7;

const int MAX_N = 1e3 + 1;



int N, P;



ll memo[MAX_N][MAX_N];



ll nCr(ll n, ll r)

{

  if (r == 0 || n == r) return 1;

  if (memo[n][r] >= 0) return memo[n][r];

  return memo[n][r] = nCr(n - 1, r - 1) + nCr(n - 1, r);

}



int main()

{

  cin.tie(0);

  ios::sync_with_stdio(false);



  int odd, even;

  odd = even = 0;

  memset(memo, -1, sizeof(memo));

  

  cin >> N >> P;

  REP(i, N) {

    CIN(a);

    if (a & 1) odd++;

    else even++;

  }



  ll ans = 0ll;

  

  REP(i, odd + 1) {

    if (i % 2 == P) {

      ans += nCr(odd, i);

    }

  }

  REP(i, even) {

    ans *= 2;

  }

  cout << ans << endl;



  return 0;

}




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

using namespace std;

typedef long long int64;



int64 nCr[575][575];



int64 f(int64 n, int64 r)

{

  if (r == 0 || n == r) return 1;

  if (nCr[n][r] >= 0) return nCr[n][r];

  return nCr[n][r] = f(n - 1, r - 1) + f(n - 1, r);

}



int main()

{

  memset(nCr, -1, sizeof(nCr));;

  int N, P;

  cin >> N >> P;

 

  vector< int > a(N);

  int o = 0;

  int e = 0;

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

    cin >> a[i];

    if (a[i] % 2 == 0) {

      e++;

    } else {

      o++;

    }

  }

  

  int64 ans = 0ll;

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

    if (i % 2 == P) {

      ans += f(o, i);

    }

  }

  ans <<= e;

  

  cout << ans << endl;

  

  return 0;

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

using namespace std;

typedef long long int64;



int64 nCr[575][575];



int64 f(int64 n, int64 r)

{

  if (r == 0 || n == r) return 1;

  if (nCr[n][r] >= 0) return nCr[n][r];

  return nCr[n][r] = f(n - 1, r - 1) + f(n - 1, r);

}



int main()

{

  memset(nCr, -1, sizeof(nCr));;

  int N, P;

  cin >> N >> P;

 

  vector< int > a(N);

  int o = 0;

  int e = 0;

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

    cin >> a[i];

    if (a[i] % 2 == 0) {

      e++;

    } else {

      o++;

    }

  }

  

  int64 ans = 0ll;

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

    if (i % 2 == P) {

      ans += f(o, i);

    }

  }

  ans <<= e;

  

  cout << ans << endl;

  

  return 0;

}


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

// statics

using namespace std;

using int64 = int_fast64_t;

using PAIR = pair<int64, int64>;

constexpr int INF = 1 << 30;

constexpr int64 LINF = 1LL << 60;

constexpr int MOD = 1e9 + 7;

constexpr int MAX_N = 3e5 + 1;



// init/input

#define int int64

#define INIT ios::sync_with_stdio(false);cin.tie(0);

#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);

template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}

template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}

#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;



// out

#define OUT(dist) cout<<(dist);

#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);

#define SP cout<<" ";

#define BR cout<<endl;

#define zero(n) cout<<setfill('0')<<right<<setw(n)

#define debug(x) cerr<<#x<<":"<< (x);BR;



// utility

#define ALL(a) (a).begin(), (a).end()

#define EACH(i, a) for(auto &&i:(a))

#define FOR(i, a, b) for(int i=(a);i<(b);++i)

#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)

#define REP(i, n) for(int i=0;i<(n);++i)

#define RREP(i, n) for(int i=(n)-1;i>=0;--i)



int ncr[55][55];



int power(int x, int n) {

	int res = 1LL;

	while (n > 0) {

		if (n & 1) (res *= x);

		(x *= x);

		n >>= 1;

	}

	return res;

}



int f(int n, int r){

	if(r==0 || r==n) return 1;

	if(ncr[n][r]>0) return ncr[n][r];

	return ncr[n][r] = f(n-1, r-1) + f(n-1, r);

}



signed main() {

  INIT;

	VAR(int,n,p);

	VEC(int,a,n);

	int zero, one=0;

	REP(i,n){

		if(a[i]%2==1) ++one;

	}

	zero = n-one;



	int ans=0;

	REP(i,one+1){

		if(p==i%2){

			ans += f(one,i);

		}

	}

	ans *= power(2,zero);

	OUT(ans)BR;

  

  return 0;

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

using namespace std;



typedef long long vlong;

const int maxn = 55;



int a[maxn];

vlong dp[maxn][101*101], p, n;



vlong knap(int i, int tmp){

	if(i >= n){

		if(tmp % 2 == p)return 1;

		

		else{

			return 0;

		}

	}

	if(dp[i][tmp] == -1){

		vlong ret1 = 0, ret2 = 0;

		ret1 = knap(i+1, a[i]+tmp);

		ret2 = knap(i+1, tmp);

		dp[i][tmp] = ret1 + ret2;

	}

	return dp[i][tmp];

}



int main(int argc, char const *argv[])

{

	cin >> n >> p;

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

		cin >> a[i];



	memset(dp, -1, sizeof dp);

	cout << knap(0, 0) << endl;

}


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

#include <cstdio>

#include <algorithm>

#include <cstring>



#include <vector>



using namespace std;



const int maxN = 50 + 10;

long long dp[maxN][2], arr[maxN];

int n, p;



int main(){

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

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

	

	memset(dp, 0, sizeof(dp));

	

	cin>>n>>p;

	for(int i=1;i<=n;i++)cin>>arr[i];

	

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

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

		if(arr[i]%2==0){

			dp[i][0] += dp[i-1][0] * 2;

			dp[i][1] += dp[i-1][1] * 2;

		}

		if(arr[i]%2==1){

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

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

		}

	}

	//long long ans = 0;

	//for(int i=0;i<=n;i++)ans += dp[i][p];

	cout<<dp[n][p]<<endl;

	//for(int i=0;i<=n;i++)cout<<dp[i][0]<<' ';cout<<endl;

	//for(int i=0;i<=n;i++)cout<<dp[i][1]<<' ';cout<<endl;

	

	return 0;

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

using namespace std;



typedef long long vlong;

const int maxn = 55;



int a[maxn];

vlong dp[maxn][101*101], p, n;



vlong knap(int i, int tmp){

	if(i >= n){

		if(tmp % 2 == p)return 1;

		

		else{

			return 0;

		}

	}

	if(dp[i][tmp] == -1){

		vlong ret1 = 0, ret2 = 0;

		ret1 = knap(i+1, a[i]+tmp);

		ret2 = knap(i+1, tmp);

		dp[i][tmp] = ret1 + ret2;

	}

	return dp[i][tmp];

}



int main(int argc, char const *argv[])

{

	cin >> n >> p;

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

		cin >> a[i];



	memset(dp, -1, sizeof dp);

	cout << knap(0, 0) << endl;

}


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

#include <cmath>

using namespace std;



void solve(long long even , long long odd , long long p , long long n){

	long long ans = 0; 

	if(even == n){

		if(p == 0){

			ans = pow(2 , n);

		}

		else if(p == 1){

			ans = 0;

		}

	}

	else{

		ans = pow(2 , n-1);

	}

	cout << ans << endl; 

}



int main(){

	long long n , p; 

	cin >> n >> p;



	long long num;

	long long even = 0; 

	long long odd = 0; 

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

		cin >> num;

		if(num % 2 == 0){

			even++;

		}

		else{

			odd++;

		}

	}

	solve(even , odd , p , n);

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

using namespace std;



typedef long long vlong;

const int maxn = 55;



int a[maxn];

vlong dp[maxn][101*101], p, n;



vlong knap(int i, int tmp){

	if(i >= n){

		if(tmp % 2 == p)return 1;

		

		else{

			return 0;

		}

	}

	if(dp[i][tmp] == -1){

		vlong ret1 = 0, ret2 = 0;

		ret1 = knap(i+1, a[i]+tmp);

		ret2 = knap(i+1, tmp);

		dp[i][tmp] = ret1 + ret2;

	}

	return dp[i][tmp];

}



int main(int argc, char const *argv[])

{

	cin >> n >> p;

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

		cin >> a[i];



	memset(dp, -1, sizeof dp);

	cout << knap(0, 0) << endl;

}


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

#include <cmath>

typedef long long ll;

using namespace std;



int arr[105];



ll ways(int N, int P, int even, int odd) {

    if(even == N) {

        if(P == 0) return pow(2, N);

        else if(P == 1) return 0;

    }

    return pow(2, N-1);     // at least 1 odd

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    cout.tie(NULL);



    int N, P, odd, even;

    cin >> N >> P;

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

        cin >> arr[i];

        if(arr[i]%2 == 0) even++;

    }

    odd = N-even;

    

    cout << ways(N, P, even, odd) << endl;

}
// Slower C++ solution:
  ///====================== khela STARTS HERE =====================///

#include "bits/stdc++.h"

const int inf = 1000000005;

const long long INF = 3e18;

const double pi = 2 * acos ( 0.0 );

typedef long long ll;

#define pii pair<int, int>

#define pb push_back

#define pf push_front

#define all(v) v.begin(), v.end()

#define maximum *max_element

#define minimum *min_element

#define MEMSET(v, x) memset(v, x, sizeof(v))

#define ABS(x) ((x)<0?-(x):(x))

#define white 1

#define grey 2

#define black 3

#define bug cout << "ei porjonto thikase" << endl;

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

using namespace std;

int gcd (int a, int b ) {

    a =  abs( a ); b = abs( b );

    while ( b ) { a = a % b; swap ( a, b ); } return a;}

int modInverse(int a, int m)

{int m0 = m;int y = 0, x = 1;if (m == 1)return 0;

while (a > 1){int q = a / m;int t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}

int lcm(int a, int b)

{int temp = gcd(a, b);return temp ? (a / temp * b) : 0;}

///====================== khela end1s HERE =====================///

const int maxn = 55;

int arr[maxn];

ll dp[maxn][101*101], p, n;

ll call(int i, int ammount){

	if(i>=n){

		if(ammount%2 == p)return 1;

		else{

			return 0;

		}

	}

	if(dp[i][ammount] == -1){

		ll ret1 = 0, ret2 = 0;

		ret1 = call(i+1, arr[i]+ammount);

		ret2 = call(i+1, ammount);

		dp[i][ammount] = ret1 + ret2;

	}

	return dp[i][ammount];

}



int main(int argc, char const *argv[])

{

	cin >> n >> p;

	for(int i=0; i<n; i++)cin >> arr[i];

	MEMSET(dp, -1);

	cout << call(0, 0) << endl;

}

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



using namespace std;



int bisc[2];



long long perm(int a){

    int pangkat = 1;

    if (a == 1) return 1;

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

        pangkat*=2;

    }

    return perm(a-1) + pangkat;

}



int main(){

    int N, P;

    cin >> N >> P;

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

        int biscuits;

        cin >> biscuits;

        bisc[biscuits % 2]++;

    }

    long long ans = 1;

    for(int i=1; i<=bisc[0] ; i++) ans*=2;

    ans--;

    if(bisc[1] > 1){

        ans +=  ans*(perm(bisc[1] - 1)) + perm(bisc[1] - 1) ;

    }

    ans++;

    if (P == 0){

        cout << ans << endl;

    } else{

        long long pangkat = 1;

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

            pangkat*=2;

        }

        cout << pangkat - ans << endl;

    }

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

#define ALL(x) x.begin(), x.end()

#define LEN(x) (int)x.size()

#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)

using namespace std;

typedef int64_t i64;

typedef pair<int,int> pii;

template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}

template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;



int N, P;

int a[105];



i64 dp[55][55 * 105];



i64 slv(int i, int sum)

{

  if (i >= N) { return ((sum & 1) == P) ? 1 : 0; }

  i64 &ret = dp[i][sum];

  if (~ret) { return ret; }



  return ret = slv(i+1,sum) + slv(i+1, sum+a[i]);

}



signed main()

{



  cin >> N >> P;

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

    cin >> a[i];

  }



  memset(dp, -1, sizeof(dp));



  cout << slv(0,0) << endl;



  return 0;

}




// Faster C++ solution for the same problem (measured speedup: 3.9842346710757575x):
#include "bits/stdc++.h"

using i64 = std::int64_t;

using namespace std;



// Make Combination table using "Pascal's Triangle" at Compile-Time

template <size_t N>

struct CombTable {  // {{{

  static_assert(N < 70u,

                "Template parameter <N> is too large. It may be Overflow.");

  i64 mat[N + 1][N + 1];

  constexpr explicit CombTable() {

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

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

        mat[n][r] =

            ((r == 0 || n == r) ? (1) : (mat[n - 1][r - 1] + mat[n - 1][r]));

      }

    }

  }

  i64 operator()(int n, int r) const {

    return (r < 0 || n < r) ? 0 : mat[n][r];

  }

};  // }}}



int main() {

  cin.tie(nullptr);

  ios_base::sync_with_stdio(false);

  cout.setf(ios_base::fixed);

  cout.precision(11);



  CombTable<55> comb;



  int N, P;

  cin >> N >> P;



  i64 cnt[2]{};

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

    int x;

    cin >> x;

    cnt[x & 1] += 1;

  }



  i64 ans = 0;



  for (int evenNum = 0; evenNum <= cnt[0]; ++evenNum) {

    for (int oddNum = 0; oddNum <= cnt[1]; ++oddNum) {

      if (oddNum % 2 == P) ans += comb(cnt[0], evenNum) * comb(cnt[1], oddNum);

    }

  }



  cout << ans << endl;



  return 0;

}
// Slower C++ solution:
/*------------------------------------

........Bismillahir Rahmanir Rahim....

..........created by Abdul Aziz.......

------------------------------------*/

#include <iostream>

#include <algorithm>

#include <stdio.h>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <cstring>

#include <unordered_map>

#include <queue>

#define   mod  998244353

#define   int  long long 

#define   ld   long double

#define   pb   push_back

#define   vi  vector<int> 

#define   dbg(x)  cerr << #x << " = " << x << '\n'

#define   sz(x)  (int)x.size()

#define   all(a) (a.begin(),a.end())

#define   ff   first

#define   ss   second

#define   pii  pair<int,int> 

#define   lcm(a,b) (a*b)/__gcd(a,b) 

using namespace std;



int  n,k; 

int a[52];

int dp[5005][52];



int fun(int idx,int sum){

    if (idx>n ) return (sum%2==k); 

    if (dp[sum][idx] != -1) return dp[sum][idx];

    return  dp[sum][idx] = fun(idx+1,sum)+fun(idx+1,sum+a[idx]);

}





inline void solve(){

    memset(dp,-1,sizeof(dp));

    cin>>n>>k;

    for (int i=1;i<=n;i++) cin>>a[i];

    cout << fun(1,0) << endl;

}



signed main()

{

    int n=1; // cin>>n;

    while (n--) solve();

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.696142938582399x):
/*------------------------------------

........Bismillahir Rahmanir Rahim....

..........created by Abdul Aziz.......

------------------------------------*/

#include <iostream>

#include <algorithm>

#include <stdio.h>

#include <cmath>

#include <vector>

#include <set>

#include <map>

#include <cstring>

#include <unordered_map>

#include <queue>

#define   mod  998244353

#define   int  long long 

#define   ld   long double

#define   pb   push_back

#define   vi  vector<int> 

#define   dbg(x)  cerr << #x << " = " << x << '\n'

#define   sz(x)  (int)x.size()

#define   all(a) (a.begin(),a.end())

#define   ff   first

#define   ss   second

#define   pii  pair<int,int> 

#define   lcm(a,b) (a*b)/__gcd(a,b) 

using namespace std;



int  n,k; 

int a[52];

int dp[2][52];



int fun(int idx,int sum){

    if (idx>n ) return (sum%2==k); 

    if (dp[sum][idx] != -1) return dp[sum][idx];

    return  dp[sum][idx] = fun(idx+1,sum%2) + fun(idx+1,(sum+a[idx])%2) ; 

}





inline void solve(){

    memset(dp,-1,sizeof(dp));

    cin>>n>>k;

    for (int i=1;i<=n;i++) cin>>a[i];

    cout << fun(1,0) << endl;

}



signed main()

{

    int n=1; // cin>>n;

    while (n--) solve();

    return 0;

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

#include<iostream>

using namespace std;

int mi[200010];

int n,m,a,b;

const int mod=1000000007;

int ans=0;

int fast_pow(int a,int x)

{

	int ans=1;

	for (int i=x;i;i>>=1,a=1ll*a*a%mod)

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

	return ans;

}

int C(int n,int m)

{

	return ((1ll*mi[m]*fast_pow(mi[n],mod-2))%mod*1ll*fast_pow(mi[m-n],mod-2))%mod;

}

int main()

{

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

	mi[0]=1;

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

	{

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

	}

	ans=C(n-1,n+m-2);

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

	{

		int t=1ll*C(i-1,b+i-2)*C(n-i+1-1,m-b+1+n-i+1-3)%mod;

	//	cout<<i-1<<" "<<b+i-2<<" "<<n-i<<" "<<m+n-b-i<<" "<<t<<endl;

		ans=(1ll*ans+mod-t)%mod;

	}

	printf("%d",ans);

} 

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

#include<cstring>

#include<cstdlib>

#include<algorithm>

#define MAXN 500005

#define mod 1000000007ll



long long f[MAXN]={1ll};



long long power(long long x,long long p){

	if(p==1ll) return x%mod;

	if(p==0ll) return 0ll;

	long long t=power(x,p/2ll);

	if(p&1ll) return t*t%mod*x%mod;

	else return t*t%mod;

}



long long c(long long n,long long m){

	if(m==0||m==n) return 1ll;

	if(n<m) return 0ll;

	return f[n]*power(f[m],mod-2ll)%mod*power(f[n-m],mod-2ll)%mod;

}



long long n,m;

long long a,b;

int main(){

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

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

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

		f[i]=f[i-1]*i%mod;

	long long ans=c(m+n-2,m-1);

	long long i=n-a+1,j=b;

	while(i<=n&&j>=1){

		ans=((ans-c(i+j-2,j-1)*c(m+n-i-j,m-j))%mod+mod)%mod;

		i++;j--;

	}

	printf("%lld",ans);

	system("pause");

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

#include <cstdio>

using namespace std;

const int mo=1e9+7;

int fac[200001],x[100001],y[100001];

int pow(int x,int n){

	int t=1,y=x;

	while (n){

		if (n&1) t=1ll*t*y%mo;

		y=1ll*y*y%mo;

		n>>=1;

	}

	return t;

}

int main(){

	int h,w,a,b,i,j,m,ans=0;

	scanf("%d%d%d%d",&h,&w,&a,&b);

	m=h+w;

	fac[0]=1;

	for (i=1;i<=m;++i) fac[i]=1ll*fac[i-1]*i%mo;

	for (i=b+1;i<=w;++i){

		x[i]=1ll*fac[h-a+i-2]*pow(1ll*fac[i-1]*fac[h-a-1]%mo,mo-2)%mo;

		y[i]=1ll*fac[a+w-i-1]*pow(1ll*fac[a-1]*fac[w-i]%mo,mo-2)%mo;

		ans=(ans+1ll*x[i]*y[i]%mo)%mo;

	}

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

	return 0;

}

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

#include<cstring>

#include<cstdlib>

#include<algorithm>

#define MAXN 500005

#define mod 1000000007ll



long long f[MAXN]={1ll};



long long power(long long x,long long p){

	if(p==1ll) return x%mod;

	if(p==0ll) return 0ll;

	long long t=power(x,p/2ll);

	if(p&1ll) return t*t%mod*x%mod;

	else return t*t%mod;

}



long long c(long long n,long long m){

	if(m==0||m==n) return 1ll;

	if(n<m) return 0ll;

	return f[n]*power(f[m],mod-2ll)%mod*power(f[n-m],mod-2ll)%mod;

}



long long n,m;

long long a,b;

int main(){

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

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

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

		f[i]=f[i-1]*i%mod;

	long long ans=c(m+n-2,m-1);

	long long i=n-a+1,j=b;

	while(i<=n&&j>=1){

		ans=((ans-c(i+j-2,j-1)*c(m+n-i-j,m-j))%mod+mod)%mod;

		i++;j--;

	}

	printf("%lld",ans);

	system("pause");

}