#include <bits/stdc++.h>
using namespace std;
const int MX = 1000001;
const int MI = 100001;
const int MT = 10001;
int a[20001][11], b[20001][11];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int kol[11] = {false};
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> a[i][j];
    }
  }
  int x, y;
  for (int i = 0; i < k; ++i) {
    cin >> x >> y;
    kol[y]++;
    b[x][y]++;
  }
  for (int i = 1; i <= n; ++i) {
    int ans = 0;
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] > 0) {
        ans += (kol[j] - b[i][j]);
      }
    }
    cout << ans << " ";
  }
  return 0;
}
