Language: C++

// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
// #pragma GCC optimize("Ofast")//Comment optimisations for interactive problems (use endl)
// #pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
using ll =  long long int;
using ld =  long double;
#define int  int64_t
#define mem(a,ss)memset( a,  ss,  sizeof(a) )/*****************************************/
#define b_s binary_search                   /*        _..._                          */
#define b_s binary_search                  /*       .'     '.      _                */
#define u_b upper_bound                   /*       /    .-""-\   _/ \              */
#define l_b lower_bound                  /*      .-|   /:.   |  | Hi/             */
#define nl cout<<endl                   /*       |  \  |:.   /.-'-./             */
#define pb push_back                   /*        | .-'-;:__.'    =/             */
#define pf push_front                 /*         .'=  *=| SDe _.='             */
#define fi first                     /*         /   _.  |    ;                */
#define se second                   /*         ;-.-'|    \   |               */
#define ppb  pop_back              /*         /   | \    _\  _\             */
#define ppf  pop_front            /*          \__/'._;.  ==' ==\           */
#define in insert                /*                   \    \   |          */
#define umap unordered_map      /*                    /   /   /          */
#define pqueue priority_que    /*                    /-._/-._/          */
#define rr return             /*                     \   `\  \         */
#define sqr(a) ((a) * (a))   /*_______________________`-._/_./________*/
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define bits(n)  __builtin_popcount(n)
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)
#define _______1 cin >> times;for (test = 1; test <= times; test++)
#define _______0 for (test = 1; test <= times; test++)
#define ready ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}

const int N =  200005;
const int mod = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld pi = atan2(0, -1);
const ld eps = 1e-9;
int times =  1;
int test = 1;
template<class x, class y>x max(x a, y b) {
    return (a > b) ? a : b;
}
template<class x, class y>x min(x a, y b) {
    return (a < b) ? a : b;
}
template<class x, class y>x log(x n, y r) {
    return (n > r - 1) ? 1 + log(n / r, r) : 0;
}
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
template<class T> void _R(T &x) { cin >> x; }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }

template<class T> void _W(const T &x) { cout << x ; }
template<class T, class U> void _W(const pair<T, U> &x) {_W(x.first); putchar(' '); _W(x.second);}
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); if (sizeof...(tail)) { cout << ' '; } ; W(tail...); }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
bool isprime(int n);
bool ispalin(int num);
bool ispalinstr(string s);
bool isleapyear(int year);
int __lcm(int a, int b);
int power(int x, int y);
int digitsum(int n);
int fact(int n);
int npr(int n, int r);
int ncr(int n, int r);
int evensum(int n);
int oddsum(int n);
void sorts(string &str);
void start();
void ______();

void solve() {
    _______0
    {
#ifndef ONLINE_JUDGE
        W("________:", test); nl;
#endif
        ______();  cerr << endl << test << "______" << endl;}
}
ll mi(ll a, ll b)
{
    if (a < 0)
    {
        a += mod;
    }
    if (b < 0)
    {
        b += mod;
    }
    ll x = ((a % mod) * (b % mod)) % mod;
    return x % mod;
}
ll maxProduct(ll A[], ll n, ll k)
{
    sort(A, A + n);
    ll product = 1;
    if (A[n - 1] == 0 && (k & 1))
        return 0;
    if (A[n - 1] <= 0 && (k & 1)) {
        for (ll i = n - 1; i >= n - k; i--)
        {

            product = mi(product, A[i]);
            product = product % mod;
        }
        if (product < 0)
        {
            product = product + mod;
            product = product % mod;
        }
        product = product % mod;
        return product;
    }
    ll i = 0;

    ll j = n - 1;
    if (k & 1) {
        product = mi(product, A[j]);
        product = product % mod;
        j--;
        k--;
    }
    k >>= 1;
    for (ll itr = 0; itr < k; itr++) {

        ll left_product = mi(A[i], A[i + 1]);
        ll right_product = mi(A[j] , A[j - 1]);
        if (left_product > right_product) {
            product = mi(product, left_product);
            product = product % mod;
            i += 2;
        }
        else {
            product = mi(product, right_product);
            product = product % mod;
            j -= 2;
        }
    }
    if (product < 0)
    {
        product += mod;
        product = product % mod;
    }
    product = product % mod;
    return product;
}
void ______() {
    // W("Case #", test, ":");
    W(fixed);
    // W(scientific);
    W(setprecision(0));
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.




    int n, k;
    R(n, k);
    int a[n];
    fore(i, 0, n)
    R(a[i]);
    cout << maxProduct(a, n, k);



///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
}






bool isprime(int n)
{
    if (n < 2)
        rr false;
    for (int i = 2; i <= sqrt(n); i++)
    {
        if (n % i == 0)
            return false ;
    }
    return true ;

}

bool ispalin(int num)
{
    bool flag = false;
    int digit, rev = 0, n = num;
    do
    {
        digit = num % 10;
        rev = (rev * 10) + digit;
        num = num / 10;
    } while (num != 0);
    if (rev == n)
        flag = true;
    return flag;
}


bool ispalinstr(string s)
{
    string ss = s;
    reverse(all(ss));
    return s == ss;
}

bool isleapyear(int year)
{
    if (year % 400 == 0)
        return true;

    if (year % 100 == 0)
        return false;

    if (year % 4 == 0)
        return true;
    return false;
}

int __lcm(int a, int b)
{
    return (a * b) / __gcd(a, b);
}

int power(int x, int y)
{
    int temp;
    if ( y == 0)
        return 1;
    temp = pow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
        return x * temp * temp;
}

int digitsum(int n)
{
    int c = 0;
    while (n > 0)
    {
        c++;
        n /= 10;
    }
    return c;
}

int fact(int n)
{
    if (n <= 1)
        return 1;
    return n * fact(n - 1);
}

int ncr(int n, int r)
{
    if (n < r)
        rr 0;
    long long p = 1, k = 1;
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;
            int m = __gcd(p, k);
            p /= m;
            k /= m;
            n--;
            r--;
        }
    }
    else
        p = 1;
    return p;
}

int npr(int n, int r)
{
    return fact(n) / fact(n - r);
}

int evensum(int n)
{
    return (n / 2 * (n / 2 + 1));
}

int oddsum(int n)
{
    return (((n + 1) / 2) * ((n + 1) / 2));
}

void sorts(string &str)
{
    sort(str.begin(), str.end());
}

void start()
{
#ifndef ONLINE_JUDGE
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        freopen("error.txt", "w", stderr);
    }
#endif
}
int32_t main() {ready; start(); solve();}

Compiler output:
a.cc: In function 'void ______()':
a.cc:191:24: error: invalid conversion from 'int64_t*' {aka 'long int*'} to 'll*' {aka 'long long int*'} [-fpermissive]
  191 |     cout << maxProduct(a, n, k);
      |                        ^
      |                        |
      |                        int64_t* {aka long int*}
a.cc:122:18: note:   initializing argument 1 of 'll maxProduct(ll*, ll, ll)'
  122 | ll maxProduct(ll A[], ll n, ll k)
      |               ~~~^~~