Language: C++

#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<iostream>
#include<queue>
using namespace std;
 
priority_queue<int>QD;
priority_queue<int,vector<int>,greater<int> >QU;
 
typedef long long ll;
int n;
int a[310000];
ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
 
int main(){
    scanf("%d",&n);
    for(int i=1;i<=3*n;i++){
        scanf("%d",&a[i]);
    }for(int i=1;i<=n;i++){
        smx+=a[i];
        QU.push(a[i]);
    }
    pmx[n]=smx;
    for(int i=n+1;i<=2*n;i++){
        if(a[i]>QU.top()){
            smx-=QU.top();
            QU.pop();
            smx+=a[i];
            QU.push(a[i]);
        }
        pmx[i]=smx;
    }
    for(int i=3*n;i>2*n;i--){
        smn+=a[i];
        QD.push(a[i]);
    }
    qmn[2*n+1]=smn;
    for(int i=2*n;i>=n;i--){
        if(a[i]<QD.top()){
            smn-=QD.top();
            QD.pop();
            smn+=a[i];
            QD.push(a[i]);
        }
        qmn[i]=smn;
    }
    for(int i=n;i<=2*n;i++){
        ans=max(ans,pmx[i]-qmn[i+1]);
    }
    printf("%lld\n",ans);
    return 0;
}#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<iostream>
#include<queue>
using namespace std;
 
priority_queue<int>QD;
priority_queue<int,vector<int>,greater<int> >QU;
 
typedef long long ll;
int n;
int a[310000];
ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
 
int main(){
    scanf("%d",&n);
    for(int i=1;i<=3*n;i++){
        scanf("%d",&a[i]);
    }for(int i=1;i<=n;i++){
        smx+=a[i];
        QU.push(a[i]);
    }
    pmx[n]=smx;
    for(int i=n+1;i<=2*n;i++){
        if(a[i]>QU.top()){
            smx-=QU.top();
            QU.pop();
            smx+=a[i];
            QU.push(a[i]);
        }
        pmx[i]=smx;
    }
    for(int i=3*n;i>2*n;i--){
        smn+=a[i];
        QD.push(a[i]);
    }
    qmn[2*n+1]=smn;
    for(int i=2*n;i>=n;i--){
        if(a[i]<QD.top()){
            smn-=QD.top();
            QD.pop();
            smn+=a[i];
            QD.push(a[i]);
        }
        qmn[i]=smn;
    }
    for(int i=n;i<=2*n;i++){
        ans=max(ans,pmx[i]-qmn[i+1]);
    }
    printf("%lld\n",ans);
    return 0;
}

Compiler output:
a.cc:54:2: error: stray '#' in program
   54 | }#include<stdio.h>
      |  ^
a.cc:54:3: error: 'include' does not name a type
   54 | }#include<stdio.h>
      |   ^~~~~~~
a.cc:62:20: error: redefinition of 'std::priority_queue<int> QD'
   62 | priority_queue<int>QD;
      |                    ^~
a.cc:9:20: note: 'std::priority_queue<int> QD' previously declared here
    9 | priority_queue<int>QD;
      |                    ^~
a.cc:63:46: error: redefinition of 'std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> > QU'
   63 | priority_queue<int,vector<int>,greater<int> >QU;
      |                                              ^~
a.cc:10:46: note: 'std::priority_queue<int, std::vector<int, std::allocator<int> >, std::greater<int> > QU' previously declared here
   10 | priority_queue<int,vector<int>,greater<int> >QU;
      |                                              ^~
a.cc:66:5: error: redefinition of 'int n'
   66 | int n;
      |     ^
a.cc:13:5: note: 'int n' previously declared here
   13 | int n;
      |     ^
a.cc:67:5: error: redefinition of 'int a [310000]'
   67 | int a[310000];
      |     ^
a.cc:14:5: note: 'int a [310000]' previously declared here
   14 | int a[310000];
      |     ^
a.cc:68:4: error: redefinition of 'll pmx [310000]'
   68 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |    ^~~
a.cc:15:4: note: 'll pmx [310000]' previously declared here
   15 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |    ^~~
a.cc:68:16: error: redefinition of 'll qmn [310000]'
   68 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |                ^~~
a.cc:15:16: note: 'll qmn [310000]' previously declared here
   15 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |                ^~~
a.cc:68:28: error: redefinition of 'll smx'
   68 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |                            ^~~
a.cc:15:28: note: 'll smx' previously declared here
   15 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |                            ^~~
a.cc:68:32: error: redefinition of 'll smn'
   68 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |                                ^~~
a.cc:15:32: note: 'll smn' previously declared here
   15 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |                                ^~~
a.cc:68:36: error: redefinition of 'll ans'
   68 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |                                    ^~~
a.cc:15:36: note: 'll ans' previously defined here
   15 | ll pmx[310000],qmn[310000],smx,smn,ans=-(1ll<<60);
      |                                    ^~~
a.cc:70:5: error: redefinition of 'int main()'
   70 | int main(){
      |     ^~~~
a.cc:17:5: note: 'int main()' previously defined here
   17 | int main(){
      |     ^~~~