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

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

int main(){
    long long x,y,z,k;
    cin>>x>>y>>z>>k;
    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> ans;

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

    ans.push_back(a[0]+b[0]+c[0]);

    bool used[x][y][z]={};
    used[0][0][0]=true;
    long long s=0,t=0,u=0;
    for(long long i=1;i<min((long long)100000,x*y*z);i++){
        
        if(s){
           if(t!=y-1 && !used[s-1][t+1][u] ) ans.push_back(a[s-1]+b[t+1]+c[u]);
           if(u!=z-1 && !used[s-1][t][u+1] ) ans.push_back(a[s-1]+b[t]+c[u+1]);
        }
        if(t){
            if(u!=z-1 && !used[s][t-1][u+1] ) ans.push_back(a[s]+b[t-1]+c[u+1]);
            if(s!=x-1 && !used[s+1][t-1][u] ) ans.push_back(a[s+1]+b[t-1]+c[u]);
        }
        if(u){
            if(t!=y-1 && !used[s][t+1][u-1] ) ans.push_back(a[s]+b[t+1]+c[u-1]);
            if(s!=x-1 && !used[s+1][t][u-1] ) ans.push_back(a[s+1]+b[t]+c[u-1]);
        }

        if(s!=x-1 && !used[s+1][t][u]) ans.push_back(a[s+1]+b[t]+c[u]);
        if(t!=y-1 && !used[s][t+1][u]) ans.push_back(a[s]+b[t+1]+c[u]);
        if(u!=z-1 && !used[s][t][u+1]) ans.push_back(a[s]+b[t]+c[u+1]);

        //cerr<<i<<" "<<ans[i]<<" "<<s<<" "<<t<<" "<<u<<endl;

        if(s){
           if(t!=y-1 && !used[s-1][t+1][u]){
           
               used[s-1][t+1][u]=true;
           
           }
           if(u!=z-1 && !used[s-1][t][u+1]){
      
               used[s-1][t][u+1]=true;
            
           }
        }
        if(t){
           if(s!=x-1 && !used[s+1][t-1][u]){
        
               used[s+1][t-1][u]=true;
          
           }
           if(u!=z-1 && !used[s][t-1][u+1]){
      
               used[s][t-1][u+1]=true;
            
           }
        }
        if(u){
           if(s!=x-1 && !used[s+1][t][u-1]){
         
               used[s+1][t][u-1]=true;
          
           }
           if(t!=y-1 && !used[s][t+1][u-1]){
       
               used[s][t+1][u-1]=true;
              
           }
        }

        if(s!=x-1 && !used[s+1][t][u]){
            used[s+1][t][u]=true;
            a++;
        
           
        }
        if(t!=y-1 && !used[s][t+1][u]){
            used[s][t+1][u]=true;
            t++;
       
           
        }
        if(u!=z-1 && !used[s][t][u+1]){
            used[s][t][u+1]=true; 
            u++;
        }
    }
     

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:92:13: error: lvalue required as increment operand
   92 |             a++;
      |             ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
int main(){
  ll X, Y, Z, K, tmp;
  cin >> X >> Y >> Z >> K;
  vector<ll> A, B, C;
  for (int i=0; i<X; i++){
    cin >> tmp;
    A.push_back(tmp);
  }
  for (int i=0; i<Y; i++){
    cin >> tmp;
    B.push_back(tmp);
  }
  for (int i=0; i<Z; i++){
    cin >> tmp;
    C.push_back(tmp);
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  ll pa = A.size() - 1; pb = B.size() - 1; pc = C.size() - 1;
  ll count = 0;
  ll sa, sb, sc;
  while(count < K){
    cout << A[pa] + B[pb] + C[pc];
    sa = A[pa] - A[pa - 1];
    sb = A[pb] - A[pb - 1];
    sc = A[pc] - A[pc - 1];
    if (pa < pb && pa < pc && pa >= 0)pa--;
    else if (pb < pa && pb < pc && pb >= 0)pb--;
    else if (pc >= 0)pc--;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: 'pb' was not declared in this scope; did you mean 'pa'?
   26 |   ll pa = A.size() - 1; pb = B.size() - 1; pc = C.size() - 1;
      |                         ^~
      |                         pa
a.cc:26:44: error: 'pc' was not declared in this scope; did you mean 'pa'?
   26 |   ll pa = A.size() - 1; pb = B.size() - 1; pc = C.size() - 1;
      |                                            ^~
      |                                            pa
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <climits>
using namespace std;

int main()
{
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vector<long long int> A(X+Y+Z);
  vector<int> label(X+Y+Z); // 0: A, 1: B, 2: C

  for(int i=0; i<X; i++){
    cin >> A[i];
    label[i] = 0;
  }
  for(int i=X; i<Y+X; i++){
    cin >> A[i];
    label[i] = 1;
  }
  for(int i=X+Y; i<X+Y+Z; i++){
    cin >> A[i];
    label[i] = 2;
  }
  std::vector<size_t> indices(A.size());
  std::iota(indices.begin(), indices.end(), 0);

  std::sort(indices.begin(), indices.end(), [&A](size_t i1, size_t i2) {
      return A[i1] < A[i2];
  });

  int a, b, c;
  for(int i=0; i < K; ++i){
    if(label[i] == 0){
      a = A[i];
    }else if(label[i] == 1){
      b = A[i];
    }else if(label[i] == 2){
      c = A[i];
    }
    cout << a + b + c << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:8: error: 'iota' is not a member of 'std'
   29 |   std::iota(indices.begin(), indices.end(), 0);
      |        ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
bool flg = false;
int main() {
  long long X, Y, Z, K;
  cin >> X;
  cin >> Y;
  cin >> Z;
  cin >> K;
  long long A[X], B[Y], C[Z];
  for (long long i = 0; i < X; i++) cin >> A[i];
  for (long long i = 0; i < Y; i++) cin >> B[i];
  for (long long 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>());
  long long A1[X], B1[Y], C1[Z];
  for (long long i = 0; i < X; i++) A1[i] = A[0] - A[i];
  for (long long i = 0; i < Y; i++) B1[i] = B[0] - B[i];
  for (long long i = 0; i < Z; i++) C1[i] = C[0] - C[i];
  cout << A[0] << "\n" << B[0] << "\n" << C[0] << "\n";
  int cnt = 0;
  long long ans = 0;
  while (cnt <= K) {
    for (int i = 0; i < 1000, i++) {
      if(A1[i+1]-A1[i] >= B1[i+1]-B1[i] && A1[i+1]-A1[i] >= C1[i+1]-C1[i]) {
        if(B1[i+1]-B1[i] >= C1[i+1]-C1[i]) {
          int j = i
          while(B1[i+1]-B1[i] >= C1[j+1]-C1[i]) {
            cnt++;
            j++;
            ans = A[i] + B[j] + C[k];
            cout << ans << "\n";
            if(cnt = K) {
              flg = true;
              break;
            }
          }
          j++;
          k=0;
          if(flg) break;
        }
        if(flg) break;
      }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:34: error: expected ';' before ')' token
   25 |     for (int i = 0; i < 1000, i++) {
      |                                  ^
      |                                  ;
a.cc:29:11: error: expected ',' or ';' before 'while'
   29 |           while(B1[i+1]-B1[i] >= C1[j+1]-C1[i]) {
      |           ^~~~~
a.cc:40:11: error: 'k' was not declared in this scope
   40 |           k=0;
      |           ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:24:20: note: to match this '{'
   24 |   while (cnt <= K) {
      |                    ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C

#include <stdio.h>
#include <stdlib.h>

long *V;
long LEN = 0;
long X, Y, Z, K;
long A[1000], B[1000], C[1000];

void swap(long i, long j) {
	long tmp = V[i];
	V[i] = V[j];
	V[j] = tmp;
}

void prlong() {
	for (long i = 0; i < LEN; i++) {
		prlongf("%ld, ", V[i]);
	}
	prlongf("\n");
}


void push(long ix, long val) {
	V[ix] = val;
	while (ix > 1 && V[ix / 2] < V[ix]) {
		// prlongf("+ ");
		// prlong();
		swap(ix, ix / 2);
		ix = ix / 2;
	}
	// prlong();
}

long pop() {
	long val = V[1];
	if (LEN > 1) {
		LEN--;
		V[1] = V[LEN];

		long ix = 1;
		while (ix * 2 < LEN) {
			if (ix * 2 + 1 < LEN) {
				if (V[ix] < V[ix * 2]) {
					if (V[ix * 2] < V[ix * 2 + 1]) {
						swap(ix, ix * 2 + 1);
						ix = ix * 2 + 1;
					} else {
						swap(ix, ix * 2);
						ix = ix * 2;
					}
				} else if (V[ix * 2] < V[ix * 2 + 1]) {
					swap(ix, ix * 2 + 1);
					ix = ix * 2 + 1;
				} else {
					break;
				}
			} else {
				if (V[ix] < V[ix * 2]) {
					swap(ix, ix * 2);
					ix = ix * 2;
				} else {
					break;
				}
			}
		}
	}
	return val;
}

long main() {
	scanf("%d %d %d %d\n", &X, &Y, &Z, &K);

	for (long i = 0; i < X; i++) {
		scanf("%ld", &A[i]);
	}
	for (long i = 0; i < Y; i++) {
		scanf("%ld", &B[i]);
	}
	for (long i = 0; i < Z; i++) {
		scanf("%ld", &C[i]);
	}
	V = (long*)calloc(X * Y * Z + 1, sizeof(long));
	LEN = 1;
	for (long a = 0; a < X; a++) {
		for (long b = 0; b < Y; b++) {
			for (long c = 0; c < Z; c++) {
				long v = A[a] + B[b] + C[c];
				push(LEN++, v);
			}
		}
	}
	if (LEN != X * Y * Z + 1) {
		exit(1);
	}
	// prlong();
	for (long i = 0; i < K; i++) {
		long v = pop();
		prlongf("%ld\n", v);
	}
}



Compiler output:
main.c: In function 'prlong':
main.c:17:17: error: implicit declaration of function 'prlongf'; did you mean 'prlong'? [-Wimplicit-function-declaration]
   17 |                 prlongf("%ld, ", V[i]);
      |                 ^~~~~~~
      |                 prlong
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

int next(int idx, int c, vector<pair<ll, int> > &p){
    for(int i = idx+1; idx < p.size(); i++){
        if(p[i].second == c){
            return i;
        }
    }
}

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

    vector<pair<ll, int> > pairs(x+y+z);
    ll d;
    int count = 0;
    for(int i=0; i<x; ++i){
        cin >> d;
        pairs[count] = make_pair(d, 0);
        count++;
    }
    for(int i=0; i<y; ++i){
        cin >> d;
        pairs[count] = make_pair(d, 1);
        count++;
    }
    for(int i=0; i<z; ++i){
        cin >> d;
        pairs[count] = make_pair(d, 2);
        count++;
    }

    sort(pairs.rbegin(), pairs.rend());
    ll ans;
    int idx_a = next(0, 0, pairs);
    int idx_b = next(0, 1, pairs);
    int idx_c = next(0, 2, pairs);
    cout << pairs[idx_a].first + pairs[idx_b].first + pairs[idx_c].first << endl;

    for(int i=1; i<k; i++){
        int max_idx = max(idx_a, idx_b, idx_c);
        int max_char;
        if(max_idx == idx_a){
            idx_a = next(idx_a, 0, pairs);
        }else if(max_idx == idx_b){
            idx_b = next(idx_b, 1, pairs);
        }else{
            idx_c = next(idx_c, 2, pairs);
        }
        cout << pairs[idx_a].first + pairs[idx_b].first + pairs[idx_c].first << endl;
    }

    return 0;
}

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::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:47:26:   required from here
   47 |         int max_idx = max(idx_a, idx_b, idx_c);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
a.cc: In function 'int next(int, int, std::vector<std::pair<long long int, int> >&)':
a.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^
Language: C++

def merge(x,y):
    ans = []
    l = len(x) + len(y)
    for i in range(l):
        if x[0] < y[0]:
            ans.append(y[0])
            if(len(y)<=1):
                ans.extend(x)
                break
            y = y[1:]
        else:
            ans.append(x[0])
            if(len(x)<=1):
                ans.extend(y)
                break
            x = x[1:]
    return ans

def sort(L):
    l = len(L)
    if l <= 1:
        return L
    else:
        b = l // 2
        left = sort(L[0:b])
        right = sort(L[b:])
        return merge(left,right)

k = 1
def sortK(L):
    l = len(L)
    if l <= 1:
        return L
    else:
        b = l // 2
        left = sort(L[0:b])
        right = sort(L[b:])
        return merge(left,right)[0:k]

def find(l,t):
    a = 0
    b = len(l)
    while (b-a) > 0:
        c = (a+b) // 2
        tmp = l[c] 
        if c > t:
            a = c
        else:
            b = c
    return a

X,Y,Z,k=(int(x) for x in input().split())
cake = []
for i in range(3):
    tmp=[]
    for x in input().split():
        tmp.append(int(x))
    cake.append(sort(tmp))
mix = sortK(cake[0].append(cake[1]).append(cake[2]))
y = mix[k]
a = find(cake[0],y)
b = find(cake[1],y)
c = find(cake[2],y)

ans = []
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            ans.append(cake[0][i] + cake[1][j] + cake[2][k])

hoge = sort(ans)

for i in range(k):
    print(hoge[i])


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def merge(x,y):
      | ^~~
Language: C++

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

int main() {
  int X, Y , Z, K;
  cin >> X >> Y >> Z >> K;
  vector<long> A, B, C;
  long tmp;
  for(int i = 0; i < X; ++i) {
    cin >> tmp;
    A.push_back(tmp);
  }
  for(int i = 0; i < Y; ++i) {
    cin >> tmp;
    B.push_back(tmp);
  }
  for(int i = 0; i < Z; ++i) {
    cin >> tmp;
    C.push_back(tmp);
  }  
  sort(A.begin(),A.end(),greater<long>());
  sort(B.begin(),B.end(),greater<long>());
  sort(C.begin(),C.end(),greater<long>());
  vector<long> vec;
  for (int i = 0; i < min(K,X); ++i) {
    for (int j = 0; j < min(K,Y); ++j) {
      for (int k = 0; k < min(K,Z); ++k) {
        vec.push_back(A[i] + B[j] + C[k]);
      }
    }
  }
  sort(vec.begin(),vec.end(),greater<long>());
  
  for(int i = 0; i < K; ++i) {
    cout << vec[i] << endl;
  }
  
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> X >> Y >> Z >> K;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:36:5: error: 'cout' was not declared in this scope
   36 |     cout << vec[i] << endl;
      |     ^~~~
a.cc:36:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:23: error: 'endl' was not declared in this scope
   36 |     cout << vec[i] << endl;
      |                       ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
int main(){
  ll X, Y, Z, K, tmp;
  cin >> X >> Y >> Z >> K;
  vector<ll> A, B, C;
  for (int i=0; i<X; i++){
    cin >> tmp;
    A.push_back(tmp);
  }
  for (int i=0; i<Y; i++){
    cin >> tmp;
    B.push_back(tmp);
  }
  for (int i=0; i<Z; i++){
    cin >> tmp;
    C.push_back(tmp);
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  ll pa = A.size() - 1; pb = B.size() - 1; pc = C.size() - 1;
  ll count = 0;
  ll sa, sb, sc;
  while(count < K){
    cout << A[pa] + B[pb] + C[pc];
    sa = A[pa] - A[pa - 1];
    sb = A[pb] - A[pb - 1];
    sc = A[pc] - A[pc - 1];
    if (pa < pb && pa < pc)pa--;
    else if (pb < pa && pb < pc)pb--;
    else pc--;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:25: error: 'pb' was not declared in this scope; did you mean 'pa'?
   26 |   ll pa = A.size() - 1; pb = B.size() - 1; pc = C.size() - 1;
      |                         ^~
      |                         pa
a.cc:26:44: error: 'pc' was not declared in this scope; did you mean 'pa'?
   26 |   ll pa = A.size() - 1; pb = B.size() - 1; pc = C.size() - 1;
      |                                            ^~
      |                                            pa
Language: C++

#include<iostream>
#include <string>   
using namespace std;
int main(){
    string min_b;
    long long int x[5],aa,n,k,a[11][1111],aaa[11];
    cin >> x[1] >> x[2] >> x[3] >> k;
    for(int i = 1;i <= 3; i++ ){
        for(int mm=1;mm<=1100;mm++){
            a[i][mm]=0;
        }
        aa = 0;
        for(int m = 1;m <= x[i];m++){
            cin>>n;
            aa+=1;
            if(aa==1){
                a[i][aa]=n;
            }else{
                for(int h = 1;h<=aa;h++){
                    if(a[i][h]<=n){
                        for(int u = aa;u >= h;u--){
                            a[i][u+1]=a[i][u];
                        }
                        a[i][h]=n;
                        goto xx;
                    }
                }
            }
            xx:;
        }
    }
    aaa[1]=1;
    aaa[2]=1;
    aaa[3]=1;
    int min_a=0;
    for(int i=1;i<=k;i++){
        if(i==1){
            cout << a[1][aaa[1]] + a[2][aaa[2]] + a[3][aaa[3]] << endl;
        }else{
            if(a[1][aaa[1]+1]>=a[2][aaa[2]]){
                min_a=a[1][aaa[1]+1];
                min_b = "a";
            }else{
                min_a=a[2][aaa[2]+1];
                min_b = "b";
            }
            if(min_a>=a[3][aaa[3]+1]){
                min_a=a[3][aaa[3]+1];
                min_b="c";
            }
            if(min_a=="a"){
                aaa[1]+=1;
            }
            if(min_b=="c"){
                aaa[2]+=1;
            }
            if(min_c=="d"){
                aaa[3]+=1;
            }
            cout << a[1][aaa[1]] + a[2][aaa[2]] + a[3][aaa[3]] << endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   51 |             if(min_a=="a"){
      |                ~~~~~^~~~~
a.cc:57:16: error: 'min_c' was not declared in this scope; did you mean 'min_a'?
   57 |             if(min_c=="d"){
      |                ^~~~~
      |                min_a
Language: C++

#include <iostream>
#include <string>
typedef long long ll;
//#include <algorithm>
using namespace std;

int main() {
  int N[3];

  for(int i = 0; i < 3; i++){
    cin >> N[i];
  }

  int k;
  cin >> k;

  ll oisisa[3][2000];
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < N[i]; j++){
      cin >> oisisa[i][j];
    }
    oisisa[i][N[i]] = -10000000000;
  }

  for(int i = 0; i < 3; i++){
    std::sort(oisisa[i], oisisa[i] + N[i], greater<int>());
  }

  ll lastTotal = oisisa[0][0] + oisisa[1][0] + oisisa[2][0];
  //cout << lastTotal << endl;

  int i = 0;
  int indexs[] = {0,0,0};
  while(true){
    ll totals[8];
    totals[0] = oisisa[0][indexs[0]] + oisisa[1][indexs[1]] + oisisa[2][indexs[2]];
    totals[1] = oisisa[0][indexs[0]] + oisisa[1][indexs[1]] + oisisa[2][indexs[2] + 1];
    totals[2] = oisisa[0][indexs[0]] + oisisa[1][indexs[1] + 1] + oisisa[2][indexs[2]];
    totals[3] = oisisa[0][indexs[0]] + oisisa[1][indexs[1] + 1] + oisisa[2][indexs[2] + 1];
    totals[4] = oisisa[0][indexs[0] + 1] + oisisa[1][indexs[1]] + oisisa[2][indexs[2]];
    totals[5] = oisisa[0][indexs[0] + 1] + oisisa[1][indexs[1]] + oisisa[2][indexs[2] + 1];
    totals[6] = oisisa[0][indexs[0] + 1] + oisisa[1][indexs[1] + 1] + oisisa[2][indexs[2]];
    totals[7] = oisisa[0][indexs[0] + 1] + oisisa[1][indexs[1] + 1] + oisisa[2][indexs[2] + 1];

    std::sort(totals, totals + 8, greater<ll>());

    for(int j = 0; j < 8; j++){
      if(i < k){
        cout << totals[j] << endl;
        i++;
      }else{
        return 0;
      }
    }

    ll mindelta = 10000000000;
    int minIndex = -1;
    for(int j = 0; j < 3; j++){
      ll delta = oisisa[j][indexs[j]] - oisisa[j][indexs[j] + 1];
      if(delta < mindelta){
        mindelta = delta;
        minIndex = j;
      }
    }

    indexs[minIndex]++;

  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   26 |     std::sort(oisisa[i], oisisa[i] + N[i], greater<int>());
      |          ^~~~
      |          qsort
a.cc:45:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   45 |     std::sort(totals, totals + 8, greater<ll>());
      |          ^~~~
      |          qsort
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++){
    D.at(l) += A.at(i)
    for(j = 0; j < y; j++){
      D.at(l) += B.at(j)
      for(h = 0; h < z; h++){
        D.at(l) += C.at(h);
        l++;
      }
    }
  }
  
  sort(D.begin(), D.end());
  
  for(l = 0; l < k; l++){
  cout << D.at(x * y * z - 1 - l) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: expected ';' before 'for'
   28 |     D.at(l) += A.at(i)
      |                       ^
      |                       ;
   29 |     for(j = 0; j < y; j++){
      |     ~~~                
a.cc:29:26: error: expected ';' before ')' token
   29 |     for(j = 0; j < y; j++){
      |                          ^
      |                          ;
Language: C++

#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
using namespace std;
#define ll long long

int main(){
    ll x, y, z, k, t;
    priority_queue<ll> pq;
    vector<ll> a, b, c, ans;
    scanf("%lld%lld%lld%lld" , &x, &y , &z ,&k);
    for(int i = 0; i < x; i++){
        scanf("%lld", &t);
        a.push_back(t);
    }
    for(int i = 0; i < x; i++){
        scanf("%lld", &t);
        b.push_back(t);
    }
    for(int i = 0; i < x; i++){
        scanf("%lld", &t);
        c.push_back(t);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    for(int i = 0; i < x; i++){
        for(int j = 0; j < y; j++){
            for(int h = 0; h < z; h++){
                pq.push(a[i] + b[j] + c[h]);
            }
        }
    }
    for(int i = 0; i < k; i++){
        printf("%lld\n", pq.top());
        pq.pop();
    }
    
}

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

#include<cstdio>
#include<queue>
#include<vector>
using namespace std;
#define ll long long

int main(){
    ll x, y, z, k, t;
    priority_queue<ll> pq;
    vector<ll> a, b, c, ans;
    scanf("%lld%lld%lld%lld" , &x, &y , &z ,&k);
    for(int i = 0; i < x; i++){
        scanf("%lld", &t);
        a.push_back(t);
    }
    for(int i = 0; i < x; i++){
        scanf("%lld", &t);
        b.push_back(t);
    }
    for(int i = 0; i < x; i++){
        scanf("%lld", &t);
        c.push_back(t);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    for(int i = 0; i < x; i++){
        for(int j = 0; j < y; j++){
            for(int h = 0; h < z; h++){
                pq.push(a[i] + b[j] + c[h]);
            }
        }
    }
    for(int i = 0; i < k; i++){
        printf("%lld\n", pq.top());
        pq.pop();
    }
    
}

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

#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
  long long x,y,z,k,ans;
  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];
  }
  long long m=1;
  m=((x/2)*(y/2))*(z/2);
  sort(a,a+x);reverse(a,a+x);
  sort(b,b+y);reverse(b,b+y);
  sort(c,c+z);reverse(c,c+z); 
  long long aans[m]={};
  long long aaa=0;
  for(int i=0;i<x/2;i++){
    for(int j=0;j<y/2;j++){
      for(int k=0;k<z/2;k++){
        aans[aaa]=a[i]+b[j]+c[k];
        aaa++;
      }
    }
  }
  sort(aans,aans+m);
  reverse(aans,aans+m);
 for(int i=0;i<k;i++){
    cout<<aans[i]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:2: error: expected '}' at end of input
   47 | }
      |  ^
a.cc:13:11: note: to match this '{'
   13 | int main(){
      |           ^
Language: C

#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

int main()
{
    int x,y,z,k,h=0;
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&z);
    scanf("%d",&k);
    h=x*y*z;
    int a[x],b[y],c[z],d[h],i=0;
    for(i=0;i<x;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<y;i++)
    {
        scanf("%d",&b[i]);
    }
    for(i=0;i<z;i++)
    {
        scanf("%d",&c[i]);
    }
    sort(a,a+x);
    sort(b,b+y);
    sort(c,c+z);
    int j=0,t=0,p=0;
    for(i=0;i<x;i++)
    {
        for(j=0;j<y;j++)
        {
            for(t=0;t<z;t++)
            {
                d[p]=a[i]+b[j]+c[t];
                p++;
            }
        }
    }
    sort(d,d+h);
    for(i=h-1;i>=h-k;i--)
    {
        printf("%d\n",d[i]);
    }
    return 0;
}


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

#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
  long long x,y,z,k,ans;
  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);reverse(a,a+x);
  sort(b,b+y);reverse(b,b+y);
  sort(c,c+z);reverse(c,c+z); 
  long long aans[343000000];
  long long aaa=0;
  for(int i=0;i<700;i++){
    for(int j=0;j<700;j++){
      for(int k=0;k<700;k++;){
        aans[aaa]=a[i]+b[j]+c[k];
        aaa++;
      }
    }
  }
  sort(aans,aans+343000000)
 for(int i=0;i<k;i++){
    cout<<aans[i]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:28: error: expected ')' before ';' token
   35 |       for(int k=0;k<700;k++;){
      |          ~                 ^
      |                            )
a.cc:35:29: error: expected primary-expression before ')' token
   35 |       for(int k=0;k<700;k++;){
      |                             ^
a.cc:41:28: error: expected ';' before 'for'
   41 |   sort(aans,aans+343000000)
      |                            ^
      |                            ;
   42 |  for(int i=0;i<k;i++){
      |  ~~~                        
a.cc:42:14: error: 'i' was not declared in this scope
   42 |  for(int i=0;i<k;i++){
      |              ^
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <cstdlib>
using namespace std;
long long int q[1000000000];
long long int a[1000];
long long int b[1000];
long long int c[1000];
int main(){
	long long int x, y, z, k;
	//priority_queue<long long int> q;
	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];
	}
	long long int count = 0;
	for(long long int i = 0;i < x;i++){
		for(long long int j = 0;j < y;j++){
			for(long long int w = 0;w < z;w++){
				q[count] = a[i] + b[j] + c[w];
				count++;
			}
		}
	}
	sort(q, q + x * y * z);
	long long int xyz = x * y * z;
	for(int i = 0;i < k;i++){
		cout << q[xyz - 1 - i] << endl;
		//q.pop();
	}
}

Compiler output:
/tmp/ccb1H7BV.o: in function `main':
a.cc:(.text+0x6d): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccb1H7BV.o
a.cc:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccb1H7BV.o
a.cc:(.text+0xf7): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccb1H7BV.o
a.cc:(.text+0x15e): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccb1H7BV.o
a.cc:(.text+0x175): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccb1H7BV.o
a.cc:(.text+0x190): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccb1H7BV.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <cstdlib>
using namespace std;
long long int q[1000000000];
long long int a[1000];
long long int b[1000];
long long int c[1000];
int main(){
	long long int x, y, z, k;
	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];
	}
	int count = 0;
	for(long long int i = 0;i < x;i++){
		for(long long int j = 0;j < y;j++){
			for(long long int w = 0;w < z;w++){
				q[count] = a[i] + b[j] + c[w];
				count++;
			}
		}
	}
	sort(q, q + x * y * z);
	long long int xyz = x * y * z;
	for(int i = 0;i < k;i++){
		cout << q[xyz - 1 - i] << endl;
	}
}

Compiler output:
/tmp/cc3RJ4j9.o: in function `main':
a.cc:(.text+0x6d): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc3RJ4j9.o
a.cc:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cc3RJ4j9.o
a.cc:(.text+0xf7): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cc3RJ4j9.o
a.cc:(.text+0x15d): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc3RJ4j9.o
a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cc3RJ4j9.o
a.cc:(.text+0x18f): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cc3RJ4j9.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
int main(){
  long long x,y,z,k,ans;
  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);reverse(a,a+x);
  sort(b,b+y);reverse(b,b+y);
  sort(c,c+z);reverse(c,c+z); 
  ans=a[0]+b[0]+c[0]; 
  long long ad[x-1];
  long long bd[y-1];
  long long cd[z-1];
  for(int i=0;i<x-1;i++){
    if(i==0)
    ad[i]=a[i]-a[i+1];
    else
    ad[i]=a[i]-a[i+1]+ad[i-1];
  }
  for(int i=0;i<y-1;i++){
    if(i==0)
    bd[i]=b[i]-b[i+1];
    else
    bd[i]=b[i]-b[i+1]+bd[i-1];
  }
  for(int i=0;i<z-1;i++){
    if(i==0)
    cd[i]=c[i]-c[i+1];
    else
    cd[i]=c[i]-c[i+1]+cd[i-1];
  }
  long long aans[k+10];
  long long al,bl,cl;
  aans[0]=0;al=ad[x-2];bl=bd[y-2];cl=cd[z-2];
  for(int i=0;i<700;i++){
    for(int j=0;j<700;j++){
      for(int k=0;k<700;k++;){
        
      }
    }
  }
  for(int i=0;i<k;i++){
    cout<<ans-aans[i]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:28: error: expected ')' before ';' token
   58 |       for(int k=0;k<700;k++;){
      |          ~                 ^
      |                            )
a.cc:58:29: error: expected primary-expression before ')' token
   58 |       for(int k=0;k<700;k++;){
      |                             ^
Language: C++

#include <stdio.h>

long V[1000 * 1000 * 1000];
int LEN = 0;
int X, Y, Z, K;
long A[1000], B[1000], C[1000];

void swap(int i, int j) {
	long tmp = V[i];
	V[i] = V[j];
	V[j] = tmp;
}

void print() {
	for (int i = 0; i < LEN; i++) {
		printf("%ld, ", V[i]);
	}
	printf("\n");
}


void push(int ix, long val) {
	V[ix] = val;
	while (ix > 1 && V[ix / 2] < V[ix]) {
		// printf("+ ");
		// print();
		swap(ix, ix / 2);
		ix = ix / 2;
	}
	// print();
}

long pop() {
	long val = V[1];
	if (LEN > 1) {
		LEN--;
		V[1] = V[LEN];

		int ix = 1;
		while (ix * 2 < LEN) {
			if (ix * 2 + 1 < LEN) {
				if (V[ix] < V[ix * 2]) {
					if (V[ix * 2] < V[ix * 2 + 1]) {
						swap(ix, ix * 2 + 1);
						ix = ix * 2 + 1;
					} else {
						swap(ix, ix * 2);
						ix = ix * 2;
					}
				} else if (V[ix * 2] < V[ix * 2 + 1]) {
					swap(ix, ix * 2 + 1);
					ix = ix * 2 + 1;
				} else {
					break;
				}
			} else {
				if (V[ix] < V[ix * 2]) {
					swap(ix, ix * 2);
					ix = ix * 2;
				} else {
					break;
				}
			}
		}
	}
	return val;
}

int main() {
	scanf("%d %d %d %d\n", &X, &Y, &Z, &K);

	for (int i = 0; i < X; i++) {
		scanf("%ld", &A[i]);
	}
	for (int i = 0; i < Y; i++) {
		scanf("%ld", &B[i]);
	}
	for (int i = 0; i < Z; i++) {
		scanf("%ld", &C[i]);
	}
	LEN = 1;
	for (int a = 0; a < X; a++) {
		for (int b = 0; b < Y; b++) {
			for (int c = 0; c < Z; c++) {
				long v = A[a] + B[b] + C[c];
				push(LEN++, v);
			}
		}
	}
	// print();
	for (int i = 0; i < K; i++) {
		long v = pop();
		printf("%ld\n", v);
	}
}



Compiler output:
/tmp/cci8gGuo.o: in function `print()':
a.cc:(.text+0xbc): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cci8gGuo.o
/tmp/cci8gGuo.o: in function `pop()':
a.cc:(.text+0x184): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cci8gGuo.o
a.cc:(.text+0x193): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cci8gGuo.o
a.cc:(.text+0x19c): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cci8gGuo.o
a.cc:(.text+0x1a2): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cci8gGuo.o
a.cc:(.text+0x1d8): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cci8gGuo.o
a.cc:(.text+0x34a): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cci8gGuo.o
/tmp/cci8gGuo.o: in function `main':
a.cc:(.text+0x36d): relocation truncated to fit: R_X86_64_PC32 against symbol `K' defined in .bss section in /tmp/cci8gGuo.o
a.cc:(.text+0x374): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/cci8gGuo.o
a.cc:(.text+0x37e): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/cci8gGuo.o
a.cc:(.text+0x388): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>

long V[1000 * 1000 * 1000];
int LEN = 0;
int X, Y, Z, K;
long A[1000], B[1000], C[1000];

void swap(int i, int j) {
	long tmp = V[i];
	V[i] = V[j];
	V[j] = tmp;
}

void print() {
	for (int i = 0; i < LEN; i++) {
		printf("%ld, ", V[i]);
	}
	printf("\n");
}


void push(int ix, long val) {
	V[ix] = val;
	while (ix > 1 && V[ix / 2] < V[ix]) {
		// printf("+ ");
		// print();
		swap(ix, ix / 2);
		ix = ix / 2;
	}
	// print();
}

long pop() {
	long val = V[1];
	if (LEN > 1) {
		LEN--;
		V[1] = V[LEN];

		int ix = 1;
		while (ix * 2 < LEN) {
			if (ix * 2 + 1 < LEN) {
				if (V[ix] < V[ix * 2]) {
					if (V[ix * 2] < V[ix * 2 + 1]) {
						swap(ix, ix * 2 + 1);
						ix = ix * 2 + 1;
					} else {
						swap(ix, ix * 2);
						ix = ix * 2;
					}
				} else if (V[ix * 2] < V[ix * 2 + 1]) {
					swap(ix, ix * 2 + 1);
					ix = ix * 2 + 1;
				} else {
					break;
				}
			} else {
				if (V[ix] < V[ix * 2]) {
					swap(ix, ix * 2);
					ix = ix * 2;
				} else {
					break;
				}
			}
		}
	}
	return val;
}

int main() {
	scanf("%d %d %d %d\n", &X, &Y, &Z, &K);

	for (int i = 0; i < X; i++) {
		scanf("%ld", &A[i]);
	}
	for (int i = 0; i < Y; i++) {
		scanf("%ld", &B[i]);
	}
	for (int i = 0; i < Z; i++) {
		scanf("%ld", &C[i]);
	}
	LEN = 1;
	for (int a = 0; a < X; a++) {
		for (int b = 0; b < Y; b++) {
			for (int c = 0; c < Z; c++) {
				long v = A[a] + B[b] + C[c];
				push(LEN++, v);
			}
		}
	}
	// print();
	for (int i = 0; i < K; i++) {
		long v = pop();
		printf("%ld\n", v);
	}
}



Compiler output:
/tmp/cczBSBa0.o: in function `print':
main.c:(.text+0xbc): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cczBSBa0.o
/tmp/cczBSBa0.o: in function `pop':
main.c:(.text+0x184): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cczBSBa0.o
main.c:(.text+0x193): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cczBSBa0.o
main.c:(.text+0x19c): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cczBSBa0.o
main.c:(.text+0x1a2): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cczBSBa0.o
main.c:(.text+0x1d8): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cczBSBa0.o
main.c:(.text+0x34a): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/cczBSBa0.o
/tmp/cczBSBa0.o: in function `main':
main.c:(.text+0x36d): relocation truncated to fit: R_X86_64_PC32 against symbol `K' defined in .bss section in /tmp/cczBSBa0.o
main.c:(.text+0x374): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/cczBSBa0.o
main.c:(.text+0x37e): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/cczBSBa0.o
main.c:(.text+0x388): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>

long V[1000 * 1000 * 1000];
int LEN = 0;
int X, Y, Z, K;
long A[1000], B[1000], C[1000];

void swap(int i, int j) {
	long tmp = V[i];
	V[i] = V[j];
	V[j] = tmp;
}

void print() {
	for (int i = 0; i < LEN; i++) {
		printf("%ld, ", V[i]);
	}
	printf("\n");
}


void push(int ix, long val) {
	V[ix] = val;
	while (ix > 1 && V[ix / 2] < V[ix]) {
		// printf("+ ");
		// print();
		swap(ix, ix / 2);
		ix = ix / 2;
	}
	// print();
}

long pop() {
	long val = V[1];
	if (LEN > 1) {
		LEN--;
		V[1] = V[LEN];

		int ix = 1;
		while (ix * 2 < LEN) {
			if (ix * 2 + 1 < LEN) {
				if (V[ix] < V[ix * 2]) {
					if (V[ix * 2] < V[ix * 2 + 1]) {
						swap(ix, ix * 2 + 1);
						ix = ix * 2 + 1;
					} else {
						swap(ix, ix * 2);
						ix = ix * 2;
					}
				} else if (V[ix * 2] < V[ix * 2 + 1]) {
					swap(ix, ix * 2 + 1);
					ix = ix * 2 + 1;
				} else {
					break;
				}
			} else {
				if (V[ix] < V[ix * 2]) {
					swap(ix, ix * 2);
					ix = ix * 2;
				} else {
					break;
				}
			}
		}
	}
	return val;
}

int main() {
	scanf("%d %d %d %d\n", &X, &Y, &Z, &K);

	for (int i = 0; i < X; i++) {
		scanf("%ld", &A[i]);
	}
	for (int i = 0; i < Y; i++) {
		scanf("%ld", &B[i]);
	}
	for (int i = 0; i < Z; i++) {
		scanf("%ld", &C[i]);
	}
	LEN = 1;
	for (int a = 0; a < X; a++) {
		for (int b = 0; b < Y; b++) {
			for (int c = 0; c < Z; c++) {
				long v = A[a] + B[b] + C[c];
				push(LEN++, v);
			}
		}
	}
	// print();
	for (int i = 0; i < K; i++) {
		long v = pop();
		printf("%ld\n", v);
	}
}



Compiler output:
/tmp/ccwXiavy.o: in function `print':
main.c:(.text+0xbc): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/ccwXiavy.o
/tmp/ccwXiavy.o: in function `pop':
main.c:(.text+0x184): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/ccwXiavy.o
main.c:(.text+0x193): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/ccwXiavy.o
main.c:(.text+0x19c): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/ccwXiavy.o
main.c:(.text+0x1a2): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/ccwXiavy.o
main.c:(.text+0x1d8): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/ccwXiavy.o
main.c:(.text+0x34a): relocation truncated to fit: R_X86_64_PC32 against symbol `LEN' defined in .bss section in /tmp/ccwXiavy.o
/tmp/ccwXiavy.o: in function `main':
main.c:(.text+0x36d): relocation truncated to fit: R_X86_64_PC32 against symbol `K' defined in .bss section in /tmp/ccwXiavy.o
main.c:(.text+0x374): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/ccwXiavy.o
main.c:(.text+0x37e): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccwXiavy.o
main.c:(.text+0x388): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {`
    int X, Y, Z, K; cin >> X >> Y >> Z >> K;
    vector<ll> 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());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());
    reverse(C.begin(), C.end());

    vector<ll> D(X - 1), E(Y - 1), F(Z - 1);
    for (int i = 0; i < X - 1; i++) D[i] = A[i + 1] - A[i];
    for (int i = 0; i < Y - 1; i++) E[i] = B[i + 1] - B[i];
    for (int i = 0; i < Z - 1; i++) F[i] = C[i + 1] - C[i];

    ll maxi = A[0] + B[0] + C[0];
    cout << maxi << endl;

    int x = 0, y = 0, z = 0;

    int N = max(3000, X * Y * Z)

    for (int i =0; i < N - 1; i++) {
        if (D[x] < E[y] && D[x] < F[z]) {
            maxi -= D[x];
            cout << maxi << endl;
            x++;
        }
        else if (D[x] > E[y] && E[y] < F[z]) {
            maxi -= E[y];
            cout << maxi << endl;
            y++;
        }
        else if (D[x] > F[z] && E[y] > F[z]) {
            maxi -= F[z];
            cout << maxi << endl;
            z++;
        }
        else if (D[x] == E[y] && E[y] == F[z]) {
            maxi -= E[y];
            cout << maxi << endl;
            y++;
        }
        else if (D[x] > E[y] && E[y] == F[z]) {
            maxi -= E[y];
            cout << maxi << endl;
            y++;
        }
        else if (D[x] < E[y] && D[x] == F[z]) {
            maxi -= D[x];
            cout << maxi << endl;
            x++;
        }
        else if (D[x] > F[z] && E[y] == F[z]) {
            maxi -= F[z];
            cout << maxi << endl;
            z++;
        }
    }



}


Compiler output:
a.cc:5:13: error: stray '`' in program
    5 | int main() {`
      |             ^
a.cc: In function 'int main()':
a.cc:32:5: error: expected ',' or ';' before 'for'
   32 |     for (int i =0; i < N - 1; i++) {
      |     ^~~
a.cc:32:20: error: 'i' was not declared in this scope
   32 |     for (int i =0; i < N - 1; i++) {
      |                    ^
Language: C++

#include <iostream>
#include <vector>
#include <set>

using namespace std;


int main(int argc, char** argv) {
    long long x, y, z, k, buf;
    cin >> x >> y >> z >> k;

    std::vector<long long> a, b, c;
    for (long long i = 0; i < x; ++i) {
        cin >> buf;
        a.push_back(buf);
    }
    for (long long i = 0; i < y; ++i) {
        cin >> buf;
        b.push_back(buf);
    }
    for (long long i = 0; i < z; ++i) {
        cin >> buf;
        c.push_back(buf);
    }
    std::sort(a.begin(), a.end(), std::greater<long long>());
    std::sort(b.begin(), b.end(), std::greater<long long>());
    std::sort(c.begin(), c.end(), std::greater<long long>());

    std::multiset<long long, std::greater<long long>> ans;
    for (long long i = 0; i < x; ++i) {
        for (long long j = 0; j < y; ++j) {
            int sz = ans.size();
            for (long long l = 0; l < z; ++l) {
                long long sum = a[i] + b[j] + c[l];
                if (ans.size() > k && *(ans.rbegin()) > sum) {
                    break;
                }
                ans.insert(sum);
            }
            if (sz > k && ans.size() == sz) {
                break;
            }
        }
    }

    auto it = ans.begin();
    for (int i = 0; i < k; ++i) {
        cout << *it << endl;
        ++it;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:25:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   25 |     std::sort(a.begin(), a.end(), std::greater<long long>());
      |          ^~~~
      |          qsort
a.cc:26:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   26 |     std::sort(b.begin(), b.end(), std::greater<long long>());
      |          ^~~~
      |          qsort
a.cc:27:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   27 |     std::sort(c.begin(), c.end(), std::greater<long long>());
      |          ^~~~
      |          qsort
Language: C++

# encoding:utf-8
import copy
import numpy as np
import random
import bisect #bisect_left　これで二部探索の大小検索が行える

x,y,z,k = map(int,input().split())
A = [i for i in map(int,input().split())]
B = [i for i in map(int,input().split())]
C =[i for i in map(int,input().split())]


A.sort()
A.reverse()
B.sort()
B.reverse()
C.sort()
C.reverse()
ak = A[0:k]
bk = B[0:k]
ck = C[0:k]

anss = []
for i in ak:
    for j in bk:
        for l in ck:
            anss.append(i+j+l)

anss.sort()
anss.reverse()

for i in range(k):
    print(anss[i])


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #encoding
    1 | # encoding:utf-8
      |   ^~~~~~~~
a.cc:5:15: error: stray '#' in program
    5 | import bisect #bisect_left　これで二部探索の大小検索が行える
      |               ^
a.cc:5:16: error: extended character 　 is not valid in an identifier
    5 | import bisect #bisect_left　これで二部探索の大小検索が行える
      |                ^
a.cc:2:1: error: 'import' does not name a type
    2 | import copy
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
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;

int main()
{
  int X, Y, Z;
  long K;
  long A[1000];
  long B[1000];
  long C[1000];
  multiset<long> ansSet;

  scanf("%d %d %d %ld", &X, &Y, &Z, &K);
  for (int i=0;i<X;i++)
    scanf("%ld", &A[i]);
  for (int i=0;i<Y;i++)
    scanf("%ld", &B[i]);
  for (int i=0;i<Z;i++)
    scanf("%ld", &C[i]);
  for (int i=0;i<X;i++)
    for (int j=0;j<Y;j++)
      for (int k=0;k<Z;k++) {
        ansSet.insert(A[i]+B[j]+C[k]);
      }
  long a = 0;
  for (auto itr = ansSet.rbegin(); itr != ansSet.rend(); itr++) {
    printf("%ld\n", *itr);
    a++;
    if (a>=K) break;
  }
  return 0;
}
#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;

int main()
{
  int X, Y, Z;
  long K;
  long A[1000];
  long B[1000];
  long C[1000];
  multiset<long> ansSet;

  scanf("%d %d %d %ld", &X, &Y, &Z, &K);
  for (int i=0;i<X;i++)
    scanf("%ld", &A[i]);
  for (int i=0;i<Y;i++)
    scanf("%ld", &B[i]);
  for (int i=0;i<Z;i++)
    scanf("%ld", &C[i]);
  for (int i=0;i<X;i++)
    for (int j=0;j<Y;j++)
      for (int k=0;k<Z;k++) {
        ansSet.insert(A[i]+B[j]+C[k]);
      }
  long a = 0;
  for (auto itr = ansSet.rbegin(); itr != ansSet.rend(); itr++) {
    printf("%ld\n", *itr);
    a++;
    if (a>=K) break;
  }
  return 0;
}


Compiler output:
a.cc:56:5: error: redefinition of 'int main()'
   56 | int main()
      |     ^~~~
a.cc:14:5: note: 'int main()' previously defined here
   14 | int main()
      |     ^~~~