Language: C++

#include<bits/stdc++.h>
using namespace std;

ll ara[100005];
ll A[100005],B[100005];
void prll(multiset<ll>st)
{
    for(auto it=st.begin();it!=st.end();it++)
        cout<<*it<<" ";
    cout<<endl;
}
#define inf -1000000000000000
int main()
{
    ll n;cin>>n;
    for(ll i=0;i<3*n;i++)cin>>ara[i];
    multiset<ll>st;
    multiset<ll,greater<ll>>ss;
    multiset<ll,greater<ll>>::iterator ii;
    multiset<ll>::iterator it;
    ll sum=0;
    for(ll i=0;i<n;i++)
    {
        sum+=ara[i];
        st.insert(ara[i]);
    }
    A[n-1]=sum;
    for(ll i=n;i<2*n;i++)
    {
        it=st.begin();
        if(*it<ara[i]){

//            cout<<"eraseing "<<endl;
            sum=sum+ara[i]-*it;
            st.erase(it);
            st.insert(ara[i]);
//            prll(st);
        }
        A[i]=sum;
    }
//    for(ll i=n-1;i<=2*n;i++)cout<<A[i]<<" ";cout<<endl;
    sum=0;
    for(ll i=3*n-1;i>=2*n;i--)
    {
        sum+=ara[i];
        ss.insert(ara[i]);
    }
    B[2*n]=sum;
    for(ll i=2*n-1;i>=n;i--)
    {
        ii=ss.begin();
        if(*ii>ara[i])
        {
//            cout<<"i = "<<i<<
            sum=sum+ara[i]-*ii;
            ss.erase(ii);
            ss.insert(ara[i]);
        }
        B[i]=sum;
    }
    ll ans=inf;
    for(ll i=n-1;i<2*n;i++)
    {
        ll temp=A[i]-B[i+1];
        ans=max(ans,temp);
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc:4:1: error: 'll' does not name a type
    4 | ll ara[100005];
      | ^~
a.cc:5:1: error: 'll' does not name a type
    5 | ll A[100005],B[100005];
      | ^~
a.cc:6:20: error: 'll' was not declared in this scope
    6 | void prll(multiset<ll>st)
      |                    ^~
a.cc:6:22: error: template argument 1 is invalid
    6 | void prll(multiset<ll>st)
      |                      ^
a.cc:6:22: error: template argument 2 is invalid
a.cc:6:22: error: template argument 3 is invalid
a.cc: In function 'void prll(int)':
a.cc:8:20: error: request for member 'begin' in 'st', which is of non-class type 'int'
    8 |     for(auto it=st.begin();it!=st.end();it++)
      |                    ^~~~~
a.cc:8:35: error: request for member 'end' in 'st', which is of non-class type 'int'
    8 |     for(auto it=st.begin();it!=st.end();it++)
      |                                   ^~~
a.cc: In function 'int main()':
a.cc:15:5: error: 'll' was not declared in this scope
   15 |     ll n;cin>>n;
      |     ^~
a.cc:15:15: error: 'n' was not declared in this scope; did you mean 'yn'?
   15 |     ll n;cin>>n;
      |               ^
      |               yn
a.cc:16:11: error: expected ';' before 'i'
   16 |     for(ll i=0;i<3*n;i++)cin>>ara[i];
      |           ^~
      |           ;
a.cc:16:16: error: 'i' was not declared in this scope
   16 |     for(ll i=0;i<3*n;i++)cin>>ara[i];
      |                ^
a.cc:16:31: error: 'ara' was not declared in this scope
   16 |     for(ll i=0;i<3*n;i++)cin>>ara[i];
      |                               ^~~
a.cc:17:16: error: template argument 2 is invalid
   17 |     multiset<ll>st;
      |                ^
a.cc:17:16: error: template argument 3 is invalid
a.cc:18:27: error: template argument 2 is invalid
   18 |     multiset<ll,greater<ll>>ss;
      |                           ^~
a.cc:18:27: error: template argument 3 is invalid
a.cc:19:27: error: template argument 2 is invalid
   19 |     multiset<ll,greater<ll>>::iterator ii;
      |                           ^~
a.cc:19:27: error: template argument 3 is invalid
a.cc:19:40: error: expected initializer before 'ii'
   19 |     multiset<ll,greater<ll>>::iterator ii;
      |                                        ^~
a.cc:20:16: error: template argument 2 is invalid
   20 |     multiset<ll>::iterator it;
      |                ^
a.cc:20:16: error: template argument 3 is invalid
a.cc:20:28: error: expected initializer before 'it'
   20 |     multiset<ll>::iterator it;
      |                            ^~
a.cc:21:7: error: expected ';' before 'sum'
   21 |     ll sum=0;
      |       ^~~~
      |       ;
a.cc:22:11: error: expected ';' before 'i'
   22 |     for(ll i=0;i<n;i++)
      |           ^~
      |           ;
a.cc:22:16: error: 'i' was not declared in this scope
   22 |     for(ll i=0;i<n;i++)
      |                ^
a.cc:24:9: error: 'sum' was not declared in this scope
   24 |         sum+=ara[i];
      |         ^~~
a.cc:24:14: error: 'ara' was not declared in this scope
   24 |         sum+=ara[i];
      |              ^~~
a.cc:25:12: error: request for member 'insert' in 'st', which is of non-class type 'int'
   25 |         st.insert(ara[i]);
      |            ^~~~~~
a.cc:27:5: error: 'A' was not declared in this scope
   27 |     A[n-1]=sum;
      |     ^
a.cc:27:12: error: 'sum' was not declared in this scope
   27 |     A[n-1]=sum;
      |            ^~~
a.cc:28:11: error: expected ';' before 'i'
   28 |     for(ll i=n;i<2*n;i++)
      |           ^~
      |           ;
a.cc:28:16: error: 'i' was not declared in this scope
   28 |     for(ll i=n;i<2*n;i++)
      |                ^
a.cc:30:9: error: 'it' was not declared in this scope; did you mean 'st'?
   30 |         it=st.begin();
      |         ^~
      |         st
a.cc:30:15: error: request for member 'begin' in 'st', which is of non-class type 'int'
   30 |         it=st.begin();
      |               ^~~~~
a.cc:31:16: error: 'ara' was not declared in this scope
   31 |         if(*it<ara[i]){
      |                ^~~
a.cc:35:16: error: request for member 'erase' in 'st', which is of non-class type 'int'
   35 |             st.erase(it);
      |                ^~~~~
a.cc:36:16: error: request for member 'insert' in 'st', which is of non-class type 'int'
   36 |             st.insert(ara[i]);
      |                ^~~~~~
a.cc:43:11: error: expected ';' before 'i'
   43 |     for(ll i=3*n-1;i>=2*n;i--)
      |           ^~
      |           ;
a.cc:43:20: error: 'i' was not declared in this scope
   43 |     for(ll i=3*n-1;i>=2*n;i--)
      |                    ^
a.cc:45:14: error: 'ara' was not declared in this scope
   45 |         sum+=ara[i];
      |              ^~~
a.cc:46:12: error: request for member 'insert' in 'ss', which is of non-class type 'int'
   46 |         ss.insert(ara[i]);
      |            ^~~~~~
a.cc:48:5: error: 'B' was not declared in this scope
   48 |     B[2*n]=sum;
      |     ^
a.cc:49:11: error: expected ';' before 'i'
   49 |     for(ll i=2*n-1;i>=n;i--)
      |           ^~
      |           ;
a.cc:49:20: error: 'i' was not declared in this scope
   49 |     for(ll i=2*n-1;i>=n;i--)
      |                    ^
a.cc:51:9: error: 'ii' was not declared in this scope
   51 |         ii=ss.begin();
      |         ^~
a.cc:51:15: error: request for member 'begin' in 'ss', which is of non-class type 'int'
   51 |         ii=ss.begin();
      |               ^~~~~
a.cc:52:16: error: 'ara' was not declared in this scope
   52 |         if(*ii>ara[i])
      |                ^~~
a.cc:56:16: error: request for member 'erase' in 'ss', which is of non-class type 'int'
   56 |             ss.erase(ii);
      |                ^~~~~
a.cc:57:16: error: request for member 'insert' in 'ss', which is of non-class type 'int'
   57 |             ss.insert(ara[i]);
      |                ^~~~~~
a.cc:61:7: error: expected ';' before 'ans'
   61 |     ll ans=inf;
      |       ^~~~
      |       ;
a.cc:62:11: error: expected ';' before 'i'
   62 |     for(ll i=n-1;i<2*n;i++)
      |           ^~
      |           ;
a.cc:62:18: error: 'i' was not declared in this scope
   62 |     for(ll i=n-1;i<2*n;i++)
      |                  ^
a.cc:64:11: error: expected ';' before 'temp'
   64 |         ll temp=A[i]-B[i+1];
      |           ^~~~~
      |           ;
a.cc:65:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   65 |         ans=max(ans,temp);
      |         ^~~
      |         abs
a.cc:65:21: error: 'temp' was not declared in this scope; did you mean 'tm'?
   65 |         ans=max(ans,temp);
      |                     ^~~~
      |                     tm
a.cc:67:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   67 |     cout<<ans<<endl;
      |           ^~~
      |           abs