Language: C++

#include<stdio.h>
int main(){
		#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base:sync_with_stdio(true);
	cin.tie(NULL);
	int n; cin >> n;
	vector<ll> x(n);
	vector<ll> y(n);
	vector<ll> p(n);
	vector<ll> ans(n + 1, INF64);
	for(int i = 0; i < n; i++) cin >> x[i] >> y[i] >> p[i];
	for(int i = 0; i < pow3(n); i++)
	{
		ll d = 0;
		int ii = i;
		vector<pair<bool, ll>> r(2);
		r[0] = make_pair(0, 0);
		r[1] = make_pair(1, 0);
		for(int j = 0; j < n; j++)
		{
			if(ii % 3 == 1) r.push_back(make_pair(0, x[j]));
			else if(ii % 3 == 2) r.push_back(make_pair(1, y[j]));
			ii /= 3;
		}
		if(r.size() - 2 > n) continue;
		for(int j = 0; j < n; j++)
		{
			ll mini = abs(max(x[j], y[j]));
			for(int k = 0; k < r.size(); k++)
			{
				if(r[k].first) mini = min(mini, abs(y[j] - r[k].second));
				else mini = min(mini, abs(x[j] - r[k].second));
			}
			d += mini * p[j];
		}
		ans[r.size() - 2] = min(ans[r.size() - 2], d);
	}
	for(int i = 0; i < n + 1; i++) cout << ans[i] << endl;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'sync_with_stdio' was not declared in this scope
    7 |         ios_base:sync_with_stdio(true);
      |                  ^~~~~~~~~~~~~~~
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin.tie(NULL);
      |         ^~~
a.cc:10:9: error: 'vector' was not declared in this scope
   10 |         vector<ll> x(n);
      |         ^~~~~~
a.cc:10:16: error: 'll' was not declared in this scope
   10 |         vector<ll> x(n);
      |                ^~
a.cc:10:20: error: 'x' was not declared in this scope
   10 |         vector<ll> x(n);
      |                    ^
a.cc:11:20: error: 'y' was not declared in this scope
   11 |         vector<ll> y(n);
      |                    ^
a.cc:12:20: error: 'p' was not declared in this scope
   12 |         vector<ll> p(n);
      |                    ^
a.cc:13:31: error: 'INF64' was not declared in this scope
   13 |         vector<ll> ans(n + 1, INF64);
      |                               ^~~~~
a.cc:13:20: error: 'ans' was not declared in this scope
   13 |         vector<ll> ans(n + 1, INF64);
      |                    ^~~
a.cc:15:28: error: 'pow3' was not declared in this scope
   15 |         for(int i = 0; i < pow3(n); i++)
      |                            ^~~~
a.cc:17:19: error: expected ';' before 'd'
   17 |                 ll d = 0;
      |                   ^~
      |                   ;
a.cc:19:24: error: 'pair' was not declared in this scope
   19 |                 vector<pair<bool, ll>> r(2);
      |                        ^~~~
a.cc:19:29: error: expected primary-expression before 'bool'
   19 |                 vector<pair<bool, ll>> r(2);
      |                             ^~~~
a.cc:20:17: error: 'r' was not declared in this scope
   20 |                 r[0] = make_pair(0, 0);
      |                 ^
a.cc:20:24: error: 'make_pair' was not declared in this scope
   20 |                 r[0] = make_pair(0, 0);
      |                        ^~~~~~~~~
a.cc:31:27: error: expected ';' before 'mini'
   31 |                         ll mini = abs(max(x[j], y[j]));
      |                           ^~~~~
      |                           ;
a.cc:34:48: error: 'mini' was not declared in this scope; did you mean 'ii'?
   34 |                                 if(r[k].first) mini = min(mini, abs(y[j] - r[k].second));
      |                                                ^~~~
      |                                                ii
a.cc:34:65: error: 'abs' was not declared in this scope
   34 |                                 if(r[k].first) mini = min(mini, abs(y[j] - r[k].second));
      |                                                                 ^~~
a.cc:34:55: error: 'min' was not declared in this scope; did you mean 'main'?
   34 |                                 if(r[k].first) mini = min(mini, abs(y[j] - r[k].second));
      |                                                       ^~~
      |                                                       main
a.cc:35:38: error: 'mini' was not declared in this scope; did you mean 'ii'?
   35 |                                 else mini = min(mini, abs(x[j] - r[k].second));
      |                                      ^~~~
      |                                      ii
a.cc:35:55: error: 'abs' was not declared in this scope
   35 |                                 else mini = min(mini, abs(x[j] - r[k].second));
      |                                                       ^~~
a.cc:35:45: error: 'min' was not declared in this scope; did you mean 'main'?
   35 |                                 else mini = min(mini, abs(x[j] - r[k].second));
      |                                             ^~~
      |                                             main
a.cc:37:25: error: 'd' was not declared in this scope
   37 |                         d += mini * p[j];
      |                         ^
a.cc:37:30: error: 'mini' was not declared in this scope; did you mean 'ii'?
   37 |                         d += mini * p[j];
      |                              ^~~~
      |                              ii
a.cc:39:60: error: 'd' was not declared in this scope
   39 |                 ans[r.size() - 2] = min(ans[r.size() - 2], d);
      |                                                            ^
a.cc:39:37: error: 'min' was not declared in this scope; did you mean 'main'?
   39 |                 ans[r.size() - 2] = min(ans[r.size() - 2], d);
      |                                     ^~~
      |                                     main
a.cc:41:40: error: 'cout' was not declared in this scope
   41 |         for(int i = 0; i < n + 1; i++) cout << ans[i] << endl;
      |                                        ^~~~
a.cc:41:58: error: 'endl' was not declared in this scope
   41 |         for(int i = 0; i < n + 1; i++) cout << ans[i] << endl;
      |                                                          ^~~~