#include <bits/stdc++.h>
using namespace std;
const int oo = 2e4 + 10, o = 11;
int n, m, k, a[oo], b[o];
bool c[oo][o];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> c[i][j];
  for (int i = 0; i < k; i++) {
    int x, y;
    cin >> x >> y;
    a[x]--;
    b[y]++;
  }
  for (int j = 1; j <= m; j++)
    for (int i = 1; i <= n; i++)
      if (c[i][j]) a[i] += b[j];
  for (int i = 1; i <= n; i++) cout << a[i] << ' ';
  return 0;
}
