func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 105;   int main() {     int n;     int as[maxn], bs[maxn], cs[maxn];     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d%d%d , &as[i], &bs[i], &cs[i]);       as[i]--;       bs[i]--;     }     int costA = 0;     int costB = 0;     int curEdge = 0;     int curTown = as[curEdge];     for (int i = 0; i < n; i++) {       int newEdge = -1;       int newTown = -1;       for (int j = 0; j < n; j++) {         if (j == curEdge) continue;         if (as[j] == curTown) {           newEdge = j;           newTown = bs[j];           costA += cs[j];           break;         }         if (bs[j] == curTown) {           newEdge = j;           newTown = as[j];           costB += cs[j];           break;         }       }       curEdge = newEdge;       curTown = newTown;     }     printf( %d n , min(costA, costB));     return 0;   }   