Language: C++

#include<map>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;

#define REP(i,e,s) for(register int i=e; i<=s; i++)
#define DREP(i,e,s) for(register int i=e; i>=s; i--)
#define ll long long
#define DE(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG(a) DE("DEBUG: %d\n",a)
#define int ll
int read() {
	int x=0,f=1,ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MAXN=100000+10;

struct edge {
	int x,y;
} a[MAXN];

int ans[10];

map<pair<int,int>,int> mp;

signed main() {
	int h=read(),w=read(),n=read();

	REP(i,1,n) {
		int x=read(),y=read();
		REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
	}	

	map<pair<int,int>,int>:: iterator iter;
	iter=mp.begin();
	while(iter!=mp.end()) {
		ans[iter->second]++;
		iter++;
	}

	int ans0=(h-2)*(w-2);

	REP(i,1,9) ans0-=ans[i];

	printf("%lld\n",ans0);
	REP(i,1,9) printf("%lld\n",ans[i]);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   34 |         REP(i,1,n) {
      |             ^
a.cc:8:37: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                     ^
a.cc:36:26: error: no matching function for call to 'max(int, long long int)'
   36 |                 REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
      |                       ~~~^~~~~~~
a.cc:8:39: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                       ^
In file included from /usr/include/c++/14/bits/stl_tree.h:63,
                 from /usr/include/c++/14/map:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:36:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   36 |                 REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
      |                       ~~~^~~~~~~
a.cc:8:39: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                       ^
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
a.cc:36:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   36 |                 REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
      |                     ^
a.cc:8:37: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                     ^
a.cc:36:55: error: no matching function for call to 'max(int, long long int)'
   36 |                 REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
      |                                                    ~~~^~~~~~~
a.cc:8:39: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                       ^
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:36:55: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   36 |                 REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
      |                                                    ~~~^~~~~~~
a.cc:8:39: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                       ^
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
a.cc:36:50: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   36 |                 REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++;
      |                                                  ^
a.cc:8:37: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                     ^
a.cc:48:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   48 |         REP(i,1,9) ans0-=ans[i];
      |             ^
a.cc:8:37: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                     ^
a.cc:51:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   51 |         REP(i,1,9) printf("%lld\n",ans[i]);
      |             ^
a.cc:8:37: note: in definition of macro 'REP'
    8 | #define REP(i,e,s) for(register int i=e; i<=s; i++)
      |                                     ^