#include <bits/stdc++.h>
const clock_t tl = 0.5 * CLOCKS_PER_SEC;
double start;
long long p = 307, mod = 99999989;
#pragma comment(linker, "/STACK:25600000")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  vector<vector<int> > matrix(n + 1);
  for (int i = 1; i <= n; i++) {
    matrix[i].resize(m + 1);
    ;
    for (int j = 1; j <= m; j++) {
      scanf("%d", &matrix[i][j]);
    }
  }
  vector<int> v(m + 1, 0);
  vector<int> ok(n + 1, 0);
  int a, b;
  for (int i = 0; i < k; i++) {
    scanf("%d %d", &a, &b);
    v[b]++;
    ok[a]--;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (matrix[i][j]) {
        ok[i] += v[j];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ok[i] << ' ';
  }
  return 0;
}
