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