description: Moamen and Ezzat are playing a game. They create an array a of n non-negative integers where every element is less than 2^k.
  
  Moamen wins if a_1  \&  a_2  \&  a_3  \&  …  \&  a_n ≥ a_1 ⊕ a_2 ⊕ a_3 ⊕ … ⊕ a_n.
  
  Here \& denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND), and ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).
  
  Please calculate the number of winning for Moamen arrays a.
  
  As the result may be very large, print the value modulo 1 000 000 007 (10^9 + 7).
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 5)— the number of test cases. 
  
  Each test case consists of one line containing two integers n and k (1 ≤ n≤ 2⋅ 10^5, 0 ≤ k ≤ 2⋅ 10^5).
  
  Output
  
  For each test case, print a single value — the number of different arrays that Moamen wins with.
  
  Print the result modulo 1 000 000 007 (10^9 + 7).
  
  Example
  
  Input
  
  
  3
  3 1
  2 1
  4 0
  
  
  Output
  
  
  5
  2
  1
  
  Note
  
  In the first example, n = 3, k = 1. As a result, all the possible arrays are [0,0,0], [0,0,1], [0,1,0], [1,0,0], [1,1,0], [0,1,1], [1,0,1], and [1,1,1].
  
  Moamen wins in only 5 of them: [0,0,0], [1,1,0], [0,1,1], [1,0,1], and [1,1,1].
solution: #include <bits/stdc++.h>
  using namespace std;
  const long long N = 3e5 + 5, M = 1e9 + 7, OO = 0x3f3f3f3f;
  long long t, n, k, cm;
  long long nCr[N];
  long long mem[N][2];
  long long power(long long a, long long b, long long m) {
    if (!b) return 1;
    long long t = power(a, b >> 1, m) % m;
    return ((t * t) % m * (b & 1 ? a : 1) % m) % m;
  }
  long long modinv(long long x) { return power(x, M - 2, M); }
  void calc() {
    nCr[0] = 1;
    nCr[1] = n;
    nCr[2] = (n * (n - 1)) / 2;
    for (int i = 3; i <= n; ++i) {
      nCr[i] = (((n - i + 1) * nCr[i - 1]) % M * modinv(i)) % M;
    }
  }
  long long solve(long long idx, bool gr) {
    if (idx == k) return 1;
    if (mem[idx][gr] != -1) return mem[idx][gr];
    long long ret = 0;
    if (gr == 1) {
      ret = (solve(idx + 1, 1) * power(2, n, M)) % M;
    } else {
      if (n % 2 == 0) {
        ret = (solve(idx + 1, 0) * (cm)) % M;
        ret = (ret + solve(idx + 1, 1)) % M;
      } else {
        ret = (solve(idx + 1, 0) * (cm + 1)) % M;
      }
    }
    return mem[idx][gr] = ret;
  }
  int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ;
    cin >> t;
    while (t--) {
      cin >> n >> k;
      if (k == 0) {
        cout << 1 << endl;
        continue;
      }
      calc();
      cm = 0;
      if (n % 2 == 0) {
        for (int i = 0; i <= n - 2; i += 2) {
          cm = (cm + nCr[i]) % M;
        }
      } else {
        for (int i = 0; i <= n - 1; i += 2) {
          cm = (cm + nCr[i]) % M;
        }
      }
      for (int i = 0; i < k; ++i) mem[i][0] = mem[i][1] = -1;
      long long ans = solve(0, 0);
      cout << ans << endl;
    }
  }
  