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 <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
//#include <utility>
#include <set>
#include <iostream>
//#include <memory>
#include <string>
#include <vector>
#include <algorithm>
//#include <functional>
#include <sstream>
//#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
//#include <cctype>
#include <cstring>
//#include <ctime>
#include <iterator>
#include <bitset>
//#include <numeric>
//#include <list>
//#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
int h,w;
int dx1[]={0,-1,1,0,1,-1};
int dy1[]={-1,0,0,1,1,1};
int dx2[]={-1,0,1,1,0,-1};
int dy2[]={0,1,0,-1,-1,-1};
int dy[6][2];
int dx[6][2];
void mainmain(){
	rep(i,6){
		dy[i][0]=dy1[i];
		dx[i][0]=dx1[i];
	}
	rep(i,6){
		dy[i][1]=dy2[i];
		dx[i][1]=dx2[i];
	}
	while(cin>>w>>h,h||w){
		// cout<<h<<" "<<w<<endl;
		queue<pair<pii,int>> q1;
		vvint table;
		initvv(table,h,w,-1);
		int n;
		cin>>n;
		rep(i,n){
			pii a;
			cin>>a.S>>a.F;
			a.F--;
			a.S--;
			// cout<<a.F<<" "<<a.S<<endl;
			q1.push(mkp(a,0));
		}
		while(!q1.empty()){
			pair<pii,int> top=q1.front();
			q1.pop();
			if(table[top.F.F][top.F.S]!=-1){
				continue;
			}
			table[top.F.F][top.F.S]=top.S;
			rep(i,6){
				pii next=top.F;
				int t=1&top.F.F;
				t=1-t;
				next.F+=dx[i][t];
				next.S+=dy[i][t];
				if(0<=next.F&&next.F<h&&0<=next.S&&next.S<w){
					q1.push(mkp(next,top.S+1));
				}
			}
		}
		// rep(i,h){
			// if(i&1) cout<<" ";
			// rep(j,w){
				// cout<<table[i][j]<<" ";	
			// }
			// cout<<endl;
		// }
		int m;
		cin>>m;
		vvint used;
		int ans=0;
		rep(i,m){
			pii a;
			initvv(used,h,w,0);
			cin>>a.S>>a.F;
			a.F--;
			a.S--;
			// continue;
			queue<pair<pii,int>> q2;
			q2.push(mkp(a,0));
			int tmp=0;
			// cout<<i<<"----------"<<endl;
			while(!q2.empty()){
				pair<pii,int> top=q2.front();
				q2.pop();
				if(used[top.F.F][top.F.S]) continue;
				if(table[top.F.F][top.F.S]<=top.S) continue;
				// cout<<top.F.F<<" "<<top.F.S<<" "<<top.S<<" "<<table[top.F.F][top.F.S]<<endl;
				tmp++;
				used[top.F.F][top.F.S]=1;
				rep(i,6){
					pii next=top.F;
					int t=1&top.F.F;
					t=1-t;
					next.F+=dx[i][t];
					next.S+=dy[i][t];
					if(0<=next.F&&next.F<h&&0<=next.S&&next.S<w){
						q2.push(mkp(next,top.S+1));
					} 
				}
			}
			ans=max(ans,tmp);
		}
		cout<<ans<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

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[11], y[11];
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) {
			scanf("%d%d", &x[s], &y[s]); x[s]--; y[s]--;
			queue<st>que;
			memset(d, -1, sizeof(d));
			rep(j, s + 1) {
				d[x[j]][y[j]] = 0; b[x[j]][y[j]] = j;
				que.push({ x[j],y[j],j });
			}
			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);
	}
}