Language: C++

oo#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
vector<LL> solve(vector<LL> a){
    priority_queue<LL,vector<LL>,greater<LL>> sub;
    priority_queue<LL> que;
    int N=a.size();
    int m=N/3;
    vector<LL> res(m+1);
    REP(i,m)sub.push(a[i]);
    LL sum=0;
    FOR(i,m,2*m+1){
        res[i-m]=sum;
        LL v=a[m];
        que.push(v);
        sum+=v;
        v=que.top();que.pop();
        sum-=v;
        sub.push(v);
        v=sub.top();sub.pop();
        que.push(v);
        sum+=v;
    }
    return res;
}
int main(){
    int m;
    cin>>m;
    int N=m*3;
    vector<LL> a(N);
    cin>>a;
    vector<LL> S(N+1,0);
    REP(i,N)S[i+1]=S[i]+a[i];
    auto L=solve(a);
    reverse(ALL(a));
    REP(i,N)a[i]*=-1;
    auto R=solve(a);
    reverse(ALL(a));
    REP(i,N)a[i]*=-1;
    reverse(ALL(R));
    for(auto &it:R)it*=-1;
    LL res=-1e17;
    REP(i,m+1){
        //cout<<L[i]<<" "<<R[i]<<endl;
        LL lsum=S[i+m]-L[i];
        LL rsum=S[N]-S[i+m]-R[i];
        chmax(res,lsum-rsum);
    }
    cout<<res<<endl;
    
    return 0;
}


Compiler output:
a.cc:1:3: error: stray '#' in program
    1 | oo#include<bits/stdc++.h>
      |   ^
a.cc:1:1: error: 'oo' does not name a type; did you mean 'bool'?
    1 | oo#include<bits/stdc++.h>
      | ^~
      | bool
a.cc: In constructor 'cww::cww()':
a.cc:8:9: error: 'ios' has not been declared
    8 |         ios::sync_with_stdio(false);cin.tie(0);
      |         ^~~
a.cc:8:37: error: 'cin' was not declared in this scope; did you mean 'fin'?
    8 |         ios::sync_with_stdio(false);cin.tie(0);
      |                                     ^~~
      |                                     fin
a.cc: At global scope:
a.cc:25:1: error: 'istream' does not name a type
   25 | istream& operator>>(istream &is,vector<T> &v){
      | ^~~~~~~
a.cc:29:1: error: 'vector' does not name a type
   29 | vector<LL> solve(vector<LL> a){
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:53:5: error: 'cin' was not declared in this scope; did you mean 'fin'?
   53 |     cin>>m;
      |     ^~~
      |     fin
a.cc:55:5: error: 'vector' was not declared in this scope
   55 |     vector<LL> a(N);
      |     ^~~~~~
a.cc:55:14: error: expected primary-expression before '>' token
   55 |     vector<LL> a(N);
      |              ^
a.cc:55:16: error: 'a' was not declared in this scope
   55 |     vector<LL> a(N);
      |                ^
a.cc:57:14: error: expected primary-expression before '>' token
   57 |     vector<LL> S(N+1,0);
      |              ^
a.cc:57:16: error: 'S' was not declared in this scope
   57 |     vector<LL> S(N+1,0);
      |                ^
a.cc:59:12: error: 'solve' was not declared in this scope
   59 |     auto L=solve(a);
      |            ^~~~~
a.cc:60:5: error: 'reverse' was not declared in this scope
   60 |     reverse(ALL(a));
      |     ^~~~~~~
a.cc:74:5: error: 'cout' was not declared in this scope
   74 |     cout<<res<<endl;
      |     ^~~~
a.cc:74:16: error: 'endl' was not declared in this scope
   74 |     cout<<res<<endl;
      |                ^~~~