#include <bits/stdc++.h>
using namespace std;
const int INF = 0xfffffff;
int f[20010][11];
int s[20010][11];
int jx[11];
int n, m, k;
int x, y;
int main() {
  int i, j;
  while (scanf("%d %d %d", &n, &m, &k) == 3) {
    memset(jx, 0, sizeof(jx));
    memset(s, 0, sizeof(s));
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) scanf("%d", &f[i][j]);
    for (i = 1; i <= k; i++) {
      scanf("%d %d", &x, &y);
      s[x][y]++;
      jx[y]++;
    }
    for (i = 1; i <= n; i++) {
      int num = 0;
      for (j = 1; j <= m; j++) {
        if (f[i][j] == 1) {
          num += (jx[j] - s[i][j]);
        }
      }
      if (i == 1)
        cout << num;
      else
        cout << " " << num;
    }
    cout << endl;
  }
}
