#include <bits/stdc++.h>
unsigned M[20002][11], V[11], R[20002];
int main() {
  unsigned n, m, i, j, k;
  scanf("%u%u%u", &n, &m, &k);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) scanf("%u", &M[i][j]);
  while (k--) {
    scanf("%u%u", &i, &j);
    R[i - 1]--;
    V[j - 1]++;
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (M[i][j]) R[i] += V[j];
  printf("%u", *R);
  for (i = 0; ++i < n; printf(" %u", R[i]))
    ;
  putchar('\n');
  return 0;
}
