#include <bits/stdc++.h>
using namespace std;
int a[22222][11];
int s[11];
int b[22222][11];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  while (k-- > 0) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    s[y]++;
    b[x][y]++;
  }
  for (int i = 0; i < n; i++) {
    int x = 0;
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 1) {
        x += s[j] - b[i][j];
      }
    }
    cout << x << " ";
  }
  return 0;
}
