#include <bits/stdc++.h>
using namespace std;
bool ok[20010][11];
int num[20010];
int sum[11];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int a;
      scanf("%d", &a);
      ok[i][j] = a;
    }
  while (k--) {
    int a, b;
    scanf("%d %d", &a, &b);
    sum[b]++;
    num[a]--;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      if (ok[i][j]) num[i] += sum[j];
    printf("%d ", num[i]);
  }
  return 0;
}
