Buggy python submission (verdict: Runtime Error):
import sys
(h, w) = map(int, input().split())
sw = []
sw.append(['.' for i in range(h + 2)])
for i in range(w):
    sw.append(['.'] + list(input()) + ['.'])
sw.append(['.' for i in range(h + 2)])

dirs = [[1, 0], [-1, 0], [0, 1], [0, -1]]
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sw[i][j] == '.':
            continue
        ok = False
        for dir in dirs:
            if sw[i + dir[0]][j + dir[1]] == '#':
                ok = True
                break
        if ok == False:
            print('No')
            sys.exit(0)
print('Yes')

Fixed submission:
import sys
(h, w) = map(int, input().split())
D = '.'
sw = []
sw.append([D for i in range(w + 2)])
for i in range(h):
    sw.append([D] + list(input()) + [D])
sw.append([D for i in range(w + 2)])

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sw[i][j] == D:
            continue
        ok = False
        for dir in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
            if sw[i + dir[0]][j + dir[1]] == '#':
                ok = True
                break
        if ok == False:
            print('No')
            sys.exit(0)
print('Yes')

Buggy python submission (verdict: Runtime Error):
import sys
(h, w) = map(int, input().split())
sw = [['.' for i in range(h + 2)]]
for i in range(w):
    sw.append(['.'] + list(input()) + ['.'])
sw.append(['.' for i in range(h + 2)])

dirs = [[1, 0], [-1, 0], [0, 1], [0, -1]]
for i in range(1, w + 1):
    for j in range(1, h + 1):
        if sw[i][j] == '.':
            continue
        ok = False
        for dir in dirs:
            if sw[i + dir[0]][j + dir[1]] == '#':
                ok = True
                break
        if ok == False:
            print('No')
            sys.exit(0)
print('Yes')

Fixed submission:
import sys
(h, w) = map(int, input().split())
D = '.'
sw = []
sw.append([D for i in range(w + 2)])
for i in range(h):
    sw.append([D] + list(input()) + [D])
sw.append([D for i in range(w + 2)])

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sw[i][j] == D:
            continue
        ok = False
        for dir in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
            if sw[i + dir[0]][j + dir[1]] == '#':
                ok = True
                break
        if ok == False:
            print('No')
            sys.exit(0)
print('Yes')

Buggy python submission (verdict: Runtime Error):
(h, w) = map(int, input().split())
sw = [['.' for i in range(h + 2)]]
for i in range(w):
    sw.append(['.'] + list(input()) + ['.'])
sw.append(['.' for i in range(h + 2)])

dirs = [[1, 0], [-1, 0], [0, 1], [0, -1]]
ng = False
for i in range(1, w + 1):
    if ng == True:
        break
    for j in range(1, h + 1):
        if ng == True:
            break
        if sw[i][j] == '.':
            continue
        ok = False
        for dir in dirs:
            if sw[i + dir[0]][j + dir[1]] == '#':
                ok = True
                break
        if ok == False:
            print('No')
            ng = True
if ng == False:
    print('Yes')

Fixed submission:
import sys
(h, w) = map(int, input().split())
D = '.'
sw = []
sw.append([D for i in range(w + 2)])
for i in range(h):
    sw.append([D] + list(input()) + [D])
sw.append([D for i in range(w + 2)])

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sw[i][j] == D:
            continue
        ok = False
        for dir in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
            if sw[i + dir[0]][j + dir[1]] == '#':
                ok = True
                break
        if ok == False:
            print('No')
            sys.exit(0)
print('Yes')