criyle/codenet-compile-errors huggingface dataset:
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[j]);
                    else if (a[i] + b[j] + c[j] > que.top()) {
                        que.pop();
                        que.push(a[i] + b[j] + c[j]);

            }
        }
    }
    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[j]);
      |                         ^~~
a.cc:32:50: error: 'a' was not declared in this scope
   32 |                     if (que.size() < K) que.push(a[i] + b[j] + c[j]);
      |                                                  ^
a.cc:32:57: error: 'b' was not declared in this scope
   32 |                     if (que.size() < K) que.push(a[i] + b[j] + c[j]);
      |                                                         ^
a.cc:32:64: error: 'c' was not declared in this scope
   32 |                     if (que.size() < K) que.push(a[i] + b[j] + c[j]);
      |                                                                ^
a.cc:33:30: error: 'a' was not declared in this scope
   33 |                     else if (a[i] + b[j] + c[j] > que.top()) {
      |                              ^
a.cc:33:37: error: 'b' was not declared in this scope
   33 |                     else if (a[i] + b[j] + c[j] > que.top()) {
      |                                     ^
a.cc:33:44: error: 'c' was not declared in this scope
   33 |                     else if (a[i] + b[j] + c[j] > que.top()) {
      |                                            ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
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[l]);
                    else if (a[i] + b[j] + c[l] > que.top()) {
                        que.pop();
                        que.push(a[i] + b[j] + c[l]);

            }
        }
    }
    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[l]);
      |                         ^~~
a.cc:32:50: error: 'a' was not declared in this scope
   32 |                     if (que.size() < K) que.push(a[i] + b[j] + c[l]);
      |                                                  ^
a.cc:32:57: error: 'b' was not declared in this scope
   32 |                     if (que.size() < K) que.push(a[i] + b[j] + c[l]);
      |                                                         ^
a.cc:32:64: error: 'c' was not declared in this scope
   32 |                     if (que.size() < K) que.push(a[i] + b[j] + c[l]);
      |                                                                ^
a.cc:32:66: error: 'l' was not declared in this scope
   32 |                     if (que.size() < K) que.push(a[i] + b[j] + c[l]);
      |                                                                  ^
a.cc:33:30: error: 'a' was not declared in this scope
   33 |                     else if (a[i] + b[j] + c[l] > que.top()) {
      |                              ^
a.cc:33:37: error: 'b' was not declared in this scope
   33 |                     else if (a[i] + b[j] + c[l] > que.top()) {
      |                                     ^
a.cc:33:44: error: 'c' was not declared in this scope
   33 |                     else if (a[i] + b[j] + c[l] > que.top()) {
      |                                            ^
a.cc:33:46: error: 'l' was not declared in this scope
   33 |                     else if (a[i] + b[j] + c[l] > que.top()) {
      |                                              ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++


#include "pch.h"
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int>> PP;

const ll INF = 10000000000;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };



int main(void) {
	int X, Y, Z, K;
	ll A[1010], B[1010], C[1010];
	vector<ll> AB, ABC;
	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 < X; i++) cin >> C[i];

	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(), greater<ll>());
	
	int sz = AB.size();
	for (int i = 0; i < min(K, sz); i++)
		for (int j = 0; j < Z; j++) ABC.push_back(AB[i] + C[j]);

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

	for (int i = 0; i < min(K, X*Y*Z); i++) cout << ABC[i] << endl;
	

}


Compiler output:
a.cc:2:10: fatal error: pch.h: No such file or directory
    2 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

//最大公約数
template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//最小公倍数
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

long long ABC[3][1001];
vector<long long> AB_best
vector<long long> ans;

int main(){
    int xyzk[4];
    for (int i = 0; i < 4; i++) {
        cin >> xyzk[i];
    }
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < xyzk[i]; j++) {
            cin >> ABC[i][j];
        }
    }
    AB_best = vector<long long>(xyzk[0] * xyzk[1]);
    int cnt = 0;
    for (int i = 0; i < xyzk[0]; i++) {
        for (int j = 0; j < xyzk[1]; j++) {
            AB_best[cnt++] = ABC[0][i] + ABC[1][j];
        }
    }
    sort(AB_best.begin(), AB_best.end(), greater<long long>());
    cnt = 0;
    ans = vector<long long>(max(3000, xyzk[0]*xyzk[1])*xyzk[2]);
    for (int i = 0; i < AB_best.size() && i < 3000; i++) {
        for (int j = 0; j < xyzk[2]; j++) {
            ans[cnt++] = AB_best[i] + ABC[2][j];
        }
    }
    sort(ans.begin(), ans.end(), greater<long long>());
    for (int i = 0; i < xyzk[3]; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}



Compiler output:
a.cc:56:1: error: expected initializer before 'vector'
   56 | vector<long long> ans;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:68:5: error: 'AB_best' was not declared in this scope
   68 |     AB_best = vector<long long>(xyzk[0] * xyzk[1]);
      |     ^~~~~~~
a.cc:77:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   77 |     ans = vector<long long>(max(3000, xyzk[0]*xyzk[1])*xyzk[2]);
      |     ^~~
      |     abs
Language: C++

#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

int main() {
  int x, y, z, k;
  ll t;

  cin >> x >> y >> z >> k;

  vector<ll> a, b, c;

  for (int i = 0; i < x; i++) {
    cin >> t; a.push_back(t);
  }
  for (int i = 0; i < y; i++) {
    cin >> t; b.push_back(t);
  }
  for (int i = 0; i < z; i++) {
    cin >> t; c.push_back(t);
  }

  vector<ll> bc;
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      t = a[i] + b[j];
      bc.push_back(t);
    }
  }

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

  vector<ll> cand;

  int s = min(x*y, 3333);
  for (int i = 0; i < z; i++) {
    for (int j = 0; j < s; j++) {
      t = c[i] + bc[j];
      cand.push_back(t);
    }
  }
  sort(cand.begin(), cand.end(), greater<ll>());

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

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

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X,Y,Z,K;
    scanf("%d %d %d %d",&X,&Y,&Z,&K);
    ll A[1000],B[1000],C[1000];
    REP(i,X) scanf("%lld",&A[i]);
    REP(i,Y) scanf("%lld",&B[i]);
    REP(i,Z) scanf("%lld",&C[i]);

    sort(ALL(A),greater<ll>);
    sort(ALL(B),greater<ll>);
    sort(ALL(C),greater<ll>);

    priority_queue<ll,vector<ll>,greater<>> q;

    REP(i,X) {
        REP(j,Y) {
            REP(k,Z) {
                if (q.size() < K) q.push(A[i] + B[j] + C[k]);
                else if (A[i] + B[j] + C[k] > q.top()) {
                    q.pop();
                    q.push(A[i] + B[j] + C[k]);
                }
            }
        }
    }

    vector<ll> ans(K);
    REP(i,K) {
        ans[K - i - 1] = que.top();
        que.pop();
    }
    REP(i,K) {
        printf("%lld\n",q.top());
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:28: error: expected primary-expression before ')' token
   29 |     sort(ALL(A),greater<ll>);
      |                            ^
a.cc:30:28: error: expected primary-expression before ')' token
   30 |     sort(ALL(B),greater<ll>);
      |                            ^
a.cc:31:28: error: expected primary-expression before ')' token
   31 |     sort(ALL(C),greater<ll>);
      |                            ^
a.cc:49:26: error: 'que' was not declared in this scope
   49 |         ans[K - i - 1] = que.top();
      |                          ^~~
Language: C++

#include<iostream>
#include<vector>
#include<cmath>

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

	std::vector<long long> aList;
	std::vector<long long> bList;
	std::vector<long long> cList;
	std::vector<long long> abList;
	std::vector<long long> abcList;

	std::cin>>x>>y>>z>>k;
	aList.resize(x);
	bList.resize(y);
	cList.resize(z);
	abList.resize(x*y);
	abcList.resize(k*k);

	for(int i=0; i<x; i++)
		std::cin>>aList[i];

	for(int i=0; i<y; i++)
		std::cin>>bList[i];

	for(int i=0; i<z; i++)
		std::cin>>cList[i];

	for(int i=0; i<x; i++)
		for(int j=0; j<y; j++)
			abList[i*y+j]= aList[i]+bList[j];

	std::sort(abList.begin(), abList.end(), [](long long a, long long b){return a>b;});
	std::sort(cList.begin(), cList.end(), [](long long a, long long b){return a>b;});

	int len1= std::min(k, x*y);
	int len2= std::min(k, z);
	int len3= std::min(k, len1*z);

	for(int i=0; i<len1; i++)
		for(int j=0; j<len2; j++)
			abcList[i*len2+j]= abList[i]+cList[j];

	std::sort(abcList.begin(), abcList.end(), [](long long a, long long b){return a>b;});

	for(int i=0; i<len3; i++)
		std::cout<<abcList[i]<<std::endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:14: error: 'sort' is not a member of 'std'; did you mean 'sqrt'?
   34 |         std::sort(abList.begin(), abList.end(), [](long long a, long long b){return a>b;});
      |              ^~~~
      |              sqrt
a.cc:35:14: error: 'sort' is not a member of 'std'; did you mean 'sqrt'?
   35 |         std::sort(cList.begin(), cList.end(), [](long long a, long long b){return a>b;});
      |              ^~~~
      |              sqrt
a.cc:45:14: error: 'sort' is not a member of 'std'; did you mean 'sqrt'?
   45 |         std::sort(abcList.begin(), abcList.end(), [](long long a, long long b){return a>b;});
      |              ^~~~
      |              sqrt
Language: C++

#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecstr vector<string>
#define vecch vector<char>
#define vecpii vector<pii>
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}

string strin(){string s;cin>>s;return s;}
char chin(){char c;cin>>c;return c;}
ll lin() {ll x;scanf("%lld",&x);return x;}
const bool bl[１００１][1001][1001];
int main(){
    int x=in(),y=in(),z=in(),K=in();
    vecll a(x),b(y),c(z);
    rep(i,x)a[i]=lin();
    rep(i,y)b[i]=lin();
    rep(i,z)c[i]=lin();
    sort(ALL(a),greater<ll>());
    sort(ALL(b),greater<ll>());
    sort(ALL(c),greater<ll>());
    priority_queue<pair<ll,pair<int,pii>>> que;
    que.push(make_pair(a[0]+b[0]+c[0],make_pair(0,make_pair(0,0))));
    rep(m,K){
        ll p=que.top().first;
        int i=que.top().second.first,j=que.top().second.second.first,k=que.top().second.second.second;
        cout<<p<<endl;
        que.pop();
        if(i<x-1 && !bl[i+1][j][k]){
            que.push(make_pair(a[i+1]+b[j]+c[k],make_pair(i+1, make_pair(j, k))));
            bl[i+1][j][k]=true;
        }
        if(j<y-1 && !bl[i][j+1][k]){
            que.push(make_pair(a[i]+b[j+1]+c[k],make_pair(i, make_pair(j+1, k))));
            bl[i][j+1][k]=true;
        }
        if(k<z-1 && !bl[i][j][k+1]){
            que.push(make_pair(a[i]+b[j]+c[k+1],make_pair(i, make_pair(j, k+1))));
            bl[i][j][k+1]=true;
        }
    }
}

Compiler output:
a.cc:48:15: error: '\U0000ff11\U0000ff10\U0000ff10\U0000ff11' was not declared in this scope
   48 | const bool bl[１００１][1001][1001];
      |               ^~~~~~~~
a.cc: In function 'int main()':
a.cc:65:22: error: 'bl' was not declared in this scope; did you mean 'b'?
   65 |         if(i<x-1 && !bl[i+1][j][k]){
      |                      ^~
      |                      b
a.cc:69:22: error: 'bl' was not declared in this scope; did you mean 'b'?
   69 |         if(j<y-1 && !bl[i][j+1][k]){
      |                      ^~
      |                      b
a.cc:73:22: error: 'bl' was not declared in this scope; did you mean 'b'?
   73 |         if(k<z-1 && !bl[i][j][k+1]){
      |                      ^~
      |                      b
Language: C++

#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecstr vector<string>
#define vecch vector<char>
#define vecpii vector<pii>
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}

string strin(){string s;cin>>s;return s;}
char chin(){char c;cin>>c;return c;}
ll lin() {ll x;scanf("%lld",&x);return x;}
    bool bl[１００１][1001][1001];
int main(){
    int x=in(),y=in(),z=in(),K=in();
    vecll a(x),b(y),c(z);
    rep(i,x)a[i]=lin();
    rep(i,y)b[i]=lin();
    rep(i,z)c[i]=lin();
    sort(ALL(a),greater<ll>());
    sort(ALL(b),greater<ll>());
    sort(ALL(c),greater<ll>());
    priority_queue<pair<ll,pair<int,pii>>> que;
    que.push(make_pair(a[0]+b[0]+c[0],make_pair(0,make_pair(0,0))));
    rep(m,K){
        ll p=que.top().first;
        int i=que.top().second.first,j=que.top().second.second.first,k=que.top().second.second.second;
        cout<<p<<endl;
        que.pop();
        if(i<x-1 && !bl[i+1][j][k]){
            que.push(make_pair(a[i+1]+b[j]+c[k],make_pair(i+1, make_pair(j, k))));
            bl[i+1][j][k]=true;
        }
        if(j<y-1 && !bl[i][j+1][k]){
            que.push(make_pair(a[i]+b[j+1]+c[k],make_pair(i, make_pair(j+1, k))));
            bl[i][j+1][k]=true;
        }
        if(k<z-1 && !bl[i][j][k+1]){
            que.push(make_pair(a[i]+b[j]+c[k+1],make_pair(i, make_pair(j, k+1))));
            bl[i][j][k+1]=true;
        }
    }
}

Compiler output:
a.cc:48:13: error: '\U0000ff11\U0000ff10\U0000ff10\U0000ff11' was not declared in this scope
   48 |     bool bl[１００１][1001][1001];
      |             ^~~~~~~~
a.cc: In function 'int main()':
a.cc:65:22: error: 'bl' was not declared in this scope; did you mean 'b'?
   65 |         if(i<x-1 && !bl[i+1][j][k]){
      |                      ^~
      |                      b
a.cc:69:22: error: 'bl' was not declared in this scope; did you mean 'b'?
   69 |         if(j<y-1 && !bl[i][j+1][k]){
      |                      ^~
      |                      b
a.cc:73:22: error: 'bl' was not declared in this scope; did you mean 'b'?
   73 |         if(k<z-1 && !bl[i][j][k+1]){
      |                      ^~
      |                      b
Language: C++

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

class Candle {
 public:
  long long value;
  int a_i, b_i, c_i;
  Candle(long long value,
         int a_i,int b_i,int c_i) :
    value(value),
    a_i(a_i),
    b_i(b_i),
    c_i(c_i) {};

  bool operator < (const Candle &c) const {
    return c.value > value;
  }
};

int main() {
  int X,Y,Z;
  long long K;
  cin >> X >> Y >> Z >> K;
  long long A[X];
  long long B[Y];
  long long 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, A+X, greater<long long>());
  sort(B, B+Y, greater<long long>());
  sort(C, C+Z, greater<long long>());
  priority_queue<Candle> q;
  Candle candle(A[0]+B[0]+C[0], 0, 0, 0);
  bool registered[X*Y*Z];
  for (int i = 0; i < X; i++) {
    for (int j = 0; j < Y; j++) {
      for (int k = 0; k < Z; k++) {
        registered[i+j*X+k*(X+Y)] = false;
      }
    }
  }
  //registered[0][0][0] = true;
  q.push(candle);
  return 0;
  for (long long i = 0; i < K; i++) {
    Candle top_candle = q.top();
    q.pop();
    cout << top_candle.value << endl;
    int a_i = top_candle.a_i;
    int b_i = top_candle.b_i;
    int c_i = top_candle.c_i;
    if (a_i+1 < X && !registered[a_i+1][b_i][c_i]) {
      registered[a_i+1][b_i][c_i] = true;
      Candle new_candle(A[a_i+1]+B[b_i]+C[c_i],
                        a_i+1, b_i, c_i);
      q.push(new_candle);
    }
    if (b_i+1 < Y && !registered[a_i][b_i+1][c_i]) {
      registered[a_i][b_i+1][c_i] = true;
      Candle new_candle(A[a_i]+B[b_i+1]+C[c_i],
                        a_i, b_i+1, c_i);
      q.push(new_candle);
    }
    if (c_i+1 < Z && !registered[a_i][b_i][c_i+1]) {
      registered[a_i][b_i][c_i+1] = true;
      Candle new_candle(A[a_i]+B[b_i]+C[c_i+1],
                        a_i, b_i, c_i+1);
      q.push(new_candle);
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:40: error: invalid types 'bool[int]' for array subscript
   62 |     if (a_i+1 < X && !registered[a_i+1][b_i][c_i]) {
      |                                        ^
a.cc:63:24: error: invalid types 'bool[int]' for array subscript
   63 |       registered[a_i+1][b_i][c_i] = true;
      |                        ^
a.cc:68:38: error: invalid types 'bool[int]' for array subscript
   68 |     if (b_i+1 < Y && !registered[a_i][b_i+1][c_i]) {
      |                                      ^
a.cc:69:22: error: invalid types 'bool[int]' for array subscript
   69 |       registered[a_i][b_i+1][c_i] = true;
      |                      ^
a.cc:74:38: error: invalid types 'bool[int]' for array subscript
   74 |     if (c_i+1 < Z && !registered[a_i][b_i][c_i+1]) {
      |                                      ^
a.cc:75:22: error: invalid types 'bool[int]' for array subscript
   75 |       registered[a_i][b_i][c_i+1] = true;
      |                      ^
Language: C++


  vector<ll> a1;
  REP(i,x) REP(j,y) {
    a1.pb(a[i]+b[j]);
  }
  sort(a1.rbegin(),a1.rend());
  vector<ll> a2;
  REP(i,min(k,(int)sz(a1))) REP(j,z) {
    a2.pb(a1[i]+c[j]);
  }
  sort(a2.rbegin(),a2.rend());
  REP(i,k) cout << a2[i] << endl;
  return 0;
}


Compiler output:
a.cc:2:3: error: 'vector' does not name a type
    2 |   vector<ll> a1;
      |   ^~~~~~
a.cc:3:6: error: expected constructor, destructor, or type conversion before '(' token
    3 |   REP(i,x) REP(j,y) {
      |      ^
a.cc:6:7: error: expected constructor, destructor, or type conversion before '(' token
    6 |   sort(a1.rbegin(),a1.rend());
      |       ^
a.cc:7:3: error: 'vector' does not name a type
    7 |   vector<ll> a2;
      |   ^~~~~~
a.cc:8:6: error: expected constructor, destructor, or type conversion before '(' token
    8 |   REP(i,min(k,(int)sz(a1))) REP(j,z) {
      |      ^
a.cc:11:7: error: expected constructor, destructor, or type conversion before '(' token
   11 |   sort(a2.rbegin(),a2.rend());
      |       ^
a.cc:12:6: error: expected constructor, destructor, or type conversion before '(' token
   12 |   REP(i,k) cout << a2[i] << endl;
      |      ^
a.cc:13:3: error: expected unqualified-id before 'return'
   13 |   return 0;
      |   ^~~~~~
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
Language: C++

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

class Candle {
 public:
  long long value;
  int a_i, b_i, c_i;
  Candle(long long value,
         int a_i,int b_i,int c_i) :
    value(value),
    a_i(a_i),
    b_i(b_i),
    c_i(c_i) {};

  bool operator < (const Candle &c) const {
    return c.value > value;
  }
};

int main() {
  int X,Y,Z;
  long long K;
  cin >> X >> Y >> Z >> K;
  vector<long long> A;
  vector<long long> B;
  vector<long long> C;

  A.resize(X);
  B.resize(Y);
  C.resize(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];
  }
  for (int i = 0; i < X; i++) {
    for (int j = 0; j < Y; j++) {
      for (int k = 0; k < Z; k++) {
        registered[i][j][k] = false;
      }
    }
  }
  sort(A.begin(), A.end(), greater<long long>());
  sort(B.begin(), B.end(), greater<long long>());
  sort(C.begin(), C.end(), greater<long long>());
  priority_queue<Candle> q;
  Candle candle(A[0]+B[0]+C[0], 0, 0, 0);
  return 0;
  bool registered[X][Y][Z];
  registered[0][0][0] = true;
  q.push(candle);
  for (long long i = 0; i < K; i++) {
    Candle top_candle = q.top();
    q.pop();
    cout << top_candle.value << endl;
    int a_i = top_candle.a_i;
    int b_i = top_candle.b_i;
    int c_i = top_candle.c_i;
    if (a_i+1 < X && !registered[a_i+1][b_i][c_i]) {
      registered[a_i+1][b_i][c_i] = true;
      Candle new_candle(A[a_i+1]+B[b_i]+C[c_i],
                        a_i+1, b_i, c_i);
      q.push(new_candle);
    }
    if (b_i+1 < Y && !registered[a_i][b_i+1][c_i]) {
      registered[a_i][b_i+1][c_i] = true;
      Candle new_candle(A[a_i]+B[b_i+1]+C[c_i],
                        a_i, b_i+1, c_i);
      q.push(new_candle);
    }
    if (c_i+1 < Z && !registered[a_i][b_i][c_i+1]) {
      registered[a_i][b_i][c_i+1] = true;
      Candle new_candle(A[a_i]+B[b_i]+C[c_i+1],
                        a_i, b_i, c_i+1);
      q.push(new_candle);
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:9: error: 'registered' was not declared in this scope; did you mean 'register_t'?
   45 |         registered[i][j][k] = false;
      |         ^~~~~~~~~~
      |         register_t
Language: C++

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl

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

  vl A(X);
  vl B(Y);
  vl C(Z);

  FOR(i, 0, X) { cin >> A[i]; }
  FOR(i, 0, Y) { cin >> B[i]; }
  FOR(i, 0, Z) { cin >> C[i]; }

  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());  //降順ソート
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());  //降順ソート
  sort(C.begin(), C.end());
  reverse(C.begin(), C.end());  //降順ソート

  int a, b, c;
  ll rep = A[0] + B[0] + C[0];

  priority_queue<ll> PQ;

  FOR(i, 0, min(X, K)) {
    FOR(j, 0, min(Z,Y) {
      FOR(k, 0, min(Z, K)) {
        if ((i + 1) * (j * 1) * (k * 1) <= K)
          PQ.push(A[i] + B[j] + C[k]);
        else
          break;
      }
    }
  }

  FOR(i, 0, K) {
    cout << PQ.top() << endl;
    PQ.pop();
  }
}

Compiler output:
a.cc:58:2: error: unterminated argument list invoking macro "FOR"
   58 | }
      |  ^
a.cc: In function 'int main()':
a.cc:44:5: error: 'FOR' was not declared in this scope
   44 |     FOR(j, 0, min(Z,Y) {
      |     ^~~
a.cc:44:8: error: expected '}' at end of input
   44 |     FOR(j, 0, min(Z,Y) {
      |        ^
a.cc:43:24: note: to match this '{'
   43 |   FOR(i, 0, min(X, K)) {
      |                        ^
a.cc:44:8: error: expected '}' at end of input
   44 |     FOR(j, 0, min(Z,Y) {
      |        ^
a.cc:19:12: note: to match this '{'
   19 | int main() {
      |            ^
Language: C++

import sys
from collections import deque
import heapq
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [X, Y, Z, K] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2]), int(input_raw[3])]

    input_raw = read_func().strip().split()
    A = [long(input_raw[i]) for i in range(X)]
    input_raw = read_func().strip().split()
    B = [long(input_raw[i]) for i in range(Y)]
    input_raw = read_func().strip().split()
    C = [long(input_raw[i]) for i in range(Z)]

    count = 0
    BC = []
    for i in range(X):
        for j in range(Z):
            heapq.heappush(BC, -(B[i] + C[j]))

    A.sort(reverse = True)

    T = []
    for j in range(min(K, len(BC))):
        bc = -heapq.heappop(BC)
        for i in range(X):
            heapq.heappush(T, -(A[i] + bc))

    for i in range(K):
        t = -heapq.heappop(T)
        print t

if __name__ == '__main__':
    main()


Compiler output:
a.cc:48:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   48 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:20:5: error: 'input_raw' does not name a type
   20 |     input_raw = read_func().strip().split()
      |     ^~~~~~~~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <functional> 

using namespace std;
typedef long l;

int main(){
	int x,y,z;
    long k;
	cin>>x>>y>>z>>k;
  	vector<l> a(x,0);
  	for(int i=0;i<x;i++)
      cin>>a[i];
  	vector<l> b(y,0);
  	for(int i=0;i<y;i++)
      cin>>b[i];
  	vector<l> c(z,0);
  	for(int i=0;i<z;i++)
      cin>>c[i];
  	set<l, greater<l>> res;
  	for(int i=0;i<x;i++){
      for(int j=0;j<y;j++){
        for(int g=0;g<z;g++){
          res.insert(a[i]+b[j]+c[g]);
          if(long long res.size()>k) res.erase(res.end());
        }
      }
    }
  	for(auto it=res.begin();it!=res.end();it++)
      cout<<*it;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:27: error: expected initializer before '.' token
   34 |           if(long long res.size()>k) res.erase(res.end());
      |                           ^
a.cc:34:27: error: expected ')' before '.' token
   34 |           if(long long res.size()>k) res.erase(res.end());
      |             ~             ^
      |                           )
a.cc:34:42: error: request for member 'erase' in 'res', which is of non-class type 'long long int'
   34 |           if(long long res.size()>k) res.erase(res.end());
      |                                          ^~~~~
a.cc:34:52: error: request for member 'end' in 'res', which is of non-class type 'long long int'
   34 |           if(long long res.size()>k) res.erase(res.end());
      |                                                    ^~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <functional> 

using namespace std;
typedef long l;

int main(){
	int x,y,z,k;
	cin>>x>>y>>z>>k;
  	vector<l> a(x,0);
  	for(int i=0;i<x;i++)
      cin>>a[i];
  	vector<l> b(y,0);
  	for(int i=0;i<y;i++)
      cin>>b[i];
  	vector<l> c(z,0);
  	for(int i=0;i<z;i++)
      cin>>c[i];
  	set<l, greater<l>> s;
  	for(int i=0;i<x;i++){
      for(int j=0;j<y;j++){
        for(int g=0;g<z;g++){
          res.insert(a[i]+b[j]+c[g]);
          if(res.size()>k) res.erase(res.end());
        }
      }
    }
  	for(auto it=res.begin();it!=res.end();it++)
      cout<<*it;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:11: error: 'res' was not declared in this scope
   32 |           res.insert(a[i]+b[j]+c[g]);
      |           ^~~
a.cc:37:21: error: 'res' was not declared in this scope
   37 |         for(auto it=res.begin();it!=res.end();it++)
      |                     ^~~
Language: C++

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

int main() {
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  
  vector<long long> A(x);
  vector<long long> B(y);
  vector<long long> C(z);
  
  int i, j, h;
  long long l = 0, m = 0;
  for(i = 0; i < x; i++){
    cin >> A.at(i);
  }
  
  for(i = 0; i < y; i++){
    cin >> B.at(i);
  }
  
  for(i = 0; i < z; i++){
    cin >> C.at(i);
  }
  
  vector<long long> D(x * y);
  vector<long long> E(x * y * z);
  for(i = 0; i < x; i++){
    for(j = 0; j < y; j++){
        D.at(l) += A.at(i) + B.at(j);
        l++;
      }
    }
  }
  
  sort(D.begin(), D.end());
  reverse(D.begin(), D.end());

  for(l = 0; l < k; l++){
    for(j = 0; j < z; j++){
        E.at(m) = D.at(l) + C.at(j);
        m++;
      }
    }
  }
  
  sort(E.begin(), E.end());
  reverse(E.begin(), E.end());

  for(l = 0; l < k; l++){
  cout << E.at(l) << endl;
  }
}


Compiler output:
a.cc:36:7: error: expected constructor, destructor, or type conversion before '(' token
   36 |   sort(D.begin(), D.end());
      |       ^
a.cc:37:10: error: expected constructor, destructor, or type conversion before '(' token
   37 |   reverse(D.begin(), D.end());
      |          ^
a.cc:39:3: error: expected unqualified-id before 'for'
   39 |   for(l = 0; l < k; l++){
      |   ^~~
a.cc:39:14: error: 'l' does not name a type
   39 |   for(l = 0; l < k; l++){
      |              ^
a.cc:39:21: error: 'l' does not name a type
   39 |   for(l = 0; l < k; l++){
      |                     ^
a.cc:45:3: error: expected declaration before '}' token
   45 |   }
      |   ^
a.cc:47:7: error: expected constructor, destructor, or type conversion before '(' token
   47 |   sort(E.begin(), E.end());
      |       ^
a.cc:48:10: error: expected constructor, destructor, or type conversion before '(' token
   48 |   reverse(E.begin(), E.end());
      |          ^
a.cc:50:3: error: expected unqualified-id before 'for'
   50 |   for(l = 0; l < k; l++){
      |   ^~~
a.cc:50:14: error: 'l' does not name a type
   50 |   for(l = 0; l < k; l++){
      |              ^
a.cc:50:21: error: 'l' does not name a type
   50 |   for(l = 0; l < k; l++){
      |                     ^
a.cc:53:1: error: expected declaration before '}' token
   53 | }
      | ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>
#include <functional> 

using namespace std;
typedef long l;

int main(){
	int x,y,z,k;
	cin>>x>>y>>z>>k;
  	vector<l> a(x,0);
  	for(int i=0;i<x;i++)
      cin>>a[i];
  	vector<l> b(y,0);
  	for(int i=0;i<y;i++)
      cin>>b[i];
  	vector<l> c(z,0);
  	for(int i=0;i<z;i++)
      cin>>c[i];
  	set<l, std::greater> s;
  	for(int i=0;i<x;i++){
      for(int j=0;j<y;j++){
        for(int g=0;g<z;g++){
          res.insert(a[i]+b[j]+c[g]);
          if(res.size()>k) res.erase(res.end());
        }
      }
    }
  	for(auto it=res.begin();it!=res.end();it++)
      cout<<*it;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:28: error: type/value mismatch at argument 2 in template parameter list for 'template<class _Key, class _Compare, class _Alloc> class std::set'
   28 |         set<l, std::greater> s;
      |                            ^
a.cc:28:28: note:   expected a type, got 'greater'
a.cc:32:11: error: 'res' was not declared in this scope
   32 |           res.insert(a[i]+b[j]+c[g]);
      |           ^~~
a.cc:37:21: error: 'res' was not declared in this scope
   37 |         for(auto it=res.begin();it!=res.end();it++)
      |                     ^~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>

using namespace std;
typedef long l;

int main(){
	int x,y,z,k;
	cin>>x>>y>>z>>k;
  	vector<l> a(x,0);
  	for(int i=0;i<x;i++)
      cin>>a[i];
  	vector<l> b(y,0);
  	for(int i=0;i<y;i++)
      cin>>b[i];
  	vector<l> c(z,0);
  	for(int i=0;i<z;i++)
      cin>>c[i];
  	set<int, std::greater> s;
  	for(int i=0;i<x;i++){
      for(int j=0;j<y;j++){
        for(int g=0;g<z;g++){
          res.insert(a[i]+b[j]+c[g]);
          if(res.size()>k) res.erase(res.end());
        }
      }
    }
  	for(auto it=res.begin();it!=res.end();it++)
      cout<<*it;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:30: error: type/value mismatch at argument 2 in template parameter list for 'template<class _Key, class _Compare, class _Alloc> class std::set'
   27 |         set<int, std::greater> s;
      |                              ^
a.cc:27:30: note:   expected a type, got 'greater'
a.cc:31:11: error: 'res' was not declared in this scope
   31 |           res.insert(a[i]+b[j]+c[g]);
      |           ^~~
a.cc:36:21: error: 'res' was not declared in this scope
   36 |         for(auto it=res.begin();it!=res.end();it++)
      |                     ^~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>

using namespace std;
typedef long l;

int main(){
	int x,y,z,k;
	cin>>x>>y>>z>>k;
  	vector<l> a(x,0);
  	for(int i=0;i<x;i++)
      cin>>a[i];
  	vector<l> b(y,0);
  	for(int i=0;i<y;i++)
      cin>>b[i];
  	vector<l> c(z,0);
  	for(int i=0;i<z;i++)
      cin>>c[i];
  	set<l,greater> res;
  	for(int i=0;i<x;i++){
      for(int j=0;j<y;j++){
        for(int g=0;g<z;g++){
          res.insert(a[i]+b[j]+c[g]);
          if(res.size()>k) res.erase(res.end());
        }
      }
    }
  	for(auto it=res.begin();it!=res.end();it++)
      cout<<*it;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:22: error: type/value mismatch at argument 2 in template parameter list for 'template<class _Key, class _Compare, class _Alloc> class std::set'
   27 |         set<l,greater> res;
      |                      ^
a.cc:27:22: note:   expected a type, got 'greater'
a.cc:31:15: error: request for member 'insert' in 'res', which is of non-class type 'int'
   31 |           res.insert(a[i]+b[j]+c[g]);
      |               ^~~~~~
a.cc:32:18: error: request for member 'size' in 'res', which is of non-class type 'int'
   32 |           if(res.size()>k) res.erase(res.end());
      |                  ^~~~
a.cc:32:32: error: request for member 'erase' in 'res', which is of non-class type 'int'
   32 |           if(res.size()>k) res.erase(res.end());
      |                                ^~~~~
a.cc:32:42: error: request for member 'end' in 'res', which is of non-class type 'int'
   32 |           if(res.size()>k) res.erase(res.end());
      |                                          ^~~
a.cc:36:25: error: request for member 'begin' in 'res', which is of non-class type 'int'
   36 |         for(auto it=res.begin();it!=res.end();it++)
      |                         ^~~~~
a.cc:36:41: error: request for member 'end' in 'res', which is of non-class type 'int'
   36 |         for(auto it=res.begin();it!=res.end();it++)
      |                                         ^~~
Language: C++

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

int main() {
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  
  vector<long long> A(x);
  vector<long long> B(y);
  vector<long long> C(z);
  
  int i, j, h;
  long long l = 0;
  for(i = 0; i < x; i++){
    cin >> A.at(i);
  }
  
  for(i = 0; i < y; i++){
    cin >> B.at(i);
  }
  
  for(i = 0; i < z; i++){
    cin >> C.at(i);
  }
  
  vector<long long> D(x * y * z);
  for(i = 0; i < x; i++){
    for(j = 0; j < y; j++){
        D.at(l) += A.at(i) + B.at(j);
        l++;
      }
    }
  }
  
  sort(D.begin(), D.end());
  reverse(D.begin(), D.end());

  for(l = 0; l < k; l++){
    for(j = 0; j < z; j++){
        D.at(l) += C.at(j);
        l++;
      }
    }
  }
  
  sort(D.begin(), D.end());
  reverse(D.begin(), D.end());

  for(l = 0; l < k; l++){
  cout << D.at(l) << endl;
  }
}


Compiler output:
a.cc:35:7: error: expected constructor, destructor, or type conversion before '(' token
   35 |   sort(D.begin(), D.end());
      |       ^
a.cc:36:10: error: expected constructor, destructor, or type conversion before '(' token
   36 |   reverse(D.begin(), D.end());
      |          ^
a.cc:38:3: error: expected unqualified-id before 'for'
   38 |   for(l = 0; l < k; l++){
      |   ^~~
a.cc:38:14: error: 'l' does not name a type
   38 |   for(l = 0; l < k; l++){
      |              ^
a.cc:38:21: error: 'l' does not name a type
   38 |   for(l = 0; l < k; l++){
      |                     ^
a.cc:44:3: error: expected declaration before '}' token
   44 |   }
      |   ^
a.cc:46:7: error: expected constructor, destructor, or type conversion before '(' token
   46 |   sort(D.begin(), D.end());
      |       ^
a.cc:47:10: error: expected constructor, destructor, or type conversion before '(' token
   47 |   reverse(D.begin(), D.end());
      |          ^
a.cc:49:3: error: expected unqualified-id before 'for'
   49 |   for(l = 0; l < k; l++){
      |   ^~~
a.cc:49:14: error: 'l' does not name a type
   49 |   for(l = 0; l < k; l++){
      |              ^
a.cc:49:21: error: 'l' does not name a type
   49 |   for(l = 0; l < k; l++){
      |                     ^
a.cc:52:1: error: expected declaration before '}' token
   52 | }
      | ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>

using namespace std;
typedef long l;

int main(){
	int x,y,z,k;
	cin>>l>>x>>z>>k;
  	vector<l> a(x,0);
  	for(int i=0;i<x;i++)
      cin>>a[i];
  	vector<l> b(y,0);
  	for(int i=0;i<y;i++)
      cin>>b[i];
  	vector<l> c(z,0);
  	for(int i=0;i<z;i++)
      cin>>c[i];
  	set<l,greater> res;
  	for(int i=0;i<x;i++){
      for(int j=0;j<y;j++){
        for(int g=0;g<z;g++){
          res.insert(a[i]+b[j]+c[g]);
          if(res.size()>k) res.erase(res.end());
        }
      }
    }
  	for(auto it=res.begin();it!=res.end();it++)
      cout<<*it;
  	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:15: error: expected primary-expression before '>>' token
   17 |         cin>>l>>x>>z>>k;
      |               ^~
a.cc:27:22: error: type/value mismatch at argument 2 in template parameter list for 'template<class _Key, class _Compare, class _Alloc> class std::set'
   27 |         set<l,greater> res;
      |                      ^
a.cc:27:22: note:   expected a type, got 'greater'
a.cc:31:15: error: request for member 'insert' in 'res', which is of non-class type 'int'
   31 |           res.insert(a[i]+b[j]+c[g]);
      |               ^~~~~~
a.cc:32:18: error: request for member 'size' in 'res', which is of non-class type 'int'
   32 |           if(res.size()>k) res.erase(res.end());
      |                  ^~~~
a.cc:32:32: error: request for member 'erase' in 'res', which is of non-class type 'int'
   32 |           if(res.size()>k) res.erase(res.end());
      |                                ^~~~~
a.cc:32:42: error: request for member 'end' in 'res', which is of non-class type 'int'
   32 |           if(res.size()>k) res.erase(res.end());
      |                                          ^~~
a.cc:36:25: error: request for member 'begin' in 'res', which is of non-class type 'int'
   36 |         for(auto it=res.begin();it!=res.end();it++)
      |                         ^~~~~
a.cc:36:41: error: request for member 'end' in 'res', which is of non-class type 'int'
   36 |         for(auto it=res.begin();it!=res.end();it++)
      |                                         ^~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

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

	sort(a,a+x);
	reverse(a.begin(),a.end());
	sort(b,b+y);
	reverse(b.begin(),b.end());
	sort(c,c+z);
	reverse(c.begin(),c.end());

	long long aa,bb,cc;

	x>k ? aa=k : aa=x;
	y>k ? bb=k : bb=y;
	z>k ? cc=k : cc=z;
	
	long long h[aa*bb*cc];

	for(i=0;i<aa;i++) for(ii=0;ii<bb;ii++) for(iii=0;iii<cc;iii++) h[i+ii+iii] = a[i]+b[ii]+c[iii];
	sort(h,h+k);
	reverse(h.begin(),h.end());

	for(i=0;i<k;i++) cout << h[i] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: request for member 'begin' in 'a', which is of non-class type 'long long int [x]'
   15 |         reverse(a.begin(),a.end());
      |                   ^~~~~
a.cc:15:29: error: request for member 'end' in 'a', which is of non-class type 'long long int [x]'
   15 |         reverse(a.begin(),a.end());
      |                             ^~~
a.cc:17:19: error: request for member 'begin' in 'b', which is of non-class type 'long long int [y]'
   17 |         reverse(b.begin(),b.end());
      |                   ^~~~~
a.cc:17:29: error: request for member 'end' in 'b', which is of non-class type 'long long int [y]'
   17 |         reverse(b.begin(),b.end());
      |                             ^~~
a.cc:19:19: error: request for member 'begin' in 'c', which is of non-class type 'long long int [z]'
   19 |         reverse(c.begin(),c.end());
      |                   ^~~~~
a.cc:19:29: error: request for member 'end' in 'c', which is of non-class type 'long long int [z]'
   19 |         reverse(c.begin(),c.end());
      |                             ^~~
a.cc:31:19: error: request for member 'begin' in 'h', which is of non-class type 'long long int [((aa * bb) * cc)]'
   31 |         reverse(h.begin(),h.end());
      |                   ^~~~~
a.cc:31:29: error: request for member 'end' in 'h', which is of non-class type 'long long int [((aa * bb) * cc)]'
   31 |         reverse(h.begin(),h.end());
      |                             ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
ull X,Y,Z,K;
vector<ull> A,B,C;
vector<ull> v1;
vector<ull> v2;
 
constexpr int d1 = 1000;
bool visited1[d1][d1];
bool visited2[d1][d1];

void dfs1(ull i, ull j){
  if(i<X&&j<Y&&!visited1[i][j]){
    v1.push_back(A[i]+B[j]);
    visited1[i][j] = 1;
    dfs1(i+1, j);
    dfs1(i, j+1);
  }
}
void dfs2(ull i, ull j){
  if(i<d2&&j<Z&&!visited2[i][j]){
    v2.push_back(v1[i]+C[j]);
    visited2[i][j] = 1;
    dfs2(i+1, j);
    dfs2(i, j+1);
  }
}
 
int main(){
  cin>>X>>Y>>Z>>K;
  for(int i=0;i<X;i++){ ull a; cin>>a; A.push_back(a); }
  for(int i=0;i<Y;i++){ ull a; cin>>a; B.push_back(a); }
  for(int i=0;i<Z;i++){ ull a; cin>>a; C.push_back(a); }
  sort(A.begin(), A.end(), greater<ull>()); sort(B.begin(), B.end(), greater<ull>()); sort(C.begin(), C.end(), greater<ull>());
  
  dfs1(0,0);
  sort(v1.begin(),v1.end(),greater<ull>());
  erase(v1.begin()+K,v1.end());
  dfs2(0,0);
  sort(v2.begin(),v2.end(),greater<ull>());
  for(int i=0;i<K;i++){
    cout<<v2[i]<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'void dfs2(ull, ull)':
a.cc:30:8: error: 'd2' was not declared in this scope; did you mean 'v2'?
   30 |   if(i<d2&&j<Z&&!visited2[i][j]){
      |        ^~
      |        v2
a.cc: In function 'int main()':
a.cc:47:3: error: 'erase' was not declared in this scope
   47 |   erase(v1.begin()+K,v1.end());
      |   ^~~~~