func_code_string: #include <bits/stdc++.h>   using namespace std;   struct edge {     int b;     bool x;     edge *next;   } E[100010], *rt[100010];   int o = 0;   int mi = 100000000;   int N;   void addedge(int a, int b) {     edge *p = &E[o++];     p->b = b;     p->x = false;     p->next = rt[a];     rt[a] = p;     p = &E[o++];     p->b = a;     p->x = true;     p->next = rt[b];     rt[b] = p;   }   int S[10010];   bool jud[10010];   void init() {     for (int i = 1; i <= N; i++) {       jud[i] = false;       S[i] = 0;     }   }   void pdfs(int n) {     jud[n] = true;     for (edge *p = rt[n]; p != NULL; p = p->next) {       int b = p->b;       if (!jud[b]) {         pdfs(b);         S[n] += S[b];         if (p->x) S[n]++;       }     }   }   void dfs(int n, int s0, int s1) {     jud[n] = true;     int b, s, t0, t1;     for (edge *p = rt[n]; p != NULL; p = p->next) {       b = p->b;       if (!jud[b]) {         s = S[n];         mi = min(mi, s + s0);         t0 = s + s0 - S[b];         if (p->x)           s = S[n] - 1;         else           s = S[n] + 1;         mi = min(mi, s + s1);         t1 = s + s1 - S[b];         s = S[n] - (p->x == true);         mi = min(mi, s + s0);         t1 = min(t1, s + s0 - S[b]);         dfs(b, t0, t1);       }     }   }   int main() {     o = 0;     int i, j, k;     int a, b, s;     scanf( %d , &N);     if (N == 1) {       printf( 0 n );       return 0;     }     for (i = 0; i <= N; i++) {       rt[i] = NULL;     }     for (i = 1; i < N; i++) {       scanf( %d%d , &a, &b);       addedge(a, b);     }     for (i = 1; i <= N; i++) {       init();       pdfs(i);       for (j = 0; j <= N; j++) jud[j] = false;       dfs(i, 0, 0);     }     printf( %d n , mi);     return 0;   }   