#include <bits/stdc++.h>
using namespace std;
int N, M, K, x, y, sol[20005], mesaje[20005];
vector<int> G[20005];
int main() {
  cin.sync_with_stdio(false);
  cin >> N >> M >> K;
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j) {
      cin >> x;
      if (x) G[j].push_back(i);
    }
  for (int i = 1; i <= K; ++i) {
    cin >> x >> y;
    --sol[x];
    ++mesaje[y];
  }
  for (int i = 1; i <= M; ++i)
    if (G[i].size())
      for (int j = 0; j < G[i].size(); ++j) sol[G[i][j]] += mesaje[i];
  for (int i = 1; i <= N; ++i) cout << sol[i] << ' ';
  return 0;
}
