criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
define int long long

struct ABC{
    int x,a,b,c;

	ABC(int _x,int _a,int _b,int _c){
		x=_x;a=_a;b=_b;c=_c;	
	}

    bool operator <(const ABC& other ) const{
        return x < other.x;
    }

}; 



signed main(){
    int X,Y,Z,K;
    cin >>X >>Y >>Z >>K;
    vector<int> A(X),B(Y),C(Z);
    for(auto&& w:A)cin >>w;
    for(auto&& w:B)cin >>w;
    for(auto&& w:C)cin >>w;
//    A.push_back((int)-1e17);
//    B.push_back((int)-1e17);
//    C.push_back((int)-1e17);
   
    sort(A.begin(),A.end(),greater<int>());
    sort(B.begin(),B.end(),greater<int>());
    sort(C.begin(),C.end(),greater<int>());
    priority_queue<ABC> pq;
    set<int>s; 
    pq.push(ABC(A[0]+B[0]+C[0],0,0,0));
    s.insert(0);

    vector<int>ans;
    
    while(ans.size()<K){
        auto v=pq.top();pq.pop();
        ans.push_back(v.x);
        //cout<<"ans "<<v.x<<" "<<v.a<<" "<<v.b<<" "<<v.c<<endl;
        for(int i=0;i<3;i++){
            int a=v.a;
            int b=v.b;
            int c=v.c;
            if (i==0){if(a==X-1)continue;a++;}
            else if(i==1){if(b==Y-1)continue;b++;}
            else if(i==2){if(c==Z-1)continue;c++;}
            int hash=(A[a]<<20)+(B[b]<<10)+C[c];
            //cout<<hash<<" "<<a<<" "<<b<<" "<<c<<endl;
            if(s.find(hash)!=s.end())continue;
                s.insert(hash);
                pq.push(ABC(A[a]+B[b]+C[c],a,b,c));
           //     cout<<A[a]+B[b]+C[c]<<" "<<a<<" "<<b<<" "<<c<<" "<<endl;
            
        }
    }
    for(auto&& w:ans)cout<<w<<endl;

}



Compiler output:
a.cc:3:1: error: 'define' does not name a type
    3 | define int long long
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:34:20: error: 'ABC' was not declared in this scope
   34 |     priority_queue<ABC> pq;
      |                    ^~~
a.cc:34:23: error: template argument 1 is invalid
   34 |     priority_queue<ABC> pq;
      |                       ^
a.cc:34:23: error: template argument 2 is invalid
a.cc:34:23: error: template argument 3 is invalid
a.cc:36:8: error: request for member 'push' in 'pq', which is of non-class type 'int'
   36 |     pq.push(ABC(A[0]+B[0]+C[0],0,0,0));
      |        ^~~~
a.cc:42:19: error: request for member 'top' in 'pq', which is of non-class type 'int'
   42 |         auto v=pq.top();pq.pop();
      |                   ^~~
a.cc:42:28: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   42 |         auto v=pq.top();pq.pop();
      |                            ^~~
a.cc:56:20: error: request for member 'push' in 'pq', which is of non-class type 'int'
   56 |                 pq.push(ABC(A[a]+B[b]+C[c],a,b,c));
      |                    ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
define int long long

struct ABC{
    int x,a,b,c;

	ABC(int _x,int _a,int _b,int _c){
		x=_x;a=_a;b=_b;c=_c;	
	}

    bool operator <(const ABC& other ) const{
        return x < other.x;
    }

}; 



signed main(){
    int X,Y,Z,K;
    cin >>X >>Y >>Z >>K;
    vector<int> A(X),B(Y),C(Z);
    for(auto&& w:A)cin >>w;
    for(auto&& w:B)cin >>w;
    for(auto&& w:C)cin >>w;
    A.push_back((int)-1e17);
    B.push_back((int)-1e17);
    C.push_back((int)-1e17);
   
    sort(A.begin(),A.end(),greater<int>());
    sort(B.begin(),B.end(),greater<int>());
    sort(C.begin(),C.end(),greater<int>());
    priority_queue<ABC> pq;
    set<int>s; 
    pq.push(ABC(A[0]+B[0]+C[0],0,0,0));
    s.insert(0);

    vector<int>ans;
    
    while(ans.size()<K){
        auto v=pq.top();pq.pop();
        ans.push_back(v.x);
        //cout<<"ans "<<v.x<<" "<<v.a<<" "<<v.b<<" "<<v.c<<endl;
        for(int i=0;i<3;i++){
            int a=v.a;
            int b=v.b;
            int c=v.c;
            if (i==0)a++;
            else if(i==1)b++;
            else if(i==2)c++;
            int hash=(A[a]<<20)+(B[b]<<10)+C[c];
            //cout<<hash<<" "<<a<<" "<<b<<" "<<c<<endl;
            if(s.find(hash)!=s.end())continue;
                s.insert(hash);
                pq.push(ABC(A[a]+B[b]+C[c],a,b,c));
           //     cout<<A[a]+B[b]+C[c]<<" "<<a<<" "<<b<<" "<<c<<" "<<endl;
            
        }
    }
    for(auto&& w:ans)cout<<w<<endl;

}



Compiler output:
a.cc:3:1: error: 'define' does not name a type
    3 | define int long long
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:34:20: error: 'ABC' was not declared in this scope
   34 |     priority_queue<ABC> pq;
      |                    ^~~
a.cc:34:23: error: template argument 1 is invalid
   34 |     priority_queue<ABC> pq;
      |                       ^
a.cc:34:23: error: template argument 2 is invalid
a.cc:34:23: error: template argument 3 is invalid
a.cc:36:8: error: request for member 'push' in 'pq', which is of non-class type 'int'
   36 |     pq.push(ABC(A[0]+B[0]+C[0],0,0,0));
      |        ^~~~
a.cc:42:19: error: request for member 'top' in 'pq', which is of non-class type 'int'
   42 |         auto v=pq.top();pq.pop();
      |                   ^~~
a.cc:42:28: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   42 |         auto v=pq.top();pq.pop();
      |                            ^~~
a.cc:56:20: error: request for member 'push' in 'pq', which is of non-class type 'int'
   56 |                 pq.push(ABC(A[a]+B[b]+C[c],a,b,c));
      |                    ^~~~
Language: C++

#include <stdio.h>
#include <set>
#include <vector>
using namespace std;
int main(){
	int x, y, z, k; scanf("%d %d %d %d", &x, &y, &z, &k);
	vector<long long> xx(x); for(long long & v : xx) scanf("%lld", &v);
	vector<long long> yy(y); for(long long & v : yy) scanf("%lld", &v);
	vector<long long> zz(z); for(long long & v : zz) scanf("%lld", &v);
	sort(xx.rbegin(), xx.rend());
	sort(yy.rbegin(), yy.rend());
	sort(zz.rbegin(), zz.rend());
	set<vector<long long> > tot;
	long long st = xx[0] + yy[0] + zz[0];
	tot.insert({-st, 0, 0, 0});
	for(int i = 0; i < k; i++){
		vector<long long> now = *tot.begin(); tot.erase(tot.begin());
		printf("%lld\n", -now[0]);
		if (now[1] + 1 < x) {
			tot.insert({-(-now[0]-xx[now[1]]+xx[now[1]+1]), now[1] + 1, now[2], now[3]});
		}
		if (now[2] + 1 < y) {
			tot.insert({-(-now[0]-yy[now[2]]+yy[now[2]+1]), now[1], now[2] + 1, now[3]});
		}
		if (now[3] + 1 < z) {
			tot.insert({-(-now[0]-zz[now[3]]+zz[now[3]+1]), now[1], now[2], now[3] + 1});
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(xx.rbegin(), xx.rend());
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <queue>
#include <vector>

class Cake
{
public: 
    int x, y, z;
    long long val;
    Cake(int x, int y, int z, long long val)
    {
        this->x = x;
        this->y = y;
        this->z = z;
        this->val = val;
    }

    bool operator > (const Cake &other) const
    {
        return this->val < other.val;
    }
};


int main()
{
    int X, Y, Z, K;
    std::cin >> X >> Y >> Z >> K;

    std::vector<long long> A(X), B(Y), C(Z);
    for (int i = 0; i < X; ++i) { std::cin >> A[i]; }
    for (int i = 0; i < Y; ++i) { std::cin >> B[i]; }
    for (int i = 0; i < Z; ++i) { std::cin >> C[i]; }

    std::sort(A.begin(), A.end());
    std::sort(B.begin(), B.end());
    std::sort(C.begin(), C.end());

    std::priority_queue< Cake, std::vector<Cake>, std::greater<Cake> > queue;
    queue.push(Cake(X - 1, Y - 1, Z - 1, A[X - 1] + B[Y - 1] + C[Z - 1]));

    std::vector<bool> searched(X * Y * Z, false);
    for (int i = 0; i < K;)
    {
        Cake c = queue.top();
        queue.pop();
        if (searched[c.x * (Y * Z) + c.y * (Z) + c.z])
        {
            continue;
        }

        std::cout << c.val << std::endl;

        searched[c.x * (Y * Z) + c.y * (Z) + c.z] = true;

        if (c.x > 0) { queue.push(Cake(c.x - 1, c.y, c.z, A[c.x - 1] + B[c.y] + C[c.z])); }
        if (c.y > 0) { queue.push(Cake(c.x, c.y - 1, c.z, A[c.x] + B[c.y - 1] + C[c.z])); }
        if (c.z > 0) { queue.push(Cake(c.x, c.y, c.z - 1, A[c.x] + B[c.y] + C[c.z - 1])); }

        i++;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   35 |     std::sort(A.begin(), A.end());
      |          ^~~~
      |          qsort
a.cc:36:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   36 |     std::sort(B.begin(), B.end());
      |          ^~~~
      |          qsort
a.cc:37:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   37 |     std::sort(C.begin(), C.end());
      |          ^~~~
      |          qsort
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0; i<n ; ++i)
#define all(v) v.begin() , v.end()
#define sz(v) (int(v.size()))
typedef unsigned long long ul;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<char, int> pci;
typedef vector<pii> vp;
typedef vector<pci> vpc;
typedef pair<int,pii> piii;

int OO = 2e9;
const double eps = 1e-9 ;
const int N = 50005;
int mx = -1e9 , mn = 1e9 ;

int main()
{
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<long long> x(X + 1, 0);
    vector<long long> y(Y + 1, 0);
    vector<long long> z(Z + 1, 0);

    for (int i = 1; i <= X; ++i) {
        cin >> x[i];
    }
    for (int i = 1; i <= Y; ++i) {
        cin >> y[i];
    }
    for (int i = 1; i <= Z; ++i) {
        cin >> z[i];
    }

    sort(x.rbegin(), x.rend());
    sort(y.rbegin(), y.rend());
    sort(z.rbegin(), z.rend());
    
    priority_queue<long long> pq;
    for (int i = 1; i <= X; ++i) {
        for (int j = 1; j <= Y; ++j) {
            for (int k = 1; k <= Z; ++k) {
                if (i * j * k > K)
                    break;
                pq.push(x[i] + y[j] + z[k]);
            }
        }
    }
    
    while (k--){
        cout << pq.top() << '\n';
        pq.pop();
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:12: error: 'k' was not declared in this scope
   56 |     while (k--){
      |            ^
Language: C++

#include<iostream>
#include<cstdio>
#include<set>
#include<queue>
#include<vector>
using namespace std;

typedef long long int ll;
const ll maxn = 1000 + 5;
ll x, y, z, k;
ll A[maxn], B[maxn], C[maxn];
ll ans[10];

struct py
{
	ll value;
	int a;
	int b;
	int c;
};

struct cmp
{
	bool operator() (const py &a, const py &b) const
	{
		return a.value < b.value;
	}
};

struct cmp2
{
	bool operator() (const py &x, const py &y) const
	{
		if(x.a != y.a) return x.a > y.a;
		else if(x.b != y.b) return x.b > y.b;
		else return x.c > y.c;
	}
};

priority_queue<py, vector<py>, cmp> que;
set<py, cmp2> s;

void solve()
{
	py res;
	res.value = A[0] + B[0] + C[0];
	res.a = 0; res.b = 0; res.c = 0;
	que.push(res);
	s.insert(res); 
	int cnt = 0;

	while(!que.empty())
	{
		py p = que.top(); que.pop(); 
		cout << p.value << endl;
		cnt++; if(cnt == k) break;

		for(int i = 0; i < 3; i++)
		{
			py np = p;
			if(i == 0) { if(np.a == x-1) continue; np.a++; }
			else if(i == 1) { if(np.b == y-1) continue; np.b++; }
			else if(i == 2) { if(np.c == z-1) continue; np.c++; }

			if(!s.count(np)) //当在已存的坐标中没有时继续插入新坐标
			{
				np.value = A[np.a] + B[np.b] + C[np.c];
				que.push(np);
				s.insert(np);
			}
		}
	}
}

int main()
{
	cin >> x >> y >> z >> k;
	for(ll i = 0; i < x; i++) scanf("%lld", &A[i]); sort(A, A+x, greater<ll>());
	for(ll i = 0; i < y; i++) scanf("%lld", &B[i]); sort(B, B+y, greater<ll>());
	for(ll i = 0; i < z; i++) scanf("%lld", &C[i]); sort(C, C+z, greater<ll>());
	solve();
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:57: error: 'sort' was not declared in this scope; did you mean 'short'?
   78 |         for(ll i = 0; i < x; i++) scanf("%lld", &A[i]); sort(A, A+x, greater<ll>());
      |                                                         ^~~~
      |                                                         short
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;

    vector<long long> A(X), B(Y), C(Z);
    for (int i = 0; i < X; i++) cin >> A[i];
    for (int i = 0; i < Y; i++) cin >> B[i];
    for (int i = 0; i < Z; i++) cin >> C[i];

    sort(A.begin(), A.end(), greater<long long>());
    sort(B.begin(), B.end(), greater<long long>());
    sort(C.begin(), C.end(), greater<long long>());
    
    vector<long long> AB(X*Y);
    for (int i = 0; i < X; i++) {
        for (int j = 0; j < Y; j++) {
            AB[i*Y+j] = A[i] + B[j];
        }
    }
    sort(AB.begin(), AB.end(), greater<long long>());

    long long AB_small_size = min(K, X*Y);
    vector<long long> AB_small = vector<long long>(AB.begin(), AB.begin() + AB_small_size);

    vector<long long> ABC(AB_small_size*Z);
    for (int i = 0; i < AB_small_size; i++) {
        for (int j = 0; j < Z; j++) {
            ABC[i*Z+j] = AB_small[i] + C[j];
        }
    }
    sort(ABC.begin(), ABC.end(), greater<long long>());

    for (int i = 0; i < K; i++) {
        cout << ABC[i] << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(A.begin(), A.end(), greater<long long>());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
#include<utility>
#include<tuple>
#include<set>
using namespace std;

int main(void)
{
	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;

	vector<long long> A(X), B(Y), C(Z);
	for (int i = 0; i < X; i++)
		cin >> A[i];
	for (int i = 0; i < Y; i++)
		cin >> B[i];
	for (int i = 0; i < Z; i++)
		cin >> C[i];

	const long long minf = -1;
	A.push_back(minf);
	B.push_back(minf);
	C.push_back(minf);

	sort(A.rbegin(), A.rend());
	sort(B.rbegin(), B.rend());
	sort(C.rbegin(), C.rend());

	vector<long long> abc;
	set<int> dic;
	priority_queue < pair<long long, tuple<int, int, int>>> task;
	dic.insert(0);
	task.push(make_pair(A[0] + B[0] + C[0], make_tuple(0, 0, 0)));
	for (int i = 0; i < K; i++) {
		auto p = task.top();
		task.pop();

		abc.push_back(p.first);

		for (int j = 0; j < 3; j++) {
			int a, b, c;
			tie(a, b, c) = p.second;

			if (j == 0)
				a++;
			else if (j == 1)
				b++;
			else
				c++;

			int hash = (a << 20) + (b << 10) + c;
			if (dic.count(hash) == 1)
				continue;

			dic.insert(hash);
			task.push(make_pair(A[a] + B[b] + C[c], make_tuple(a, b, c)));
		}
	}
	
	sort(abc.rbegin(), abc.rend());

	for (int i = 0; i < K; i++) {
		cout << abc[i] << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: 'priority_queue' was not declared in this scope
   35 |         priority_queue < pair<long long, tuple<int, int, int>>> task;
      |         ^~~~~~~~~~~~~~
a.cc:9:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    8 | #include<set>
  +++ |+#include <queue>
    9 | using namespace std;
a.cc:35:63: error: expected primary-expression before '>' token
   35 |         priority_queue < pair<long long, tuple<int, int, int>>> task;
      |                                                               ^
a.cc:35:65: error: 'task' was not declared in this scope
   35 |         priority_queue < pair<long long, tuple<int, int, int>>> task;
      |                                                                 ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define all(v) v.begin(), v.end()

struct node {
  int x, y, z;
  ll v;
  node(int a, int b, int c, ll d) : x(a), y(b), z(c), v(d) {}
  bool operator<(const node b) const {
    return v < b.v;
  }
  bool operator>(const node b) const {
    return b < (*this);
  }
};

vector<ll> a, b, c;

node calc(int x, int y, int z)
{
  if (x < a.size() && y < b.size() && z < c.size()) {
    node n(x, y, z, a[x] + b[y] + c[z]);
    return n;
  }
  node n(x, y, z, 0);
  return n;
}

int main()
{
  int 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];
  sort(all(a), greater<ll>());
  sort(all(b), greater<ll>());
  sort(all(c), greater<ll>());
  priority_queue<node> q;
  q.push(calc(0, 0, 0));
  unorderd_set<node> s;
  s.insert(calc(0, 0, 0));
  while (1) {
    if (k == 0) break;
    auto a = q.top();
    q.pop();
    cout << a.v << endl;
    node t = calc(a.x+1, a.y, a.z);
    if (s.count(t) == 0) {
      q.push(t);
      s.insert(t);
    }
    t = calc(a.x, a.y+1, a.z);
    if (s.count(t) == 0) {
      q.push(t);
      s.insert(t);
    }
    t = calc(a.x, a.y, a.z+1);
    if (s.count(t) == 0) {
      q.push(t);
      s.insert(t);
    }    
    k--;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:49:3: error: 'unorderd_set' was not declared in this scope
   49 |   unorderd_set<node> s;
      |   ^~~~~~~~~~~~
a.cc:49:20: error: expected primary-expression before '>' token
   49 |   unorderd_set<node> s;
      |                    ^
a.cc:49:22: error: 's' was not declared in this scope
   49 |   unorderd_set<node> s;
      |                      ^
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>

// MARK: - header
namespace {
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<ull MOD>
struct Mod {
    ull v = 0;
    Mod() {};
    Mod(ull val) : v(val) {}
    operator ull() const {return v;}
    ull operator=(ll x) {return v = x % MOD;}
    ull operator+=(ll x) {return operator=(v + x);}
    ull operator*=(ll x) {return operator=(v * x);}
};
}

// MARK: - answer

ll X, Y, Z, K;
vector<ll> A, B, C;

void input() {
    cin >> X >> Y >> Z >> K;
    A.resize(X);
    for (auto& a : A)
        cin >> a;
    B.resize(Y);
    for (auto& b : B)
        cin >> b;
    C.resize(Z);
    for (auto& c : C)
        cin >> c;
}

bool cut_search(ll p, vector<ll>& sums, bool quick_cut = true) {
    sums = {};
    for (auto a : A) {
        for (auto b : B) {
            for (auto c : C) {
                auto sum = a+b+c;
                if (sum < p)
                    break;
                sums.push_back(sum);
                if (quick_cut and sums.size() >= K)
                    return true;
            }
        }
    }
    return false;
}

void solve() {
    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());
    sort(C.rbegin(), C.rend());
    vector<ll> sums;
    ll l = 0, r = 3e10;
    ll p = 0;
    while (l <= r) {
        ll c = (l+r)/2;
        if (cut_search(c, sums)) {
            p = c;
            l = c + 1;
        } else {
            r = c - 1;
        }
    }
    cut_search(p, sums, false);
    sort(sums.rbegin(), sums.rend());
    for (int i = 0; i < K; i++)
        cout << sum << endl;
}

int main() {
    input();
//    cout << (solve() ? "Yay!" : ":(") << endl;
    solve();
    
    return 0;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:81:17: error: 'sum' was not declared in this scope; did you mean 'sums'?
   81 |         cout << sum << endl;
      |                 ^~~
      |                 sums
Language: C++

#include<iostream>
#include<set>
using namespace std;
int main(){
  int x,y,z,k;
  cin>>x>>y>>z>>k;
  multiset<long long> a,b,c,ab,abc;
  long long in;
  for(int i=0;i<x;i++){
    cin>>in;
    a.insert(in);
  }
  for(int i=0;i<y;i++){
    cin>>in;
    b.insert(in);
  }
  for(int i=0;i<z;i++){
    cin>>in;
    c.insert(in);
  }
  for(auto itra=a.begin();itra!=a.end();itra++){
    for(auto itrb=b.begin();itrb!=b.end();itrb++){
      ab.insert(*itra+*itrb);
    }
  }
  auto itr=ab.end();
  for(int i=0;i<k;i++){
    itr--;
    if(itr==ab.begin())break;
  }
  for(auto itrab=itr;itrab!=ab.end();itrab++){
    for(auto itrc=c.begin();itrc!=c.end();c++){
      abc.insert(*itrab+*itrc);
    }
  } 
  int cnt=0;
  for(auto itrabc=abc.end();itrabc!=abc.begin();itrabc--){
    itrabc--;
    cout<<*itrabc<<endl;
    cnt++;
    if(cnt==k)break;
    itrabc++;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:44: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   32 |     for(auto itrc=c.begin();itrc!=c.end();c++){
      |                                           ~^~
Language: Java

import java.util.*;

public class D {
	static int X, Y, Z, K;
	static long[] A, B, C;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		X = sc.nextInt();
		Y = sc.nextInt();
		Z = sc.nextInt();
		K = sc.nextInt();
		A = new long[X];
		for (int i = 0; i < X; i++) {
			A[i] = sc.nextLong();
		}
		B = new long[Y];
		for (int i = 0; i < Y; i++) {
			B[i] = sc.nextLong();
		}
		C = new long[Z];
		for (int i = 0; i < Z; i++) {
			C[i] = sc.nextLong();
		}

		Arrays.sort(A);
		Arrays.sort(B);
		Arrays.sort(C);
		Collections.reverse(Arrays.asList(A));
		Collections.reverse(Arrays.asList(B));
		Collections.reverse(Arrays.asList(C));

		ArrayList<Long> ABC = new ArrayList<Long>();
		for (int i = 0; i < X; i++) {
			for (int j = 0; j < Y; j++) {
				for (int k = 0; k < Z; k++) {
					if (i + j + k < K) {
						ABC.add(A[i] + B[j] + C[k]);
					}
				}
			}
		}
		ABC.sort(Comparator.reverseOrder());
		for (int i = 0; i < K; i++) {
			System.out.println(ABC.get(i));
		}
	}
}


Compiler output:
Main.java:3: error: class D is public, should be declared in a file named D.java
public class D {
       ^
1 error
Language: C++

#include<iostream>
#include<queue>
#include<vector>

using namespace std;

int main(){
  int x, y, z, k;
  int a[1000];
  int b[1000];
  int c[1000];
  cin >> x >> y >> z >> k;
  for(int i = 0; i < x; i++){
    cin >> a[i];
  }
  for(int i = 0; i < y; i++){
    cin >> b[i];
  }
  for(int i = 0; i < z; i++){
    cin >> c[i];
  }
  sort(a, a + x, greater<int>());
  sort(b, b + y, greater<int>());
  sort(c, c + z, greater<int>());
  vector<int> v;
  for(int i = 0 ; i < x; i++){
    for(int j = 0; j < y ; j++){
      for(int l = 0; l < z; l++){
        if((i + 1) * (j + 1) * (l + 1) < k) v.push_back(a[i]+b[j]+c[l]);
      }
    }
  }
  sort(v.begin(), v.end(), greater<int>());
  for(int i = 0; i < k ; i++){
    cout << v[i] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |   sort(a, a + x, greater<int>());
      |   ^~~~
      |   short
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main () {
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  long long x[1000];
  long long y[1000];
  long long z[1000];
  for (int i = 0; i < X; i ++) cin >> x[i];
  for (int i = 0; i < Y; i ++) cin >> y[i];
  for (int i = 0; i < Z; i ++) cin >> z[i];
  vector<long long> XY(X * Y);
  for (int i = 0; i < X; i ++) {
    for (int j = 0; i < Y; j ++) {
      XY[i * Y + j] = x[i] + y[j];
    }
  }
  sort(XY.begin(), XY.end());
  vector<long long> an(K);
  for (int i = 0; i < K; i ++) an[i] = XY[X * Y - i - 1];
  sort(z.begin(), z.end());
  vector<long long> as(K);
  for (int i = 0; i < K; i ++) as[i] = z[Z - i - 1];
  vector<long long> ans(K * K);
  for (int i = 0; i < K; i ++) {
    for (int j = 0; j < K; j ++) {
      ans[i * K + j] = an[i] + as[j];
    }
  }
  sort(ans.begin(), ans.end());
  for (int i = 1; i <= K; i ++) {
    cout << ans[K * K - i] << endl;
  }
}

  

Compiler output:
a.cc: In function 'int main()':
a.cc:21:10: error: request for member 'begin' in 'z', which is of non-class type 'long long int [1000]'
   21 |   sort(z.begin(), z.end());
      |          ^~~~~
a.cc:21:21: error: request for member 'end' in 'z', which is of non-class type 'long long int [1000]'
   21 |   sort(z.begin(), z.end());
      |                     ^~~
Language: C

#include <stdio.h>

int main()
{
    int x,y,z,e,v;
    long long int k;
    scanf("%d %d %d %lld",&x,&y,&z,&k);
    long long long int a[x],b[y],c[z],i,j,l,tmp,ans[3000];
    for (i=0;i<x;i++){
        scanf("%llld",&a[i]);
//        printf("%lld ",a[i]);
    }
    for (i=0;i<y;i++){
        scanf("%llld",&b[i]);
//        printf("%lld ",b[i]);
    }
    for (i=0;i<z;i++){
        scanf("%llld",&c[i]);
//        printf("%lld ",c[i]);
    }
    for (i=0; i<3000; i++) {
        ans[i]=0;
    }
    
    // ここからソート
    for (i=0; i<x; ++i) {
        for (j=i+1; j<x; ++j) {
            if (a[i] < a[j]) {
                tmp =  a[i];
                a[i] = a[j];
                a[j] = tmp;
            }
        }
    }
    for (i=0; i<y; ++i) {
        for (j=i+1; j<y; ++j) {
            if (b[i] < b[j]) {
                tmp =  b[i];
                b[i] = b[j];
                b[j] = tmp;
            }
        }
    }
    for (i=0; i<z; ++i) {
        for (j=i+1; j<z; ++j) {
            if (c[i] < c[j]) {
                tmp =  c[i];
                c[i] = c[j];
                c[j] = tmp;
            }
        }
    }
    for (i=0;i<x;i++){
//        printf("{%lld ",a[i]);
    }
    for (i=0;i<y;i++){
//        printf("%lld ",b[i]);
    }
    for (i=0;i<z;i++){
//        printf("%lld} ",c[i]);
    }
    v=0;
    for(i=0;i<x;i++){
        for(j=0;j<y;j++){
            for(l=0;l<z;l++){
                ans[v] = a[i]+b[j]+c[l];
                v++;
            }
        }
    }
//    printf("%d",v);
    for (i=0; i<3000; ++i) {
        for (j=i+1; j<3000; ++j) {
            if (ans[i] < ans[j]) {
                tmp =  ans[i];
                ans[i] = ans[j];
                ans[j] = tmp;
            }
        }
    }
    for (i=0; i<k; i++) {
        printf("%llld\n",ans[i]);
    }
    
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:15: error: 'long long long' is too long for GCC
    8 |     long long long int a[x],b[y],c[z],i,j,l,tmp,ans[3000];
      |               ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;

long long x, y, z, k, a[1009], b[1009], c[1009];
vector<long long>vec;

int main()
{
    cin >> x >> y >> z >> k;
    for(int i = 0; i < x; ++i) { cin >> a[i]; }
    sort(a, a+x, greater<long long>());
    for(int i = 0; i < y; ++i) { cin >> b[i]; }
    sort(b, b+y, greater<long long>());
    for(int i = 0; i < z; ++i) { cin >> c[i]; }
    sort(c, c+z, greater<long long>());

    for(int l = 0; l < x; ++l) {
        for(int m = 0; m < y; ++m) {
            for(int n = 0; n < z; ++n) {
                if((l+1)*(m+1)*(n+1) <= k) {
                    vec.push_back(a[l] + b[m] + c[n]);
                }
                else { break; }
            }
        }
    }

    sort(vec.begin(), vec.end(), greater<long long>());
    for(int i = 0; i < k; ++i) { cout << vec[i] << endl; }
    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;

public class Main {
	
	private void findCombinations(long[] xArr, long[] yArr, long[] zArr, int k) {
		List<Long> ans = new ArrayList<>();
		
		for(int a = 0; a < xArr.length; a++){
			for(int b = 0; b < yArr.length; b++){
				for(int c = 0; c < zArr.length; c++){
					if((a + 1) * (b + 1) * (c + 1) <= k) ans.add(xArr[a] + yArr[b] + zArr[c]);
				}
			}
		}
		
		Collections.sort(ans, new Comparator<Long>() {
			@Override
			public int compare(Long o1, Long o2) {
				return (int) (o2 - o1);
			}
		});
		
		for(long tmp : ans){
			System.out.println(tmp);
		}
	}
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		int k = sc.nextInt();
		
		long[] xArr = new long[x];
		long[] yArr = new long[y];
		long[] zArr = new long[z];
		
		for(int i = 0; i < x; i++) xArr[i] = sc.nextLong();
		for(int i = 0; i < y; i++) yArr[i] = sc.nextLong();
		for(int i = 0; i < z; i++) zArr[i] = sc.nextLong();
		
		Main dCake123 = new DCake123();
		dCake123.findCombinations(xArr, yArr, zArr, k);
	}
}

Compiler output:
Main.java:44: error: cannot find symbol
		Main dCake123 = new DCake123();
		                    ^
  symbol:   class DCake123
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;

int main(){
  int X, Y, Z, K;cin >> X >> Y >> Z >> K;
  vll A, B, C;
  for (int i=0;i<X;++i){
    ll a;cin>>a;
    A.push_back(a);
  }

  for (int i=0;i<Y;++i){
    ll b;cin>>b;
    B.push_back(b);
  }

  for (int i=0;i<Z;++i){
    ll c;cin>>c;
    C.push_back(c);
  }

  priority_queue<ll> AB_sum;
  for (int i=0;i<X;++i){
    for (int j=0;j<Y;++j){
      AB_sum.push(A[i]+B[j]);
    }
  }

  vll ans_list;

  for (int i=0;i<K;i++){
    ll s=AB_sum.top();AB_sum.pop();
    for (int j=0;j<Z;++j){
      ans_list.push_back(s+AB_sum[j]);
    }
  }

  sort(ans_list.begin(), ans_list.end(), greater<ll>());

  for (int i=0;i<K;++i){
    cout << ans_list[i] << endl;
  }

  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:34: error: no match for 'operator[]' (operand types are 'std::priority_queue<long long int>' and 'int')
   36 |       ans_list.push_back(s+AB_sum[j]);
      |                                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;

int main(){
  int X, Y, Z, K;cin >> X >> Y >> Z >> K;
  vll A, B, C;
  for (int i=0;i<X;++i){
    ll a;cin>>a;
    A.push_back(a);
  }

  for (int i=0;i<Y;++i){
    ll b;cin>>b;
    B.push_back(b);
  }

  for (int i=0;i<Z;++i){
    ll c;cin>>c;
    C.push_back(c);
  }

  priority_queue<ll> AB_sum;
  for (int i=0;i<X;++i){
    for (int j=0;j<Y;++j){
      ABsum.push(A[i]+B[j]);
    }
  }

  vll ans_list;

  for (int i=0;i<K;i++){
    ll s=ABsum.top();ABsum.pop();
    for (int j=0;j<Z;++j){
      ans_list.push_back(s+ABsum[j]);
    }
  }

  sort(ans_list.begin(), ans_list.end(), greater<ll>());

  for (int i=0;i<K;++i){
    cout << ans_list[i] << endl;
  }

  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:7: error: 'ABsum' was not declared in this scope; did you mean 'AB_sum'?
   27 |       ABsum.push(A[i]+B[j]);
      |       ^~~~~
      |       AB_sum
a.cc:34:10: error: 'ABsum' was not declared in this scope; did you mean 'AB_sum'?
   34 |     ll s=ABsum.top();ABsum.pop();
      |          ^~~~~
      |          AB_sum
Language: C++

#include <iostream>
#include <vector>
#include <unordered_set>
#include <string>
#include <algorithm>

using ll = long long;

using namespace std;

int main()
{
	int x, y, z, k;
	cin >> x >> y >> z >> k;

	vector<int> as, bs, cs;

	for (int i = 0; i < x; i++)
		cin >> as[i];
	for (int i = 0; i < y; i++)
		cin >> bs[i];
	for (int i = 0; i < z; i++)
		cin >> cs[i];

	sort(as.begin(), as.end());
	reverse(as.begin(), as.end());
	sort(bs.begin(), bs.end());
	reverse(bs.begin(), bs.end());
	sort(cs.begin(), cs.end());
	reverse(cs.begin(), cs.end());

	vector<ll> ab, abc;
	for (int i = 0; i < x; i++)
	{
		for (int j = 0; j < y; j++)
		{
			ab.push_back(as[i] + bs[i]);
		}
	}

	sort(ab.begin(), ab.end());
	reverse(ab.begin(), ab.end());

	for (int i = 0; i < min(k, (int)ab.size()); i++)
	{
		for (int j = 0; j < cs.size(); j++)
		{
			abc.push_back(ab[i] + c[j]);
		}
	}

	sort(abc.begin(), abc.end());
	reverse(abc.begin(), abc.end());

	for (int i = 0; i < k; i++)
	{
		cout << abc[i] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:47: error: 'c' was not declared in this scope
   48 |                         abc.push_back(ab[i] + c[j]);
      |                                               ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
 
int main()
{
    int ca, cb, cc, k;
    cin>>ca>>cb>>cc>>k;
 
    vector<long long> a(ca), b(cb), c(cc); 
    for (int i=0; i<ca; i++) cin>>a[i];
    for (int i=0; i<cb; i++) cin>>b[i];
    for (int i=0; i<cc; i++) cin>>c[i];
 
    vector<long long> ab;
    for (int i = 0; i < ca; i++) {
        for (int j = 0; j < cb; j++) {
            ab.push_back(a[i] + b[j]);
        }
    }
    sort(ab.begin(), ab.end());
    reverse(ab.begin(), ab.end());
 
    vector<long long> abc;
    for (int i = 0; i < min(k, (int)ab.sicce()); i++) {
        for (int j = 0; j < cc; j++) {
            abc.push_back(ab[i] + c[j]);
        }
    }
    sort(abc.begin(), abc.end());
    reverse(abc.begin(), abc.end());
 
    for (int i = 0; i < k; i++) {
        cout << abc[i] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:40: error: 'class std::vector<long long int>' has no member named 'sicce'
   27 |     for (int i = 0; i < min(k, (int)ab.sicce()); i++) {
      |                                        ^~~~~
Language: C

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
 
int main() 
{
    int x, y, z;
    int k;
    cin >> x >> y >> z;
    cin >> k;
 
    vector<long long> a(x), b(y), c(z);
    for (int i = 0; i < x; ++i) cin >> a[i];
    for (int i = 0; i < y; ++i) cin >> b[i];
    for (int i = 0; i < z; ++i) cin >> c[i];
 
    vector<long long> ab;
    for (int i = 0; i < x; ++i) {
        for (int j = 0; j < y; ++j) {
            ab.push_back(a[i] + b[j]);
        }
    }
    sort(ab.begin(), ab.end());
    reverse(ab.begin(), ab.end());
 
    vector<long long> abc;
    for (int i = 0; i < min(k, (int)ab.size()); ++i) {
        for (int j = 0; j < z; ++j) {
            abc.push_back(ab[i] + c[j]);
        }
    }
    sort(abc.begin(), abc.end());
    reverse(abc.begin(), abc.end());
 
    for (int i = 0; i < k; ++i) {
        cout << abc[i] << endl;
    }
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

int X,Y,Z,K;
vector<ll> A,B,C;
vector<vector<vector<ll>>> dp;
int dpf(void){
    vector<ll> ans;
    //cout<<dp[0][0][0]<<endl;
    for(int i=0;i<min(X,K);i++){
        for(int j = 0;j<min(Y,K);j++){
            for(int k = 0;k<min(Z,K);k++){
                if(i+j+k+3>K) continue;
                ans.push_back(A[i]+B[j]+C[k])
            }
        }
    }
    sort(ans.begin(),ans.end(),greater<ll>());
    REP(i,K){
        cout<<ans[i]<<endl;
    }
    return 0;
}




int main(){
    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];
    int minx = min(X,K);
    dp.resize(minx);
    int miny = min(Y,K);
    REP(i,minx) dp[i].resize(miny);
    int minz = min(Z,K);
    REP(i,minx){
        REP(j,miny){
            dp[i][j].resize(minz);
        }
    }
    sort(A.begin(),A.end(),greater<ll>());
    sort(B.begin(),B.end(),greater<ll>());
    sort(C.begin(),C.end(),greater<ll>());
    dpf();
}

Compiler output:
a.cc: In function 'int dpf()':
a.cc:23:46: error: expected ';' before '}' token
   23 |                 ans.push_back(A[i]+B[j]+C[k])
      |                                              ^
      |                                              ;
   24 |             }
      |             ~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;

int X,Y,Z,K;
vector<ll> A,B,C;
ll dp[10][10][10];

int dpf(void){
    vector<ll> ans;
    dp[0][0][0] = A[0]+B[0]+C[0];
    ans.push_back(dp[0][0][0]);
    //cout<<dp[0][0][0]<<endl;
    for(int i=0;i<min(X,K-2);i++){
        for(int j = 0;j<min(Y,K-i-2);j++){
            for(int k = 0;k<min(Z,K-2-i-j);k++){
                if (i==0 and j==0 and k==0) continue;
                if(i-1>=0 and dp[i-1][j][k] != 0){
                    dp[i][j][k] = dp[i-1][j][k] - A[i-1] + A[i];
                     ans.push_back(dp[i][j][k]);
                     //cout<<i<<j<<k<<endl;
                }
                else if(j-1>=0 and dp[i][j-1][k] != 0){
                    dp[i][j][k] = dp[i][j-1][k] - B[j-1] + B[j];
                     ans.push_back(dp[i][j][k]);
                     //cout<<i<<j<<k<<endl;
                }
                else if(k-1>=0 and dp[i][j][k-1] != 0){
                    dp[i][j][k] = dp[i][j][k-1] - C[k-1] + C[k];
                    ans.push_back(dp[i][j][k]);
                    //cout<<i<<j<<k<<endl;
                }
            }
        }
    }
    sort(ans.begin(),ans.end(),greater<ll>());
    REP(i,K){
        cout<<ans[i]<<endl;
    }
    return 0;
}



Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: Java

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int X = sc.nextInt();
        int Y = sc.nextInt();
        int Z = sc.nextInt();
        int K = sc.nextInt();

        Long[] A = new Long[X];
        Long[] B = new Long[Y];
        Long[] C = new Long[Z];
        Long[] AB = new Long[X*Y];
        int size = Math.min(AB.length, K);
        Long[] ABC = new Long[size * Z];
        for (int i = 0; i < X; i++) {
            A[i] = sc.nextLong();
        }

//        Arrays.sort(A, Collections.reverseOrder());

        for (int i = 0; i < Y; i++) {
            B[i] = sc.nextLong();
        }
//        Arrays.sort(B, Collections.reverseOrder());
        for (int i = 0; i < Z; i++) {
            C[i] = sc.nextLong();
        }

        for (int i = 0; i < X; i++) {
            for (int j = 0; j < Y; j++) {
                AB[Y*i+j] = A[i] + B[j];
            }
        }

        Arrays.sort(AB, Collections.reverseOrder());
        Arrays.sort(C, Collections.reverseOrder());

        int csize = Math.min(Z,K);
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < csize; j++) {
                ABC[Z*i+j] = AB[i] + C[j];
            }
        }

        Arrays.sort(ABC, Collections.reverseOrder());

//        System.out.println(Arrays.toString(A));
//        System.out.println(Arrays.toString(B));
//        System.out.println(Arrays.toString(AB));
//        System.out.println(Arrays.toString(ABC));

        for (int i = 0; i < K; i++) {
            System.out.println(ABC[i]);
        }

    }
}

Compiler output:
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:36: error: cannot find symbol
        Arrays.sort(AB, Collections.reverseOrder());
        ^
  symbol:   variable Arrays
  location: class Main
Main.java:36: error: cannot find symbol
        Arrays.sort(AB, Collections.reverseOrder());
                        ^
  symbol:   variable Collections
  location: class Main
Main.java:37: error: cannot find symbol
        Arrays.sort(C, Collections.reverseOrder());
        ^
  symbol:   variable Arrays
  location: class Main
Main.java:37: error: cannot find symbol
        Arrays.sort(C, Collections.reverseOrder());
                       ^
  symbol:   variable Collections
  location: class Main
Main.java:46: error: cannot find symbol
        Arrays.sort(ABC, Collections.reverseOrder());
        ^
  symbol:   variable Arrays
  location: class Main
Main.java:46: error: cannot find symbol
        Arrays.sort(ABC, Collections.reverseOrder());
                         ^
  symbol:   variable Collections
  location: class Main
8 errors
Language: C++

#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
const ll MOD=100000007;
#define rep(i,a,b) for(ll i=a;i<b;i++)
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
int main(){
    ll x,y,z,k;
    cin>>x>>y>>z>>k;
    vector<ll> xx(x),yy(y),zz(z);
    rep(i,0,x) cin>>xx[i];
    rep(i,0,y) cin>>yy[i];
    rep(i,0,z) cin>>zz[i];
    sort(xx.begin(),xx.end());
    sort(yy.begin(),yy.end());
    sort(zz.begin(),zz.end());
    reverse(xx.begin(),xx.end());
    reverse(yy.begin(),yy.end());
    reverse(zz.begin(),zz.end());
    rep(i,0,k){
        cout<<xx[0]+yy[0]+zz[0];
        if(k-i){
            ll t;
            t=min(xx[1]-xx[0],yy[1]-yy[0],zz[1]-zz[0]);
            if(t==yy[1]-yy[0]) yy.erase(yy.begin());
            else if(t==xx[1]-xx[0]) xx.erase(xx.begin());
            else if(t==zz[1]-zz[0]) zz.erase(zz.begin());
        }
    }
}


Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:41:18:   required from here
   41 |             t=min(xx[1]-xx[0],yy[1]-yy[0],zz[1]-zz[0]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
const ll MOD=100000007;
#define rep(i,a,b) for(ll i=a;i<b;i++)
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
int main(){
    ll x,y,z,k;
    cin>>x>>y>>z>>k;
    vector<ll> xx(x),yy(y),zz(z);
    rep(i,0,x) cin>>xx[i];
    rep(i,0,y) cin>>yy[i];
    rep(i,0,z) cin>>zz[i];
    sort(xx.begin(),xx.end());
    sort(yy.begin(),yy.end());
    sort(zz.begin(),zz.end());
    reverse(xx.begin(),xx.end());
    reverse(yy.begin(),yy.end());
    reverse(zz.begin(),zz.end());
    rep(i,0,k){
        cout<<xx[0]+yy[0]+zz[0];
        if(k-i){
            ll t;
            t=min(xx[1]-xx[0],yy[1]-yy[0],zz[1]-zz[0]);
            if(t==yy[1]-yy[0]) erase(yy.begin);
            else if(t==xx[1]-xx[0]) erase(xx.begin);
            else if(t==zz[1]-zz[0]) erase(zz.begin);
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:32: error: 'erase' was not declared in this scope
   42 |             if(t==yy[1]-yy[0]) erase(yy.begin);
      |                                ^~~~~
a.cc:43:37: error: 'erase' was not declared in this scope
   43 |             else if(t==xx[1]-xx[0]) erase(xx.begin);
      |                                     ^~~~~
a.cc:44:37: error: 'erase' was not declared in this scope
   44 |             else if(t==zz[1]-zz[0]) erase(zz.begin);
      |                                     ^~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:41:18:   required from here
   41 |             t=min(xx[1]-xx[0],yy[1]-yy[0],zz[1]-zz[0]);
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  	cin.tie(0);
	ios::sync_with_stdio(false);
    int x, y, z, K;
    cin >> x >> y >> z >> K;
    vector<long long> A(x), B(y), C(z);
    for (int i = 0; i < x; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < y; i++)
    {
        cin >> B[i];
    }
    for (int i = 0; i < z; i++)
    {
        cin >> C[i];
    }
  	sort(A.rbegin(),A.rend());
  	sort(B.rbegin(),B.rend());
  	sort(C.rbegin(),C.rend());
    priority_queue<long long> P;
    for (int i = 0; i < x; i++)
    {
        for (int j = 0; j < y; j++)
        {
            for (int k = 0; k < z; k++)
            {
                    if (que.size() < K) que.push(A[i] + B[j] + C[k]);
                    else if (A[i] + B[j] + C[k] > que.top()) {
                        que.pop();
                        que.push(A[i] + B[j] + C[k]);

            }
        }
    }
    for (int i = 0; i < K; i++)
    {
        cout << P.top() << endl;
        P.pop();
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:25: error: 'que' was not declared in this scope
   32 |                     if (que.size() < K) que.push(A[i] + B[j] + C[k]);
      |                         ^~~
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^