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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);i--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};

int dis(pint a,pint b){
	int res=abs(a.Y-b.Y);
	if(a.Y%2==0){
		if(b.Y%2==0){
			res+=max(abs(a.X-b.X)-abs(a.Y-b.Y)/2,0);
		}else{
			if(a.X<b.X){
				res+=max(abs(a.X-b.X)-abs(a.Y-b.Y)/2,0);
			}else{
				res+=max(abs(a.X-b.X)-abs(a.Y-b.Y)/2-1,0);
			}
		}
	}else{
		if(b.Y%2==0){
			if(a.X<b.X){
				res+=max(abs(a.X-b.X)-abs(a.Y-b.Y)/2-1,0);
			}else{
				res+=max(abs(a.X-b.X)-abs(a.Y-b.Y)/2,0);
			}
		}else{
			res+=max(abs(a.X-b.X)-abs(a.Y-b.Y)/2,0);
		}
	}
	return res;
}

int d[110][110];

int main() {
	int m,n,s,t,res;
	pint c,x;
	IL{
		cin>>m;
		if(m==0)break;
		res=0;
		cin>>n>>s;
		rep(i,n){
			rep(j,m){
				d[i][j]=INF;
			}
		}
		rep(i,s){
			cin>>c.X>>c.Y;
			--c.X;
			--c.Y;
			rep(i,n){
				rep(j,m){
					chmin(d[i][j],dis(MP(i,j),c));
				}
			}
		}
rep(i,n){
rep(j,m){
debug<<d[i][j]<<" ";
}
debug<<endl;
}
		cin>>t;
		rep(i,t){
			int r=0;
			cin>>x.X>>x.Y;
			--x.X;
			--x.Y;
			rep(i,n){
				rep(j,m){
					if(d[i][j]>dis(MP(i,j),x))++r;
				}
			}
			chmax(res,r);
		}
		cout<<res<<endl;
	}
	return 0;
}

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

int main() {
  while (true){
    int w,h,s,ans=1;
    vector<int> adx={0,0,1,1,1,-1},ady={-1,1,1,-1,0,0};
    vector<int> bdx={0,0,-1,-1,-1,1},bdy={-1,1,0,1,-1,0};
    queue<pair<pair<int,int>,int>> q;
    pair<pair<int,int>,int> v;
    cin >> w >> h;
    if (w==0 && h==0) break;
    cin >> s;
    vector<vector<int>> a(w+2,vector<int>(h+2));
    rep(i,h+2){
      rep(j,w+2){
        a.at(j).at(i)=1;
      }
    }
    for (int i=1;i<h+1;i++){
      for (int j=1;j<w+1;j++){
        a.at(j).at(i)=0;
      }
    }
    vector<int> e(s),r(s);
  rep (i,s){
    cin >> e.at(i) >> r.at(i);
  }
  int u;
  cin >> u;
  rep(i,u){
    rep(i,h+2){
      rep(j,w+2){
        a.at(j).at(i)=1;
      }
    }
    for (int i=1;i<h+1;i++){
      for (int j=1;j<w+1;j++){
        a.at(j).at(i)=0;
      }
    }
      rep (p,s){
    a.at(e.at(p)).at(r.at(p))=1;
    v.first.first=e.at(p);v.first.second=r.at(p);
    v.second=0;
    q.push(v);
  }
    int xx,yy,o=1;
    cin >> xx >> yy;
    v.first.first=xx;v.first.second=yy;v.second=1;
    a.at(xx).at(yy)=1;
    q.push(v);
    while (!q.empty()){
      int x=q.front().first.first,y=q.front().first.second,t=q.front().second;
      q.pop();
      for (int j=0;j<6;j++){
        if (y%2==0){
        if (a.at(x+adx.at(j)).at(y+ady.at(j))==0) {
          a.at(x+adx.at(j)).at(y+ady.at(j))=1;
          v.first.first=x+adx.at(j);v.first.second=y+ady.at(j);v.second=t;
          q.push(v);
          if (t==1)  o++;
        }
        }
        if (y%2==1){
        if (a.at(x+bdx.at(j)).at(y+bdy.at(j))==0) {
          a.at(x+bdx.at(j)).at(y+bdy.at(j))=1;
          v.first.first=x+bdx.at(j);v.first.second=y+bdy.at(j);v.second=t;
          q.push(v);
          if (t==1) o++;
        }
        }
      }
    }
    ans=max(ans,o);
  }
  cout << ans << endl;
  }
}