#include <bits/stdc++.h>
using namespace std;
int ans = 0;
int i, j, n, m, k, z, x, y, t, mi, ma;
int a[21111][11], d[21111], b[11], bb[21111], dp[21111][11];
char st[11];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  while (k--) {
    scanf("%d%d", &x, &y);
    dp[x][y]++;
    b[y]++;
  }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      if (a[i][j]) d[i] = d[i] + b[j] - dp[i][j];
    }
  for (i = 1; i <= n; i++) printf("%d ", d[i]);
}
