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

ans = "Yes"
for i in range(H-1):
  for j in range(W-1):
    if(C[i][j] == "#"):
      if(i != 0 and C[i-1][j] == "#"):
        continue
      if(i != H and C[i+1][j] == "#"):
        continue
      if(j != 0 and C[i][j-1] == "#"):
        continue
      if(j != W and C[i][j+1] == "#"):
        continue
      ans = "No"
print(ans)

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

ans = "Yes"
for i in range(H-1):
  for j in range(W-1):
    if(HW[i][j] == "."):
      continue
    if(i != 0 and HW[i-1][j] == "#"):
      continue
    if(j != 0 and HW[i][j-1] == "#"):
      continue
    if(j != H and HW[i+1][j] == "#"):
      continue
    if(j != W and HW[i][j+1] == "#"):
      continue
    ans = "No"
print(ans)

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

ans = "Yes"
for i in range(H):
  for j in range(W):
    if(C[i][j] == "."):
      continue
    if(i > 0 and C[i-1][j] == "#"):
      continue
    if(i+1 < H and C[i+1][j] == "#"):
      continue
    if(j > 0 and C[i][j-1] == "#"):
      continue
    if(j+1 < W and C[i][j+1] == "#"):
      continue
    ans = "No"
print(ans)

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

ans = "Yes"
for i in range(H-1):
  for j in range(W-1):
    if(HW[i][j] == "."):
      continue
    if(i != 0 and HW[i-1][j] == "#"):
      continue
    if(j != 0 and HW[i][j-1] == "#"):
      continue
    if(j != H and HW[i+1][j] == "#"):
      continue
    if(j != W and HW[i][j+1] == "#"):
      continue
    ans = "No"
print(ans)

Buggy python submission (verdict: Runtime Error):
H, W = map(int,input().split())
S = [list(input()) for _ in range(H)]
ans = "Yes"
for i in range(H):
  for j in range(W):
    if(S[i][j] == "#"):
      if(i != 0 and S[i-1][j] == "#"):
        continue
      if(i != H and S[i+1][j] == "#"):
        continue
      if(j != 0 and S[i][j-1] == "#"):
        continue
      if(j != W and S[i][j+1] == "#"):
        continue
      ans = "No"
print(ans)

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

ans = "Yes"
for i in range(H-1):
  for j in range(W-1):
    if(HW[i][j] == "."):
      continue
    if(i != 0 and HW[i-1][j] == "#"):
      continue
    if(j != 0 and HW[i][j-1] == "#"):
      continue
    if(j != H and HW[i+1][j] == "#"):
      continue
    if(j != W and HW[i][j+1] == "#"):
      continue
    ans = "No"
print(ans)

Buggy python submission (verdict: Runtime Error):
H, W = map(int,input().split())
S = [list(input()) for _ in range(H)]
ans = "Yes"
for i in range(H):
  for j in range(W):
    if(S[i][j] == "#"):
      if(i != 0 and S[i-1][j] == "#"):
        continue
      if(i != H and S[i+1][j] == "#"):
        continue
      if(j != 0 and S[i][j-1] == "#"):
        continue
      if(j+1 < W and S[i][j+1] == "#"):
        continue
      ans = "No"
print(ans)

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

ans = "Yes"
for i in range(H-1):
  for j in range(W-1):
    if(HW[i][j] == "."):
      continue
    if(i != 0 and HW[i-1][j] == "#"):
      continue
    if(j != 0 and HW[i][j-1] == "#"):
      continue
    if(j != H and HW[i+1][j] == "#"):
      continue
    if(j != W and HW[i][j+1] == "#"):
      continue
    ans = "No"
print(ans)