Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define rrep(i,a,b)for(int i=a;i<b;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
//#define __int64 long long
#define P pair<int,int>
int n;
int a[400000];
ll a1[300000];
ll a2[300000];
priority_queue<ll,vector<ll>,greater<ll> >q1;
priority_queue<ll>q2;
ll s1,s2;
int main(){
	cin>>n;
	rep(i,3*n)cin>>a[i];
	
	rep(i,n){s1+=a[i];q1.push(a[i]);}
	a1[0]=s1;
	q1.push(a[n]);
	s1+=a[n];

	rrep(i,2*n,3*n){s2+=a[i];q2.push(a[i]);}
	a2[n]=s2;
	q2.push(a[2*n-1]);
	s2+=a[2*n-1];

	for(int i=2*n-2;i>=n-1;i--){
		ll tmp=q2.top();
		q2.pop();
		s2-=tmp;
		//cout<<i-n+1<<" "<<s2<<endl;
		a2[i-n+1]=s2;
		s2+=a[i];
		q2.push(a[i]);
	}


	rrep(i,n+1,2*n+1){
		ll tmp=q1.top();
		q1.pop();
		s1-=tmp;
		//cout<<i-n<<" "<<s1<<endl;
		a1[i-n]=s1;
		s1+=a[i];
		q1.push(a[i]);
	}
	ll ans=a1[0]-a2[0];
	rep(i,n)ans=max(ans,a1[i]-a2[i]);
	cout<<ans<<endl;
	return 0;
}




Compiler output:
a.cc:17:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:22:1: note: in expansion of macro 'll'
   22 | ll a1[300000];
      | ^~
a.cc:17:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:23:1: note: in expansion of macro 'll'
   23 | ll a2[300000];
      | ^~
a.cc:17:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:24:16: note: in expansion of macro 'll'
   24 | priority_queue<ll,vector<ll>,greater<ll> >q1;
      |                ^~
a.cc:17:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:24:26: note: in expansion of macro 'll'
   24 | priority_queue<ll,vector<ll>,greater<ll> >q1;
      |                          ^~
a.cc:24:28: error: template argument 1 is invalid
   24 | priority_queue<ll,vector<ll>,greater<ll> >q1;
      |                            ^
a.cc:24:28: error: template argument 2 is invalid
a.cc:17:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:24:38: note: in expansion of macro 'll'
   24 | priority_queue<ll,vector<ll>,greater<ll> >q1;
      |                                      ^~
a.cc:24:40: error: template argument 1 is invalid
   24 | priority_queue<ll,vector<ll>,greater<ll> >q1;
      |                                        ^
a.cc:24:42: error: template argument 1 is invalid
   24 | priority_queue<ll,vector<ll>,greater<ll> >q1;
      |                                          ^
a.cc:24:42: error: template argument 2 is invalid
a.cc:24:42: error: template argument 3 is invalid
a.cc:17:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:25:16: note: in expansion of macro 'll'
   25 | priority_queue<ll>q2;
      |                ^~
a.cc:25:18: error: template argument 1 is invalid
   25 | priority_queue<ll>q2;
      |                  ^
a.cc:25:18: error: template argument 2 is invalid
a.cc:25:18: error: template argument 3 is invalid
a.cc:17:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:26:1: note: in expansion of macro 'll'
   26 | ll s1,s2;
      | ^~
a.cc: In function 'int main()':
a.cc:31:18: error: 's1' was not declared in this scope; did you mean 'q1'?
   31 |         rep(i,n){s1+=a[i];q1.push(a[i]);}
      |                  ^~
      |                  q1
a.cc:31:30: error: request for member 'push' in 'q1', which is of non-class type 'int'
   31 |         rep(i,n){s1+=a[i];q1.push(a[i]);}
      |                              ^~~~
a.cc:32:9: error: 'a1' was not declared in this scope; did you mean 'q1'?
   32 |         a1[0]=s1;
      |         ^~
      |         q1
a.cc:32:15: error: 's1' was not declared in this scope; did you mean 'q1'?
   32 |         a1[0]=s1;
      |               ^~
      |               q1
a.cc:33:12: error: request for member 'push' in 'q1', which is of non-class type 'int'
   33 |         q1.push(a[n]);
      |            ^~~~
a.cc:36:25: error: 's2' was not declared in this scope; did you mean 'q2'?
   36 |         rrep(i,2*n,3*n){s2+=a[i];q2.push(a[i]);}
      |                         ^~
      |                         q2
a.cc:36:37: error: request for member 'push' in 'q2', which is of non-class type 'int'
   36 |         rrep(i,2*n,3*n){s2+=a[i];q2.push(a[i]);}
      |                                     ^~~~
a.cc:37:9: error: 'a2' was not declared in this scope; did you mean 'q2'?
   37 |         a2[n]=s2;
      |         ^~
      |         q2
a.cc:37:15: error: 's2' was not declared in this scope; did you mean 'q2'?
   37 |         a2[n]=s2;
      |               ^~
      |               q2
a.cc:38:12: error: request for member 'push' in 'q2', which is of non-class type 'int'
   38 |         q2.push(a[2*n-1]);
      |            ^~~~
a.cc:17:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:42:17: note: in expansion of macro 'll'
   42 |                 ll tmp=q2.top();
      |                 ^~
a.cc:43:20: error: request for member 'pop' in 'q2', which is of non-class type 'int'
   43 |                 q2.pop();
      |                    ^~~
a.cc:44:21: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   44 |                 s2-=tmp;
      |                     ^~~
      |                     tm
a.cc:48:20: error: request for member 'push' in 'q2', which is of non-class type 'int'
   48 |                 q2.push(a[i]);
      |                    ^~~~
a.cc:17:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:53:17: note: in expansion of macro 'll'
   53 |                 ll tmp=q1.top();
      |                 ^~
a.cc:54:20: error: request for member 'pop' in 'q1', which is of non-class type 'int'
   54 |                 q1.pop();
      |                    ^~~
a.cc:55:21: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   55 |                 s1-=tmp;
      |                     ^~~
      |                     tm
a.cc:59:20: error: request for member 'push' in 'q1', which is of non-class type 'int'
   59 |                 q1.push(a[i]);
      |                    ^~~~
a.cc:17:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   17 | #define ll __int64
      |            ^~~~~~~
a.cc:61:9: note: in expansion of macro 'll'
   61 |         ll ans=a1[0]-a2[0];
      |         ^~
a.cc:62:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   62 |         rep(i,n)ans=max(ans,a1[i]-a2[i]);
      |                 ^~~
      |                 abs
a.cc:63:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |         cout<<ans<<endl;
      |               ^~~
      |               abs