Language: C++

#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;

class select{
	public:
		int i;
		int j;
		int k;
		long sum;
		select(int a,int b,int c,long d){
			i=a;
			j=b;
			k=c;
			sum=d;
		}
};

bool operator>(class select S1,class select S2){
	return S1.sum>S2.sum;
}
bool operator<(class select S1,class select S2){
	return S1.sum<S2.sum;
}
bool operator==(class select S1,class select S2){
	return (S1.i==S2.i && S1.j==S2.j && S1.k==S2.k);
}




int main(){
	long X,Y,Z;
	long K;
	cin>>X>>Y>>Z>>K;
	vector<long>A,B,C;
	long tmp;
	for(int i=0;i<X;++i){
		cin>>tmp;
		A.push_back(tmp);
	}
	for(int i=0;i<Y;++i){
		cin>>tmp;
		B.push_back(tmp);
	}
	for(int i=0;i<Z;++i){
		cin>>tmp;
		C.push_back(tmp);
	}
	sort(A.begin(),A.end(),greater<long>());
	sort(B.begin(),B.end(),greater<long>());
	sort(C.begin(),C.end(),greater<long>());
	select status(0,0,0,A[0]+B[0]+C[0]);
	priority_queue<select>q;
	q.push(status);
	vector<select>statusarr;
	vector<long>ans;
	while(true){
		status=q.top();
		//cout<<status.i<<" "<<status.j<<" "<<status.k<<endl;
		q.pop();
		int tmp=0;
		for(int i=0;i<statusarr.size();++i){
			if(statusarr[i]==status)tmp=1;
		}
		if(tmp==1)continue;
		statusarr.push_back(status);
		ans.push_back(status.sum);
		if(ans.size()==K)break;
		if(status.i<X-1){
			status.i++;
			status.sum+=-A[status.i-1]+A[status.i];
			q.push(status);
			status.i--;
			status.sum+=-A[status.i+1]+A[status.i];
		}
		if(status.j<Y-1){
			status.j++;
			status.sum+=-B[status.j-1]+B[status.j];
			q.push(status);
			status.j--;
			status.sum+=-B[status.j+1]+B[status.j];
		}
		if(status.k<Z-1){
			status.k++;
			status.sum+=-C[status.k-1]+C[status.k];
			q.push(status);
			status.k--;
			status.sum+=-C[status.k+1]+C[status.k];
		}
	}
	for(int i=0;i<ans.size();++i){
		cout<<ans[i]<<endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:15: error: expected ';' before 'status'
   55 |         select status(0,0,0,A[0]+B[0]+C[0]);
      |               ^~~~~~~
      |               ;
a.cc:56:30: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Sequence, class _Compare> class std::priority_queue'
   56 |         priority_queue<select>q;
      |                              ^
a.cc:56:30: note:   expected a type, got 'select'
a.cc:56:30: error: template argument 2 is invalid
a.cc:56:30: error: template argument 3 is invalid
a.cc:57:11: error: request for member 'push' in 'q', which is of non-class type 'int'
   57 |         q.push(status);
      |           ^~~~
a.cc:57:16: error: 'status' was not declared in this scope; did you mean 'static'?
   57 |         q.push(status);
      |                ^~~~~~
      |                static
a.cc:58:22: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   58 |         vector<select>statusarr;
      |                      ^
a.cc:58:22: note:   expected a type, got 'select'
a.cc:58:22: error: template argument 2 is invalid
a.cc:61:26: error: request for member 'top' in 'q', which is of non-class type 'int'
   61 |                 status=q.top();
      |                          ^~~
a.cc:63:19: error: request for member 'pop' in 'q', which is of non-class type 'int'
   63 |                 q.pop();
      |                   ^~~
a.cc:65:41: error: request for member 'size' in 'statusarr', which is of non-class type 'int'
   65 |                 for(int i=0;i<statusarr.size();++i){
      |                                         ^~~~
a.cc:66:37: error: invalid types 'int[int]' for array subscript
   66 |                         if(statusarr[i]==status)tmp=1;
      |                                     ^
a.cc:69:27: error: request for member 'push_back' in 'statusarr', which is of non-class type 'int'
   69 |                 statusarr.push_back(status);
      |                           ^~~~~~~~~
a.cc:75:27: error: request for member 'push' in 'q', which is of non-class type 'int'
   75 |                         q.push(status);
      |                           ^~~~
a.cc:82:27: error: request for member 'push' in 'q', which is of non-class type 'int'
   82 |                         q.push(status);
      |                           ^~~~
a.cc:89:27: error: request for member 'push' in 'q', which is of non-class type 'int'
   89 |                         q.push(status);
      |                           ^~~~