## Editorial for Bee Walk

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Lưu ý: Các code mẫu dưới đây chỉ mang tính tham khảo và có thể không AC được bài tập này

#### Code mẫu của flashmt

const dx:array[1..6] of longint=(-1,-1,0,0,1,1);
dy:array[1..6] of longint=(0,1,-1,1,-1,0);
var f:array[-14..14,-14..14,0..14] of longint;
n,test,it:longint;

procedure init;
var i,x,y,j:longint;
begin
f[0,0,0]:=1;
for i:=1 to 14 do
for x:=-14 to 14 do
for y:=-14 to 14 do
if f[x,y,i-1]>0 then
for j:=1 to 6 do
inc(f[x+dx[j],y+dy[j],i],f[x,y,i-1]);
end;

begin
init;
for it:=1 to test do
begin
writeln(f[0,0,n]);
end;
end.


#### Code mẫu của happyboy99x

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
#define max 100000000
int f[40][40][40];
int main()
{
int n,tc;
int d[6][2] = {{0,-1},{0,1},{-1,1},{-1,0},{1,0},{1,-1}};
f[20][20][0]=1;
scanf("%d",&tc);
for(int i=0;i<tc;i++)
{
scanf("%d",&n);
for(int k=1;k<=n;++k)
for(int x=1;x<=38;x++)
for(int y=1;y<=38;y++) {
f[x][y][k] = 0;
for(int l=0;l<=5;l++)
f[x][y][k] += f[x+d[l][0]][y+d[l][1]][k-1];
}
printf("%d\n",f[20][20][n]);
}
}


program BEE;
uses    math;
const   fi = '';
fo = '';
maxn = 50;
B = trunc(1e9);
dx: array[1..6] of longint = (-1,-1,0,1,1,0);
dy: array[1..6] of longint = (0,1,1,0,-1,-1);
var     F:array[-maxn..maxn,-maxn..maxn,0..maxn] of longint;
chk:array[-maxn..maxn,-maxn..maxn,0..maxn] of boolean;
inp,oup:text;
n,i,res,t,tt: longint;

function DP(i,j,step: longint): longint;
var     d,x,y:longint;
begin
if chk[i,j,step] then exit(F[i,j,step]);
chk[i,j,step] := true;
if step = 0 then exit(0);
for d:=1 to 6 do begin
x := i + dx[d]; y := j + dy[d];
F[i,j,step] := (F[i,j,step] + DP(x,y,step-1)); //mod B;
end;
exit(F[i,j,step]);
end;

begin
assign(inp,fi);reset(inp);assign(oup,fo);rewrite(oup);
for tt:=1 to t do begin
readln(inp,n); chk[0,0,0] := true; F[0,0,0] := 1;
for i:=1 to 6 do begin
chk[dx[i],dy[i],1] := true;
F[dx[i],dy[i],1] := 1;
end;
res := DP(0,0,n);
writeln(oup,res);
end;
close(oup);
end.


#### Code mẫu của RR

{$R+,Q+} {$Mode objFPC}
uses math;
const
FINP='';
FOUT='';
MAXN=14;
var
d:array[0..MAXN,-MAXN..MAXN,-MAXN..MAXN] of longint;
f1,f2:text;
n,test:longint;
procedure openF;
begin
assign(f1,FINP); reset(f1);
assign(f2,FOUT); rewrite(f2);
end;
procedure closeF;
begin
close(f1); close(f2);
end;
procedure init;
var
i,l1,l2:longint;
begin
d[0,0,0]:=1;
for i:=0 to 13 do
for l1:=-i to i do
for l2:=-i to i do
if d[i,l1,l2]>0 then
begin
d[i+1,l1+1,l2]+=d[i,l1,l2];
d[i+1,l1-1,l2]+=d[i,l1,l2];
d[i+1,l1,l2+1]+=d[i,l1,l2];
d[i+1,l1,l2-1]+=d[i,l1,l2];
d[i+1,l1+1,l2+1]+=d[i,l1,l2];
d[i+1,l1-1,l2-1]+=d[i,l1,l2];
end;
end;
begin
init;
openF;
for test:=1 to test do
begin
writeln(f2,d[n,0,0]);
end;
closeF;
end.


#### Code mẫu của hieult

#include <stdio.h>
//#include <conio.h>

bool test(int n,int m)
{
if(n>=2&&n<=30&&m>=1&&m<=15)
return true;
else return false;
}
main()
{
int f[32][16][15];
for(int i=2;i<=30;i++)
for(int j=1;j<=15;j++)
f[i][j][0]=0;
f[16][8][0]=1;
for(int k=1;k<=14;k++)
{
for(int i=2;i<=30;i++)
for(int j=1;j<=15;j++)
{
if((i-j)%2==0)
{
f[i][j][k]=0;
if(test(i+1,j+1)) f[i][j][k]+=f[i+1][j+1][k-1];
if(test(i+1,j-1)) f[i][j][k]+=f[i+1][j-1][k-1];
if(test(i-1,j+1)) f[i][j][k]+=f[i-1][j+1][k-1];
if(test(i-1,j-1)) f[i][j][k]+=f[i-1][j-1][k-1];
if(test(i+2,j))   f[i][j][k]+=f[i+2][j][k-1];
if(test(i-2,j+1)) f[i][j][k]+=f[i-2][j][k-1];
}
}
}
int n,m;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&m);
printf("%d\n",f[16][8][m]);
}
//for(int i=1;i<=14;i++)
//printf(" %d",f[16][8][i]);
//getch();
}


{$MODE DELPHI} program MBEEWALK; const dx: array[1..6] of integer = (-1,-1,0,0,1,1); dy: array[1..6] of integer = (0,1,-1,1,-1,0); maxn = 14; type rec = record x,y: integer; end; var f: array[-maxn..maxn,-maxn..maxn,0..maxn] of int64; q: array[1..40000] of rec; front,rear,back: integer; nTest,n,i: integer; procedure precalc; var i,j: integer; u,v: rec; begin fillchar(f, sizeof(f), 0); f[0,0,0] := 1; front := 1; rear := 1; back := 1; q[1].x := 0; q[1].y := 0; for i := 1 to maxn do begin back := rear; while front <= back do begin u := q[front]; inc(front); for j := 1 to 6 do begin v.x := u.x + dx[j]; v.y := u.y + dy[j]; if f[v.x,v.y,i] = 0 then begin inc(rear); q[rear] := v; end; f[v.x,v.y,i] := f[v.x,v.y,i] + f[u.x,u.y,i - 1]; end; end; end; end; begin precalc; readln(nTest); for i := 1 to nTest do begin readln(n); writeln(f[0,0,n]); end; end.  #### Code mẫu của khuc_tuan // {$APPTYPE CONSOLE}
{\$mode delphi}

var
a : array[1..40,1..40,0..7] of integer;

procedure go(i, j, s : integer);
begin
if s > 7 then exit;
inc(a[i,j,s]);
go(i,j-1,s+1);
go(i,j+1,s+1);
if i mod 2=0 then
begin
go(i+1,j,s+1);
go(i+1,j-1,s+1);
go(i-1,j,s+1);
go(i-1,j-1,s+1);
end
else
begin
go(i+1,j+1,s+1);
go(i+1,j,s+1);
go(i-1,j+1,s+1);
go(i-1,j,s+1);
end;
end;

var
k, res, st, i, j, x, y : integer;

begin
go(20,20,0);
for k:=1 to st do
begin
y := x div 2;
x := x - y;
res := 0;
for i:=1 to 40 do
for j:=1 to 40 do
res := res + a[i,j,x] * a[i,j,y];
writeln(res);
end;
end.