Language: C++

int main(){
    ll x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x),b(y),c(z);
    rep(i,x) cin>>a[i];
    rep(i,y) cin>>b[i];
    rep(i,z) cin>>c[i];
    sort(a.begin(),a.end(),greater<ll>());
    sort(b.begin(),b.end(),greater<ll>());
    sort(c.begin(),c.end(),greater<ll>());

    set<tuple<ll,ll,ll,ll>> kouho;
    ll first_val = a[0]+b[0]+c[0];
    kouho.insert(make_tuple(first_val,0,0,0));
    rep(i,k){
        auto maxitr = --kouho.end();
        tuple<ll,ll,ll,ll> tmp = *maxitr;
        cout << get<0>(tmp) << endl;
        kouho.erase(maxitr);
        ll a_tmp,b_tmp,c_tmp;
        a_tmp = get<1>(tmp);
        b_tmp = get<2>(tmp);
        c_tmp = get<3>(tmp);
        if(get<1>(tmp)!=x-1){
            ll new_val = a[a_tmp+1]+b[b_tmp]+c[c_tmp];
            kouho.insert(make_tuple(new_val,a_tmp+1,b_tmp,c_tmp));
        }
        if(get<2>(tmp)!=y-1){
            ll new_val = a[a_tmp]+b[b_tmp+1]+c[c_tmp];
            kouho.insert(make_tuple(new_val,a_tmp,b_tmp+1,c_tmp));
        }
        if(get<3>(tmp)!=z-1){
            ll new_val = a[a_tmp]+b[b_tmp]+c[c_tmp+1];
            kouho.insert(make_tuple(new_val,a_tmp,b_tmp,c_tmp+1));
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'll' was not declared in this scope
    2 |     ll x,y,z,k;
      |     ^~
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> x >> y >> z >> k;
      |     ^~~
a.cc:3:12: error: 'x' was not declared in this scope
    3 |     cin >> x >> y >> z >> k;
      |            ^
a.cc:3:17: error: 'y' was not declared in this scope
    3 |     cin >> x >> y >> z >> k;
      |                 ^
a.cc:3:22: error: 'z' was not declared in this scope
    3 |     cin >> x >> y >> z >> k;
      |                      ^
a.cc:3:27: error: 'k' was not declared in this scope
    3 |     cin >> x >> y >> z >> k;
      |                           ^
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<ll> a(x),b(y),c(z);
      |     ^~~~~~
a.cc:4:16: error: 'a' was not declared in this scope
    4 |     vector<ll> a(x),b(y),c(z);
      |                ^
a.cc:4:21: error: 'b' was not declared in this scope
    4 |     vector<ll> a(x),b(y),c(z);
      |                     ^
a.cc:4:26: error: 'c' was not declared in this scope
    4 |     vector<ll> a(x),b(y),c(z);
      |                          ^
a.cc:5:9: error: 'i' was not declared in this scope
    5 |     rep(i,x) cin>>a[i];
      |         ^
a.cc:5:5: error: 'rep' was not declared in this scope
    5 |     rep(i,x) cin>>a[i];
      |     ^~~
a.cc:8:28: error: 'greater' was not declared in this scope
    8 |     sort(a.begin(),a.end(),greater<ll>());
      |                            ^~~~~~~
a.cc:8:40: error: expected primary-expression before ')' token
    8 |     sort(a.begin(),a.end(),greater<ll>());
      |                                        ^
a.cc:8:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    8 |     sort(a.begin(),a.end(),greater<ll>());
      |     ^~~~
      |     short
a.cc:9:40: error: expected primary-expression before ')' token
    9 |     sort(b.begin(),b.end(),greater<ll>());
      |                                        ^
a.cc:10:40: error: expected primary-expression before ')' token
   10 |     sort(c.begin(),c.end(),greater<ll>());
      |                                        ^
a.cc:12:5: error: 'set' was not declared in this scope
   12 |     set<tuple<ll,ll,ll,ll>> kouho;
      |     ^~~
a.cc:12:9: error: 'tuple' was not declared in this scope
   12 |     set<tuple<ll,ll,ll,ll>> kouho;
      |         ^~~~~
a.cc:12:29: error: 'kouho' was not declared in this scope
   12 |     set<tuple<ll,ll,ll,ll>> kouho;
      |                             ^~~~~
a.cc:13:7: error: expected ';' before 'first_val'
   13 |     ll first_val = a[0]+b[0]+c[0];
      |       ^~~~~~~~~~
      |       ;
a.cc:14:29: error: 'first_val' was not declared in this scope
   14 |     kouho.insert(make_tuple(first_val,0,0,0));
      |                             ^~~~~~~~~
a.cc:14:18: error: 'make_tuple' was not declared in this scope
   14 |     kouho.insert(make_tuple(first_val,0,0,0));
      |                  ^~~~~~~~~~