#include <bits/stdc++.h>
using namespace std;
long long int n, m, k, res[20007], num[11];
vector<long long int> v[11];
int main() {
  scanf("%lld %lld %lld", &n, &m, &k);
  for (long long int i = 1; i <= n; ++i) {
    for (long long int j = 1; j <= m; ++j) {
      long long int temp;
      scanf("%lld", &temp);
      if (temp) v[j].push_back(i);
    }
  }
  for (long long int i = 0; i < k; ++i) {
    long long int x, y;
    scanf("%lld %lld", &x, &y);
    res[x]--;
    num[y]++;
  }
  for (long long int i = 1; i <= m; ++i) {
    for (long long int j = 0; j < v[i].size(); ++j) {
      res[v[i][j]] += num[i];
    }
  }
  for (long long int i = 1; i <= n; ++i) printf("%lld ", res[i]);
  return 0;
}
