#include <bits/stdc++.h>
using namespace std;
int em[20005], ma[20005][11], lts[11];
int main() {
  int n, m, k;
  while (scanf("%d %d %d", &n, &m, &k) != EOF) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) scanf("%d", &ma[i][j]);
    }
    memset(em, 0, sizeof(em));
    memset(lts, 0, sizeof(lts));
    for (int i = 0; i < k; i++) {
      int a, b;
      scanf("%d %d", &a, &b);
      --em[a];
      ++lts[b];
    }
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) {
        if (ma[j][i] == 1) em[j] += lts[i];
      }
    }
    for (int i = 1; i <= n; i++) {
      if (i == 1)
        printf("%d", em[i]);
      else
        printf(" %d", em[i]);
    }
    printf("\n");
  }
  return 0;
}
