#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[20001][11];
int sum[20001];
int summ[11];
int main() {
  int i, j, t;
  int x, y;
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  memset(sum, 0, sizeof(sum));
  memset(summ, 0, sizeof(summ));
  for (t = 0; t < k; t++) {
    scanf("%d%d", &x, &y);
    sum[x]--;
    summ[y]++;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (a[i][j] == 1) sum[i] += summ[j];
    }
  }
  for (i = 1; i <= n; i++) {
    if (i != n)
      printf("%d ", sum[i]);
    else
      printf("%d\n", sum[i]);
  }
  return 0;
}
