Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())

line_list = []
for i in range(w):
    line_list.append(input())

if h == 1:
    if w == 1:
        print("No")
        exit()
    else:
        for j in range(w-1):
            if line_list[0][j] == "#":
                if line_list[0][j + 1] != "#":
                    print("No")
                    exit()
                else:
                    j += 1
                    continue
    print("Yes")
    exit()
elif w == 1:
    if h == 1:
        print("No")
        exit()
    else:
        for j in range(h-1):
            if line_list[j] == "#":
                if line_list[j + 1] != "#":
                    print("No")
                    exit()
                else:
                    j += 1
                    continue
    print("Yes")
    exit()


before_line = [["."] for _ in range(w)]
current_line = list(line_list[0])
for i in range(h-1):
    after_line = list(line_list[i + 1])
    j = 0
    while j < w-1:
        if current_line[j] == "#":
            if current_line[j+1] == "#":
                j += 1
                while j < w - 1:
                    if current_line[j + 1] != "#":
                       break
                    else:
                        j += 1
                j += 1
                continue
            elif before_line[j] != "#" and after_line[j] != "#":
                print("No")
                exit()
        j += 1
    before_line = current_line
    current_line = after_line

print("Yes")

Fixed submission:
h, w = map(int, input().split())

line_list = []
for i in range(h):
    line_list.append(input())

if h == 1:
    if w == 1:
        print("No")
        exit()
    else:
        current_line = line_list[0]
        j = 0
        while j < w - 1:
            if current_line[j] == "#":
                if current_line[j + 1] == "#":
                    j += 1
                    while j < w - 1:
                        if current_line[j + 1] != "#":
                            break
                        else:
                            j += 1
                    j += 1
                    continue
            j += 1
    print("Yes")
    exit()
elif w == 1:
    if h == 1:
        print("No")
        exit()
    else:
        j = 0
        while j < h - 1:
            if line_list[j] == "#":
                if line_list[j + 1] == "#":
                    j += 1
                    while j < h - 1:
                        if line_list[j + 1] != "#":
                            break
                        else:
                            j += 1
                    j += 1
                    continue
            j += 1
    print("Yes")
    exit()


before_line = [["."] for _ in range(w)]
current_line = list(line_list[0])
for i in range(h-1):
    after_line = list(line_list[i + 1])
    j = 0
    while j < w-1:
        if current_line[j] == "#":
            if current_line[j+1] == "#":
                j += 1
                while j < w - 1:
                    if current_line[j + 1] != "#":
                       break
                    else:
                        j += 1
                j += 1
                continue
            elif before_line[j] != "#" and after_line[j] != "#":
                print("No")
                exit()
        j += 1
    before_line = current_line
    current_line = after_line

print("Yes")