func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAXN = 1e5 + 10;   const long long INF = 1e18;   int n, m, h[MAXN], a[MAXN], c[MAXN];   double x, ans[MAXN];   vector<pair<int, int>> g[MAXN];   vector<int> going;   bool visited[MAXN], b, res, f;   void dfs(int v, int hi, int p) {     visited[v] = true;     going.push_back(v);     h[v] = hi;     for (auto u : g[v]) {       if (!visited[u.first]) {         a[u.first] = u.second - a[v];         dfs(u.first, hi + 1, v);       } else if (u.first != p) {         if ((h[v] & 1) == (h[u.first] & 1)) {           double z = double(a[v] - (u.second - a[u.first])) / 2;           if (!(h[v] & 1)) {             z *= -1;           }           if (!b) {             b = true;             x = z;           } else if (z != x) {             res = false;           }         } else {           if (u.second - a[u.first] != a[v]) {             res = false;           }         }       }     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 0; i < m; i++) {       int u, v, c;       cin >> u >> v >> c;       g[u].push_back({v, c});       g[v].push_back({u, c});     }     res = true;     for (int i = 1; i <= n; i++) {       if (!visited[i]) {         b = false;         going.clear();         dfs(i, 0, 0);         if (res) {           if (!b) {             for (int j = 0; j < going.size(); j++) {               if (h[going[j]] & 1) {                 c[j] = a[going[j]];               } else {                 c[j] = -a[going[j]];               }             }             sort(c, c + going.size());             x = c[going.size() / 2];           }           for (auto j : going) {             if (h[j] & 1) {               ans[j] = double(a[j]) - x;             } else {               ans[j] = double(a[j]) + x;             }           }         } else {           cout <<  NO ;           return 0;         }       }     }     cout <<  YES  <<   n ;     for (int i = 1; i <= n; i++) {       if (ceil(ans[i]) != ans[i]) {         cout << fixed << setprecision(1);       }       cout << ans[i] <<    ;     }     return 0;   }   