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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, W+1):
    for j in range(1, H+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, W+1):
    for j in range(1, H+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1

if flg==0:
    print('Yes')
else:
    print('No')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, W):
    for j in range(1, H):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break

if flg==0:
    print('Yes')
else:
    print('No')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, W+1):
    for j in range(1, H+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break

if flg==0:
    print('Yes')
else:
    print('No')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

for i in range(1, W+1):
    for j in range(1, H+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                print('No')
                break
            
print('Yes')

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

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')