Language: C++

//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int red[MAX], green[MAX], mixed[MAX];
int x, y, a, b, c;
ll csr[MAX], csg[MAX], csm[MAX];

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int x, y, a, b, c;

    cin>>x>>y>>a>>b>>c;

    int val;
    for(int i = 0; i < a; i++){
        cin>>red[i];
    }

    sort(red, red + a);
    reverse(red, red + a);

    for(int i = 0; i < a; i++)
        csr[i+1] = csr[i] + red[i];

    for(int i = 0; i < b; i++){
        cin>>green[i];
    }

    sort(green, green + b);
    reverse(green, green + b);

    for(int i = 0; i < b; i++)
        csg[i+1] = csg[i] + green[i];
    int ptrx = x, ptry = y;

    for(int i = 0; i < c; i++){
        cin>>mixed[i];
    }
    sort(mixed, mixed + c);
    reverse(mixed, mixed + c);

    ll Max = csg[y] + csr[x];

    for(int i = 0; i < c; i++){
        if(y - 1 >= 0 && mixed[i] > green[y-1] && green[y-1] <= red[x-1]){
            int temp = csg[y-1] + mixed[i] + csr[x];
            Max = max(Max, temp);
            y--;
        }
        else if(x - 1 >= 0 && mixed[i] > red[x-1] && red[x-1] <= green[y-1]){
            int temp = csr[x-1] + mixed[i] + csg[y];
            Max = max(Max, temp);
            x--;
        }
        else if(x - 1 >= 0 && y - 1 < 0 && mixed[i] > red[x-1]){
            Max = max(Max, csr[x-1] + mixed[i] + csg[y]);
            x--;
        }
        else if(y - 1 >0 && x - 1 < 0 && mixed[i] > green[y-1]){
            Max = max(Max, csg[y-1] + mixed[i] + csr[x]);
            y--;
        }
        if(x == 0 && y == 0)
            break;
    }

    cout<<Max<<endl;


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:22: error: no matching function for call to 'max(ll&, int&)'
   68 |             Max = max(Max, temp);
      |                   ~~~^~~~~~~~~~~
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:2:
/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:68:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   68 |             Max = max(Max, temp);
      |                   ~~~^~~~~~~~~~~
/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:68:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   68 |             Max = max(Max, temp);
      |                   ~~~^~~~~~~~~~~
a.cc:73:22: error: no matching function for call to 'max(ll&, int&)'
   73 |             Max = max(Max, temp);
      |                   ~~~^~~~~~~~~~~
/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:73:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   73 |             Max = max(Max, temp);
      |                   ~~~^~~~~~~~~~~
/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
/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:73:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   73 |             Max = max(Max, temp);
      |                   ~~~^~~~~~~~~~~