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