#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
int a[20000][10];
int cntc[10], cnte[20000];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int(i) = 0; (i) < (int)(n); ++(i))
    for (int(j) = 0; (j) < (int)(m); ++(j)) scanf("%d", &a[i][j]);
  memset(cntc, 0, sizeof(cntc));
  memset(cnte, 0, sizeof(cnte));
  for (int(i) = 0; (i) < (int)(k); ++(i)) {
    int x, y;
    scanf("%d%d", &x, &y), x--, y--;
    cnte[x]++;
    cntc[y]++;
  }
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    if (i != 0) putchar(' ');
    int sum = 0;
    for (int(j) = 0; (j) < (int)(m); ++(j))
      if (a[i][j] == 1) sum += cntc[j];
    sum -= cnte[i];
    printf("%d", sum);
  }
  puts("");
  return 0;
}
