Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <iostream>
#include <bitset>
#include <map>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
#define fix(n) fixed << setprecision(n)
#define gmax(a,b) __gcd(a,b)
#define gmin(a,b) a/__gcd(a,b)*b
using namespace std;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}



nt main(){
    int n,k;cin>>n>>k;
	vi a;
	vi b;
rep(i,n){
	int an;
	cin>>an;
	if(an<0)b.pb(an);
	else a.pb(an):
}	
sort(all(a));
reverse(all(a));
sort(all(b));

mint ans=1;
	if(a.size()==0){
		if(k%2==0){
			rep(i,k){
				ans*=b.at(i);
			}
			cout<<ans<<endl;
			return 0;
		}else{
			reverse(all(b));
			rep(i,k){
				ans*=b.at(i);
			}
			cout<<ans<<endl;
			return 0;
		}
	}else{
	for(int j=0;j<b.size()/2;j+=2){
			ll bn;
			b.at(j)=b.at(j)*b.at(j+1);
			
	}
		if(k%2==0){
			
			for(int j=0;j<a.size()/2;j+=2){
					ll bn;
					a.at(j)=a.at(j)*a.at(j+1);
					
			}
			sort(all(a));
			reverse(all(a));
			sort(all(b));
			reverse(all(b));
			int sum=0;
			int h=0,hi=0;
			while(sum<k){
				ans*=max(a.at(h),b.at(hi));
				if(a.at(h)<b.at(hi))hi+=2;
				else h+=2;
				sum+=2;
				
				}
				cout<<ans<<endl;
				return 0;
			
		}else{
		for(int j=1;j<a.size()/2;j+=2){
				ll bn;
				a.at(j)=a.at(j)*a.at(j+1);
		}
		sort(all(a));
		reverse(all(a));
		sort(all(b));
		reverse(all(b));
			int sum=0;
			int h=0,hi=0;
			while(sum<k){
				ans*=max(a.at(h),b.at(hi));
				if(a.at(h)<b.at(hi)){
				hi+=2;
				sum+=2;}
				else if(h==0&&a.at(h)>b.at(hi)){
				h++;
				sum++;}
				else{
				 h+=2;
				 sum+=2;
				 }
				cout<<ans<<endl;
				return 0;
			}
		
		}
	
	
	}
	
	
return 0;
}

Compiler output:
a.cc:68:1: error: 'nt' does not name a type; did you mean 'int'?
   68 | nt main(){
      | ^~
      | int