#include <bits/stdc++.h>
using namespace std;
const int MaxN = 2 * 10000 + 10;
const int MaxM = 11;
int n, m, k;
int chats[MaxN][MaxM];
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> chats[i][j];
  vector<int> num_wr(m, 0);
  vector<int> sub(n, 0);
  for (int i = 0, x, y; i < k; ++i) {
    cin >> x >> y;
    --x, --y;
    ++num_wr[y];
    sub[x]++;
  }
  for (int i = 0; i < n; ++i) {
    int ans = 0;
    for (int j = 0; j < m; ++j)
      if (chats[i][j]) ans += num_wr[j];
    cout << ans - sub[i] << " ";
  }
  cout << endl;
  return 0;
}
