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