#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
int mat[20022][12];
int machine[12];
long long res[20022];
int main() {
  std::ios_base::sync_with_stdio(0);
  int n, m, k, x, y;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> mat[i][j];
    }
  }
  for (int i = 0; i < k; ++i) {
    cin >> x >> y;
    machine[y]++;
    mat[x][y]++;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (mat[i][j] == 0) continue;
      res[i] += machine[j];
      res[i] -= (mat[i][j] - 1);
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << res[i] << " ";
  }
  return 0;
}
