#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
int n, m, k;
int x[20010][20], sum[20010], ans[20010];
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", &x[i][j]);
    }
  }
  int a, b;
  for (int i = 1; i <= k; i++) {
    scanf("%d%d", &a, &b);
    sum[b]++;
    ans[a]--;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++)
      if (x[j][i]) {
        x[j][i] = sum[i];
      }
  }
  for (int i = 1; i <= n; i++) {
    int ret = 0;
    for (int j = 1; j <= m; j++) {
      ret += x[i][j];
    }
    printf("%d%c", ret + ans[i], (i == n) ? 10 : ' ');
  }
  return 0;
}
