#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> ans, count;
  vector<vector<int> > a;
  int n, m, k, x, y;
  cin >> n >> m >> k;
  a.resize(n);
  ans.resize(n, 0);
  for (int i = 0; i < n; i++) {
    a[i].resize(m);
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  count.resize(m);
  for (int i = 0; i < k; i++) {
    cin >> x >> y;
    x--;
    y--;
    ans[x]--;
    count[y]++;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j]) ans[i] += count[j];
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
