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