#include <bits/stdc++.h>
using namespace std;
int tab[20002];
int wth[11];
bool arr[20002][11];
int main() {
  int n, m, k, a, b, c;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> arr[i][j];
  memset(tab, 0, sizeof(tab)), memset(wth, 0, sizeof(wth));
  while (k--) {
    scanf("%d%d", &a, &b);
    tab[a - 1]++, wth[b - 1]++;
  }
  for (int i = 0; i < n; i++) {
    c = 0;
    for (int j = 0; j < m; j++) c += (arr[i][j] ? wth[j] : 0);
    printf("%d ", c - tab[i]);
  }
}
