func_code_string: #include <bits/stdc++.h>   int n, m;   int graph[21][21];   int deg[21];   int odd_cnt;   int odd[21];   int check[21];   int min1, sum;   void dfs(int u, int v, int len) {     int i, j;     if (len > min1) return;     for (i = 0; i < odd_cnt; i++) {       if (check[i] == 0) break;     }     if (i == odd_cnt) {       if (min1 > len) min1 = len;       return;     }     for (j = i + 1; j < odd_cnt; j++) {       if (!check[j]) {         check[i] = check[j] = 1;         dfs(i, j, len + graph[odd[i]][odd[j]]);         check[i] = check[j] = 0;       }     }   }   int chinese_postman() {     int i, j, k;     for (k = 1; k <= n; k++) {       for (i = 1; i <= n; i++) {         for (j = 1; j <= n; j++) {           graph[i][j] = ((graph[i][j]) > (graph[i][k] + graph[k][j])                              ? (graph[i][k] + graph[k][j])                              : (graph[i][j]));         }       }     }     for (i = 1; i <= n; i++) {       if (graph[1][i] == 999999999 && deg[i] > 0) return -1;     }     memset(odd, 0, sizeof(odd));     odd_cnt = 0;     for (i = 1; i <= n; i++) {       if (deg[i] & 1) {         odd[odd_cnt++] = i;       }     }     memset(check, 0, sizeof(check));     if (odd_cnt)       min1 = 999999999;     else       min1 = 0;     for (i = 1; i < odd_cnt; i++) {       check[0] = check[i] = 1;       dfs(0, i, graph[odd[0]][odd[i]]);       check[0] = check[i] = 0;     }     return min1 + sum;   }   int main() {     int i, j, a, b, c, res;     while (scanf( %d%d , &n, &m) == 2) {       memset(deg, 0, sizeof(deg));       for (i = 1; i <= n; i++) {         for (j = 1; j <= n; j++) graph[i][j] = 999999999;         graph[i][j] = 0;       }       sum = 0;       for (i = 0; i < m; i++) {         scanf( %d%d%d , &a, &b, &c);         sum += c;         graph[a][b] = graph[b][a] = ((graph[a][b]) > (c) ? (c) : (graph[a][b]));         deg[a]++;         deg[b]++;       }       res = chinese_postman();       printf( %d n , res);     }     return 0;   }   