Buggy python submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest

a = input().rstrip().split(" ")

H = int(a[0])  # 行
W = int(a[1])  # 列
K = int(a[2])  # 操作後に残る黒いマスの数

m = []
for i in range(H):
    n = list(input())
    m.append(n)

# print(m)
ans = 0

for maskR in range(1 << H):
    for maskC in range(1 << W):
        black = 0
        for i in range(H):
            for j in range(W):
                if (maskR >> i & 1) == 0 and (maskL >> j & 1) == 0 and m[i][j] == '#':
                    black += 1
        if black == k:
            ans += 1
print(ans)


Fixed submission:
a = input().rstrip().split(" ")
 
H = int(a[0])   #行
W = int(a[1])   #列
K = int(a[2])   #操作後に残る黒いマスの数
 
m = []
for i in range(H):
    n = list(input())
    m.append(n)
 
#print(m)
ans = 0
 
#2進数のyes/no(赤く塗るか否か)列を作る
for maskR in range(1 << H):
    for maskC in range(1 << W):
        black = 0
        
        for i in range(H):
            for j in range(W):
                if (maskR >> i & 1) == 0 and (maskC >> j & 1) == 0 and m[i][j] == "#":
                    black += 1
    
        if black == K:
            ans += 1
 
print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest

a = input().rstrip().split(" ")

H = int(a[0])  # 行
W = int(a[1])  # 列
K = int(a[2])  # 操作後に残る黒いマスの数

m = []
for i in range(H):
    n = list(input())
    m.append(n)

# print(m)
ans = 0

for maskR in range(1 << H):
    for maskC in range(1 << W):
        black = 0
        for i in range(H):
            for j in range(W):
                if (maskR >> i & 1) == 0 and (maskL >> j & 1) == 0 and m[i][j] == '#':
                    black += 1
        if black == k:
            ans += 1
print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2 3 2
..#
###"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2 3 4
..#
###"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """2 2 3
##
##"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """6 6 8
..##..
.#..#.
#....#
######
#....#
#....#"""
        output = """208"""
        self.assertIO(input, output)


if __name__ == "__main__":
    unittest.main()


Fixed submission:
a = input().rstrip().split(" ")
 
H = int(a[0])   #行
W = int(a[1])   #列
K = int(a[2])   #操作後に残る黒いマスの数
 
m = []
for i in range(H):
    n = list(input())
    m.append(n)
 
#print(m)
ans = 0
 
#2進数のyes/no(赤く塗るか否か)列を作る
for maskR in range(1 << H):
    for maskC in range(1 << W):
        black = 0
        
        for i in range(H):
            for j in range(W):
                if (maskR >> i & 1) == 0 and (maskC >> j & 1) == 0 and m[i][j] == "#":
                    black += 1
    
        if black == K:
            ans += 1
 
print(ans)