#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[20000 + 10][20];
int kq[20000 + 10], chat[20];
void input() {
  int i, j, x, room;
  scanf("%d %d %d", &n, &m, &k);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  memset(kq, 0, sizeof(kq));
  memset(chat, 0, sizeof(chat));
  for (i = 1; i <= k; i++) {
    scanf("%d %d", &x, &room);
    kq[x]--;
    chat[room]++;
  }
  for (i = 1; i <= m; i++)
    for (j = 1; j <= n; j++)
      if (a[j][i]) kq[j] += chat[i];
  for (i = 1; i <= n; i++) {
    if (i - 1) printf(" ");
    printf("%d", kq[i]);
  }
}
int main() {
  input();
  fclose(stdin);
  fclose(stdout);
  return 0;
}
