Language: C++

#include <iostream>
#include <algorithm>

int main()
{
    uint64_t x, y, z, k;
    std::cin >> x >> y >> z >> k;
    uint64_t xx[1000], yy[1000], zz[1000], foo[1000000];
    for (int i = 0; (i < x); ++i) {
        std::cin >> xx[i];
    }
    for (int i = 0; (i < y); ++i) {
        std::cin >> yy[i];
    }
    for (int i = 0; (i < z); ++i) {
        std::cin >> zz[i];
    }
    std::sort(xx, xx + x);
    std::sort(yy, yy + y);
    std::sort(zz, zz + z);
    int xi = x - 1, yi = y -1, zi = z - 1;
    uint64_t max = xx[xi];
    max = std::max(max, yy[yi]);
    max = std::max(max, zz[zi]);
    switch (max) {
        case xx[xi]:
            for (int i = 0; (i < y); ++i) {
                for (int j = 0; (j < z); ++j) {
                    foo[i+j] = yy[i] + zz[i];
                }
            }
            std::sort(foo, foo + (y + z));
            break;
        case yy[yi]:
            for (int i = 0; (i < x); ++i) {
                for (int j = 0; (j < z); ++j) {
                    foo[i+j] = xx[i] + zz[i];
                }
            }
            std::sort(foo, foo + (x + z));
            break;
        case zz[zi]:
            for (int i = 0; (i < x); ++i) {
                for (int j = 0; (j < y); ++j) {
                    foo[i+j] = xx[i] + yy[i];
                }
            }
            std::sort(foo, foo + (y + x));
            break;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'uint64_t' was not declared in this scope
    6 |     uint64_t x, y, z, k;
      |     ^~~~~~~~
a.cc:3:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <algorithm>
  +++ |+#include <cstdint>
    3 | 
a.cc:7:17: error: 'x' was not declared in this scope
    7 |     std::cin >> x >> y >> z >> k;
      |                 ^
a.cc:7:22: error: 'y' was not declared in this scope
    7 |     std::cin >> x >> y >> z >> k;
      |                      ^
a.cc:7:27: error: 'z' was not declared in this scope
    7 |     std::cin >> x >> y >> z >> k;
      |                           ^
a.cc:7:32: error: 'k' was not declared in this scope
    7 |     std::cin >> x >> y >> z >> k;
      |                                ^
a.cc:8:13: error: expected ';' before 'xx'
    8 |     uint64_t xx[1000], yy[1000], zz[1000], foo[1000000];
      |             ^~~
      |             ;
a.cc:10:21: error: 'xx' was not declared in this scope
   10 |         std::cin >> xx[i];
      |                     ^~
a.cc:13:21: error: 'yy' was not declared in this scope
   13 |         std::cin >> yy[i];
      |                     ^~
a.cc:16:21: error: 'zz' was not declared in this scope
   16 |         std::cin >> zz[i];
      |                     ^~
a.cc:18:15: error: 'xx' was not declared in this scope
   18 |     std::sort(xx, xx + x);
      |               ^~
a.cc:19:15: error: 'yy' was not declared in this scope
   19 |     std::sort(yy, yy + y);
      |               ^~
a.cc:20:15: error: 'zz' was not declared in this scope
   20 |     std::sort(zz, zz + z);
      |               ^~
a.cc:22:13: error: expected ';' before 'max'
   22 |     uint64_t max = xx[xi];
      |             ^~~~
      |             ;
a.cc:23:5: error: 'max' was not declared in this scope; did you mean 'std::max'?
   23 |     max = std::max(max, yy[yi]);
      |     ^~~
      |     std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:23:28: error: 'yi' was not declared in this scope; did you mean 'xi'?
   23 |     max = std::max(max, yy[yi]);
      |                            ^~
      |                            xi
a.cc:24:28: error: 'zi' was not declared in this scope; did you mean 'xi'?
   24 |     max = std::max(max, zz[zi]);
      |                            ^~
      |                            xi
a.cc:29:21: error: 'foo' was not declared in this scope
   29 |                     foo[i+j] = yy[i] + zz[i];
      |                     ^~~
a.cc:32:23: error: 'foo' was not declared in this scope
   32 |             std::sort(foo, foo + (y + z));
      |                       ^~~