#include <bits/stdc++.h>
using namespace std;
int arr[20004];
bool MAP[20004][11];
int S[11];
int main() {
  memset(arr, 0, sizeof arr);
  memset(S, 0, sizeof S);
  int players, rooms, k, a, b;
  cin >> players >> rooms >> k;
  for (int i = 0; i < players; i++) {
    for (int j = 0; j < rooms; j++) {
      cin >> MAP[i][j];
    }
  }
  while (k--) {
    cin >> a >> b;
    S[b - 1]++;
    arr[a - 1]--;
  }
  for (int i = 0; i < rooms; i++) {
    for (int j = 0; j < players; j++) {
      if (MAP[j][i]) arr[j] += S[i];
    }
  }
  for (int i = 0; i < players; i++) {
    cout << arr[i] << " ";
  }
  return 0;
}
