Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define MOD 10000000070
#define DEBUG 1
#define REP(i,n) for(int i=0;i<n;i++)

vector<lli> a,b,c;

class p{
public:
	lli x,y,z;
	lli sum;
	p(lli sX,lli sY,lli sZ){
		x = sX;
		y = sY;
		z = sZ;
		sum = a[x]+b[y]+c[z];
	}

	bool operator < (const p &p1,const p &p2){
		return p1.sum < p2.sum;
	}
};

p make_p(lli sX,lli sY,lli sZ){
	p tmp(sX,sY,sZ);
	return tmp;
}

void sort2(vector<lli> *a){
	sort(a->begin(),a->end(),greater<lli>());
}

int main(){

	lli x,y,z,k;
	cin>>x>>y>>z>>k;
	a.resize(x);
	b.resize(y);
	c.resize(z);

	REP(i,x)cin>>a[i];
	REP(i,y)cin>>b[i];
	REP(i,z)cin>>c[i];

	sort2(&a);
	sort2(&b);
	sort2(&c);

	priority_queue<p> pQ;

	p first(0,0,0);
	pQ.push(first);

	lli cnt=0;
	while(pQ.size()){
		p top = pQ.front();
		pQ.pop();
		cout<<top.sum<<endl;
		cnt++;
		if(cnt>=k)break;

		if(top.x+1<x)first.push(make_p(top.x+1,top.y,top.z));
		if(top.y+1<y)first.push(make_p(top.x,top.y+1,top.z));
		if(top.z+1<z)first.push(make_p(top.x,top.y,top.z+1));
	}
	return 0;

}
 

Compiler output:
a.cc:23:14: error: 'bool p::operator<(const p&, const p&)' must have exactly one argument
   23 |         bool operator < (const p &p1,const p &p2){
      |              ^~~~~~~~
a.cc: In function 'int main()':
a.cc:60:28: error: 'class std::priority_queue<p>' has no member named 'front'
   60 |                 p top = pQ.front();
      |                            ^~~~~
a.cc:66:36: error: 'class p' has no member named 'push'
   66 |                 if(top.x+1<x)first.push(make_p(top.x+1,top.y,top.z));
      |                                    ^~~~
a.cc:67:36: error: 'class p' has no member named 'push'
   67 |                 if(top.y+1<y)first.push(make_p(top.x,top.y+1,top.z));
      |                                    ^~~~
a.cc:68:36: error: 'class p' has no member named 'push'
   68 |                 if(top.z+1<z)first.push(make_p(top.x,top.y,top.z+1));
      |                                    ^~~~
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = p]':
/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<p*, std::vector<p, std::allocator<p> > >; _Value = p; _Compare = std::less<p>]'
  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<p*, vector<p, allocator<p> > >; _Distance = long int; _Tp = p; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<p> >]'
  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<p*, vector<p, allocator<p> > >; _Compare = less<p>]'
  216 |       std::__push_heap(__first, _DistanceType((__last - __first) - 1),
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217 |                        _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:739:16:   required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = p; _Sequence = std::vector<p, std::allocator<p> >; _Compare = std::less<p>; value_type = p]'
  739 |         std::push_heap(c.begin(), c.end(), comp);
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:56:9:   required from here
   56 |         pQ.push(first);
      |         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const p' and 'const p')
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
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:
/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_function.h:405:20: note:   'const p' is not derived from 'const std::pair<_T1, _T2>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  448 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const p' is not derived from 'const std::reverse_iterator<_Iterator>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  493 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const p' is not derived from 'const std::reverse_iterator<_Iterator>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1694 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const p' is not derived from 'const std::move_iterator<_IteratorL>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1760 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const p' is not derived from 'const std::move_iterator<_IteratorL>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~