Language: C++

#include<bits/stdc++.h>
#define INF 2147483647
#define LLINF 9223372036854775807
typedef long long ll;
using namespace std;
ll prev[500100];
ll suf[500100];
ll a[500100];
priority_queue<ll,vector<ll>,greater<ll> > q;
priority_queue<ll,vector<ll>,greater<ll> > p;
ll n;
void run(){
	cin>>n;
	for(int i=0;i<3*n;i++)cin>>a[i];
	ll sum=0;
	for(int i=0;i<n;i++){
		sum+=a[i];
		q.push(a[i]);
	}
	prev[n-1]=sum;
	for(int i=n;i<2*n;i++){
		prev[i]+=a[i];
		q.push(a[i]);
		sum-=q.top();
		q.pop();
		prev[i]=sum;
	}
	sum=0;
	for(int i=3*n-1;i>=2*n;i--){
		sum+=a[i];
		p.push(-a[i]);
	}
	suf[2*n]=sum;
	for(int i=2*n-1;i>=n;i--){
		sum+=a[i];
		p.push(-a[i]);
		sum-=-p.top();
		p.pop();
		suf[i]=sum;
	}
	ll mx=-LLINF;
	for(int i=n-1;i<2*n;i++){
		mx=max(mx,prev[i]-suf[i+1]);
	}
	cout<<mx<<endl;
}
int main(){
	run();
	return 0;
}

Compiler output:
a.cc: In function 'void run()':
a.cc:20:9: error: reference to 'prev' is ambiguous
   20 |         prev[n-1]=sum;
      |         ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:4: note:                 'll prev [500100]'
    6 | ll prev[500100];
      |    ^~~~
a.cc:22:17: error: reference to 'prev' is ambiguous
   22 |                 prev[i]+=a[i];
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:4: note:                 'll prev [500100]'
    6 | ll prev[500100];
      |    ^~~~
a.cc:26:17: error: reference to 'prev' is ambiguous
   26 |                 prev[i]=sum;
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:4: note:                 'll prev [500100]'
    6 | ll prev[500100];
      |    ^~~~
a.cc:43:27: error: reference to 'prev' is ambiguous
   43 |                 mx=max(mx,prev[i]-suf[i+1]);
      |                           ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:4: note:                 'll prev [500100]'
    6 | ll prev[500100];
      |    ^~~~