Language: C++

#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T &a){int t = 0;for(auto itr :a){if(t++)cout << " "; cout << itr;} cout <<endl; }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    //    std::ios_base::sync_with_stdio(false);
    //    cin.tie(NULL);
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<int>vx(x),vy(y),vz(z);
    for(auto & e : vx) cin >> e;
    for(auto & e : vy) cin >> e;
    for(auto & e : vz) cin >> e;
    sort(all(vx),greater<>());
    sort(all(vy),greater<>());
    sort(all(vz),greater<>());
    //    vector<int>nx,ny,nz;
    //    nx.push_back(vx.front());
    //    ny.push_back(vy.front());
    //    nz.push_back(vz.front());
    
    //    priority_queue<int,vector<int>>xque,yque,zque;
    //    rep(i,x)if(i)xque.push(vx[i]);
    //    rep(i,y)if(i)yque.push(vy[i]);
    //    rep(i,z)if(i)zque.push(vz[i]);
    //    xque.push(-10000000000);
    //    yque.push(-10000000000);
    //    zque.push(-10000000000);
    //
    //    while((int)nx.size() * (int)ny.size() * (int)nz.size() < k){
    //        int xdif = nx.back() - xque.top();
    //        int ydif = ny.back() - yque.top();
    //        int zdif = nz.back() - zque.top();
    //        if(xdif <= ydif and xdif <= zdif and !xque.empty()){
    //            nx.push_back(xque.top());
    //            xque.pop();
    //        } else if(ydif <= xdif and ydif <= zdif and !yque.empty()){
    //            ny.push_back(yque.top());
    //            yque.pop();
    //        } else {
    //            nz.push_back(zque.top());
    //            zque.pop();
    //        }
    //    }
    vector<int>ans;
    //    rep(i,nx.size())rep(j,ny.size())rep(k,nz.size()){
    //        ans.push_back(nx[i] + ny[j] + nz[k]);
    //    }
    vector<int>sum;
    rep(i,vy.size())rep(j,vz.size())sum.push_back(vy[i] + vz[j]);
    sort(all(sum));
    rep(i,vx.size())rep(j,min(k,sum.size()))ans.push_back(vx[i] + sum[j]);
    sort(all(ans),greater<>());
    rep(i,k)cout << ans[i] << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:70:30: error: no matching function for call to 'min(ll&, std::vector<long long int>::size_type)'
   70 |     rep(i,vx.size())rep(j,min(k,sum.size()))ans.push_back(vx[i] + sum[j]);
      |                           ~~~^~~~~~~~~~~~~~
a.cc:4:32: note: in definition of macro 'rep'
    4 | #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:70:30: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'})
   70 |     rep(i,vx.size())rep(j,min(k,sum.size()))ans.push_back(vx[i] + sum[j]);
      |                           ~~~^~~~~~~~~~~~~~
a.cc:4:32: note: in definition of macro 'rep'
    4 | #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:70:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   70 |     rep(i,vx.size())rep(j,min(k,sum.size()))ans.push_back(vx[i] + sum[j]);
      |                           ~~~^~~~~~~~~~~~~~
a.cc:4:32: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(int i=0;i<n;i++)
      |                                ^