#include <bits/stdc++.h>
int n, m, k, counter[12], fuck[20010], ar[20010][12];
int main() {
  int i, j, l, x, y;
  while (scanf("%d %d %d", &n, &m, &k) != EOF) {
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        scanf("%d", &ar[i][j]);
      }
    }
    memset(counter, 0, sizeof(counter)), memset(fuck, 0, sizeof(fuck));
    while (k--) {
      scanf("%d %d", &x, &y);
      counter[y]++;
      fuck[x]++;
    }
    for (i = 1; i <= n; i++) {
      int res = 0;
      for (j = 1; j <= m; j++) {
        if (ar[i][j]) res += counter[j];
      }
      res -= fuck[i];
      if (i > 1) putchar(32);
      printf("%d", res);
    }
    puts("");
  }
  return 0;
}
