Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split(' '))
matrix = []
for _ in range(W):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

flag = 'Yes'
for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        if s == 1:
            if j > 0 and row[j-1] == 0:
                if j < W - 1 and row[j+1] == 0:
                    if i > 0 and matrix[i-1][j] == 0:
                        if i < H - 1 and matrix[i+1][j] == 0:
                            flag = 'No'
                            break

print(flag)


Fixed submission:
H, W = map(int, input().split(' '))
matrix = []
for _ in range(H):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

flag = 'Yes'
for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) and (i < H - 1 and matrix[i+1][j] == 0):
                    flag = 'No'
                    break

print(flag)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split(' '))
matrix = []
for _ in range(W):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

flag = 'Yes'
for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) and (i < H - 1 and matrix[i+1][j] == 0):
                    flag = 'No'
        if flag == 'No':
            break

print(flag)


Fixed submission:
H, W = map(int, input().split(' '))
matrix = []
for _ in range(H):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

flag = 'Yes'
for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) and (i < H - 1 and matrix[i+1][j] == 0):
                    flag = 'No'
                    break

print(flag)

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

H, W = map(int, input().split(' '))
matrix = []
for _ in range(W):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        flag = True
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) and (i < H - 1 and matrix[i+1][j] == 0):
                    print('No')
                    exit(0)

print('Yes')


Fixed submission:
H, W = map(int, input().split(' '))
matrix = []
for _ in range(H):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

flag = 'Yes'
for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) and (i < H - 1 and matrix[i+1][j] == 0):
                    flag = 'No'
                    break

print(flag)

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split(' '))
matrix = []
for _ in range(W):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        flag = True
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) or (i < H - 1 and matrix[i+1][j] == 0):
                  exit(0)

print('Yes')


Fixed submission:
H, W = map(int, input().split(' '))
matrix = []
for _ in range(H):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

flag = 'Yes'
for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) and (i < H - 1 and matrix[i+1][j] == 0):
                    flag = 'No'
                    break

print(flag)