Language: C++

#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const ll m=1000000007,inf=1e18+5;
ll n,k,a;
vector<ll> neg,pos,nol,jn,jp;
ll hitung()
{
	ll now=1;
	if(jp.size()>0) 
	{
		for(int i=0;i<jp.size();i++) now=(now*jp[i])%m;
	}
	if(jn.size()>0)
	{
		for(int i=0;i<jn.size();i++) now=(now*jn[i])%m;
	}
	return now%m;
}
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++) 
	{
		cin>>a;
		if(a>0) pos.pb(a);
		else if(a==0) nol.pb(a);
		else neg.pb(abs(a));
	}
	sort(pos.begin(),pos.end(),greater<ll>());
	sort(neg.begin(),neg.end(),greater<ll>());
	if(pos.size()+neg.size()<k) 
	{
		cout<<"0"<<endl;
		return 0;
	}
	if(pos.size()==0)
	{
		if(k%2==1) 
		{
			for(int i=neg.size()-1;i>=neg.size()-k;i--) jn.pb(neg[i]);
			ll p=-1*hitung();
			cout<<p+m<<endl;
		}
	}
	else
	{
		ll cur=k,negg=0,mp,mn;
		while(cur--)
		{
			if(pos.size())
			{
				if(neg.size())
				{
					if(pos[0]>=neg[0]) jp.pb(pos[0]),mp=pos[0],pos.erase(pos.begin());
					else jn.pb(neg[0]),mn=neg[0],neg.erase(neg.begin()),negg++;
				}
				else jp.pb(pos[0]),mp=pos[0],pos.erase(pos.begin());
			}
			else jn.pb(neg[0]),mn=neg[0],neg.erase(neg.begin()),negg++;
		}
		if(negg%2==1)
		{
			ll cek=0,now=inf;
			if(pos.size()>0)
			{
				cek=1;
				if(jp.size()>0) now=jp.back()*pos[0];
				else now=pos[0];
			}
			if(neg.size()>0)
			{
				if(jn.back()*neg[0]<now) cek=-1,now=jn.back()*neg[0];
			}
			if(cek==0) 
			{
				if(nol.size()>0) 
				{
					cout<<"0"<<endl;
					return 0;
				}
				else 
				{
					ll tmp=-1*hitung();
					cout<<tmp+m<<endl;
					return 0;
				}
			}
			else if(cek==1)
			{
				jn.pop_back(),jp.pb(pos[0]);
			}
			else if(cek==-1)
			{
				jp.pop_back(),jn.pb(neg[0]);
			}
			ll tmp=hitung();
			cout<<tmp%m<<endl;
		}
		else 
		{
			ll tmp=hitung();
			cout<<tmp%m<<endl;
		}
	}
}

Compiler output:
a.cc:7:24: error: 'std::vector<long long int> jn' redeclared as different kind of entity
    7 | vector<ll> neg,pos,nol,jn,jp;
      |                        ^~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:255:1: note: previous declaration 'double jn(int, double)'
  255 | __MATHCALL (jn,, (int, _Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'll hitung()':
a.cc:15:15: error: request for member 'size' in 'jn', which is of non-class type 'double(int, double) noexcept'
   15 |         if(jn.size()>0)
      |               ^~~~
a.cc:17:34: error: request for member 'size' in 'jn', which is of non-class type 'double(int, double) noexcept'
   17 |                 for(int i=0;i<jn.size();i++) now=(now*jn[i])%m;
      |                                  ^~~~
a.cc:17:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |                 for(int i=0;i<jn.size();i++) now=(now*jn[i])%m;
      |                                                           ^
a.cc:17:54: error: invalid operands of types 'll' {aka 'long long int'} and 'double(int, double) noexcept' to binary 'operator*'
   17 |                 for(int i=0;i<jn.size();i++) now=(now*jn[i])%m;
      |                                                   ~~~^~~~~~
      |                                                   |       |
      |                                                   |       double(int, double) noexcept
      |                                                   ll {aka long long int}
a.cc: In function 'int main()':
a.cc:2:12: error: request for member 'push_back' in 'jn', which is of non-class type 'double(int, double) noexcept'
    2 | #define pb push_back
      |            ^~~~~~~~~
a.cc:42:72: note: in expansion of macro 'pb'
   42 |                         for(int i=neg.size()-1;i>=neg.size()-k;i--) jn.pb(neg[i]);
      |                                                                        ^~
a.cc:2:12: error: request for member 'push_back' in 'jn', which is of non-class type 'double(int, double) noexcept'
    2 | #define pb push_back
      |            ^~~~~~~~~
a.cc:57:49: note: in expansion of macro 'pb'
   57 |                                         else jn.pb(neg[0]),mn=neg[0],neg.erase(neg.begin()),negg++;
      |                                                 ^~
a.cc:2:12: error: request for member 'push_back' in 'jn', which is of non-class type 'double(int, double) noexcept'
    2 | #define pb push_back
      |            ^~~~~~~~~
a.cc:61:33: note: in expansion of macro 'pb'
   61 |                         else jn.pb(neg[0]),mn=neg[0],neg.erase(neg.begin()),negg++;
      |                                 ^~
a.cc:74:39: error: request for member 'back' in 'jn', which is of non-class type 'double(int, double) noexcept'
   74 |                                 if(jn.back()*neg[0]<now) cek=-1,now=jn.back()*neg[0];
      |                                       ^~~~
a.cc:74:72: error: request for member 'back' in 'jn', which is of non-class type 'double(int, double) noexcept'
   74 |                                 if(jn.back()*neg[0]<now) cek=-1,now=jn.back()*neg[0];
      |                                                                        ^~~~
a.cc:92:36: error: request for member 'pop_back' in 'jn', which is of non-class type 'double(int, double) noexcept'
   92 |                                 jn.pop_back(),jp.pb(pos[0]);
      |                                    ^~~~~~~~
a.cc:2:12: error: request for member 'push_back' in 'jn', which is of non-class type 'double(int, double) noexcept'
    2 | #define pb push_back
      |            ^~~~~~~~~
a.cc:96:50: note: in expansion of macro 'pb'
   96 |                                 jp.pop_back(),jn.pb(neg[0]);
      |                                                  ^~