#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-8;
const double PI = acos(-1);
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
ostream &operator<<(ostream &o, const vector<T> &t) {
  o << '[';
  for (__typeof((t).begin()) i = (t).begin(); i != (t).end(); ++i) {
    if (i != t.begin()) o << ',';
    o << *i;
  }
  return o << ']';
}
template <class S, class T>
ostream &operator<<(ostream &o, const pair<S, T> &t) {
  return o << '(' << t.first << ',' << t.second << ')';
}
template <int N, class Tp>
void out(ostream &, const Tp &) {}
template <int N, class Tp, class, class... Ts>
void out(ostream &o, const Tp &t) {
  if (N) o << ',';
  o << get<N>(t);
  out<N + 1, Tp, Ts...>(o, t);
}
template <class... Ts>
ostream &operator<<(ostream &o, const tuple<Ts...> &t) {
  o << '(';
  out<0, tuple<Ts...>, Ts...>(o, t);
  return o << ')';
}
template <class T>
void output(T *a, int n) {
  for (int i = 0; i < (int)(n); ++i) {
    if (i) cout << ',';
    cout << a[i];
  }
  cout << endl;
}
template <class T>
void output(T *a, int n, int m) {
  for (int i = 0; i < (int)(n); ++i) output(a[i], m);
}
template <class T>
void output(T t) {
  if (t < 0) t = -t, putchar('-');
  static int c[20];
  int k = 0;
  while (t) c[k++] = t % 10, t /= 10;
  if (!k) c[k++] = 0;
  while (k) putchar(c[--k] ^ 48);
}
template <class S, class... T>
void output(S a, T... t) {
  output(a);
  putchar(' ');
  output(t...);
}
template <class T>
bool input(T &t) {
  t = 0;
  int n = 0, c;
  while (!~(c = getchar()) && isdigit(c) && c != '-')
    ;
  if (!~c) return 0;
  if (c == '-')
    n = 1;
  else
    t = c ^ 48;
  while (isdigit(c = getchar())) t = 10 * t + c - '0';
  t = n ? -t : t;
  return 1;
}
template <class S, class... T>
bool input(S &a, T &...t) {
  input(a);
  return input(t...);
}
int f[20000][10];
int ans[20000];
int sm[10];
int main() {
  int n, m, k;
  while (input(n, m, k)) {
    memset(ans, 0, sizeof(ans));
    memset(sm, 0, sizeof(sm));
    for (int i = 0; i < (int)(n); ++i)
      for (int j = 0; j < (int)(m); ++j) input(f[i][j]);
    for (int i = 0; i < (int)(k); ++i) {
      int x, y;
      input(x, y);
      x--;
      y--;
      sm[y]++;
      ans[x]--;
    }
    for (int i = 0; i < (int)(n); ++i) {
      int res = ans[i];
      for (int j = 0; j < (int)(m); ++j)
        if (f[i][j]) res += sm[j];
      printf("%d%c", res, i != n - 1 ? ' ' : '\n');
    }
  }
}
