#include <bits/stdc++.h>
using namespace std;
const int N = 20001;
const int M = 11;
int a[N][M];
int L[M];
int sent[N];
int res[N];
int n, m, k;
int main() {
  cin >> n >> m >> k;
  int u, v;
  for (int i = 1; i <= n; i++) {
    sent[i] = 0;
    res[i] = 0;
  }
  for (int i = 1; i <= m; i++) L[i] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int i = 1; i <= k; i++) {
    cin >> u >> v;
    sent[u]++;
    L[v]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) res[i] += a[i][j] * L[j];
  }
  for (int i = 1; i <= n; i++) cout << res[i] - sent[i] << " ";
}
