Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>

using namespace std;

long long a[300000];

int main()
{
	int n;
	long long sp=0;
	long long sl=0;
	long long ans;
	priority_queue<int>l;//後半n
	priority_queue<int,vector<int>,greater<int>>p;//前半n
	cin>>n;
	for(int i=0;i<3*n;i++)
	{
		cin>>a[i];
		ans -= a[i];
	}
	for(int i=n;i<n*2;i++)
	{
		sp=0;
		sl=0;
		p=priority_queue<long long,vector<long long>,greater<long long>>();
		l=priority_queue<long long>();
		for(int j=0;j<i;j++)
		{
			sp+=(long long)a[j];
			p.push(a[j]);
		}
		for(int j=p.size();j>n;j=p.size())
		{
			sp-=p.top();
			cerr<<i<<" "<<p.top()<<endl;
			p.pop();
		}
		for(int j=i;j<n*3;j++)
		{
			sl+=a[j];
			l.push(a[j]);
		}
		for(int j=l.size();j>n;j=l.size())
		{
			sl-=l.top();
			cerr<<i<<" "<<l.top()<<endl;
			l.pop();
		}
		cerr<<sp-sl<<endl;
		ans = max(ans,sp-sl);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:82: error: no match for 'operator=' (operand types are 'std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >' and 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >')
   29 |                 p=priority_queue<long long,vector<long long>,greater<long long>>();
      |                                                                                  ^
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >& std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >::operator=(const std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >&)'
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:496:11: note:   no known conversion for argument 1 from 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' to 'const std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >&'
/usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >& std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >::operator=(std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >&&)'
/usr/include/c++/14/bits/stl_queue.h:496:11: note:   no known conversion for argument 1 from 'std::priority_queue<long long int, std::vector<long long int>, std::greater<long long int> >' to 'std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> >&&'
a.cc:30:45: error: no match for 'operator=' (operand types are 'std::priority_queue<int>' and 'std::priority_queue<long long int>')
   30 |                 l=priority_queue<long long>();
      |                                             ^
/usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int>& std::priority_queue<int>::operator=(const std::priority_queue<int>&)'
  496 |     class priority_queue
      |           ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:496:11: note:   no known conversion for argument 1 from 'std::priority_queue<long long int>' to 'const std::priority_queue<int>&'
/usr/include/c++/14/bits/stl_queue.h:496:11: note: candidate: 'std::priority_queue<int>& std::priority_queue<int>::operator=(std::priority_queue<int>&&)'
/usr/include/c++/14/bits/stl_queue.h:496:11: note:   no known conversion for argument 1 from 'std::priority_queue<long long int>' to 'std::priority_queue<int>&&'