code
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll H,W,N,h,w;
cin>>H>>W>>N>>h>>w;
map<ll,ll> mp_all;
VV A(H, VI(W));
rep(i,H){
rep(j,W){
ll a;cin>>a;
A[i][j]=a;
mp_all[a]++;
}
}
rep(k,H-h+1){
auto mp = mp_all;
rep(i,h){
rep(j,w){
ll y = k+i;
ll x = j;
ll a = A[y][x];
mp[a]--;
if(mp[a]==0)mp.erase(a);
}
}
VI Ans;
Ans.push_back(mp.size());
FOR(dx,1,W-w+1){
rep(i,h){
ll a = A[k+i][dx-1];
mp[a]++;
a = A[k+i][dx+w-1];
mp[a]--;
if(mp[a]==0)mp.erase(a);
}
Ans.push_back(mp.size());
}
print_vector(Ans);
}
return 0;
}