func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     vector<vector<int>> g(n);     for (int i = 0; (i) < (int)(n - 1); (i)++) {       int a, b;       scanf( %d%d , &a, &b);       a--, b--;       g[a].push_back(b);       g[b].push_back(a);     }     int ans = 0;     for (int s = 0; (s) < (int)(n); (s)++) {       for (int t = s + 1; t < n; t++) {         vector<int> tmp, path;         function<void(int, int)> dfs = [&](int u, int prev) {           if (u == t) {             path = tmp;             return;           }           for (auto v : g[u])             if (v != prev) {               tmp.push_back(v);               dfs(v, u);               tmp.pop_back();             }         };         tmp.push_back(s);         dfs(s, -1);         vector<bool> ng(n);         for (int p : path) ng[p] = true;         int len = (int)path.size() - 1;         vector<int> dp1(n), dp2(n);         function<void(int, int)> dfs2 = [&](int u, int prev) {           vector<int> pro;           for (auto v : g[u])             if (v != prev) {               dfs2(v, u);               dp1[u] = max(dp1[u], dp1[v]);               dp1[u] = max(dp1[u], dp2[v]);               if (!ng[v]) pro.push_back(dp2[v]);             }           if (pro.size() == 0 || ng[u]) return;           sort(pro.rbegin(), pro.rend());           dp2[u] = pro[0] + 1;           if (pro.size() > 1) {             dp1[u] = max(dp1[u], pro[0] + pro[1] + 2);           }         };         dfs2(s, -1);         ans = max(ans, len * dp1[s]);       }     }     printf( %d n , ans);     return 0;   }   