Language: C++

// UNNECESSARY
// #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration
// #include <cstdio>//printf/scanf/fopen/fclose/fprintf/fscanf/snprintf/putc/puts/getc/gets
// #include <fstream>//ifstream/ofstream

// DATA STRUCTURES
#include <array>
#include <bitset>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <valarray>
#include <vector>

// MISCELLANEOUS
#include <algorithm>//min/max/sort(rand-access it)/merge
#include <cassert>
#include <climits>//INT_MAX/INT_MIN/ULLONG_MAX
#include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc
#include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort
#include <iomanip>//setfill/setw/setprecision/fixed/scientific
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific
#include <iterator>
#include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN
#include <new>
#include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline
#include <utility>//pair

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> plli;
typedef std::pair<ull, int> puli;
typedef std::pair<double, int> pdi;
typedef std::pair<ll, ll> pllll;
typedef std::pair<ull, ull> pulul;
typedef std::pair<double, double> pdd;
typedef std::tuple<int, int, int> ti3;
typedef std::tuple<int, int, int, int> ti4;

const bool debug = false;

// --------------------------------------------------------------------------------------

// DECLARATIONS
template <typename T> void read(size_t n, T* a);
template <typename T> void read2(size_t n, size_t m, T** a);


// IMPLEMENTATIONS
template <typename T> void read(size_t n, T* a) {
    for (size_t i = 0; i < n; ++i) { std::cin >> a[i]; }
}

template <typename T> void read2(size_t n, size_t m, T** a) {
    for (size_t i = 0; i < n; ++i) {
        a[i] = new int[m];
        for (size_t j = 0; j < m; ++j) { std::cin >> a[i][j]; }
    }
}


using namespace std;

int main(void)
{
    size_t n;
    cin >> n;
    n *= 3;
    vector<ull> a;
    read(n, a);

    sort(a.begin(), a.end());

    vector<ull> b;
    for (size_t i = n/3; i < n; ++i) {
        b.push_back(a[i]);
    }

    ull total = 0UL;

    for (size_t i = 0; i < b.size(); ++i) {
        if (i%2 == 0) {
            total += b[i];
        }
    }

    cout << total << '\n';

    delete[] a;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:9: error: no matching function for call to 'read(size_t&, std::vector<long long unsigned int>&)'
   75 |     read(n, a);
      |     ~~~~^~~~~~
a.cc:55:28: note: candidate: 'template<class T> void read(size_t, T*)'
   55 | template <typename T> void read(size_t n, T* a) {
      |                            ^~~~
a.cc:55:28: note:   template argument deduction/substitution failed:
a.cc:75:9: note:   mismatched types 'T*' and 'std::vector<long long unsigned int>'
   75 |     read(n, a);
      |     ~~~~^~~~~~
a.cc:94:14: error: type 'class std::vector<long long unsigned int>' argument given to 'delete', expected pointer
   94 |     delete[] a;
      |              ^