#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int> > groups;
  for (int i = 0; i < n; i++) {
    vector<int> emp;
    groups.push_back(emp);
    for (int j = 0; j < m; j++) {
      int tmp;
      cin >> tmp;
      if (tmp == 1) groups[i].push_back(j);
    }
  }
  vector<int> chats;
  vector<int> sent;
  for (int i = 0; i < m; i++) chats.push_back(0);
  for (int i = 0; i < n; i++) sent.push_back(0);
  for (int i = 0; i < k; i++) {
    int tmpx, tmpy;
    cin >> tmpx >> tmpy;
    tmpx--;
    tmpy--;
    chats[tmpy]++;
    sent[tmpx]++;
  }
  for (int i = 0; i < n; i++) {
    int total = 0;
    for (int j = 0; j < groups[i].size(); j++) {
      total += chats[groups[i][j]];
    }
    cout << total - sent[i] << " ";
  }
  return 0;
}
