#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 5 + 2e4;
const int INF = 1e9;
int ans[N], ch[20];
vector<int> v[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, t, m, a, b, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> t;
      if (t) v[i].push_back(j);
    }
  }
  for (int i = 0; i < k; ++i) {
    cin >> a >> b;
    ans[a]--;
    ch[b]++;
  }
  for (int i = 1; i <= n; ++i) {
    for (auto x : v[i]) ans[i] += ch[x];
  }
  for (int i = 1; i <= n; ++i) cout << ans[i] << ((i < n) ? " " : "");
}
