Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,z,k;
  cin >> x >> y >> z >> k;
  vector<long>a(x);
  vector<long>b(y);
  vector<long>c(z);
  int i,j,kk;
  for(i=0;i<x;i++){
    cin >> a[i];
  }
  for(i=0;i<y;i++){
    cin >> b[i];
  }
  for(i=0;i<z;i++){
    cin >> c[i];
  }
  sort(a.begin(),a.end(),greater<long>());
  sort(b.begin(),b.end(),greater<long>());
  sort(c.begin(),c.end(),greater<long>());

  long aa,bb,cc;
  aa = 1;
  bb = 1;
  cc = 1;
  priority_queue<long>yummy;
  while(aa*bb*cc < 1000000 || (aa==x && bb == y && cc == z)){
    if(max(a[aa-1],max(b[bb-1],c[cc-1]))==a[aa-1] && aa<x)aa++;
    else if(max(a[aa-1],max(b[bb-1],c[cc-1]))==b[bb-1] && bb<y)bb++;
    else if(cc<z)cc++;
    else break;
  }
  for(i=0;i<min(aa+100,x);i++){
    for(j=0;j<min(bb+100,y);j++){
      for(kk=0;kk<min(cc+100,z);kk++){
        yummy.push(a[i]+b[j]+c[kk]);
      }
    }
  }
  for(i=0;i<k;i++){
    cout << yummy.top() << endl;
    yummy.pop();
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:16: error: no matching function for call to 'min(long int, int&)'
   34 |   for(i=0;i<min(aa+100,x);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: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:34:16: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   34 |   for(i=0;i<min(aa+100,x);i++){
      |             ~~~^~~~~~~~~~
/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:34:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   34 |   for(i=0;i<min(aa+100,x);i++){
      |             ~~~^~~~~~~~~~
a.cc:35:18: error: no matching function for call to 'min(long int, int&)'
   35 |     for(j=0;j<min(bb+100,y);j++){
      |               ~~~^~~~~~~~~~
/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:35:18: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   35 |     for(j=0;j<min(bb+100,y);j++){
      |               ~~~^~~~~~~~~~
/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
/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:35:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   35 |     for(j=0;j<min(bb+100,y);j++){
      |               ~~~^~~~~~~~~~
a.cc:36:22: error: no matching function for call to 'min(long int, int&)'
   36 |       for(kk=0;kk<min(cc+100,z);kk++){
      |                   ~~~^~~~~~~~~~
/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:36:22: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   36 |       for(kk=0;kk<min(cc+100,z);kk++){
      |                   ~~~^~~~~~~~~~
/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
/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:36:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   36 |       for(kk=0;kk<min(cc+100,z);kk++){
      |                   ~~~^~~~~~~~~~