Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(w):
  for i in range(h):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<h:
        if s[j+1][i] == '#': ok = True
      if i+1<w:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)

Fixed submission:
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(h):
  for i in range(w):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<h:
        if s[j+1][i] == '#': ok = True
      if i+1<w:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(w):
  for i in range(h):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<w:
        if s[j+1][i] == '#': ok = True
      if i+1<h:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)

Fixed submission:
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(h):
  for i in range(w):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<h:
        if s[j+1][i] == '#': ok = True
      if i+1<w:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
cross = [[0,-1],[-1,0],[1,0],[0,1]] # 上左右下の定義

for j in range(w):
  for i in range(h):
    if s[j][i] == '#' or s[j][i] == 'B':
      if i-1>=0 :
        if s[j][i-1] == '#': s[j][i-1] = 'B'
      if i+1<w :
        if s[j][i+1] == '#': s[j][i+1] = 'B'
      if j-1>=0 :
        if s[j-1][i] == '#': s[j-1][i] = 'B'
      if j+1<h :
        if s[j+1][i] == '#': s[j+1][i] = 'B'

for se in s:
  if '#' in se:
    print('No')
    exit()

print('Yes')

Fixed submission:
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(h):
  for i in range(w):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<h:
        if s[j+1][i] == '#': ok = True
      if i+1<w:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
cross = [[0,-1],[-1,0],[1,0],[0,1]] # 上左右下の定義

for j in range(w):
  for i in range(h):
    if s[j][i] == '#' or s[j][i] == 'B':
      if i-1>=0 :
        if s[j][i-1] == '#': s[j][i-1] = 'B'
      if i+1<w :
        if s[j][i+1] == '#': s[j][i+1] = 'B'
      if j-1>=0 :
        if s[j-1][i] == '#': s[j-1][i] = 'B'
      if j+1<h :
        if s[j+1][i] == '#': s[j+1][i] = 'B'

for se in s:
  if '#' in se:
    print('No')
    exit()

print('Yes')

Fixed submission:
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(h):
  for i in range(w):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<h:
        if s[j+1][i] == '#': ok = True
      if i+1<w:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)