Language: C++

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

int main(){
    int x, y, z, k, i, j;
    cin >> x >> y >> z >> k;
    long long a[x], b, d[x*y], e[k*z];
    for(i=0; i<x; i++){
        cin >> a[i];
    }
    for(i=0; i<y; i++){
        cin >> b;
        for(j=0; j<x; j++){
            d[y*i+j] = a[j]+b;
        }
    }
    sort(d, b+x*y, greater<long long>());
    for(i=0; i<z; i++){
        cin >> b;
        for(j=0; j<k; j++){
            e[z*i+j] = d[j]+b;
        }
    }
    sort(c, c+z*k, greater<long long>());
    for(i=0; i<k; i++){
        cout << e[i] << '\n';
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: no matching function for call to 'sort(long long int [(x * y)], long long int, std::greater<long long int>)'
   17 |     sort(d, b+x*y, greater<long long>());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:5: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   template argument deduction/substitution failed:
a.cc:17:9: note:   deduced conflicting types for parameter '_RAIter' ('long long int*' and 'long long int')
   17 |     sort(d, b+x*y, greater<long long>());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 3 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   template argument deduction/substitution failed:
a.cc:17:9: note:   variable-sized array type 'long long int (&)[(x * y)]' is not a valid template argument
   17 |     sort(d, b+x*y, greater<long long>());
      |     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:10: error: 'c' was not declared in this scope
   24 |     sort(c, c+z*k, greater<long long>());
      |          ^