Problem:
 Score : 300 points    Problem Statement We have a grid of H rows and W columns of squares. The color of the square at the i -th row from the top and the j -th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j} : the square is white if c_{i,j} is . , and black if c_{i,j} is # .  Consider doing the following operation:   Choose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.   You are given a positive integer K . How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.      Constraints  1 \leq H, W \leq 6  1 \leq K \leq HW  c_{i,j} is . or # .         Input Input is given from Standard Input in the following format:  H  W  K  c_{1,1}c_{1,2}...c_{1,W}  c_{2,1}c_{2,2}...c_{2,W}  :  c_{H,1}c_{H,2}...c_{H,W}       Output Print an integer representing the number of choices of rows and columns satisfying the condition.        Sample Input 1 2 3 2
..#
###      Sample Output 1 5  Five choices below satisfy the condition.   The 1 -st row and 1 -st column  The 1 -st row and 2 -nd column  The 1 -st row and 3 -rd column  The 1 -st and 2 -nd column  The 3 -rd column        Sample Input 2 2 3 4
..#
###      Sample Output 2 1  One choice, which is choosing nothing, satisfies the condition.       Sample Input 3 2 2 3
##
##      Sample Output 3 0       Sample Input 4 6 6 8
..##..
.#..#.
#....#
######
#....#
#....#      Sample Output 4 208

Solution (Python):



def f(c, h_patterns, w_patterns, black_count):
    used = [[False for _ in range(len(w_patterns))]
            for _ in range(len(h_patterns))]

    for index, h_pattern in enumerate(h_patterns):
        if h_pattern != 1:
            continue

        for w_dash in range(len(w_patterns)):
            if not used[index][w_dash] and c[index][w_dash] == '
                used[index][w_dash] = True
                black_count -= 1

    for index, w_pattern in enumerate(w_patterns):
        if w_pattern != 1:
            continue

        for h_dash in range(len(h_patterns)):
            if not used[h_dash][index] and c[h_dash][index] == '
                used[h_dash][index] = True
                black_count -= 1

    return black_count


def main():
    from itertools import product

    h, w, k = map(int, input().split())
    c = [list(input()) for _ in range(h)]
    black_count = 0
    ans = 0

    for hi in range(h):
        for wi in range(w):
            if c[hi][wi] == '
                black_count += 1

    for h_patterns in product([1, 0], repeat=h):
        for w_patterns in product([1, 0], repeat=w):
            fi = f(c, h_patterns, w_patterns, black_count)

            if fi == k:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main2():
    h,w,k = map(int,input().split()) 
    G = []
    for _ in range(h):
        c = list(input())
        G.append(c)
    ans = 0

    for ib in range(1<<h):
        for jb in range(1<<w):
            ct = 0
            for i in range(h):
                for j in range(w):
                    if (ib>>i)&1 and (jb>>j)&1 and G[i][j]=="
                        ct+=1
            
            if ct == k:
                ans+=1
    
    print(ans)
main2()

Solution (Python):
h, w, K = map(int, input().split())
lc = []
for _ in range(h):
    lc += list(input().split())

ans = 0
for i in range(1 << h):
    for j in range(1 << w):
        cnt = 0
        for k in range(h):
            for l in range(w):
                if i >> k & 1:
                    continue
                if j >> l & 1:
                    continue
                if lc[k][l] == '
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
H, W, K = map(lambda x: int(x), input().split())

matrix = []
for i in range(H):
	row = input()
	dots = []
	for j in range(W):
		dots.append(row[j])
	matrix.append(dots)

ans = 0
for bitR in range(1 << H):
	for bitC in range(1 << W):
		black = 0
		for i in range(H):
			for j in range(W):
				if ((bitR >> i) & 1) == 0 and ((bitC >> j) & 1) == 0 and matrix[i][j] == '
					black += 1
		if black == K:
			ans += 1

print(ans)

Solution (Python):

h,w,k=map(int,input().split())
c=[[0]*w for i in range(h)]
d=[[0]*w for i in range(h)]
ans=0
for i in range(h):
    a=input()
    for j in range(w):
        c[i][j]=a[j]
for i in range(2**(h+w)):
    for m in range(h):
        for n in range(w):
            d[m][n]=c[m][n]
    for j in range(h):
        if (i >> j)&1:
            for x in range(w):
                d[j][x]="r"
    for j in range(h,w+h):
        if (i >> j)&1:
            for x in range(h):
                d[x][j-h]="r"
    f=0
    for q in range(h):
        for s in range(w):
            if d[q][s]=="
                f+=1
            
        
    if f==k:
        ans+=1
print(ans)

Solution (Python):
from copy import deepcopy
import numpy as np
H, W, K = map(int, input().split())
matrix = []
for i in range(H):
    matrix.append(input())

matrix_int = np.ones((H, W), dtype=np.uint8)

for row in range(H):
    for column in range(W):
        if matrix[row][column] == ".":
            matrix_int[row, column] = 0

count = 0
for row_options in range(2**H):
    for col_options in range(2**W):
        tmp_matrix_int = deepcopy(matrix_int)
        tmp_row_options = row_options
        tmp_col_options = col_options

        for row in range(H):
            mod = tmp_row_options % 2
            if mod == 0:
                tmp_matrix_int[row,:] = 0
            tmp_row_options = tmp_row_options // 2
        
        for col in range(W):
            mod = tmp_col_options % 2
            if mod == 0:
                tmp_matrix_int[:,col] = 0
            tmp_col_options = tmp_col_options // 2
        
        if tmp_matrix_int.sum() == K:
            count += 1
print(count)

Solution (Python):
import copy

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0

for i in range(1 << (h + w)):
    l = copy.deepcopy(c)
    for p in range(h):
        if i >> p & 1:
            l[p] = ['r'] * w
    for m in range(w):
        if i >> (m + h) & 1:
            for o in range(h):
                l[o][m] = 'r'
    s = ''
    for i in range(h):
        s += ''.join(l[i])
    if s.count('
        ans += 1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
M = [[1 if c == "

ans = 0
for hselection in range(1 << H):
    for wselection in range(1 << W):
        count = 0
        for h in range(H):
            if hselection & (1 << h):
                continue
            for w in range(W):
                if wselection & (1 << w):
                    continue
                count += M[h][w]
        if count == K:
            ans += 1
print(ans)

Solution (Python):
import copy

def countKuro( t,p1,p2 ):
    count=0
    for i in range(h):
      if p1 & (1<<i) :
        for j in range(w):
            if p2 & (1<<j) :
                if t[i][j]=="
                    count+=1
    return count


h,w,k=map(int, input().split())
s=[]
for i in range(h):
    s.append( input() )

t=copy.copy(s)
ans=0
for i in range(1<<h):
    for j in range(1<<w):
        
        if k==countKuro(s, i,j):
            ans+=1
print(ans)

Solution (Python):
import copy

H, W, K = list(map(int, input().split()))
c = [0]*H
for i in range(H):
    char = input()
    c[i] = []
    for j in range(W):
        if char[j] == "
            c[i].append(1)
        else:
            c[i].append(0)

count = 0

for i in range(2**H):
    for j in range(2**W):
        d = copy.deepcopy(c)
        i2 = i
        j2 = j
        for k in range(H):
            if i2 & 1:
                d[k] = [0]*W
            i2 >>= 1
        for l in range(W):
            if j2 & 1:
                for m in range(H):
                    d[m][l] = 0
            j2 >>= 1
        s = sum(map(sum, d))
        if s == K:
            count += 1

print(count)

Solution (Python):
import itertools

h,w,k=map(int,input().split())
c=[list(input()) for i in range(h)]
ans=0
for filter_row in range(2**h):
  for filter_col in range(2**w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if (filter_row>>i&1)!=0 and (filter_col>>j&1)!=0 and c[i][j]=='
          cnt+=1
    if cnt==k:
      ans+=1
print(ans)

Solution (Python):
import copy

def solve(h,w,k,stage,nh,nw):
    if nh == h and nw == w:
        res = 0
        for row in stage:
            res += row.count('
        if res == k:
            return 1
        else:
            return 0
    
    elif nh == h:
        nwn = nw + 1
        stagen = copy.deepcopy(stage)
        for i in range(h):
            stagen[i][nw] = '.'

        return solve(h,w,k,stage,nh,nwn) + solve(h,w,k,stagen,nh,nwn)
    
    else:
        nhn = nh + 1
        stagen = copy.deepcopy(stage)
        stagen[nh] = list('.'*w)
        return solve(h,w,k,stage,nhn,nw) + solve(h,w,k,stagen,nhn,nw)




if __name__ == '__main__':
    h,w,k = map(int,input().split())
    stage = []
    for i in range(h):
        row = list(input())
        stage.append(row)
    
    print(solve(h,w,k,stage,0,0))

Solution (Python):
import sys, math, operator, itertools, collections, heapq, bisect



class Solution:
    def __init__(self):
        pass

    def solve(self, *Input):
        ans = 0
        h,w,k,matrix = Input
        
        for r in range(h):
            rows = list(itertools.combinations(range(h),r))
            for c in range(w):
                
                cols = list(itertools.combinations(range(w), c))
                
                for row in rows:
                    for col in cols:
                        
                        new_matrix = [[x for x in ROW] for ROW in matrix]
                        ans += self.create(h,w,k,new_matrix,row,col)
                        

        return ans

    def create(self, *Input):
        h,w,k,matrix,rows,cols = Input
        for i in range(h):
            for j in cols:
                matrix[i][j] = '.'
        for r in rows:
            matrix[r] = ['.'] * w
        
        return self.check(k,matrix)

    def check(self, *Input):
        k,matrix = Input
        cnt = 0
        for row in matrix:
            cnt += row.count('
        return cnt == k

    def sieve_classic(self,a,b):
        self.primes = [True] * (b+1)
        self.primes[0] = self.primes[1] = False
        for i in range(2,b+1):
            if self.primes[i] and i*i <= b:
                for j in range(i*i,b+1,i):
                    self.primes[j] = False
        self.primes = [x for x,y in enumerate(self.primes) if y]
        ind = bisect.bisect_left(self.primes,a)
        self.primes[:ind] = []
        return None


if __name__=='__main__':
    solution = Solution()

    inputs = iter(sys.stdin.readlines())
    h,w,k = map(int, next(inputs).split())
    matrix = [list(next(inputs).rstrip()) for _ in range(h)]
    ans = solution.solve(h,w,k,matrix)
    print(ans)

Solution (Python):
h,w,k=map(int,input().split())
c=list(list(input()) for _ in range(h))
ans=0
for n in range(2**(h+w)):
    l={}
    o={}
    x=0
    for m in range(h+w):
        if (n>>m)&1:
            if m>=h:
                o[m-h]=1
            else:
                l[m]=1
    for i in range(h):
        if not i in l:
            for j in range(w):
                if not j in o:
                    if c[i][j]=="
                        x+=1
    if x==k:
        ans+=1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
C = [0] * H
for h in range(H):
    C[h] = input()

ans = 0
for tate in range(2 ** H):
    for yoko in range(2 ** W):
        tate_ = tate
        T = []
        for _ in range(H):
            T.append(tate_ % 2 == 0)
            tate_ //= 2
        Y = []
        yoko_ = yoko
        for _ in range(W):
            Y.append(yoko_ % 2 == 0)
            yoko_ //= 2

        count = 0
        for h in range(H):
            if T[h]: continue
            for w in range(W):
                if Y[w]: continue
                if C[h][w] == '
                    count += 1
        if count == K:
            ans += 1
print(ans)

Solution (Python):
hwk = input().split()
h, w, k = int(hwk[0]), int(hwk[1]), int(hwk[2])
field = []
for i in range(h):
    row = input()
    field.append([1 if c == '
    
count = 0


def test(i, j):
    _sum = 0
    for r in range(h):
        if r in i: continue
        for c in range(w):
            if c in j: continue
            _sum += field[r][c]
            if _sum > k: return False
    return _sum == k


def subset(n):
    res = []
    i = 0
    while True:
        num_s = bin(i)[2:].zfill(n)
        tmp = []
        flag = True
        for idx in range(n):
            if num_s[idx] == '1':
                tmp.append(idx)
            else:
                flag = False
        res.append(tmp)
        i += 1
        if flag:
            break
    return res


row_idxs = subset(h)
col_idxs = subset(w)

for r_i in row_idxs:
    for c_j in col_idxs:
        if test(r_i, c_j):
            count += 1

print(count)

Solution (Python):
from itertools import product


def solve(string):
    h, w, k, *c = string.split()
    h, w, k = map(int, [h, w, k])
    ans = 0
    for f in product([True, False], repeat=h + w):
        count = 0
        for _f, _c in zip(f, c):
            if _f:
                continue
            count += sum(1 if __f and v == "
        ans += 1 if count == k else 0
    return str(ans)

    pass


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Solution (Python):
from itertools import product


def solve(string):
    h, w, k, *c = string.split()
    h, w, k = map(int, [h, w, k])
    ans = 0
    for f in product([True, False], repeat=h + w):
        count = 0
        for _f, _c in zip(f, c):
            if _f:
                continue
            count += sum(1 if not __f and v == "
        ans += 1 if count == k else 0
    return str(ans)

    pass


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Solution (Python):
h, w, k = map(int, input().split())
c = [list(input()) for i in range(h)]
ans = 0
for hh in range(2**h):
    for ww in range(2**w):
        cnt = 0
        for i in range(h):
            for j in range(w):
                if (hh >> i) & 1 and (ww >> j) & 1:
                    if c[i][j] == '
                        cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
h, w, K = map(int, input().split())

C = []

ans = 0

for i in range(h):
  c = input()
  C.append(c)
  
for i in range(2 ** h):
  for k in range(2 ** w):
    black = 0
    for j in range(h):
      for l in range(w):
        if ((i >> j) & 1) == 0 and ((k >> l) & 1) == 0 and C[j][l] == '
          black += 1
    if black == K:
      ans += 1

print(ans)

Solution (Python):
import itertools
H,W,K = map(int, input().split())

matrix =[]
rowblack = []

for i in range(H):
    row = list(input())
    matrix.append(row)
    rowblack.append(row.count('

allblacks = sum(rowblack)
ans = 0

selectRows = list(itertools.product([0,1], repeat=H))
selectColumns = list(itertools.product([0,1], repeat=W))

for selectRow in selectRows:
    for selectColumn in selectColumns:
        counter = 0

        for row in range(H):
            for column in range(W):
                if selectRow[row] == 0 and selectColumn[column] == 0 and matrix[row][column] == '
                    counter += 1
        
        if counter == K:
            ans += 1

print(ans)

Solution (Python):
from itertools import product

H,W,K=map(int,input().split())
C=[input() for _ in range(H)]


ans=0
for i in product([0,1],repeat=H):
    for j in product([0,1],repeat=W):
        cnt=0
        for row in range(H):
            for col in range(W):
                if (C[row][col]=="
                    cnt+=1
        if cnt==K:
            ans+=1
                    
print(ans)

Solution (Python):
from itertools import product
H,W,K=map(int,input().split())

A = [input() for j in range(H)]
    
ans=0

for i in product([0,1],repeat=H):
    for j in product([0,1],repeat=W):
        cnt=0
        for row in range(H):
            for col in range(W):
                if (A[row][col]=="
                    cnt+=1
        if cnt==K:
            ans+=1
        
print(ans)

Solution (Python):
from itertools import product
H,W,K=map(int,input().split())

A = [input() for j in range(H)]

ans=0
for i in product([1,0],repeat=H):
    for j in product([1,0],repeat=W):
        cnt=0
        for row in range(H):
            for col in range(W):
                if ((A[row][col]=="
                    cnt+=1
        if cnt==K:
            ans+=1
            
print(ans)

Solution (Python):
h, w, k = [int(i) for i in input().split()]
a = [input() for j in range(h)]

ans = 0
for mi in range(1 << h):
    for mj in range(1 << w):
        cnt = 0
        for i in range(h):
            for j in range(w):
                if ((mi >> i) & 1) and ((mj >> j) & 1) and a[i][j] == '
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
h, w, k = [int(i) for i in input().split()]
a = [input() for j in range(h)]

ans = 0
for mi in range(1 << h):
    for mj in range(1 << w):
        bi = [i for i in range(h) if ((mi >> i) & 1) == 0]
        bj = [j for j in range(w) if ((mj >> j) & 1) == 0]
        cnt = 0
        for i in range(h):
            if i in bi:
                continue
            for j in range(w):
                if j in bj:
                    continue
                if a[i][j] == '
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
h, w, k = map(int, input().split())
c = [list(input()) for i in range(h)]
ans = 0
for hh in range(2**h):
    for ww in range(2**w):
        cnt = 0
        for i in range(h):
            for j in range(w):
                if (hh >> i) & 1 and (ww >> j) & 1:
                    if c[i][j] == '
                        cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
nums=input().rstrip().split()
num=[]
for i in range(len(nums)):
    num.append(int(nums[i]))
main=[]
for i in range(num[0]):
    main.append(input().rstrip())
result=0
for h in range(2**num[0]):
    h_str=format(h,'0'+str(num[0])+'b')
    for w in range(2**num[1]):
        w_str=format(w,'0'+str(num[1])+'b')
        count=0
        for i in range(num[0]):
            for j in range(num[1]):
                if main[i][j]=='
                    count+=1
        if count==num[2]:
            result+=1
print(result)

Solution (Python):
from itertools import product

h, w, k = map(int,input().split())

c_map = [list(input()) for _ in range(h)]

ans = 0

for row_bit in list(product([0,1],repeat=h)):
    for col_bit in list(product([0,1],repeat=w)):
        cnt = 0
        for i in range(h):
            for j in range(w):
                
                if c_map[i][j] == "
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]

ans = 0
from itertools import product

for rb in product(range(2), repeat=h):
    for cb in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if c[row][col] == "
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
h,w,k = map(int , input().split())
c=[]
for i in range(h):
    cc = input()
    c.append(cc)
ans = 0
for i in range(1 << h):
    for j in range( 1 << w):
        cnt = 0
        for kk in range(h):
            for l in range(w):
                if (c[kk][l] == '
                    cnt += 1
        if (cnt == k): ans += 1

print(ans)

Solution (Python):
number=list(map(int,input().split()))
H,W,K=number[0],number[1],number[2]
answer=0
nums=[]
for i in range(H):
    tmp=list(str(input()))
    nums.append(tmp)
count=0
for cowmask in range(1<<H):
    for rowmask in range(1<<W):
        count=0
        for x in range(H):
            for y in range(W):
                if (cowmask>>x)&1==0 and (rowmask>>y)&1==0 and nums[x][y]=="
                    count+=1
        if count==K:
            answer+=1
            
print(answer)

Solution (Python):
number=list(map(int,input().split()))
H,W,K=number[0],number[1],number[2]
answer=0
nums=[]
for i in range(H):
    tmp=list(str(input()))
    nums.append(tmp)
count=0
for cowmask in range(1<<H):
    for rowmask in range(1<<W):
        count=0
        for x in range(H):
            for y in range(W):
                if (cowmask>>x)&1==0 and (rowmask>>y)&1==0 and nums[x][y]=="
                    count+=1
        if count==K:
            answer+=1
            
print(answer)

Solution (Python):
h,w,k=map(int,input().split())
c=[list(input()) for _ in range(h)]
ans=0
for i in range(2**h):
    for j in range(2**w):
        black=0
        for m in range(h):
            for n in range(w):
                if (i>>m)&1==0 and (j>>n)&1==0 and c[m][n]=='
                    black+=1
        if black==k:
            ans+=1
print(ans)

Solution (Python):
h,w,k = map(int,input().split())
c = [list(input()) for _ in range(h)]
cnt = 0
for c_h in range(2**h):
    for c_w in range(2**w):
        black = 0 
        for i in range(h):
            for j in range(w):
                if (c_h >> i)&1==0 and (c_w >> j)&1==0:
                    if c[i][j]=='
                        black += 1
        if black == k:
            cnt += 1
print(cnt)

Solution (Python):
H, W, K = map(int, input().split())

M = [input() for i in range(H)]


def count(rows, columns):

  M2 = [[M[i][j] for j in range(W)] for i in range(H)]

  for i in range(H):
    if ((1 << i) & rows):
      for j in range(W):
        M2[i][j] = 'r'
  
  for i in range(W):
    if ((1 << i) & columns):
      for j in range(H):
        M2[j][i] = 'r'

  c = 0
  for i in range(H):
    for j in range(W):
      if M2[i][j] == '
        c += 1
  return c

res = 0
for i in range(1 << H):
  for j in range(1 << W):
    if (count(i, j) == K):
      res += 1

print(res)

Solution (Python):
import copy
import itertools
h, w, k = map(int,input().split())
masu = []
for _ in range(h):
    masu.append(list(input()))

cnt = 0
for i in range(2**h):
    for j in range(2**w):
        masu_copy = copy.deepcopy(masu)

        for ii in range(h):
            if 1 & (i >> ii):
                for y in range(w):
                    masu_copy[ii][y] = '.'

        for jj in range(w):
            if 1 & (j >> jj):
                for x in range(h):
                    masu_copy[x][jj] = '.'
        tmp_masu = list(itertools.chain.from_iterable(masu_copy))
        if tmp_masu.count('
            cnt += 1
print(cnt)

Solution (Python):
H, W, K = list(map(int, input().split()))
s = []
for i in range(H):
    row = input()
    s.append(row)

ans = 0
for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for hi in range(H):
            for wi in range(W):
                if i >> hi & 1:
                    continue
                if j >> wi & 1:
                    continue
                if s[hi][wi] == '
                    cnt += 1
        if cnt == K:
            ans += 1

print(ans)

Solution (Python):
h,w,k=map(int, input().split())
board = [list(input()) for _ in range(h)]
ans=0
for paint_h in range(2**h):
  for paint_w in range(2**w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if (paint_h>>i)&1==0 and (paint_w>>j)&1==0:
          if board[i][j]=='
            cnt+=1
    if cnt==k:
      ans += 1
print(ans)

Solution (Python):
H, W, K = list(map(int, input().split()))
c = []
for i in range(H):
    row = input()
    c.append(row)

a1 = []
a2 = []


def f():
    pass


at1 = [None] * H


def dfs1(pos: int):
    if pos == H:
        
        a1.append(at1.copy())
        return

    at1[pos] = 0
    dfs1(pos + 1)

    at1[pos] = 1
    dfs1(pos + 1)


at2 = [None] * W


def dfs2(pos: int):
    if pos == W:
        
        a2.append(at2.copy())
        return

    at2[pos] = 0
    dfs2(pos + 1)

    at2[pos] = 1
    dfs2(pos + 1)


dfs1(0)
dfs2(0)




ans = 0

for ai in a1:
    for aj in a2:
        g = []
        for i in range(H):
            arr = [None] * W
            g.append(arr)

        for i, aii in enumerate(ai):
            if aii == 1:
                g[i] = ['r'] * W

        for i, aji in enumerate(aj):
            if aji == 1:
                for j in range(H):
                    g[j][i] = 'r'

        

        
        cnt = 0
        for i, row in enumerate(g):
            for j, col in enumerate(row):
                if col is None:
                    if c[i][j] == '
                        cnt += 1

        if cnt == K:
            ans += 1

print(ans)

Solution (Python):
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial

from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input().split())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]








h,w,k = MI()
C = LS(h)



def mycalc(c):
    count = 0
    for i in range(h):
        for j in range(w):
            if c[i][j] == '
                count += 1
    return count

n = h+w
ans = 0
for i in range(2**n):
    c = deepcopy(C)
    for j in range(n):
        if i & (2**j):
            if j>=0 and j<h:
                c[j] = ['.']*w
            else:
                col = j - h
                for r in range(h):
                    c[r][col] = '.'
    
    count = mycalc(c)
    if count == k:
        ans += 1
print(ans)

Solution (Python):
from itertools import product

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]

ans = 0

for row_bit in product(range(2), repeat=h):
    for col_bit in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if c[row][col] == "
                    cnt += 1
        if cnt == k:
            ans += 1

print(ans)

Solution (Python):

def inputlist(): return [int(j) for j in input().split()]

import copy
def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)
def check(s,n):
    if len(s) < n:
        d = n-len(s)
        for _ in range(d):
            s = '0'+s
    return s
ans = 0
H,W,K = inputlist()
maze = [[0] for _ in range(H)]
for i in range(H):
    maze[i] = list(input())
maza = copy.deepcopy(maze)
for i in range(2**H):
    xi = base10to(i,2)
    xi = check(xi,H)
    x_ = []
    for ind in range(H):
        if xi[ind] == "1":
            x_.append(ind)
    for j in range(2**W):
        yj = base10to(j,2)
        yj = check(yj,W)
        y_ = []
        for stu in range(W):
            if yj[stu] == "1":
                y_.append(stu)
        for x in x_:
            maze[x] = ["x" for _ in range(W)]
        for y in y_:
            for xa in range(H):
                maze[xa][y] = "x"
        count = 0
        for a in range(H):
            for b in range(W):
                if maze[a][b] == "
                    count+=1
        if count == K:
            ans +=1
        maze = copy.deepcopy(maza)

print(ans)

Solution (Python):

def inputlist(): return [int(j) for j in input().split()]

import copy
def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)
def check(s,n):
    if len(s) < n:
        d = n-len(s)
        for _ in range(d):
            s = '0'+s
    return s
ans = 0
H,W,K = inputlist()
maze = [[0] for _ in range(H)]
for i in range(H):
    maze[i] = list(input())
maza = copy.deepcopy(maze)
for i in range(2**H):
    xi = base10to(i,2)
    xi = check(xi,H)
    x_ = []
    for ind in range(H):
        if xi[ind] == "1":
            x_.append(ind)
    for j in range(2**W):
        yj = base10to(j,2)
        yj = check(yj,W)
        y_ = []
        for stu in range(W):
            if yj[stu] == "1":
                y_.append(stu)
        for x in x_:
            maze[x] = ["x" for _ in range(W)]
        for y in y_:
            for xa in range(H):
                maze[xa][y] = "x"
        count = 0
        for a in range(H):
            for b in range(W):
                if maze[a][b] == "
                    count+=1
        if count == K:
            ans +=1
        maze = copy.deepcopy(maza)

print(ans)

Solution (Python):
import copy

H,W,K = map(int,input().split())
C = [list(input()) for _ in range(H)]

M = [[0]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if C[i][j] == "
            M[i][j] = 1

def bit_01(keta):
    ans = []
    for i in range(2**(keta)):
        ans.append("".join(["{:0", str(keta), "b}"]).format(i))
    return ans

vert = bit_01(H)
hori = bit_01(W)

def check(v,h,M):
    M = copy.deepcopy(M)
    for i in range(len(v)):
        if v[i] == "1":
            for ii in range(W):
                M[i][ii] = 0
    for j in range(len(h)):
        if h[j] == "1":
            for jj in range(H):
                M[jj][j] = 0
    S = 0
    for i in range(W):
        for j in range(H):
            S += M[j][i]
    return S == K

ans = 0
for vp in vert:
    for hp in hori:
        if check(vp,hp,M):
            ans += 1

print(ans)

Solution (Python):
h,w,k = map(int,input().split())
s = []
for i in range(0,h):
    s.append(str(input()))
ans = 0
for bit_h in range(1 << h):
    for bit_w in range(1 << w):
        kuro = 0
        for tate in range(h):
            for yoko in range(w):
                if bit_h & (1 << tate) or bit_w & (1 << yoko):
                    kuro = kuro
                else:
                    if (s[tate])[yoko] == '
                        kuro += 1
        if kuro == k:
            ans += 1
print(ans)