#include <bits/stdc++.h>
using namespace std;
int h[11][2 * 11111];
int a[11][2 * 11111];
long int co[2 * 1111] = {0};
int main() {
  long int n, m, k;
  cin >> n >> m >> k;
  int in;
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < m + 1; j++) {
      cin >> in;
      if (in == 1) {
        h[j][i] = 1;
      } else
        h[j][i] = 0;
    }
  }
  long int x, y;
  long int c[11] = {0};
  for (int i = 0; i < k; i++) {
    cin >> x >> y;
    c[y] += 1;
    if (h[y][x] == 1) co[x] -= 1;
  }
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < m + 1; j++) {
      if (h[j][i] == 1) {
        co[i] += c[j];
      }
    }
    cout << co[i] << " ";
  }
  return 0;
}
