Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD (int)1e9+7
#define INF (int)1e15
//typedef pair<int, int> P;
#define PP pair<int,tuple<int,int,int>>
int x, y, z, k;
int a[1111], b[1111], c[1111];
map<pair<int, pair<int, int>>, bool>mp;
priority_queue<PP, vector<PP>> q;
signed main() {
	cin >> x >> y >> z >> k;
	rep(i, x)cin >> a[i];
	rep(i, y)cin >> b[i];
	rep(i, z)cin >> c[i];
	sort(a, a + x, greater<int>());
	sort(b, b + y, greater<int>());
	sort(c, c + z, greater<int>());
	a[x] = -INF;
	b[y] = -INF;
	c[z] = -INF;
	q.push({ a[0] + b[0] + c[0],{0,0,0} });
	rep(i, k) {
		PP p = q.top();
		q.pop();
		int A = get<0>(p.second);
		int B = get<1>(p.second);
		int C = get<2>(p.second);
		if (mp[{A, { B,C }}]) {
			i--; continue;
		}
		mp[{A, { B,C }}] = true;
		cout << p.first << endl;
		
		q.push({ p.first - a[A] + a[A + 1], make_tuple((A + 1,B,C) });
		q.push({ p.first - b[B] + b[B + 1], make_tuple( A,B + 1,C ) });
		q.push({ p.first - c[C] + c[C + 1], make_tuple( A,B,C + 1 ) });
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:75: error: expected ')' before '}' token
   38 |                 q.push({ p.first - a[A] + a[A + 1], make_tuple((A + 1,B,C) });
      |                                                               ~           ^~
      |                                                                           )
a.cc:38:23: error: no matching function for call to 'std::priority_queue<std::pair<long long int, std::tuple<long long int, long long int, long long int> >, std::vector<std::pair<long long int, std::tuple<long long int, long long int, long long int> > > >::push(<brace-enclosed initializer list>)'
   38 |                 q.push({ p.first - a[A] + a[A + 1], make_tuple((A + 1,B,C) });
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, std::tuple<long long int, long long int, long long int> >; _Sequence = std::vector<std::pair<long long int, std::tuple<long long int, long long int, long long int> > >; _Compare = std::less<std::pair<long long int, std::tuple<long long int, long long int, long long int> > >; value_type = std::pair<long long int, std::tuple<long long int, long long int, long long int> >]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<long long int, std::tuple<long long int, long long int, long long int> >, std::vector<std::pair<long long int, std::tuple<long long int, long long int, long long int> > > >::value_type&' {aka 'const std::pair<long long int, std::tuple<long long int, long long int, long long int> >&'}
  736 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<long long int, std::tuple<long long int, long long int, long long int> >; _Sequence = std::vector<std::pair<long long int, std::tuple<long long int, long long int, long long int> > >; _Compare = std::less<std::pair<long long int, std::tuple<long long int, long long int, long long int> > >; value_type = std::pair<long long int, std::tuple<long long int, long long int, long long int> >]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, std::tuple<long long int, long long int, long long int> >, std::vector<std::pair<long long int, std::tuple<long long int, long long int, long long int> > > >::value_type&&' {aka 'std::pair<long long int, std::tuple<long long int, long long int, long long int> >&&'}
  744 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~