Language: C++

			if (dis < mindis) {
				mindis = dis;
				x = i;
				y = k;
			}
		}
	}
	v[y] += v[x];
	myerase(v, x);
}

int f1(std::vector<int> &v, int length, int mpmax) {
	int i = 0, mindis = 1000, tmpi;
	for (const auto &e : v) {
		if (length == e) {
			myerase(v, i);
			return mpmax;
		}
		else {
			int dis = std::abs(length - e);
			if (dis <= mindis) {
				mindis = dis;
				tmpi = i;
			}
		}
		i++;
	}
	if (mindis < mpmax + 10) {
		myerase(v, tmpi);
		return mpmax + mindis;
	}
	else {
		if (static_cast<int>(v.size()) > 1) {
			mp10(v, length);
		}
		else {
			return mpmax + std::abs(length - v[0]);
		}
		return f1(v, length, mpmax + 10);
	}
}

int baka(std::vector<int> v, int x, int y, int z) {
	return f1(v, x, 0) + f1(v, y, 0) + f1(v, z, 0);
}

int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	
	int n, a, b, c, l;
	
	std::cin >> n >> a >> b >> c;
	std::cin.ignore();

	std::vector<int> v;
	rep(n, [&](int i) {
			std::cin >> l;
			v.push_back(l);
			});

	std::vector<int> mp;

	mp.push_back(baka(v, a, b, c));
	mp.push_back(baka(v, a, c, b));
	mp.push_back(baka(v, b, a, c));
	mp.push_back(baka(v, b, c, a));
	mp.push_back(baka(v, c, a, b));
	mp.push_back(baka(v, c, b, a));
	std::sort(mp.begin(), mp.end());

	std::cout << mp[0] << '\n'; 
	return 0;
}


Compiler output:
a.cc:1:25: error: expected unqualified-id before 'if'
    1 |                         if (dis < mindis) {
      |                         ^~
a.cc:6:17: error: expected declaration before '}' token
    6 |                 }
      |                 ^
a.cc:7:9: error: expected declaration before '}' token
    7 |         }
      |         ^
a.cc:8:9: error: 'v' does not name a type
    8 |         v[y] += v[x];
      |         ^
a.cc:9:16: error: expected constructor, destructor, or type conversion before '(' token
    9 |         myerase(v, x);
      |                ^
a.cc:10:1: error: expected declaration before '}' token
   10 | }
      | ^
a.cc:12:13: error: 'vector' is not a member of 'std'
   12 | int f1(std::vector<int> &v, int length, int mpmax) {
      |             ^~~~~~
a.cc:1:8: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 |                         if (dis < mindis) {
a.cc:12:20: error: expected primary-expression before 'int'
   12 | int f1(std::vector<int> &v, int length, int mpmax) {
      |                    ^~~
a.cc:12:29: error: expected primary-expression before 'int'
   12 | int f1(std::vector<int> &v, int length, int mpmax) {
      |                             ^~~
a.cc:12:41: error: expected primary-expression before 'int'
   12 | int f1(std::vector<int> &v, int length, int mpmax) {
      |                                         ^~~
a.cc:12:50: error: expression list treated as compound expression in initializer [-fpermissive]
   12 | int f1(std::vector<int> &v, int length, int mpmax) {
      |                                                  ^
a.cc:43:15: error: 'vector' is not a member of 'std'
   43 | int baka(std::vector<int> v, int x, int y, int z) {
      |               ^~~~~~
a.cc:43:15: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:43:22: error: expected primary-expression before 'int'
   43 | int baka(std::vector<int> v, int x, int y, int z) {
      |                      ^~~
a.cc:43:30: error: expected primary-expression before 'int'
   43 | int baka(std::vector<int> v, int x, int y, int z) {
      |                              ^~~
a.cc:43:37: error: expected primary-expression before 'int'
   43 | int baka(std::vector<int> v, int x, int y, int z) {
      |                                     ^~~
a.cc:43:44: error: expected primary-expression before 'int'
   43 | int baka(std::vector<int> v, int x, int y, int z) {
      |                                            ^~~
a.cc:43:49: error: expression list treated as compound expression in initializer [-fpermissive]
   43 | int baka(std::vector<int> v, int x, int y, int z) {
      |                                                 ^
a.cc: In function 'int main()':
a.cc:48:14: error: 'cin' is not a member of 'std'
   48 |         std::cin.tie(0);
      |              ^~~
a.cc:1:8: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 |                         if (dis < mindis) {
a.cc:49:14: error: 'std::ios' has not been declared
   49 |         std::ios::sync_with_stdio(false);
      |              ^~~
a.cc:53:14: error: 'cin' is not a member of 'std'
   53 |         std::cin >> n >> a >> b >> c;
      |              ^~~
a.cc:53:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:54:14: error: 'cin' is not a member of 'std'
   54 |         std::cin.ignore();
      |              ^~~
a.cc:54:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:56:14: error: 'vector' is not a member of 'std'
   56 |         std::vector<int> v;
      |              ^~~~~~
a.cc:56:14: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:56:21: error: expected primary-expression before 'int'
   56 |         std::vector<int> v;
      |                     ^~~
a.cc: In lambda function:
a.cc:58:30: error: 'cin' is not a member of 'std'
   58 |                         std::cin >> l;
      |                              ^~~
a.cc:58:30: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:59:25: error: 'v' was not declared in this scope
   59 |                         v.push_back(l);
      |                         ^
a.cc: In function 'int main()':
a.cc:57:9: error: 'rep' was not declared in this scope
   57 |         rep(n, [&](int i) {
      |         ^~~
a.cc:62:14: error: 'vector' is not a member of 'std'
   62 |         std::vector<int> mp;
      |              ^~~~~~
a.cc:62:14: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:62:21: error: expected primary-expression before 'int'
   62 |         std::vector<int> mp;
      |                     ^~~
a.cc:64:9: error: 'mp' was not declared in this scope
   64 |         mp.push_back(baka(v, a, b, c));
      |         ^~
a.cc:64:27: error: 'v' was not declared in this scope
   64 |         mp.push_back(baka(v, a, b, c));
      |                           ^
a.cc:64:26: error: 'baka' cannot be used as a function
   64 |         mp.push_back(baka(v, a, b, c));
      |                      ~~~~^~~~~~~~~~~~
a.cc:65:26: error: 'baka' cannot be used as a function
   65 |         mp.push_back(baka(v, a, c, b));
      |                      ~~~~^~~~~~~~~~~~
a.cc:66:26: error: 'baka' cannot be used as a function
   66 |         mp.push_back(baka(v, b, a, c));
      |                      ~~~~^~~~~~~~~~~~
a.cc:67:26: error: 'baka' cannot be used as a function
   67 |         mp.push_back(baka(v, b, c, a));
      |                      ~~~~^~~~~~~~~~~~
a.cc:68:26: error: 'baka' cannot be used as a function
   68 |         mp.push_back(baka(v, c, a, b));
      |                      ~~~~^~~~~~~~~~~~
a.cc:69:26: error: 'baka' cannot be used as a function
   69 |         mp.push_back(baka(v, c, b, a));
      |                      ~~~~^~~~~~~~~~~~
a.cc:70:14: error: 'sort' is not a member of 'std'
   70 |         std::sort(mp.begin(), mp.end());
      |              ^~~~
a.cc:72:14: error: 'cout' is not a member of 'std'
   72 |         std::cout << mp[0] << '\n';
      |              ^~~~
a.cc:72:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'