#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[100001][11], x[100001], cnt[11], u, v;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  for (int i = 1; i <= k && scanf("%d%d", &u, &v); i++) x[u]++, cnt[v]++;
  for (int i = 1; i <= n; i++) {
    int y = 0;
    for (int j = 1; j <= m; j++)
      if (a[i][j]) y += cnt[j];
    printf("%d ", y - x[i]);
  }
  return 0;
}
