#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 20020;
const int MAX_V = 20001;
int n, m, k;
vector<int> edge[MAX_N];
int cnt[MAX_V];
int add[MAX_N];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      int x;
      scanf("%d", &x);
      if (x == 1) {
        edge[j + n].push_back(i);
      }
    }
  }
  for (int i = 0; i < k; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    --cnt[u];
    ++add[v + n];
  }
  for (int i = n + 1; i <= n + m; ++i) {
    for (int j = 0; j < edge[i].size(); ++j) {
      cnt[edge[i][j]] += add[i];
    }
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d ", cnt[i]);
  }
  return 0;
}
