#include <bits/stdc++.h>
using namespace std;
const int N = 20100;
int n, m, k;
int chat[15];
int msg[N];
vector<int> emp[N];
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int a;
      cin >> a;
      if (a) emp[i].push_back(j);
    }
  }
  for (int i = 0; i < k; i++) {
    int a, b;
    cin >> a >> b;
    msg[a]++;
    chat[b]++;
  }
  for (int i = 1; i <= n; i++) {
    long long ans = 0;
    for (auto x : emp[i]) ans += chat[x];
    ans -= msg[i];
    cout << ans << " ";
  }
}
