#include <bits/stdc++.h>
int map[20005][12] = {{0}};
int p[20005] = {0};
int cha[12] = {0};
int main() {
  int i1, i2;
  int n, m, k;
  int x, y;
  memset(map, 0, sizeof(map));
  memset(p, 0, sizeof(p));
  memset(cha, 0, sizeof(cha));
  scanf("%d %d %d", &n, &m, &k);
  for (i1 = 1; i1 <= n; i1++) {
    for (i2 = 1; i2 <= m; i2++) {
      scanf("%d", &map[i1][i2]);
    }
  }
  for (i1 = 0; i1 < k; i1++) {
    scanf("%d %d", &x, &y);
    p[x]--;
    cha[y]++;
  }
  for (i1 = 1; i1 <= m; i1++) {
    if (map[1][i1] == 1) {
      p[1] += cha[i1];
    }
  }
  printf("%d", p[1]);
  for (i1 = 2; i1 <= n; i1++) {
    for (i2 = 1; i2 <= m; i2++) {
      if (map[i1][i2] == 1) {
        p[i1] += cha[i2];
      }
    }
    printf(" %d", p[i1]);
  }
  return 0;
}
