import sequtils proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let h = scan() let w = scan() var isWater : array[3001,array[3001,bool]] for y in 0..= w : continue if ny < 0 or ny >= h : continue if checked[nx][ny] : continue if not isWater[nx][ny] : continue discard check(nx,ny) return true var ans = 0 for x in 0..