#include <bits/stdc++.h>
using namespace std;
int mx[20100][12];
long long chatmsg[20];
long long msgcnt[20100];
int main() {
  int n, m, k, i, j, l;
  while (cin >> n >> m >> k) {
    for (i = 0; i < 20; i++) chatmsg[i] = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) cin >> mx[i][j];
      msgcnt[i] = 0;
    }
    for (i = 0; i < k; i++) {
      cin >> l >> j;
      l--;
      j--;
      msgcnt[l]--;
      chatmsg[j]++;
    }
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (mx[i][j]) msgcnt[i] += chatmsg[j];
      }
    }
    cout << msgcnt[0];
    for (i = 1; i < n; i++) cout << " " << msgcnt[i];
    cout << endl;
  }
}
