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 <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

int dyo[] = {0, -1, -1, 0, 1, 1};
int dxo[] = {1, 1, 0, -1, 0, 1};

int dye[] = {0, -1, -1, 0, 1, 1};
int dxe[] = {1, 0, -1, -1, -1, 0};

int main(){
    while(1){
        int m, n; cin>>m>>n;
        if(m == 0) return 0;
        int s; cin>>s;
        vector<int> x(s), y(s);
        vector<vector<int>> dist(n, vector<int>(m, 1e9));
        queue<T> que;
        for(int i=0; i<s; i++){
            cin>>x[i]>>y[i];
            x[i]--;
            y[i]--;
            dist[y[i]][x[i]] = 0;
            que.emplace(y[i], x[i], 0);
        }

        while(que.size()){
            int cy, cx, cnt;
            tie(cy, cx, cnt) = que.front();
            que.pop();

            for(int i=0; i<6; i++){
                int ny, nx;
                if(cy % 2 == 0){
                    ny = cy + dye[i];
                    nx = cx + dxe[i];
                }
                else{
                    ny = cy + dyo[i];
                    nx = cx + dxo[i];
                }

                if(0 <= ny && ny < n && 0 <= nx && nx < m){

                    if(cnt + 1 < dist[ny][nx]){
                        dist[ny][nx] = cnt + 1;
                        que.emplace(ny, nx, cnt + 1);
                    }
                }
            }
        }

        int t; cin>>t;
        int ans = 0;
        for(int i=0; i<t; i++){
            int p, q; cin>>p>>q;
            p--;
            q--;

            int sum = 0;
            vector<vector<int>> cdist(n, vector<int>(m, 1e9));
            cdist[q][p] = 0;
            que.emplace(q, p, 0);
            while(que.size()){
                int cy, cx, cnt;
                tie(cy, cx, cnt) = que.front();
                que.pop();

                for(int j=0; j<6; j++){
                    int ny, nx;
                    if(cy % 2 == 0){
                        ny = cy + dye[j];
                        nx = cx + dxe[j];
                    }
                    else{
                        ny = cy + dyo[j];
                        nx = cx + dxo[j];
                    }


                    if(0 <= ny && ny < n && 0 <= nx && nx < m){
                        if(cnt + 1 < cdist[ny][nx]){
                            cdist[ny][nx] = cnt + 1;
                            //if(dist[ny][nx] <= cdist[ny][nx]) continue;
                            que.emplace(ny, nx, cnt + 1);
                        }
                    }
                }
            }

            for(int j=0; j<n; j++){
                for(int k=0; k<m; k++){
                    if(cdist[j][k] < dist[j][k]){
                        sum++;
                    }
                }
            }

            ans = max(ans, sum);
        
        }

        

        cout << ans << endl;
    }
}