#include <bits/stdc++.h>
using namespace std;
int mas[2123123][13], a, b, aa[121231], bb[123123], ans, k, i, j, n, m;
int main() {
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) cin >> mas[i][j];
  }
  while (k--) {
    cin >> a >> b;
    aa[a]++;
    bb[b]++;
  }
  for (i = 1; i <= n; i++) {
    ans = 0;
    for (j = 1; j <= m; j++) {
      if (mas[i][j] == 1) ans += bb[j];
    }
    cout << ans - aa[i] << " ";
  }
}
