Language: Java

#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
int w, h;
bool board[110][110];//true?????????????????????§??¨?
bool flag[110][110];//true??????????????????????????????????????????¨???¨??\???????????????§????????????§??¨?
bool used[110][110];//bfs????????????¨????????????¢
//y???§??¨?????\????°
int dx_kisuu[6] = {1, 1, 1, 0, -1, 0};
int dy_kisuu[6] = {-1, 0, 1, 1, 0, -1};
//y???§??¨???????¶???°
int dx_gusuu[6] = {0, 1, 0, -1, -1, -1};
int dy_gusuu[6] = {-1, 0, 1, 1, 0, -1};
 
bool hantei(int nowy, int nowx){//??????????????????
    if(0 <= nowy && nowy <= h + 1 && 0 <= nowx && nowx <= w + 1){
        return true;
    }else{
        return false;
    }
}
 
int main(void){
    cin >> w >> h;
    //???????????????????????????¨??????0???§??????
    for (int i = 1; i <= h; ++i){
        for (int j = 1; j <= w; ++j){
            cin >> board[i][j];
        }
    }
 
    queue<pair<int, int> > q;
    q.push(make_pair(0, 0));
    //bfs
    while(!q.empty()){
        pair<int, int> now;//first y second x
        now = q.front(); q.pop();
        if(now.first % 2 == 0){
            rep(i, 6){
                int nowy = now.first  + dy_gusuu[i];
                int nowx = now.second + dx_gusuu[i];
                if(hantei(nowy, nowx)){
                    if(!board[nowy][nowx] && !used[nowy][nowx]){
                        q.push(make_pair(nowy, nowx));
                        flag[nowy][nowx] = true;
                        used[nowy][nowx] = true;
                    }
                }
            }
        }else{
            rep(i, 6){
                int nowy = now.first  + dy_kisuu[i];
                int nowx = now.second + dx_kisuu[i];
                if(hantei(nowy, nowx)){
                    if(!board[nowy][nowx] && !used[nowy][nowx]){
                        q.push(make_pair(nowy, nowx));
                        flag[nowy][nowx] = true;
                        used[nowy][nowx] = true;
                    }
                }
            }
        }
    }
 
    long long sum = 0;
    for (int i = 0; i <= h + 1; ++i){
        for (int j = 0; j <= w + 1; ++j){
            if(flag[i][j]){//flag=true???????????????¨??????board=true?????????(??????)???¨??\??????????????????????????????§????????????
                int tmp = 0;
                if(i % 2 == 0){
                    for (int k = 0; k < 6; ++k){
                        int nowy = i + dy_gusuu[k], nowx = j + dx_gusuu[k];
                        //??????????????????¨??\???????????????´???????????????????????????§???????????????????????????£??????¨????????????¨
                        if(board[nowy][nowx] && hantei(nowy, nowx)) sum++;
                    }
                }else{
                    for (int k = 0; k < 6; ++k){
                        int nowy = i + dy_kisuu[k], nowx = j + dx_kisuu[k];
                        if(board[nowy][nowx] && hantei(nowy, nowx)) sum++;
                    }
                }
            }
        }
    }
    printf("%lld\n", sum);
    return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <vector>
^
Main.java:3: error: illegal character: '#'
#include <cstdio>
^
Main.java:4: error: illegal character: '#'
#include <queue>
^
Main.java:5: error: illegal character: '#'
#include <algorithm>
^
Main.java:7: error: illegal character: '#'
#define rep(i,n) for(int i=0;i<(n);i++)
^
Main.java:7: error: class, interface, enum, or record expected
#define rep(i,n) for(int i=0;i<(n);i++)
        ^
Main.java:7: error: class, interface, enum, or record expected
#define rep(i,n) for(int i=0;i<(n);i++)
                             ^
Main.java:7: error: class, interface, enum, or record expected
#define rep(i,n) for(int i=0;i<(n);i++)
                                   ^
Main.java:10: error: class, interface, enum, or record expected
bool board[110][110];//true??????????????????????????
^
Main.java:11: error: class, interface, enum, or record expected
bool flag[110][110];//true?????????????????????????????????????????????????\?????????????????????????????????
^
Main.java:12: error: class, interface, enum, or record expected
bool used[110][110];//bfs??????????????????????????
^
Main.java:14: error: class, interface, enum, or record expected
int dx_kisuu[6] = {1, 1, 1, 0, -1, 0};
^
Main.java:15: error: class, interface, enum, or record expected
int dy_kisuu[6] = {-1, 0, 1, 1, 0, -1};
^
Main.java:17: error: class, interface, enum, or record expected
int dx_gusuu[6] = {0, 1, 0, -1, -1, -1};
^
Main.java:18: error: class, interface, enum, or record expected
int dy_gusuu[6] = {-1, 0, 1, 1, 0, -1};
^
Main.java:20: error: unnamed classes are a preview feature and are disabled by default.
bool hantei(int nowy, int nowx){//??????????????????
^
  (use --enable-preview to enable unnamed classes)
Main.java:29: error: not a statement
    cin >> w >> h;
             ^
Main.java:33: error: not a statement
            cin >> board[i][j];
                ^
Main.java:70: error: not a statement
    long long sum = 0;
    ^
Main.java:28: error: <identifier> expected
int main(void){
             ^
Main.java:44: error: ';' expected
            rep(i, 6){
                     ^
Main.java:56: error: ';' expected
            rep(i, 6){
                     ^
Main.java:70: error: ';' expected
    long long sum = 0;
        ^
24 errors