#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int arr[n + 1][m + 1];
  int pre[m + 1][n + 1];
  int se[m + 1][n + 1];
  int ans[n + 1];
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= n; j++) {
      se[i][j] = 0;
      ans[j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> arr[i][j];
      pre[j][i] = -1;
    }
  }
  for (int j = 1; j <= m; j++) {
    for (int i = 1; i <= n; i++) {
      if (arr[i][j] == 1) {
        pre[j][i] = 0;
      } else {
        pre[j][i] = -1;
      }
    }
  }
  for (int i = 0; i < k; i++) {
    int x, y;
    cin >> x >> y;
    se[y][x] += 1;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (se[i][j] >= 1) se[i][0] += se[i][j];
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (pre[i][j] == 0) {
        ans[j] += se[i][0] - se[i][j];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
}
