func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, m, L, start, endP;   vector<vector<long long> > edges;   vector<vector<long long> > neighbors;   vector<vector<long long> > paths;   long long weights[1000][1000] = {0};   long long dijk() {     vector<long long> distances(n, LLONG_MAX);     distances[start] = 0;     vector<bool> visited(n, false);     priority_queue<pair<long long, long long>,                    vector<pair<long long, long long> >,                    greater<pair<long long, long long> > >         pq;     pq.push({0, start});     while (!pq.empty()) {       long long currentWeight = pq.top().first;       long long currentNode = pq.top().second;       pq.pop();       if (visited[currentNode]) continue;       visited[currentNode] = true;       if (currentNode == endP) break;       for (long long i = 0; i < neighbors[currentNode].size(); i++) {         long long currNeighbor = neighbors[currentNode][i];         long long currDist = weights[currentNode][currNeighbor];         if (currDist == -1) continue;         if (currentWeight + currDist < distances[currNeighbor])           distances[currNeighbor] = currentWeight + currDist;         if (!visited[currNeighbor])           pq.push({distances[currNeighbor], currNeighbor});       }     }     return distances[endP];   }   long long dijk2() {     vector<long long> distances(n, LLONG_MAX);     distances[start] = 0;     vector<bool> visited(n, false);     priority_queue<pair<long long, long long>,                    vector<pair<long long, long long> >,                    greater<pair<long long, long long> > >         pq;     pq.push({0, start});     paths[start].push_back(start);     while (!pq.empty()) {       long long currentWeight = pq.top().first;       long long currentNode = pq.top().second;       pq.pop();       if (visited[currentNode]) continue;       visited[currentNode] = true;       if (currentNode == endP) break;       for (long long i = 0; i < neighbors[currentNode].size(); i++) {         long long currNeighbor = neighbors[currentNode][i];         long long currDist = weights[currentNode][currNeighbor];         if (currDist == -1) currDist = 1;         if (currentWeight + currDist < distances[currNeighbor]) {           distances[currNeighbor] = currentWeight + currDist;           paths[currNeighbor] = paths[currentNode];           paths[currNeighbor].push_back(currNeighbor);         }         if (!visited[currNeighbor])           pq.push({distances[currNeighbor], currNeighbor});       }     }     return distances[endP];   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> L >> start >> endP;     edges.resize(m);     neighbors.resize(n);     paths.resize(n);     long long from, to, weight;     for (long long i = 0; i < m; i++) {       cin >> from >> to >> weight;       if (weight == 0) weight = -1;       weights[from][to] = weight;       weights[to][from] = weight;       edges[i] = {from, to, weight};       neighbors[from].push_back(to);       neighbors[to].push_back(from);     }     long long currMin = dijk();     if (currMin < L) {       cout <<  NO  << endl;       return 0;     }     long long newMin = dijk2();     if (newMin > L) {       cout <<  NO  << endl;       return 0;     }     for (long long i = 1; i < paths[endP].size(); i++) {       long long prev = paths[endP][i - 1];       long long curr = paths[endP][i];       if (weights[prev][curr] == -1) {         weights[prev][curr] = -2;         weights[curr][prev] = -2;       }     }     for (long long i = 0; i < edges.size(); i++) {       long long from = edges[i][0];       long long to = edges[i][1];       long long weight = weights[from][to];       if (weight == -1) {         weights[from][to] = 999999999999;         weights[to][from] = 999999999999;       }     }     for (long long i = 1; i < paths[endP].size(); i++) {       long long prev = paths[endP][i - 1];       long long curr = paths[endP][i];       if (weights[prev][curr] == -2) {         weights[prev][curr] = -1;         weights[curr][prev] = -1;       }     }     while (newMin != L) {       long long diff = L - newMin;       for (long long i = 1; i < paths[endP].size(); i++) {         long long prev = paths[endP][i - 1];         long long curr = paths[endP][i];         if (weights[prev][curr] == -1) {           weights[prev][curr] = diff + 1;           weights[curr][prev] = diff + 1;           break;         }       }       paths.clear();       paths.resize(n);       newMin = dijk2();     }     for (long long i = 1; i < paths[endP].size(); i++) {       long long prev = paths[endP][i - 1];       long long curr = paths[endP][i];       if (weights[prev][curr] == -1) {         weights[prev][curr] = 1;         weights[curr][prev] = 1;       }     }     cout <<  YES  << endl;     for (long long i = 0; i < edges.size(); i++) {       long long from = edges[i][0];       long long to = edges[i][1];       long long weight = weights[from][to];       if (weight == -1) weight = 999999999999;       cout << from <<     << to <<     << weight << endl;     }     return 0;   }   