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++: #include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

const int MAX_N = 101;
const int INF = 1e+9;
typedef pair<int,int> P;

int w, h;
// st[y][x] := (x,y) が店舗かどうか
int st[MAX_N][MAX_N];

// 移動6方向のベクトル(偶数列と奇数列で遷移の仕方が異なる)
int dx[2][6] = {  
	{ -1, 0, -1, 1, -1, 0 },
	{  0, 1, -1, 1,  0, 1 }
};
int dy[6] = { -1, -1, 0, 0, 1, 1 };

// BFSのときに利用
int d[MAX_N][MAX_N];
// m[y][x] := (x,y) から最短の店舗までの距離
int m[MAX_N][MAX_N];
// 解
int ans;

void init(){
	for(int y=0 ; y < MAX_N ; y++ ){
		for(int x=0 ; x < MAX_N ; x++ ){
			m[y][x] = st[y][x] = 0;
		}
	}
}

void clear_d(){
	for(int y=0 ; y < MAX_N ; y++ ){
		for(int x=0 ; x < MAX_N ; x++ ){
			d[y][x] = INF;
		}
	}
}

// (sx,sy) から最短の店舗までの距離を求める
void bfs(int sx, int sy){
	queue<P> q;
	clear_d();
	q.push( P(sx,sy) );
	d[sy][sx] = 0;
	
	while( !q.empty() ){
		int px = q.front().first; 
		int py = q.front().second;
		q.pop();
		
		if( st[py][px] == 1 ){
			m[sy][sx] = d[py][px];
			break;
		}
		for(int i=0 ; i < 6 ; i++ ){
			int mx = px + dx[py%2][i];
			int my = py + dy[i];
			if( mx < 0 || my < 0 || mx >= w || my >= h ) continue;
			
			if( d[my][mx] == INF ){
				q.push( P(mx,my) );
				d[my][mx] = d[py][px] + 1;
			}
		}
	}
}

// (sx,sy) からカバーできるブロック数
int solve(int sx, int sy){
	queue<P> q;
	clear_d();
	q.push( P(sx,sy) );
	d[sy][sx] = 0;
	int cnt = 0;
	
	while( !q.empty() ){
		int px = q.front().first; 
		int py = q.front().second;
		q.pop();
		if( d[py][px] < m[py][px] ){
			cnt++;
		}else{
			continue;
		}
		
		for(int i=0 ; i < 6 ; i++ ){
			int mx = px + dx[py%2][i];
			int my = py + dy[i];
			if( mx < 0 || my < 0 || mx >= w || my >= h ) continue;
			
			if( d[my][mx] == INF ){
				q.push( P(mx,my) );
				d[my][mx] = d[py][px] + 1;
			}
		}
	}
	return cnt;
}

int main(){
	while( cin >> w >> h , w || h ){
		init();
		
		int s, t;
		cin >> s;
		for(int i=0 ; i < s ; i++ ){
			int x, y;
			cin >> x >> y;
			x--; y--;
			st[y][x] = 1;
		}
		
		for(int y=0 ; y < h ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				bfs( x , y );
			}
		}
		
		ans = 0;
		cin >> t;
		for(int i=0 ; i < t ; i++ ){
			int x, y;
			cin >> x >> y;
			x--; y--;
			int cnt = solve( x, y );
			ans = max( ans , cnt );
		}
		cout << ans << endl;
	}
}

C++: #include<stdio.h>
#include<algorithm>
#include<queue>
using namespace std;
int dx[2][6]={{-1,-1,0,0,1,1},{-1,-1,0,0,1,1}};
int dy[2][6]={{-1,0,-1,1,-1,0},{1,0,-1,1,1,0}};
int bfs[110][110];
int m[110][110];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		int c;scanf("%d",&c);
		queue<pair<int,int> >Q;
		for(int i=0;i<a;i++)for(int j=0;j<b;j++)bfs[i][j]=-1;
		for(int i=0;i<c;i++){
			int p,q;scanf("%d%d",&q,&p);
			p--;q--;
			bfs[p][q]=0;
			Q.push(make_pair(p,q));
		}
		while(Q.size()){
			int row=Q.front().first;
			int col=Q.front().second;
			Q.pop();
			int t=row%2;
			for(int i=0;i<6;i++){
				if(0<=row+dx[t][i]&&row+dx[t][i]<a&&0<=col+dy[t][i]&&col+dy[t][i]<b&&!~bfs[row+dx[t][i]][col+dy[t][i]]){
					bfs[row+dx[t][i]][col+dy[t][i]]=bfs[row][col]+1;
					Q.push(make_pair(row+dx[t][i],col+dy[t][i]));
				}
			}
		}
		int ret=0;
		int d;scanf("%d",&d);
		for(int i=0;i<d;i++){
			int p,q;scanf("%d%d",&q,&p);p--;q--;
			for(int j=0;j<a;j++)for(int k=0;k<b;k++)m[j][k]=-1;
			m[p][q]=0;
			Q.push(make_pair(p,q));
			while(Q.size()){
				int row=Q.front().first;
				int col=Q.front().second;
				Q.pop();
				int t=row%2;
				for(int i=0;i<6;i++){
					if(0<=row+dx[t][i]&&row+dx[t][i]<a&&0<=col+dy[t][i]&&col+dy[t][i]<b&&!~m[row+dx[t][i]][col+dy[t][i]]){
						m[row+dx[t][i]][col+dy[t][i]]=m[row][col]+1;
						Q.push(make_pair(row+dx[t][i],col+dy[t][i]));
					}
				}
			}
			int val=0;
			for(int j=0;j<a;j++)for(int k=0;k<b;k++)if(bfs[j][k]>m[j][k])val++;
			ret=max(val,ret);
		}
		printf("%d\n",ret);
	}
}