#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair P; #define rep(i, n) for (int i=0; i<(n); i++) #define all(c) (c).begin(), (c).end() #define uniq(c) c.erase(unique(all(c)), (c).end()) #define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin()) #define _1 first #define _2 second #define pb push_back #define INF 1145141919 #define MOD 1000000007 const int DX[6] = {-1, -1, 0, 1, 1, 0}; const int DY[6] = {0, -1, -1, 0, 1, 1}; int N, M; long long K; int A[4000][4000]; long long TX[4001][4001], TY[4001][4001]; signed main() { ios::sync_with_stdio(false); cin.tie(0); cin >> N >> M >> K; rep(i, N) rep(j, N) A[i][j] = INF; queue

q; rep(i, M) { int x, y; cin >> y >> x; x--, y--; A[x][y] = 0; q.push(P(x, y)); } while (!q.empty()) { P x = q.front(); q.pop(); rep(k, 6) { P nx = P(x._1+DX[k], x._2+DY[k]); if (0 <= nx._1 && nx._1 < N && 0 <= nx._2 && nx._2 < N && nx._1 <= nx._2 && A[nx._1][nx._2] == INF) { A[nx._1][nx._2] = A[x._1][x._2]+1; q.push(nx); } } } rep(x, N) rep(y, N) TX[x][y] = TY[x][y] = A[x][y]; rep(x, N-1) rep(y, N) TX[x+1][y] += TX[x][y]; rep(x, N) rep(y, N-1) TY[x][y+1] += TY[x][y]; long long ans = 0; rep(sx, N) { int x = sx, y = N-1, h = N-1; long long cur = 0; while (x>=0&&y>=0) { cur += TY[x][h]-(y>0?TY[x][y-1]:0); while (y <= h-1) { long long s = TX[x+h-y][h]-(x>0?TX[x-1][h]:0); if (cur-s < K) break; h--, cur -= s; } if (cur >= K) ans += N-h; x--, y--; } } cout << ans << "\n"; return 0; }