Language: C++

#include <bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0; i<n ; ++i)
#define all(v) v.begin() , v.end()
#define sz(v) (int(v.size()))
typedef unsigned long long ul;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<char, int> pci;
typedef vector<pii> vp;
typedef vector<pci> vpc;
typedef pair<int,pii> piii;

int OO = 2e9;
const double eps = 1e-9 ;
const int N = 50005;
int mx = -1e9 , mn = 1e9 ;

int main()
{
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<long long> x(X);
    vector<long long> y(Y);
    vector<long long> z(Z);

    for (int i = 0; i < X; ++i) {
        cin >> x[i];
    }
    for (int i = 0; i < Y; ++i) {
        cin >> y[i];
    }
    for (int i = 0; i < Z; ++i) {
        cin >> z[i];
    }

    vector<long long> tmp;
    for (int i = 0; i < X; ++i) {
        for (int j = 0; j < Y; ++j) {
            tmp.push_back(x[i] + y[j]);
        }
    }

    sort(tmp.rbegin(), tmp.rend());

    vector<long long> ans;
    for (int i = 0; i < Z; ++i) {
        for (int j = 0; j < min(K, tmp.size()); ++j) {
            ans.push_back(tmp[j] + z[i]);
        }
    }

    sort(ans.rbegin(), ans.rend());
    for (int i = 0; i < K; ++i) {
        cout << ans[i] << '\n';
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:32: error: no matching function for call to 'min(int&, std::vector<long long int>::size_type)'
   52 |         for (int j = 0; j < min(K, tmp.size()); ++j) {
      |                             ~~~^~~~~~~~~~~~~~~
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:52:32: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'})
   52 |         for (int j = 0; j < min(K, tmp.size()); ++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
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:52:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   52 |         for (int j = 0; j < min(K, tmp.size()); ++j) {
      |                             ~~~^~~~~~~~~~~~~~~