func_code_string: #include <bits/stdc++.h>   using namespace std;   int N, memo[1 << 25];   pair<int, int> arr[30];   int dist(int a, int n) {     int k1 = arr[n].first - arr[a].first;     int k2 = arr[n].second - arr[a].second;     return k1 * k1 + k2 * k2;   }   int dp(int mask) {     if (__builtin_popcount(mask) == N) {       return 0;     }     if (memo[mask] != 0) return memo[mask];     int res = 1e9;     for (int i = 1; i <= N; i++) {       if (!((mask >> (i - 1) & 1))) {         res = min(res, dp(mask | (1 << (i - 1))) + 2 * dist(i, 0));         for (int j = i + 1; j <= N; j++) {           if (!(mask >> (j - 1) & 1) and i != j) {             res = min(res, dp(mask | (1 << (i - 1)) | (1 << (j - 1))) +                                dist(i, 0) + dist(i, j) + dist(j, 0));           }         }         break;       }     }     memo[mask] = res;     return res;   }   void backtrack(int mask) {     if (__builtin_popcount(mask) == N) {       return;     }     for (int i = 1; i <= N; i++) {       if (!((mask >> (i - 1) & 1))) {         if (dp(mask | (1 << (i - 1))) + 2 * dist(i, 0) == dp(mask)) {           cout << 0 <<     << i <<    ;           backtrack(mask | (1 << (i - 1)));           return;         }         for (int j = i + 1; j <= N; j++) {           if (!(mask >> (j - 1) & 1) and i != j) {             if (dp(mask | (1 << (i - 1)) | (1 << (j - 1))) + dist(i, 0) +                     dist(i, j) + dist(j, 0) ==                 dp(mask)) {               cout << 0 <<     << i <<     << j <<    ;               backtrack(mask | (1 << (i - 1)) | (1 << (j - 1)));               return;             }           }         }         break;       }     }     return;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);     cin >> arr[0].first >> arr[0].second;     cin >> N;     for (int i = 1; i <= N; i++) cin >> arr[i].first >> arr[i].second;     cout << dp(0) << endl;     backtrack(0);     cout << 0 << endl;   }   