#include <bits/stdc++.h>
int sum[20000 + 2][10 + 2], save[20000 + 2], vis[20000 + 2];
int main() {
  int n, m, k;
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    memset(sum, 0, sizeof(sum));
    memset(save, 0, sizeof(save));
    memset(vis, 0, sizeof(vis));
    int val;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        scanf("%d", &val);
        if (val == 1) sum[i][j] = 1;
      }
    int k1, k2;
    while (k--) {
      scanf("%d%d", &k1, &k2);
      save[k2]++;
      vis[k1]++;
    }
    for (int z = 1; z <= n; z++) {
      int s = 0;
      for (int p = 1; p <= m; p++) {
        if (sum[z][p]) s += save[p];
      }
      if (z > 1) printf(" ");
      printf("%d", s - vis[z]);
    }
    printf("\n");
  }
  return 0;
}
