Language: C++

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

const int maxn = 1005;

#define LL __int64

int a, b, c;
int K;

int A[maxn], B[maxn], C[maxn];
LL AB[maxn * maxn];

priority_queue< pair<LL, pair<int, int> > > pq;

void work()
{
    cin >>a >>b >>c >>K;

    for(int i = 0; i < a; i++) cin >>A[i];
    for(int i = 0; i < b; i++) cin >>B[i];
    for(int i = 0; i < c; i++) cin >>C[i];

    for(int i = 0; i < a; i++)
        for(int j = 0; j < b; j++)
            AB[i * b + j] = A[i] + B[j];

    AB[a * b] = -INT_MAX;
    C[c] = -INT_MAX;

    sort(AB, AB + a * b);
    sort(C, C + c);
    reverse(AB, AB + a * b);
    reverse(C, C + c);

    for(int i = 0; i < c; i++) pq.push(make_pair(AB[0] + C[i], make_pair(0, i)));

    while(K--)
    {
        pair<LL, pair<int, int> > p = pq.top();
        pq.pop();

        cout <<p.first <<endl;

        int u = p.second.first, v = p.second.second;

        pq.push(make_pair(AB[u + 1] + C[v], make_pair(u + 1, v)));
    }
}

int main()
{
#ifdef yukihana0416
freopen("in.txt","r",stdin);
#endif // yukihana0416
    work();
    return 0;
}


Compiler output:
a.cc:6:12: error: '__int64' does not name a type; did you mean '__int64_t'?
    6 | #define LL __int64
      |            ^~~~~~~
a.cc:12:1: note: in expansion of macro 'LL'
   12 | LL AB[maxn * maxn];
      | ^~
a.cc:6:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    6 | #define LL __int64
      |            ^~~~~~~
a.cc:14:22: note: in expansion of macro 'LL'
   14 | priority_queue< pair<LL, pair<int, int> > > pq;
      |                      ^~
a.cc:14:41: error: template argument 1 is invalid
   14 | priority_queue< pair<LL, pair<int, int> > > pq;
      |                                         ^
a.cc:14:43: error: template argument 1 is invalid
   14 | priority_queue< pair<LL, pair<int, int> > > pq;
      |                                           ^
a.cc:14:43: error: template argument 2 is invalid
a.cc:14:43: error: template argument 3 is invalid
a.cc: In function 'void work()':
a.cc:26:13: error: 'AB' was not declared in this scope; did you mean 'B'?
   26 |             AB[i * b + j] = A[i] + B[j];
      |             ^~
      |             B
a.cc:28:5: error: 'AB' was not declared in this scope; did you mean 'B'?
   28 |     AB[a * b] = -INT_MAX;
      |     ^~
      |     B
a.cc:36:35: error: request for member 'push' in 'pq', which is of non-class type 'int'
   36 |     for(int i = 0; i < c; i++) pq.push(make_pair(AB[0] + C[i], make_pair(0, i)));
      |                                   ^~~~
a.cc:6:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
    6 | #define LL __int64
      |            ^~~~~~~
a.cc:40:14: note: in expansion of macro 'LL'
   40 |         pair<LL, pair<int, int> > p = pq.top();
      |              ^~
a.cc:40:33: error: template argument 1 is invalid
   40 |         pair<LL, pair<int, int> > p = pq.top();
      |                                 ^
a.cc:40:42: error: request for member 'top' in 'pq', which is of non-class type 'int'
   40 |         pair<LL, pair<int, int> > p = pq.top();
      |                                          ^~~
a.cc:41:12: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   41 |         pq.pop();
      |            ^~~
a.cc:43:18: error: request for member 'first' in 'p', which is of non-class type 'int'
   43 |         cout <<p.first <<endl;
      |                  ^~~~~
a.cc:45:19: error: request for member 'second' in 'p', which is of non-class type 'int'
   45 |         int u = p.second.first, v = p.second.second;
      |                   ^~~~~~
a.cc:47:12: error: request for member 'push' in 'pq', which is of non-class type 'int'
   47 |         pq.push(make_pair(AB[u + 1] + C[v], make_pair(u + 1, v)));
      |            ^~~~
a.cc:47:41: error: 'v' was not declared in this scope
   47 |         pq.push(make_pair(AB[u + 1] + C[v], make_pair(u + 1, v)));
      |                                         ^