#include <bits/stdc++.h>
using namespace std;
int sdct[20005], chatct[11];
int mp[20005][11];
int n, m, k;
int ans[20005];
int main() {
  while (~scanf("%d%d%d", &n, &m, &k)) {
    memset(sdct, 0, sizeof(sdct));
    memset(chatct, 0, sizeof(chatct));
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) scanf("%d", &mp[i][j]);
    }
    for (int i = 0; i < k; ++i) {
      int a, b;
      scanf("%d %d", &a, &b);
      --a, --b;
      sdct[a]++;
      chatct[b]++;
    }
    for (int i = 0; i < n; ++i) {
      ans[i] = -sdct[i];
      for (int j = 0; j < m; ++j) {
        if (mp[i][j]) ans[i] += chatct[j];
      }
    }
    for (int i = 0; i < n; ++i) printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
  }
  return 0;
}
