#include <bits/stdc++.h>   using namespace std;   vector<pair<pair<int, int>, int> > g[100010];   long long dist[100010];   bool mark[100010];   int req[100010];   void dijkstra(int n) {     memset(mark, 0, sizeof(mark));     priority_queue<pair<long long, long long>,                    vector<pair<long long, long long> >,                    greater<pair<long long, long long> > >         pq;     pq.push(make_pair(dist[n], n));     while (!pq.empty()) {       int u = pq.top().second;       pq.pop();       if (mark[u]) continue;       mark[u] = true;       for (int i = 0; i < g[u].size(); i++) {         pair<int, int> v = g[u][i].first;         int t = g[u][i].second;         if (dist[v.first] > dist[u] + v.second) {           dist[v.first] = dist[u] + v.second;           pq.push(make_pair(dist[v.first], v.first));           req[v.first] = t;         } else if (t == -1 && dist[v.first] == dist[u] + v.second) {           dist[v.first] = dist[u] + v.second;           req[v.first] = t;         }       }     }   }   int main(int argc, char const *argv[]) {     for (int i = 0; i < 100010; i++) dist[i] = 1LL << 60;     int n, m, k;     scanf( %d%d%d , &n, &m, &k);     while (m--) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       g[x].push_back({{y, z}, -1});       g[y].push_back({{x, z}, -1});     }     dist[1] = 0;     dijkstra(1);     int ans = 0;     for (int i = 0; i < k; i++) {       int x, y;       scanf( %d%d , &x, &y);       g[1].push_back({{x, y}, i + 1});       g[x].push_back({{1, y}, i + 1});     }     dijkstra(1);     for (int i = 1; i <= n; i++) {       if (req[i] > 0) ans++;     }     ans = k - ans;     printf( %d n , ans);     return 0;   }   