#include <bits/stdc++.h>
int add[100001] = {0};
int mem[100001] = {0};
int main() {
  int n, m, k, i, j;
  scanf("%d %d %d", &n, &m, &k);
  int arr[n][m];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      scanf("%d", &arr[i][j]);
    }
  }
  int x, y;
  for (i = 0; i < k; i++) {
    scanf("%d %d", &x, &y);
    add[y - 1] = add[y - 1] + 1;
    mem[x - 1] = mem[x - 1] + 1;
  }
  for (i = 0; i < n; i++) {
    int sum = 0;
    for (j = 0; j < m; j++) {
      int a = arr[i][j];
      int b = add[j];
      sum = sum + (a * b);
    }
    int c = mem[i];
    printf("%d ", sum - c);
    sum = 0;
  }
  printf("\n");
  return 0;
}
