#include <bits/stdc++.h>
using namespace std;
const int maxN = 30000 + 321;
int a[maxN][50];
int mark[maxN];
int mark1[maxN];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  for (int i = 0; i < k; i++) {
    int d, r;
    cin >> d >> r;
    d--;
    r--;
    mark1[r]++;
    mark[d]--;
  }
  for (int i = 0; i < n; i++) {
    int w = 0;
    for (int j = 0; j < m; j++)
      if (a[i][j]) w += mark1[j];
    cout << w + mark[i] << ' ';
  }
  cout << endl;
  return 0;
}
