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> has,neg,pos,nol,jn,jp;
ll hitung()
{
	ll now=1;
	if(jp.size()>0) 
	{
		for(auto x: jp) now=(now*x)%m;
	}
	if(jn.size()>0)
	{
		for(auto x: jn) now=(now*x)%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:28: error: 'std::vector<long long int> jn' redeclared as different kind of entity
    7 | vector<ll> has,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:29: error: 'begin' was not declared in this scope
   17 |                 for(auto x: jn) now=(now*x)%m;
      |                             ^~
a.cc:17:29: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:17:29: error: 'end' was not declared in this scope
   17 |                 for(auto x: jn) now=(now*x)%m;
      |                             ^~
a.cc:17:29: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
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]);
      |                                                  ^~