#include <bits/stdc++.h>
int main() {
  int N, M, K;
  int g[20005][15];
  int cM[15];
  int cN[20005];
  while (scanf("%d %d %d", &N, &M, &K) > 0) {
    for (int i = 0; i < N; i++) {
      cN[i] = 0;
      for (int k = 0; k < M; k++) {
        scanf("%d", &g[i][k]);
      }
    }
    for (int i = 0; i < M; i++) cM[i] = 0;
    while (K--) {
      int x, y;
      scanf("%d %d", &x, &y);
      x--;
      y--;
      cN[x]--;
      cM[y]++;
    }
    for (int i = 0; i < N; i++) {
      for (int k = 0; k < M; k++)
        if (g[i][k]) cN[i] += cM[k];
      if (i)
        printf(" %d", cN[i]);
      else
        printf("%d", cN[i]);
    }
    printf("\n");
  }
  return 0;
}
