#include <bits/stdc++.h>
using namespace std;
int a[30000][20];
int x, y, z[30], z1[300000], z2[300000];
int main() {
  int n, m, k, i, j;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  memset(z, 0, sizeof(z));
  memset(z1, 0, sizeof(z1));
  memset(z2, 0, sizeof(z2));
  for (i = 0; i < k; i++) {
    scanf("%d%d", &x, &y);
    z[y - 1]++;
    z1[x - 1]++;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (a[i][j]) z2[i] += z[j];
    }
    z2[i] = z2[i] - z1[i];
  }
  for (i = 0; i < n; i++) printf("%d ", z2[i]);
  return 0;
}
