#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / (gcd(a, b)));
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
int bigmod(long long b, long long p, long long m) {
  long long r = 1;
  while (p > 0) {
    if (p % 2 == 1) r = (r * b) % m;
    p /= 2;
    b = (b * b) % m;
  }
  return r;
}
void BINARY(int n) {
  cout << "Mask: ";
  for (int i = 10; i >= 0; i--)
    if (n & (1 << i))
      cout << 1;
    else
      cout << 0;
  cout << endl;
}
int arr[20], adj[40000][20];
int called[20][40000];
int main() {
  int i, j, n, m, k, a, b;
  while (cin >> n >> m >> k) {
    memset(arr, 0, sizeof(arr));
    memset(called, 0, sizeof(called));
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) scanf("%d", &adj[i][j]);
    for (i = 0; i < k; i++) {
      cin >> a >> b;
      arr[b]++;
      called[b][a]++;
    }
    for (i = 1; i <= n; i++) {
      int sum = 0;
      for (j = 1; j <= m; j++) {
        if (adj[i][j]) {
          sum += (arr[j] - called[j][i]);
        }
      }
      if (i > 1) cout << " ";
      printf("%d", sum);
    }
    cout << endl;
  }
  return 0;
}
