Language: C++


#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl


using ll = long long;
using hll = __int128;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}


#ifdef _getchar_nolock
#else
#define _getchar_nolock getchar_unlocked
#endif

template <typename T>
void freadT(T &x) {
    x = 0;
    char ch = _getchar_nolock();
    ll sign = 1;

    while (!isdigit(ch)) {
        if (ch == '-')
            sign *= -1;
        ch = _getchar_nolock();
    }

    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = _getchar_nolock();
    }

    x *= sign;
}


#define solvsh
//#define multi

#ifdef solvsh

//const int MAXN = 1e2 + 2;

#define uint ll

uint ml(uint a, uint b){
    return (a*1ll * b);
}

uint add(uint a, uint b){
    return (a*1ll + b);
}

clock_t timestamp_start = clock();
void time_calc()
{
    cerr << (ld)(clock() - timestamp_start) / CLOCKS_PER_SEC << "\n";
}


const int MAXN= 16;
pair<int, int> points[MAXN];
int popu[MAXN];


ll min_answr [MAXN];

vector<int> cnt_bt(int x) {
    vector<int> ret;
    int indx = 0;
    while (x) {
        if (x & 1) ret.push_back(indx);
        x /= 2;
        ++indx;
    }
    return ret;
}

int n;

void up_for(int mask) {
    vector<int> vert;
    vector<int> hot;

    vector<int> ones = cnt_bt(mask);

    int cnt = ones.size();

    for (int submask = 0; submask < (1 << cnt); ++submask) {
        vert.clear();
        hot.clear();

        vert.push_back(0);
        hot.push_back(0);

        for (int j = 0; j < cnt; ++ j){
            if ((1 << j) & submask) {
                vert.push_back(points[ones[j]].first);
            } else {
                hot.push_back(points[ones[j]].second);
            }
        }

        ll sm = 0;
        for (int i = 0; i < n; ++i){
            int min_dst = 1e9;
            for (auto e : vert) {
                min_dst = min(abs(points[i].first - e), min_dst);
            }

            for (auto e : hot) {
                min_dst = min(abs(points[i].second - e), min_dst);
            }

            sm += ll(min_dst) * popu[i];
        }
        min_answr[cnt] = min(min_answr[cnt], sm);
    }
}


void solve() {

    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x, y;
        ll p;
        cin >> x >> y;
        cin >> p;
        popu[i] = p;
        points[i] = {x, y};
    }

    for (int i = 0; i <= n; ++i) {
        min_answr[i] = 1e18;
    }

    ll sm = 0;
    for (int i = 0; i < n; ++i) {
        int min_dst = 1e9;
        min_dst = min(abs(points[i].first - 0), min_dst);

        min_dst = min(abs(points[i].second - 0), min_dst);

        sm += min_dst * popu[i];
    }
    min_answr[0] = min(min_answr[0], sm);

    for (int i = 0; i < (1 << n); ++i) {
        up_for(i);
    }

    for (int i = 0; i <= n; ++i) {
        cout << min_answr[i] << "\n";
    }
}

#else

void solve() {

}


#endif


void multisolve() {
//    prec();
    int t;
    cin >> t;

//    scanf("%d", &t);

    int i = 1;
    while (t--) {
        cout << "Case #" << (i++) << ":\n";
        solve();
//        cout << "\n";
    }
}

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);


#ifdef multi
    multisolve();
#else
    solve();
//    gen();
#endif
]

}

Compiler output:
a.cc: In function 'int main()':
a.cc:220:1: error: expected primary-expression before ']' token
  220 | ]
      | ^