#include <bits/stdc++.h>   using namespace std;   int n, m, k, ans, s, e, in[100020], pre[100020], vis[100020], ff[100020];   long long len[100020];   struct node {     int v, f;     long long w;   };   vector<node> adj[100020];   bool operator<(const node &x, const node &y) {     if (x.w > y.w) return true;     return false;   }   int dijk(int s) {     priority_queue<node> q;     node now, newnode;     now.w = 0;     now.v = s;     q.push(now);     int i, u, v;     memset(ff, 0, sizeof(ff));     memset(vis, 0, sizeof(vis));     memset(len, 123, sizeof(len));     len[s] = 0;     int cnt = 0;     while (!q.empty()) {       if (cnt == n) break;       u = q.top().v;       q.pop();       if (vis[u]) continue;       vis[u] = 1;       for (i = 0; i < adj[u].size(); i++) {         now = adj[u][i];         v = now.v;         if (now.w + len[u] < len[v] || (now.w + len[u] == len[v] && !now.f)) {           len[v] = now.w + len[u];           newnode.w = len[v];           newnode.v = v;           if (now.f)             ff[v] = 1;           else             ff[v] = 0;           pre[v] = u;           q.push(newnode);         }       }       cnt++;     }     return 0;   }   void addnode(int u, int v, int w, int f) {     node nn;     nn.v = v;     nn.w = w;     nn.f = f;     adj[u].push_back(nn);   }   int main() {     ans = 0;     int t, i, u, v, w, cnt = 0;     node now, nn;     scanf( %d%d%d , &n, &m, &k);     for (i = 0; i < m; i++) {       scanf( %d%d%d , &u, &v, &w);       addnode(u, v, w, 0);       addnode(v, u, w, 0);     }     for (i = 0; i < k; i++) {       scanf( %d%d , &v, &w);       addnode(1, v, w, 1);       addnode(v, 1, w, 1);     }     dijk(1);     ans = 0;     for (int i = 2; i <= n; i++) {       if (ff[i]) ans++;     }     printf( %d n , k - ans);     return 0;   }   