#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, 0));
  vector<int> worker(n, 0);
  vector<int> chat(m, 0);
  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++) {
    cin >> x >> y;
    worker[x - 1] -= 1;
    chat[y - 1] += 1;
  }
  for (int i = 0; i < n; i++) {
    int d = 0;
    for (int j = 0; j < m; j++) {
      if (a[i][j]) {
        d += chat[j];
      }
    }
    cout << d + worker[i] << " ";
  }
  return 0;
}
