Language: C++

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define MOD 1000000007


#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()å
#define rall(i) (i).begin(),(i).end(),greater<int>()


#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }
 
//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

 
signed main(){
 
    int x,y,z,k;
    cin>>x>>y>>z>>k;

    vector<int> a;
    vector<int> b;
    vector<int> c;

    int temp;
    rep(i,x){
        cin >> temp;
        a.pb(temp);
    }
    rep(i,y){
        cin >> temp;
        b.pb(temp);
    }
    rep(i,z){
        cin >> temp;
        c.pb(temp);
    }

    sort(a.begin(),a.end(),greater<int>());
    sort(b.begin(),b.end(),greater<int>());
    sort(c.begin(),c.end(),greater<int>());

    
    vector<int> ans;
    
    rep(i,min(x,k)){
        rep(j,min(y,k)){
            rep(z,min(c,k)){
                ans.pb(a[i]+b[j]+c[z]);                
            }
        }
    }

    sort(ans.begin(),ans.end(),greater<int>());

    rep(i,k){
        cout << ans[i] << endl;
    }

    return 0;
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:22: error: no matching function for call to 'min(std::vector<long long int>&, long long int&)'
   64 |             rep(z,min(c,k)){
      |                   ~~~^~~~~
a.cc:11:39: note: in definition of macro 'rep'
   11 | #define rep(i, n) for(int i = 0; i < (n); 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:64:22: note:   deduced conflicting types for parameter 'const _Tp' ('std::vector<long long int>' and 'long long int')
   64 |             rep(z,min(c,k)){
      |                   ~~~^~~~~
a.cc:11:39: note: in definition of macro 'rep'
   11 | #define rep(i, n) for(int i = 0; i < (n); 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:64:22: note:   'std::vector<long long int>' is not derived from 'std::initializer_list<_Tp>'
   64 |             rep(z,min(c,k)){
      |                   ~~~^~~~~
a.cc:11:39: note: in definition of macro 'rep'
   11 | #define rep(i, n) for(int i = 0; i < (n); i++)
      |                                       ^