Problem - C - Codeforces

someone please check my approach.am i doing something wrong?
------------
if N is even Ans will be
        ans = (2(N-1)-1)K+2N(2K-1-1)+1
else
        ans = (2(N-1)+1)K

the code is:

#include<bits/stdc++.h>
#pragma GCC optimise("Ofast")
#pragma GCC target("avx","avx2","fma")
using namespace std;
#define int unsigned long long
const long long M = 1000000007;

signed main() {
    ios_base ::sync_with_stdio(false);
    cin.tie(NULL);
    int T;
    cin>>T;
    int c = 200001;
    int* power = new int[c];
    power[0] = 1;
    for(int i = 1 ; i < c ; i++){
        power[i] = (power[i-1]*2)%M;
    }
    while(T--){
       int N,K;
       cin>>N>>K;
       int ANS = 1;
       int ANS2;
       ANS2 = power[N-1];
       if(N%2 == 1){
           ANS2++;
           ANS2 = ANS2%M;
       }else{
           ANS2--;
           ANS2 = (ANS2+M)%M;
       }
       int ANS3 = 0;
       if(K > 0){
//            ANS3 = (N*(power[K]-2))%M+1;
            ANS3 = power[N]*(power[K-1]-1)+1;
            ANS3 = ANS3%M;
       }
       ANS3 = ANS3%M;
       for(int i = 0 ; i < K ; i++){
            ANS = ANS*ANS2;
            ANS = ANS%M;
       }
       if(N%2 == 0){
            ANS += ANS3;
            ANS = ANS%M;
       }
        cout<<ANS<<"\n";
    }
    delete [] power;
    return 0;
}