func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<long long, long long> p;   vector<pair<long long, long long>> adj[101];   long long visited[101];   long long parent[101];   long long maxi = 0;   set<long long, greater<long long>> set1;   vector<long long> arr;   long long ans[101];   void dfs(long long v, long long p) {     for (auto q : adj[v]) {       long long u = q.first;       if (u == p) continue;       dfs(u, v);       ans[v] = max(ans[v], ans[u] + q.second);     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n, a, b, c;     cin >> n;     long long z = n - 1;     while (z--) {       cin >> a >> b >> c;       adj[a].push_back(make_pair(b, c));       adj[b].push_back(make_pair(a, c));     }     memset(visited, 0, sizeof(visited));     dfs(0, -1);     cout << ans[0] << endl;     return 0;   }   