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