Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [input() for i in range(H)]
precount = 0
for i in range(H):
    precount += s[i].count("#")
if precount == 0:
    print("Yes")
else:
    ans = "Yes"
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
               count = 0
               for k in range(4):
                   nx = j+dx[k]
                   ny = i+dy[k]
                   if 0 <= nx < W and 0 <= ny < H:
                      if s[ny][nx] == "#":
                         count += 1
               if count == 0:
                  ans = "No"

print(ans)

Fixed submission:
H,W = map(int,input().split())
s = [input() for i in range(H)]
precount = 0
for i in range(H):
    precount += s[i].count("#")
if precount == 0:
    print("Yes")
else:
    ans = "Yes"
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
               count = 0
               for k in range(4):
                   nx = j+dx[k]
                   ny = i+dy[k]
                   if 0 <= nx < W and 0 <= ny < H:
                      if s[ny][nx] == "#":
                         count += 1
               if count == 0:
                  ans = "No"

    print(ans)

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [input() for i in range(H)]
ans = "No"
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(0,H):
    for j in range(0,W):
        for k in range(4):
            nx = i+dx[k]
            ny = j+dy[k] 
            if s[i][j] == "#":
                if 0 <= nx < W and 0 <= ny < H:
                   if s[nx][ny] == "#":
                    ans = "Yes"

print(ans)

Fixed submission:
H,W = map(int,input().split())
s = [input() for i in range(H)]
precount = 0
for i in range(H):
    precount += s[i].count("#")
if precount == 0:
    print("Yes")
else:
    ans = "Yes"
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
               count = 0
               for k in range(4):
                   nx = j+dx[k]
                   ny = i+dy[k]
                   if 0 <= nx < W and 0 <= ny < H:
                      if s[ny][nx] == "#":
                         count += 1
               if count == 0:
                  ans = "No"

    print(ans)

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [input() for i in range(H)]
ans = "No"
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(0,H):
    for j in range(0,W):
        for k in range(4):
            nx = i+dx[k]
            ny = i+dy[k] 
            if s[i][j] == "#":
                if 0 <= nx < W and 0 <= ny < H:
                   if s[nx][ny] == "#":
                    ans = "Yes"

print(ans)

Fixed submission:
H,W = map(int,input().split())
s = [input() for i in range(H)]
precount = 0
for i in range(H):
    precount += s[i].count("#")
if precount == 0:
    print("Yes")
else:
    ans = "Yes"
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
               count = 0
               for k in range(4):
                   nx = j+dx[k]
                   ny = i+dy[k]
                   if 0 <= nx < W and 0 <= ny < H:
                      if s[ny][nx] == "#":
                         count += 1
               if count == 0:
                  ans = "No"

    print(ans)

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [input() for i in range(H)]
ans = "No"
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(0,H):
    for j in range(0,W):
        for k in range(4):
            nx = i+dx[k]
            ny = i+dy[k] 
            if s[i][j] == "#":
                if 0 <= nx < W and 0 <= ny < H:
                   if s[nx][ny] == "#":
                    ans = "Yes"

print(ans)

Fixed submission:
H,W = map(int,input().split())
s = [input() for i in range(H)]
precount = 0
for i in range(H):
    precount += s[i].count("#")
if precount == 0:
    print("Yes")
else:
    ans = "Yes"
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
               count = 0
               for k in range(4):
                   nx = j+dx[k]
                   ny = i+dy[k]
                   if 0 <= nx < W and 0 <= ny < H:
                      if s[ny][nx] == "#":
                         count += 1
               if count == 0:
                  ans = "No"

    print(ans)

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [input() for i in range(H)]
ans = "No"
for i in range(1,W-1):
    for j in range(1,H-1):
        if s[i][j] == "#":
            if s[i][j-1] == "#" or s[i][j+1] == "#" or s[i+1][j] == "#" or s[i-1][j] == "#":
                ans = "Yes"

print(ans)

Fixed submission:
H,W = map(int,input().split())
s = [input() for i in range(H)]
precount = 0
for i in range(H):
    precount += s[i].count("#")
if precount == 0:
    print("Yes")
else:
    ans = "Yes"
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
               count = 0
               for k in range(4):
                   nx = j+dx[k]
                   ny = i+dy[k]
                   if 0 <= nx < W and 0 <= ny < H:
                      if s[ny][nx] == "#":
                         count += 1
               if count == 0:
                  ans = "No"

    print(ans)