Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
	)

var scanner = bufio.NewScanner(os.Stdin)

const INF = 0x7FFFFFFF

var (
	direction1 = [][]int{ // 奇数段目の移動方向
		{-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, -1}, {1, 1},
	}
	direction2 = [][]int{ // 偶数段目の移動方向
		{-1, -1}, {0, -1}, {1, 0}, {0, 1}, {-1, 1}, {-1, 0},
	}
)

func main() {
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		m, _ := strconv.Atoi(buf[0])
		n, _ := strconv.Atoi(buf[1])
		if m == 0 && n == 0 {
			break
		}
		// initialize district_map
		/*
			district_map = [
				[-1, -1,  -1,  -1,  -1]
				[-1, INF, INF, INF, -1]
				[-1, INF, INF, INF, -1]
				[-1, INF, INF, INF, -1]
				[-1, INF, INF, INF, -1]
				[-1, -1,  -1,  -1,  -1]
			]
		*/
		district_map := make([][]int, n+2)
		for i := range district_map {
			district_map[i] = make([]int, m+2)
		}
		tmp1 := make([]int, m+2)
		for i := range tmp1 {
			tmp1[i] = -1
		}
		district_map[0] = tmp1
		district_map[n+1] = tmp1
		for i := 1; i < n+1; i++ {
			district_map[i] = make([]int, m+2)
			district_map[i][0] = -1
			district_map[i][m+1] = -1
			for j := 1; j < m+1; j++ {
				district_map[i][j] = INF
			}
		}

		scanner.Scan()
		s, _ := strconv.Atoi(scanner.Text())
		for i := 0; i < s; i++ {
			scanner.Scan()
			buf_ := strings.Split(scanner.Text(), " ")
			x, _ := strconv.Atoi(buf_[0])
			y, _ := strconv.Atoi(buf_[1])
			Search(Point{x, y}, district_map, m, n)
		}
		ans := 0
		scanner.Scan()
		t, _ := strconv.Atoi(scanner.Text())
		for i := 0; i < t; i++ {
			scanner.Scan()
			buf__ := strings.Split(scanner.Text(), " ")
			x, _ := strconv.Atoi(buf__[0])
			y, _ := strconv.Atoi(buf__[1])
			z := Count(Point{x, y}, district_map, m, n)
			ans = max(ans, z)
		}
		fmt.Println(ans)
	}
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

type Point struct {
	x, y int
}

type Entry struct {
	hop   int
	point Point
}

func Search(p Point, mp [][]int, m, n int) {
	que := make([]Entry, 0)
	que = append(que, Entry{0, p})
	check := make([][]bool, n+2)
	for i := range check {
		check[i] = make([]bool, m+2)
	}
	check[p.y][p.x] = true
	mp[p.y][p.x] = 0
	var direction [][]int
	for len(que) > 0 {
		tmp := que[0]
		que = que[1:]
		dist, point := tmp.hop, tmp.point
		if point.y%2 == 0 {
			direction = direction1
		} else {
			direction = direction2
		}
		for _, d := range direction {
			nx, ny := point.x+d[0], point.y+d[1]
			if !check[ny][nx] && mp[ny][nx] != -1 {
				check[ny][nx] = true
				if mp[ny][nx] > dist+1 {
					mp[ny][nx] = dist + 1
				}
				que = append(que, Entry{dist + 1, Point{nx, ny}})
			}
		}
	}
}

func Count(p Point, mp [][]int, m, n int) int {
	que := make([]Entry, 0)
	que = append(que, Entry{0, p})
	check := make([][]bool, n+2)
	for i := range check {
		check[i] = make([]bool, m+2)
	}
	check[p.y][p.x] = true
	ans := 1
	var direction [][]int
	for len(que) > 0 {
		tmp := que[0]
		que = que[1:]
		dist, point := tmp.hop, tmp.point
		if point.y%2 == 0 {
			direction = direction1
		} else {
			direction = direction2
		}
		for _, d := range direction {
			nx, ny := point.x+d[0], point.y+d[1]
			if !check[ny][nx] && mp[ny][nx] != -1 {
				check[ny][nx] = true
				if mp[ny][nx] > dist+1 {
					ans++
				}
				que = append(que, Entry{dist + 1, Point{nx, ny}})
			}
		}
	}
	return ans
}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

pair<int,int> maja(int x) {
  if (x == 0) return pair<int,int>(0,0);
  int n = static_cast<int>(ceil((-1.0+sqrt(1.0+4.0/3.0*x))/2.0));
  int a = 3*n*(n-1), d = static_cast<int>(ceil((1.0*x-a)/n-1.0));
  int k = x - a - n * d;
  switch (d) {
  case 0: return pair<int,int>(n-k,k);
  case 1: return pair<int,int>(-k,n);
  case 2: return pair<int,int>(-n,n-k);
  case 3: return pair<int,int>(-n+k,-k);
  case 4: return pair<int,int>(k,-n);
  case 5: return pair<int,int>(n,-n+k);
  }
}

int majadist(const pair<int,int> &a, const pair<int,int> &b) {
  int dx = abs(a.first - b.first);
  int dy = abs(a.second - b.second);
  int dz = abs(a.first+a.second-b.first-b.second);
  return min(dx+dy, min(dx+dz, dy+dz));
}

int main(){
  int W,H;

  while(~scanf("%d %d",&W,&H)){
    if(W == 0 && H == 0) break;

    map<pair<int,int>,bool> stage;
    int total_existing_stores;
    scanf("%d",&total_existing_stores);
    for(int store_idx = 0; store_idx < total_existing_stores; store_idx++){
      int x,y;
      scanf("%d %d",&x,&y);
      x--;
      y--;
      stage[pair<int,int>(x,y)] = true;
    }

    int total_new_stores;

    int res = 0;
    scanf("%d",&total_new_stores);
    for(int store_idx = 0; store_idx < total_new_stores; store_idx++){
      int sx,sy;
      scanf("%d %d",&sx,&sy);

      sx--;
      sy--;
      int region = 0;
      for(int x=0;x<W;x++){
	for(int y=0;y<H;y++){
	  int min_dist = INF;
	  
	  for(map<pair<int,int>,bool>::iterator it = stage.begin();
	      it != stage.end();
	      it++){
	    min_dist = min(min_dist,majadist(it->first,pair<int,int>(x,y)));
	  }
	  
	  if(majadist(pair<int,int>(sx,sy),pair<int,int>(x,y)) < min_dist)
	    {
	      region++;
	    }
	}
	res = max(region,res);
      }
    }
    printf("%d\n",res);
  }
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

struct st { int x, y, c; };
int d[100][100], b[100][100], x[10], y[10];
int dx[][6]{ { 0,-1,0,1,1,1, },{-1,-1,-1,0,1,0} };
int dy[]{ -1,0,1,1,0,-1 };
int main() {
	int m, n, s;
	while (scanf("%d%d", &m, &n), m) {
		scanf("%d", &s);
		rep(i, s)scanf("%d%d", &x[i], &y[i]), x[i]--, y[i]--;
		int t; scanf("%d", &t);
		int Max = 0;
		rep(i, t) {
			int p, q; scanf("%d%d", &p, &q); p--; q--;
			queue<st>que;
			memset(d, -1, sizeof(d));
			rep(j, s) {
				d[x[j]][y[j]] = 0; b[x[j]][y[j]] = j;
				que.push({ x[j],y[j],j });
			}
			d[p][q] = 0; b[p][q] = s; que.push({ p,q,s });
			while (!que.empty()) {
				st p = que.front(); que.pop();
				rep(j, 6) {
					int nx = p.x + dx[!(p.y & 1)][j], ny = p.y + dy[j];
					if (0 <= nx&&nx < m && 0 <= ny&&ny < n) {
						if (d[nx][ny] == -1) {
							d[nx][ny] = d[p.x][p.y] + 1;
							b[nx][ny] = p.c;
							que.push({ nx,ny,p.c });
						}
						else if (d[nx][ny] == d[p.x][p.y] + 1) {
							b[nx][ny] = -1;
							que.push({ nx,ny,p.c });
						}
					}
				}
			}
			int cnt = 0;
			rep(i, m)rep(j, n) {
				if (b[i][j] == s)cnt++;
			}
			Max = max(Max, cnt);
		}
		printf("%d\n", Max);
	}
}