#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int i, j, x, y;
int ch[133133], co[133133], a[133133];
int main() {
  vector<int> V[13];
  vector<int>::iterator it;
  scanf("%d %d %d", &n, &m, &k);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%d", &x);
      if (x) {
        V[j].push_back(i);
      }
    }
  }
  for (i = 1; i <= k; i++) {
    scanf("%d %d", &x, &y);
    ch[x]++;
    co[y]++;
  }
  for (i = 1; i <= m; i++) {
    for (it = V[i].begin(); it != V[i].end(); it++) {
      a[*it] += co[i];
    }
  }
  for (i = 1; i <= n; i++) {
    printf("%d ", a[i] - ch[i]);
  }
}
