Language: C++

#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int x, y, z, K;
	cin >> x >> y >> z >> K;
	vector<ll> a(x), b(y), c(z);
	rep(i, x) cin >> a[i]; sort(a.begin(), a.end(), greater<ll>());
	rep(i, y) cin >> b[i]; sort(b.begin(), b.end(), greater<ll>());
	rep(i, z) cin >> c[i]; sort(c.begin(), c.end(), greater<ll>());
	vector<ll> abc;
	rep(i, x)rep(j, y)rep(k, z) {
		if ((i+1)*(j+1)*(k+1) <= K) abc.push_back(a[i]+b[j]+c[k]);
		else break;
	}
	sort(abc.begin(), abc.end(), greater<ll>());
	rep(i, k) cout << abc[i] << endl;
	return 0;
}


Compiler output:
a.cc:4:11: error: 'pair' does not name a type
    4 | using P = pair<int, int>;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> x >> y >> z >> K;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define rep(i, n) for(int i = 0; i < (n); ++i)
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<ll> a(x), b(y), c(z);
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define rep(i, n) for(int i = 0; i < (n); ++i)
a.cc:9:18: error: expected primary-expression before '>' token
    9 |         vector<ll> a(x), b(y), c(z);
      |                  ^
a.cc:9:20: error: 'a' was not declared in this scope
    9 |         vector<ll> a(x), b(y), c(z);
      |                    ^
a.cc:9:26: error: 'b' was not declared in this scope
    9 |         vector<ll> a(x), b(y), c(z);
      |                          ^
a.cc:9:32: error: 'c' was not declared in this scope
    9 |         vector<ll> a(x), b(y), c(z);
      |                                ^
a.cc:10:57: error: 'greater' was not declared in this scope
   10 |         rep(i, x) cin >> a[i]; sort(a.begin(), a.end(), greater<ll>());
      |                                                         ^~~~~~~
a.cc:10:67: error: expected primary-expression before '>' token
   10 |         rep(i, x) cin >> a[i]; sort(a.begin(), a.end(), greater<ll>());
      |                                                                   ^
a.cc:10:69: error: expected primary-expression before ')' token
   10 |         rep(i, x) cin >> a[i]; sort(a.begin(), a.end(), greater<ll>());
      |                                                                     ^
a.cc:10:32: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         rep(i, x) cin >> a[i]; sort(a.begin(), a.end(), greater<ll>());
      |                                ^~~~
      |                                short
a.cc:11:67: error: expected primary-expression before '>' token
   11 |         rep(i, y) cin >> b[i]; sort(b.begin(), b.end(), greater<ll>());
      |                                                                   ^
a.cc:11:69: error: expected primary-expression before ')' token
   11 |         rep(i, y) cin >> b[i]; sort(b.begin(), b.end(), greater<ll>());
      |                                                                     ^
a.cc:12:67: error: expected primary-expression before '>' token
   12 |         rep(i, z) cin >> c[i]; sort(c.begin(), c.end(), greater<ll>());
      |                                                                   ^
a.cc:12:69: error: expected primary-expression before ')' token
   12 |         rep(i, z) cin >> c[i]; sort(c.begin(), c.end(), greater<ll>());
      |                                                                     ^
a.cc:13:18: error: expected primary-expression before '>' token
   13 |         vector<ll> abc;
      |                  ^
a.cc:13:20: error: 'abc' was not declared in this scope
   13 |         vector<ll> abc;
      |                    ^~~
a.cc:18:48: error: expected primary-expression before '>' token
   18 |         sort(abc.begin(), abc.end(), greater<ll>());
      |                                                ^
a.cc:18:50: error: expected primary-expression before ')' token
   18 |         sort(abc.begin(), abc.end(), greater<ll>());
      |                                                  ^
a.cc:19:16: error: 'k' was not declared in this scope
   19 |         rep(i, k) cout << abc[i] << endl;
      |                ^
a.cc:1:39: note: in definition of macro 'rep'
    1 | #define rep(i, n) for(int i = 0; i < (n); ++i)
      |                                       ^
a.cc:19:19: error: 'cout' was not declared in this scope
   19 |         rep(i, k) cout << abc[i] << endl;
      |                   ^~~~
a.cc:19:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:37: error: 'endl' was not declared in this scope
   19 |         rep(i, k) cout << abc[i] << endl;
      |                                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define rep(i, n) for(int i = 0; i < (n); ++i)