#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, k;
  cin >> n >> m >> k;
  long long int arr[n][m];
  vector<long long int> res(n, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> arr[i][j];
    }
  }
  vector<long long int> c(m, 0);
  long long int sum = 0;
  for (int i = 0; i < k; ++i) {
    long long int emp, chat;
    cin >> emp >> chat;
    c[chat - 1]++;
    sum++;
    res[emp - 1]--;
  }
  for (int i = 0; i < res.size(); ++i) {
    for (int x = 0; x < m; ++x)
      if (arr[i][x] == 0 && c[x] != 0) res[i] -= c[x];
    res[i] += sum;
    cout << res[i] << " ";
  }
  return 0;
}
