Language: C++

//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<numeric>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a)   a.begin(),a.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    //
    ModInt operator++(int) {
        auto t = *this;
        *this += 1;
        return t;
    }

    ModInt operator--(int) {
        auto t = *this;
        *this -= 1;
        return t;
    }
    ModInt operator<<(const int n){
        return ModInt(*this)*ModInt(2).pow(n);
    }
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void e(){
    ll X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;
    auto p = v<ll>(A,0); rep(i,A){cin >> p[i];} sort(all(p),greater<ll>());
    auto q = v<ll>(B,0); rep(i,B){cin >> q[i];} sort(all(q),greater<ll>());
    auto r = v<ll>(C,0); rep(i,C){cin >> r[i];} 
    
    rep(i,X)r.push_back(p[i]);
    rep(i,Y)r.push_back(q[i]);
    sort(all(r),greater<ll>());
    ll ans = 0;
    rep(i,X+Y) {ans+=r[i];cout << ans << endl;}
    cout << ans << endl;

}
int main(){
    e();
    return 0;
}//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<numeric>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a)   a.begin(),a.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    //
    ModInt operator++(int) {
        auto t = *this;
        *this += 1;
        return t;
    }

    ModInt operator--(int) {
        auto t = *this;
        *this -= 1;
        return t;
    }
    ModInt operator<<(const int n){
        return ModInt(*this)*ModInt(2).pow(n);
    }
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void e(){
    ll X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;
    auto p = v<ll>(A,0); rep(i,A){cin >> p[i];} sort(all(p),greater<ll>());
    auto q = v<ll>(B,0); rep(i,B){cin >> q[i];} sort(all(q),greater<ll>());
    auto r = v<ll>(C,0); rep(i,C){cin >> r[i];} 
    
    rep(i,X)r.push_back(p[i]);
    rep(i,Y)r.push_back(q[i]);
    sort(all(r),greater<ll>());
    ll ans = 0;
    rep(i,X+Y) {ans+=r[i];cout << ans << endl;}
    cout << ans << endl;

}
int main(){
    e();
    return 0;
}

Compiler output:
a.cc:136:24: error: redefinition of 'template<class T> T chmin(T&, T)'
  136 | template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
      |                        ^~~~~
a.cc:22:24: note: 'template<class T> T chmin(T&, T)' previously declared here
   22 | template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
      |                        ^~~~~
a.cc:137:24: error: redefinition of 'template<class T> T chmax(T&, T)'
  137 | template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
      |                        ^~~~~
a.cc:23:24: note: 'template<class T> T chmax(T&, T)' previously declared here
   23 | template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
      |                        ^~~~~
a.cc:138:10: error: redefinition of 'const ll INF'
  138 | const ll INF = (ll)1e9;
      |          ^~~
a.cc:24:10: note: 'const ll INF' previously defined here
   24 | const ll INF = (ll)1e9;
      |          ^~~
a.cc:140:8: error: redefinition of 'struct ModInt<MOD>'
  140 | struct ModInt {
      |        ^~~~~~
a.cc:26:8: note: previous definition of 'struct ModInt<MOD>'
   26 | struct ModInt {
      |        ^~~~~~
a.cc:208:15: error: redefinition of 'constexpr const int MOD'
  208 | constexpr int MOD = 1e9 + 7;
      |               ^~~
a.cc:94:15: note: 'constexpr const int MOD' previously defined here
   94 | constexpr int MOD = 1e9 + 7;
      |               ^~~
a.cc:211:6: error: redefinition of 'void e()'
  211 | void e(){
      |      ^
a.cc:97:6: note: 'void e()' previously defined here
   97 | void e(){
      |      ^
a.cc:226:5: error: redefinition of 'int main()'
  226 | int main(){
      |     ^~~~
a.cc:112:5: note: 'int main()' previously defined here
  112 | int main(){
      |     ^~~~