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