#include <bits/stdc++.h>
using namespace std;
const int N = 2e4 + 5;
int n, m, k;
int mark[N][11];
int room[11] = {}, got[N] = {};
int main(void) {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) scanf("%d", &mark[i][j]);
  for (int i = 0; i < k; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --got[--x];
    ++room[--y];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j)
      if (mark[i][j]) got[i] += room[j];
    printf("%d ", got[i]);
  }
  return 0;
}
