Buggy python submission (verdict: Runtime Error):

H,W = map(int, input().split())
s = [input() for _ in range(H)]
import sys
for j in range(H):
    for i in range(W):
        if s[j][i] =='#':
            if 0<i and s[j][i-1] == '#':
                pass
            elif 0<j and s[j-1][i] == '#':
                pass
            elif i<H-1 and s[j][i+1] == '#':
                pass
            elif j<W-1 and s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')

Fixed submission:
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(H):
    for i in range(W):
        if s[j][i] =='#':
            if j+1<W and i+1<H and j-1>=0 and i-1>=0:
                if (s[j+1][i]=='#' or s[j][i+1]=='#'or s[j][i-1]=='#',or s[j-1][i]=='#'):
                    continue
                if s[j+1][i]!='#' or s[j][i+1]!='#' or s[j-1][i]!='#' or s[j][i-1]!='#':
                    sys.exit()
print('Yes')


Fixed submission:
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(H):
    for i in range(W):
        if s[j][i] =='#':
            if j+1<W and i+1<H and 0<=j-1 and 0<=i-1:
                if (s[j+1][i]=='#' or s[j][i+1]=='#' or s[j-1][i] or s[j][i-1]):
                    continue
                if s[j+1][i]!='#' and s[j][i+1]!='#' and s[j-1][i]!='#' and s[j][i-1]!='#':
                    print('No')
                    sys.exit()
print('Yes')


Fixed submission:
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(H):
    for i in range(W):
        if s[j][i] =='#':
            if j+1<W and i+1<H and 0<=j-1 and 0<=i-1:
                if (s[j+1][i]=='#' or s[j][i+1]=='#' or s[j-1][i] or s[j][i-1]):
                    continue
                if s[j+1][i]!='#' or s[j][i+1]!='#' or s[j-1][i]!='#' or s[j][i-1]!='#':
                    print('No')
                    sys.exit()
print('Yes')


Fixed submission:
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(H):
    for i in range(W):
        if s[j][i] =='#':
            if j+1<W and i+1<H and 0<=j-1 and 0<=i-1:
                if (s[j+1][i]=='#' or s[j][i+1]=='#'):
                    continue
                if s[j+1][i]!='#' or s[j][i+1]!='#' or s[j-1][i]!='#' or s[j][i-1]!='#':
                    print('No')
                    sys.exit()
print('Yes')


Fixed submission:
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(H):
    for i in range(W):
        if s[j][i] =='#':
            if j+1<W and i+1<H and 0<=j-1 and 0<=i-1:
                if (s[j+1][i]=='#' or s[j][i+1]=='#'):
                    continue
                if s[j+1][i]!='#' or s[j][i+1]!='#' or s[j-1][i]!='#' or s[j][i-1]!='#':
                    print('No')
                    sys.exit()
print('Yes')


Fixed submission:
H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                sys.exit()
print('Yes')