func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> e[100005];   int used[100005];   void bfs(int x) {     queue<int> q;     while (!q.empty()) q.pop();     q.push(x);     used[x] = 1;     while (!q.empty()) {       int p = q.front();       q.pop();       for (int i = 0; i < e[p].size(); i++) {         if (e[p][i]) {           if (!used[e[p][i]]) {             if (used[p] == 1)               used[e[p][i]] = 2;             else               used[e[p][i]] = 1;             q.push(e[p][i]);           }         }       }     }   }   int main() {     int n, x, y;     while (~scanf( %d , &n)) {       for (int i = 0; i < n - 1; i++) {         scanf( %d%d , &x, &y);         e[x].push_back(y);         e[y].push_back(x);       }       memset(used, 0, sizeof(used));       bfs(1);       long long ans1 = 0, ans2 = 0;       for (int i = 1; i <= n; i++) {         if (used[i] == 1)           ans1++;         else           ans2++;       }       printf( %I64d n , ans2 * ans1 - (n - 1));     }     return 0;   }   