Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef  unsigned long long  int ll;
int main()
{ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    ll z1=0,z2=0;
    ll a[n+1],b[n+1];
    priority_queue <ll> l2;
    priority_queue <ll, vector<ll>, greater<ll> > l1;
    vector<ll> v;
    for(ll i=0;i<n*3;i++)
    {ll x;
    cin>>x;
    
        if(i<n)
        {
            l1.push(x);
            z1+=x;
        }
        if(i>=2*n)
        {
            l2.push(x);
            z2+=x;
        }
        v.push_back(x);
    }
    a[0]=z1;
    b[n]=z2;
    for(ll i=n;i<2*n;i++ )
    {
        if(v[i]>l1.top())
        {  z1-=l1.top();
            z1+=v[i];
          
            l1.pop();
            l1.push(v[i]);
            
            
            
        }
        a[i-n+1]=z1;
        
    }
    for(ll i=(2*n)-1,j=n-1;i>=n;i--,j--)
    {
    if(v[i]<l2.top())
    { z2-=l2.top();
        z2+=v[i];
       
          l2.pop();
            l2.push(v[i]);
        
    }
    b[j]=z2;
        
    }
    long long int  ans=-1e15;
    for(ll i=0;i<=n;i++)
    {ans=max(ans,a[i]-b[i]);
        
    }
    cout<<ans;
    
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:13: error: no matching function for call to 'max(long long int&, ll)'
   61 |     {ans=max(ans,a[i]-b[i]);
      |          ~~~^~~~~~~~~~~~~~~
In file included 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_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:61:13: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'long long unsigned int'})
   61 |     {ans=max(ans,a[i]-b[i]);
      |          ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:61:13: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   61 |     {ans=max(ans,a[i]-b[i]);
      |          ~~~^~~~~~~~~~~~~~~