#include <bits/stdc++.h>   using namespace std;   const int limN = 1e5 + 5;   vector<pair<long long, int> > adj[limN];   bool usd[limN];   long long minP[limN];   int main() {     int ans = 0;     int N, E1, E2;     priority_queue<tuple<long long, int, int> > Q;     scanf( %d%d%d , &N, &E1, &E2);     for (int a, b, c; E1; E1--) {       scanf( %d%d%d , &a, &b, &c);       a--, b--;       adj[a].push_back({c, b});       adj[b].push_back({c, a});     }     for (int b, c; E2; E2--) {       scanf( %d%d , &b, &c);       b--;       Q.push({-c, 0, b});     }     Q.push({0, 1, 0});     while (!Q.empty()) {       long long dst;       int tip, pos;       tie(dst, tip, pos) = Q.top();       Q.pop();       if (usd[pos]) {         ans += 1 - tip;         continue;       }       dst *= -1;       usd[pos] = true;       for (const auto &second : adj[pos]) {         if (!usd[second.second] || minP[second.second] > dst + second.first) {           minP[second.second] = dst + second.first;           Q.push({-minP[second.second], 1, second.second});         }       }     }     printf( %d n , ans);   }   