func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<int, int> sorted_pair(int x, int y) {     if (x > y) {       return pair<int, int>(y, x);     } else {       return pair<int, int>(x, y);     }   }   int main() {     int n;     cin >> n;     vector<vector<int>> graph(n + 1, vector<int>());     set<pair<int, int>> pairs;     for (int i = 0; i < n - 1; i++) {       int x, y;       cin >> x >> y;       graph[x].push_back(y);       graph[y].push_back(x);     }     for (int i = 1; i <= n; i++) {       queue<pair<int, int>> q;       q.push(pair<int, int>(i, 0));       vector<bool> visited(n + 1, false);       while (!q.empty()) {         int v = q.front().first;         int lvl = q.front().second;         visited[v] = true;         if (lvl < 2) {           for (int k = 0; k < graph[v].size(); k++) {             if (!visited[graph[v][k]]) {               q.push(pair<int, int>(graph[v][k], lvl + 1));             }           }         } else if (lvl == 2) {           pairs.insert(sorted_pair(i, v));         }         q.pop();       }     }     cout << pairs.size() << endl;     return 0;   }   