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

class num{
public:
    int a,b,c;

    num(int _a,int _b,int _c){
        a=_a;
        b=_b;
        c=_c;
    }

    bool operator<(const nums& other) const {
		return a < other.a;
	}
   

};


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

    vector<int> a(x);
    vector<int> b(x);
    vector<int> c(x);

    rep(i,x){
        cin >> a[i];
    }
    rep(i,y){
        cin >> b[i];
    }
    rep(i,z){
        cin >> c[i];
    }

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

    a.pb((int)-1e17);
    b.pb((int)-1e17);
    c.pb((int)-1e17);


    priority_queue<pair<int,num>> pq;
    pq.push(mp(a[0]+b[0]+c[0],num(0,0,0)));

    vector<int> ans;
    set<int> index;

    while(ans.size()<k){
        auto v = pq.top();pq.pop();
        ans.pb(v.first);

        int a2 = v.second.a;
        int b2 = v.second.b;
        int c2 = v.second.c;


        rep(i,3){
            if(i==0){a2++;}
            if(i==1){b2++;}
            if(i==2){c2++;}
            int hash = (a2<<20)+(b2<<10)+c2;
            if(index.find(hash)==index.end()){
                index.insert(hash);
                pq.push(mp(a[a2]+b[b2]+c[c2],num(a2,b2,c2)));
            }
        }

    }


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


Compiler output:
a.cc:41:26: error: 'nums' does not name a type; did you mean 'num'?
   41 |     bool operator<(const nums& other) const {
      |                          ^~~~
      |                          num
a.cc: In member function 'bool num::operator<(const int&) const':
a.cc:42:34: error: request for member 'a' in 'other', which is of non-class type 'const int'
   42 |                 return a < other.a;
      |                                  ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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_pair.h: In instantiation of 'constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&) [with _T1 = long long int; _T2 = num]':
/usr/include/c++/14/bits/stl_function.h:405:20:   required from 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = std::pair<long long int, num>]'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/predefined_ops.h:196:23:   required from 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, num>*, std::vector<std::pair<long long int, num>, std::allocator<std::pair<long long int, num> > > >; _Value = std::pair<long long int, num>; _Compare = std::less<std::pair<long long int, num> >]'
  196 |         { return bool(_M_comp(*__it, __val)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:140:48:   required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<pair<long long int, num>*, vector<pair<long long int, num>, allocator<pair<long long int, num> > > >; _Distance = long int; _Tp = pair<long long int, num>; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<pair<long long int, num> > >]'
  140 |       while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
      |                                          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:216:23:   required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<pair<long long int, num>*, vector<pair<long long int, num>, allocator<pair<long long int, num> > > >; _Compare = less<pair<long long int, num> >]'
  216 |       std::__push_heap(__first, _DistanceType((__last - __first) - 1),
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217 |                        _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:747:16:   required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<long long int, num>; _Sequence = std::vector<std::pair<long long int, num>, std::allocator<std::pair<long long int, num> > >; _Compare = std::less<std::pair<long long int, num> >; value_type = std::pair<long long int, num>]'
  747 |         std::push_heap(c.begin(), c.end(), comp);
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:79:12:   required from here
   79 |     pq.push(mp(a[0]+b[0]+c[0],num(0,0,0)));
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1047:57: error: no match for 'operator<' (operand types are 'const num' and 'const num')
 1047 |              || (!(__y.first < __x.first) && __x.second < __y.second); }
      |                                              ~~~~~~~~~~~^~~~~~~~~~~~
a.cc:41:10: note: candidate: 'bool num::operator<(const int&) const'
   41 |     bool operator<(const nums& other) const {
      |          ^~~~~~~~
a.cc:41:32: note:   no known conversion for argument 1 from 'const num' to 'const int&'
   41 |     bool operator<(const nums& other) const {
      |                    ~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1045 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:1047:57: note:   'const num' is not derived from 'const std::pair<_T1, _T2>'
 1047 |              || (!(__y.first < __x.first) && __x.second < __y.second); }
      |                                              ~~~~~~~~~~~^~~~~~~~~~~~