#include <bits/stdc++.h>
using namespace std;
int n, m, k, x, y;
int c[12], d[20002][12];
bool w[20002][12];
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", &w[i][j]);
  for (int i = 1; i <= k; i++) {
    scanf("%d %d", &x, &y);
    d[x][y]++;
    c[y]++;
  }
  for (int i = 1; i <= n; i++) {
    x = 0;
    for (int j = 1; j <= m; j++)
      if (w[i][j]) {
        x += c[j] - d[i][j];
      }
    printf("%d ", x);
  }
  return 0;
}
