#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, m, k, a[20001][11], b[10] = {0}, c[20001] = {0};
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  for (int i = 0; i < k; i++) {
    long x, y;
    cin >> x >> y;
    b[y - 1]++;
    c[x - 1]--;
  }
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < n; j++)
      if (a[j][i] == 1) c[j] += b[i];
  }
  for (int i = 0; i < n; i++) printf("%ld ", c[i]);
  return 0;
}
