Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var (
	sc = bufio.NewScanner(os.Stdin)
)

type Color int

const (
	ColorBlack Color = iota
	ColorRed
)

type Node struct {
	ID    int
	X, Y  int
	Color Color
	Nexts []*Node
}

func main() {
	for sc.Scan() {
		if sc.Text() == "0 0" {
			break
		}
		chunks := strings.Split(sc.Text(), " ")
		w, _ := strconv.Atoi(chunks[0])
		h, _ := strconv.Atoi(chunks[1])

		// Initialize map
		m := map[int]map[int]*Node{}
		for x := 1; x <= w; x++ {
			m[x] = map[int]*Node{}
			for y := 1; y <= h; y++ {
				m[x][y] = &Node{ID: x + y*w, X: x, Y: y}
			}
		}
		for x := 1; x <= w; x++ {
			for y := 1; y <= h; y++ {
				nexts := []*Node{}
				if n, ok := m[x-1][y]; ok {
					nexts = append(nexts, n)
				}
				if n, ok := m[x][y-1]; ok {
					nexts = append(nexts, n)
				}
				if n, ok := m[x+1][y]; ok {
					nexts = append(nexts, n)
				}
				if n, ok := m[x][y+1]; ok {
					nexts = append(nexts, n)
				}
				m[x][y].Nexts = nexts
			}
		}

		// Set colors
		queue := []*Node{}
		touchedIDs := map[int]struct{}{}
		for y := 1; y <= h; y++ {
			sc.Scan()
			for i, c := range sc.Text() {
				switch c {
				case '.', '@':
					n := m[i+1][y]
					n.Color = ColorBlack
					if c == '@' {
						queue = append(queue, n)
						touchedIDs[n.ID] = struct{}{}
					}
				case '#':
					m[i+1][y].Color = ColorRed
				}
			}
		}

		// Search
		visitedIDs := map[int]struct{}{}
		for {
			if len(queue) == 0 {
				break
			}
			n := queue[0]
			queue = queue[1:]
			visitedIDs[n.ID] = struct{}{}
			for _, next := range n.Nexts {
				if next.Color == ColorRed {
					continue
				}
				if _, ok := touchedIDs[next.ID]; !ok {
					queue = append(queue, next)
					touchedIDs[n.ID] = struct{}{}
				}
			}
		}
		fmt.Println(len(visitedIDs))
	}
}

Python: while 1:
    x, y = list(map(int,input().split()))
    if x == 0:break

    mx = [1,-1,0,0]
    my = [0,0,1,-1]
    m = []
    for i in range(y):
        m.append(list(input()))
        if '@' in m[-1]:
            sx = m[-1].index('@')
            sy = i
    cnt = 0

    def move(cur_x, cur_y):
        global cnt
        if cur_y >= y or cur_y < 0 or cur_x >= x or cur_x < 0:return
        if m[cur_y][cur_x] == '.' or m[cur_y][cur_x] == '@':
            cnt += 1
            m[cur_y][cur_x] = '0'
            for i in range(4):
                move(cur_x + mx[i],cur_y + my[i])
    move(sx,sy)
    print(cnt)

Python: 
def depth_first_search(x, y):
    """
    ??±???????????¢?´¢?????????
    :param x: ?????¨??°????¨?
    :param y: ?????¨??°??????
    :return: ?????°
    """

    # ????????????????????§?¢??????????
    # ??????x  ,y+1
    # ??????x+1,y
    # ??????x  ,y-1
    # ??????x-1,y
    move_list = [[0,1],[1,0],[0,-1],[-1,0]]
    for i in range(0,4,1):
        next_x = x+move_list[i][0]
        next_y = y+move_list[i][1]
        # tile_map??????????§??????§????????´??????'.'???
        if 0 <= next_x and 0 <= next_y and \
            next_x < W and next_y < H and \
            tile_map[next_y][next_x] != '#':

            # ?§?????????????????????¨??°????§??????§??????????????????"#"??????????????????
            tile_map[y][x] = '#'
            import __main__
            __main__.move_point = __main__.move_point+1
            depth_first_search(next_x, next_y)


def get_start_point(tile_map):
    """
    @????????????????????????
    :param tile_map:
    :return:
    """
    for i, y in enumerate(tile_map):
        for j, x in enumerate(y):
            if x == '@':
                return i, j



if __name__ == "__main__":
    move_point = 0
    first = True
    while (True):
        # input_1 : tile????????????
        tile_size = input('').split(' ')
        W, H = [int(x) for x in tile_size]
        if W == 0 and H == 0:
            break
        if first:
            first = False
        else:
            print('')
        tile_map=[''] * H
        for i in range(0, H, 1):
            # input_2 : tile???????????????????????????
            map_line = list(input(''))
            tile_map[i] = map_line
        start_H, start_W = get_start_point(tile_map)
        depth_first_search(start_W, start_H)
        import ipdb;ipdb.set_trace()
        print(move_point)

Python: data, res = [], 0

def valid(x, y):
    global data
    return 0 <= x < W and 0 <= y < H and data[y][x] != '#'

def dfs(x, y):
    global data, res
    if valid(x, y):
        res += 1
        data[y][x] = '#'
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4):
            dfs(x + dx[i], y + dy[i])
    else:
        return
    
while True:
    global data, res
    W, H = map(int, input().split())
    if not W:
        break
    data = [list(input()) for _ in range(H)]
    res = 0
    for i in range(W):
        for j in range(H):
            if data[j][i] == '@':
                dfs(i, j)
                break
    print(res)

Python: c = 0
def calc(t, X, Y):
    global c
    c += 1
    t[Y][X] = '#'
    for x, y in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
        if t[Y + y][X + x] == '.':
            calc(t, X + x, Y + y)
            
while True:
    c = 0
    w, h = map(int, input().split())
    if w == h == 0:
        break
    
    t = [['#'] * (w + 2) ] + [['#'] + list(input()) + ['#'] for _ in range(h)] + [['#'] * (w + 2)]
    for sy in range(h + 2):
        if '@' in t[sy]:
            sx = t[sy].index('@')
            break
      
    calc(t, sx, sy)
    print(c)

Python: #2:52
import sys

sys.setrecursionlimit(10000000)


dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]



#左上からせめて深さ優先で探索する問題
while True:
    # 地図作る
    width,hight = map(int,input().split())
    if width ==0 :
        break
    d =[]
    for _ in range(hight):
        d.append(list(input()))
    
    def dfs(x, y):
    # いまたどり着いたはずなので1に塗りつぶす
        d[y][x]="d"

    #4方向ループ
    #あくまで方向の表し方dxは
        for i in range(4):
            ny = y + dx[i]
            nx = x + dy[i]

        #行ったことがなくって、迷路の範囲内で、障害物がなければ、進む
            if 0 <= ny and ny < hight \
              and 0 <= nx and nx < width \
              and d[ny][nx] == ".":
                dfs(nx,ny) 

    


    for y in range(hight):
        for x in range(width):
            if d[y][x] == "@":
                dfs(x,y)
    
    sum = 0 
    for _ in range(hight):
        sum = sum + d[_].count('d')
    print(sum)

Python: vec = [[1,0],[0,1],[-1,0],[0,-1]]

def dfs(nw,nh):
    global count
    count += 1
    visited[nh][nw] = True
    for x,y in vec:
        new_w = nw + x
        new_h = nh + y
        if (0 <= new_w) and (new_w) < w:
            if (0 <= new_h) and (new_h) < h:
                if (lis_f[new_h][new_w] == ".") and (visited[new_h][new_w] == False):
                    dfs(new_w,new_h)
                    
while(True):
    w,h = map(int,input().split())
    if (w,h) == (0,0):
        break
    lis_f = []
    for _ in range(h):
        lis_f.append(list(input()))
    
    visited = [[False for _ in range(w)] for _ in range(h)]
    count = 0
    
    id_w = 0
    id_h = 0
    set_w = 0
    set_h = 0
    while(id_h < h):
        while(id_w < w):
            #print(lis_f[id_h][id_w])
            if lis_f[id_h][id_w] == "@":
                set_w = id_w
                set_h = id_h
            id_w += 1
        id_h += 1
        id_w = 0
    
    #print(set_w,set_h)
    
    dfs(set_w,set_h)
    print(count)