Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll=long long;

int main() {
	int x,y,a,b,c;
	vector<int> A(a);
	vector<int> B(b);
	vector<int> C(c);
	
	rep(i,a)cin>>A[i];
	rep(i,b)cin>>B[i];
	rep(i,c)cin>>C[i];
	
	sort(A.begin(),A.end(),greater<int>());
	sort(B.begin(),B.end(),greater<int>());
	sort(C.begin(),C.end(),greater<int>());
	
	ll sum=0;
	
	
	deque<int> O;//Aのdeque
	deque<int> P;//Bの
	deque<int> Q;
	rep(i,x){
		sum+=A[i];
		O.push_back(A[i]);
	}
	rep(i,y){
		sum+=B[i];
		P.push_back(B[i]);
	}
	rep(i,c)Q.push_back(C[i]);
	
	
	while(min(O.back,P.back)<Q.front){
		if(O.back>=P.back){
			sum=sum-P.back+Q.front;
			P.pop_back();
			Q.pop_front();
		}
		else{
			sum=sum-O.back+Q.front;
			O.pop_back;
			Q.pop_front();
		}
	}
	
	cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:18: error: no matching function for call to 'min(<unresolved overloaded function type>, <unresolved overloaded function type>)'
   37 |         while(min(O.back,P.back)<Q.front){
      |               ~~~^~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:37:18: note:   couldn't deduce template parameter '_Tp'
   37 |         while(min(O.back,P.back)<Q.front){
      |               ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:37:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'const __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type& (std::deque<int>::*)() const noexcept' {aka 'const int& (std::deque<int>::*)() const noexcept'}
   37 |         while(min(O.back,P.back)<Q.front){
      |               ~~~^~~~~~~~~~~~~~~
a.cc:37:18: note:   mismatched types 'std::initializer_list<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type& (std::deque<int>::*)() noexcept' {aka 'int& (std::deque<int>::*)() noexcept'}
a.cc:37:18: note:   couldn't deduce template parameter '_Tp'
a.cc:38:26: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator>='
   38 |                 if(O.back>=P.back){
      |                    ~~~~~~^~~~~~~~
      |                      |       |
      |                      |       <unresolved overloaded function type>
      |                      <unresolved overloaded function type>
a.cc:39:32: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator-'
   39 |                         sum=sum-P.back+Q.front;
      |                             ~~~^~~~~~~
      |                             |     |
      |                             |     <unresolved overloaded function type>
      |                             ll {aka long long int}
a.cc:44:32: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator-'
   44 |                         sum=sum-O.back+Q.front;
      |                             ~~~^~~~~~~
      |                             |     |
      |                             |     <unresolved overloaded function type>
      |                             ll {aka long long int}
a.cc:45:27: error: invalid use of non-static member function 'void std::deque<_Tp, _Alloc>::pop_back() [with _Tp = int; _Alloc = std::allocator<int>]'
   45 |                         O.pop_back;
      |                         ~~^~~~~~~~
In file included from /usr/include/c++/14/deque:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139:
/usr/include/c++/14/bits/stl_deque.h:1597:7: note: declared here
 1597 |       pop_back() _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~