#include <bits/stdc++.h>
using namespace std;
int64_t a[20010][11], b[20010][11];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int64_t n, m, k;
  cin >> n >> m >> k;
  for (int64_t i = 0; i < n; ++i) {
    for (int64_t j = 0; j < m; ++j) {
      cin >> a[i][j];
    }
  }
  for (int64_t i = 0; i < k; ++i) {
    int64_t x, y;
    cin >> x >> y;
    b[x - 1][y - 1]++;
  }
  vector<int64_t> sum(m, 0);
  for (int64_t j = 0; j < m; ++j) {
    for (int64_t i = 0; i < n; ++i) {
      sum[j] += b[i][j];
    }
  }
  for (int64_t i = 0; i < n; ++i) {
    int64_t s = 0;
    for (int64_t j = 0; j < m; ++j) {
      if (a[i][j]) {
        s += sum[j] - b[i][j];
      }
    }
    cout << s << ' ';
  }
}
