#include <bits/stdc++.h>
int main() {
  int n, m, s;
  int aa[200003] = {0};
  int ms[100] = {0};
  scanf("%d%d%d", &n, &m, &s);
  bool b[20003][11] = {0};
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &b[i][j]);
    }
  }
  int x, y;
  for (int i = 0; i < s; i++) {
    scanf("%d%d", &x, &y);
    aa[x]--;
    ms[y]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (b[i][j]) aa[i] += ms[j];
    }
  }
  for (int i = 1; i < n; i++) {
    printf("%d ", aa[i]);
  }
  printf("%d\n", aa[n]);
  return 0;
}
