#include <bits/stdc++.h>
const int S = 2e4 + 10;
int matrix[S][12], n, m, k, ans[S], room[12], sent[S][12];
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", &matrix[i][j]);
  for (int i = 1; i <= k; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    sent[a][b]++;
    room[b]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      if (matrix[i][j]) ans[i] += room[j] - sent[i][j];
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
