Buggy python submission (verdict: Runtime Error):
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
import numpy as np
d = stdin.readline().rstrip().split()
H = int(d[0])
W = int(d[1])
K = int(d[2])

data = []
bCount = 0
result = 0
for el1 in range(H):
    tmp = stdin.readline().rstrip().split()
    d = []
    for el in tmp:
        for el3 in el:
            if el3 == '#':
                bCount += 1
            d.append(el3)
    data.append(d)
tr = []
for i in range(W):
    tr_row = []
    for vector in data:
        tr_row.append(vector[i])
    tr.append(tr_row)
data2 = tr
counter = 0
for el in range(H+W):
    counter += 2**el
for el in range(counter+1):
    bin_str = ''.join(list(reversed(str(bin(el))[2:])))
    poss = []
    count = 0
    for el2 in bin_str:
        if el2 == '1':
            poss.append(count)
        count += 1
    res = 0
    for el2 in poss:
        if el2 >= H:
            el2 -= H
            res += data2[el2].count('#')
        else:
            res += data[el2].count('#')
    if bCount-res == K:
        result += 1

print(result)


Fixed submission:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
d = stdin.readline().rstrip().split()
H = int(d[0])
W = int(d[1])
K = int(d[2])

data = []
bCount = 0
result = 0
for el1 in range(H):
    tmp = stdin.readline().rstrip().split()
    d = []
    for el in tmp:
        for el3 in el:
            if el3 == '#':
                bCount += 1
            d.append(el3)
    data.append(d)
datas = copy.deepcopy(data)
counter = 0
for el in range(H+W):
    counter += 2**el
for el in range(counter+1):
    bin_str = ''.join(list(reversed(str(bin(el))[2:])))
    poss = []
    count = 0
    for el2 in bin_str:
        if el2 == '1':
            poss.append(count)
        count += 1
    res = 0
    for el2 in poss:
        if el2 >= H:
            el2 -= H
            for el3 in datas:
                el3[el2] = 'o'
        else:
            datas[el2] = ['o']*W
    for el2 in datas:
        res += el2.count('#')
    if res == K:
        result += 1
    datas = copy.deepcopy(data)
print(result)

Buggy python submission (verdict: Runtime Error):
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
import numpy as np
d = stdin.readline().rstrip().split()
H = int(d[0])
W = int(d[1])
K = int(d[2])

data = []
bCount = 0
result = 0
for el1 in range(H):
    tmp = stdin.readline().rstrip().split()
    d = []
    for el in tmp:
        for el3 in el:
            if el3 == '#':
                bCount += 1
            d.append(el3)
    data.append(d)
tr = []
for i in range(W):
    tr_row = []
    for vector in data:
        tr_row.append(vector[i])
    tr.append(tr_row)
data2 = tr
counter = 0
for el in range(H+W):
    counter += 2**el
for el in range(counter+1):
    bin_str = ''.join(list(reversed(str(format(el, 'b')))))
    poss = []
    count = 0
    for el2 in bin_str:
        if el2 == '1':
            poss.append(count)
        count += 1
    res = 0
    for el2 in poss:
        if el2 >= H:
            el2 -= H
            res += data2[el2].count('#')
        else:
            res += data[el2].count('#')
    if bCount-res == K:
        result += 1

print(result)


Fixed submission:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
d = stdin.readline().rstrip().split()
H = int(d[0])
W = int(d[1])
K = int(d[2])

data = []
bCount = 0
result = 0
for el1 in range(H):
    tmp = stdin.readline().rstrip().split()
    d = []
    for el in tmp:
        for el3 in el:
            if el3 == '#':
                bCount += 1
            d.append(el3)
    data.append(d)
datas = copy.deepcopy(data)
counter = 0
for el in range(H+W):
    counter += 2**el
for el in range(counter+1):
    bin_str = ''.join(list(reversed(str(bin(el))[2:])))
    poss = []
    count = 0
    for el2 in bin_str:
        if el2 == '1':
            poss.append(count)
        count += 1
    res = 0
    for el2 in poss:
        if el2 >= H:
            el2 -= H
            for el3 in datas:
                el3[el2] = 'o'
        else:
            datas[el2] = ['o']*W
    for el2 in datas:
        res += el2.count('#')
    if res == K:
        result += 1
    datas = copy.deepcopy(data)
print(result)

Buggy python submission (verdict: Runtime Error):
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
import numpy as np
d = stdin.readline().rstrip().split()
H = int(d[0])
W = int(d[1])
K = int(d[2])

data = []
bCount = 0
result = 0
for el1 in range(H):
    tmp = stdin.readline().rstrip().split()
    d = []
    for el in tmp:
        for el3 in el:
            if el3 == '#':
                bCount += 1
            d.append(el3)
    data.append(d)
data2 = np.array(data).T.tolist()
counter = 0
for el in range(H+W):
    counter += 2**el
for el in range(counter+1):
    bin_str = ''.join(list(reversed(str(format(el, 'b')))))
    poss = []
    count = 0
    for el2 in bin_str:
        if el2 == '1':
            poss.append(count)
        count += 1
    res = 0
    for el2 in poss:
        if el2 >= H:
            el2 -= H
            res += data2[el2].count('#')
        else:
            res += data[el2].count('#')
    if bCount-res == K:
        result += 1

print(result)


Fixed submission:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
d = stdin.readline().rstrip().split()
H = int(d[0])
W = int(d[1])
K = int(d[2])

data = []
bCount = 0
result = 0
for el1 in range(H):
    tmp = stdin.readline().rstrip().split()
    d = []
    for el in tmp:
        for el3 in el:
            if el3 == '#':
                bCount += 1
            d.append(el3)
    data.append(d)
datas = copy.deepcopy(data)
counter = 0
for el in range(H+W):
    counter += 2**el
for el in range(counter+1):
    bin_str = ''.join(list(reversed(str(bin(el))[2:])))
    poss = []
    count = 0
    for el2 in bin_str:
        if el2 == '1':
            poss.append(count)
        count += 1
    res = 0
    for el2 in poss:
        if el2 >= H:
            el2 -= H
            for el3 in datas:
                el3[el2] = 'o'
        else:
            datas[el2] = ['o']*W
    for el2 in datas:
        res += el2.count('#')
    if res == K:
        result += 1
    datas = copy.deepcopy(data)
print(result)