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):
from sys import stdin
import numpy as np
H, W, K = map(int, input().split())

maze = [list(input()) for i in range(H)]
ans = 0

for bith in range(1 << (H)):
    for bitw in range(1<<(W)):
                black = 0
                for i in range(H):
                    for j in range(W):
                        if ((bith >>i) & 1 ) & ((bitw >> j) & 1 ) & (maze[i][j] == "
                           black += 1 
                if black == K:
                    ans += 1
                        
print(ans)

Solution (Python):

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

ans = 0
for h in range(2**H):
    for w in range(2**W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if (h >> i) & 1 == 0 and (w >> j) & 1 == 0 and g[i][j] == "
                    cnt += 1
        if cnt == 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):
        count = 0
        for h in range(H):
            for w in range(W):
                if c[h][w] == "
                    count += 1
        if count == K:
            ans += 1


print(ans)

Solution (Python):
def nisin(a, L):
    nis = []
    for i in range(L):
        nis.insert(0, a%2)
        a = a//2
    return nis

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

ih = 0
ans = 0

while ih < 2**H:
    select_h = []
    bh = nisin(ih, H)
    iw = 0
    for i in range(H):
        if bh[i] == 0:
            select_h.append(i)
    while iw < 2**W:
        bw = nisin(iw, W)
        select_w = []
        for j in range(W):
            if bw[j] == 0:
                select_w.append(j)
        count = 0
        for u in range(H):
            for v in range(W):
                if u in select_h and v in select_w and C[u][v] == '
                    count += 1
        if count == K:
            ans += 1
        iw += 1
    ih += 1

print(ans)

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

count = 0
for i in range(2**h):
    for l in range(2**w):
        tmp = ""
        for j in range(h):
            for m in range(w):
                if ((i >> j) & 1) and ((l >> m) & 1):
                    tmp += C[j][m]
        if tmp.count("
            count += 1

print(count)

Solution (Python):
h, w, k = map(int, input().split())
maze = [input() for _ in range(h)]
ans = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        count_kuro = 0
        for x in range(h):
            for y in range(w):
                if ((i >> x) & 1) == 0 and ((j >> y) & 1) == 0 and maze[x][y] == '
                    count_kuro += 1
        if count_kuro == k:
            ans += 1
print(ans)

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

for i in range(2**h):
    for j in range(2**w):
        black = 0
        
        for a in range(h):
            if (i>>a)&1:
                for b in range(w):
                    if (j>>b)&1:
                        if c[a][b] == "
                            black += 1
                            
        if black == k:
            ans += 1
            
print(ans)

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


count = 0
for cols in range(2**H):  
    for rows in range(2**W):  
        black = 0
        for i in range(H):
            for j in range(W):
                if (cols >> i) & 1 == 0 and (rows >> j) & 1 == 0:
                    black += cw[i][j] == '
        if black == K:
            count += 1
print(count)

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

for rows in range(1 << h):
  for cols in range(1 << w):
    black = 0
    for i in range(h):
      if (rows >> i) & 1:
        continue
      for j in range(w):
        if (cols >> j) & 1:
          continue
        black += c[i][j] == "
    if black == k:
      ans += 1
      
print(ans)

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

C = []
for i in range(H):
    row = list(input())
    C.append(row)



pattern = 0

for markR in range(1<<H):
    for markC in range(1<<W):
        black = 0
        for i in range(H):
            for j in range(W):
                if (markR>>i) & 1 == 0 and (markC>>j) & 1 == 0 and C[i][j] == "
                    black += 1
        if black == K:
            pattern += 1

print(pattern)

Solution (Python):
H, W, K = map(int,input().split())
masu = []
subete = 0
yoko = [0]*H
tate = [0]*W
for i in range(H):
    s = input()
    for j in range(W):
        if s[j] == '
            yoko[i] += 1
            tate[j] += 1
            subete += 1

    masu.append(s)

kotae = 0

for i in range(2**(H+W)):
    nuri = bin(i)[2:]
    ans = 0 + subete

    while len(nuri) < H+W:
        nuri = '0' + nuri 
    for j in range(H+W):
        if nuri[j] == '1':
            if j < H:
                ans -= yoko[j]
                for l in range(H,H+W):
                    if nuri[l] == '1':
                        if masu[j][l-H] == '
                            ans += 1
            if H <= j:
                ans -= tate[j-H]
    if ans == K:
        kotae += 1

     


print(kotae)

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

  result = 0
  for i in range(1 << h):
    for j in range(1 << w):
      cnt = 0
      for n in range(h):
        if i >> n & 1:
          continue

        for m in range(w):
          if j >> m & 1:
            continue

          if C[n][m] == '
            cnt += 1

      if cnt == k:
        result += 1

  print(result)


if __name__ == "__main__":
  main()

Solution (Python):




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

    ans = 0

    for i in range(1 << H):
        for j in range(1 << W):
            cnt = 0
            for a in range(H):
                for b in range(W):
                    if not (i >> a & 1 or j >> b & 1) and C[a][b] == '
                        cnt += 1
            if cnt == K:
                ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math
import numpy as np


def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    h, w, k = map(int, input().split())
    css = np.array([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 css[i][j] == '
                            cnt += 1
            if cnt == k:
                ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np
h,w,k = map(int,input().split())
c = np.zeros((h,w))
for _ in range(h):
  row = [1 if a=='
  c[_]=row
ans = 0
for bit in range(1<<h+w):
  d = np.copy(c)
  for i in range(h+w):
    if (bit>>i)&1:
      if i<h:
        d[i]=0
      else:
        d[:,i-h]=0
  if np.sum(d)==k:
    ans += 1
print(ans)

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

ans = 0

for h_bin in range(1 << h):
    for w_bin in range(1 << w):
        black_cnt = 0
        for i in range(h):
            for j in range(w):
                if (h_bin >> i & 1) == 1 and (w_bin >> j & 1) == 1 and l[i][j] == '
                   black_cnt += 1
        if k == black_cnt:
            ans += 1

print(ans)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, acos, asin, atan, sqrt, tan, cos, pi
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


h, w, k = LI()
C = SR(h)
ans = 0
for i in range(2 ** (h + w)):
    ret = 0
    for y in range(h):
        for x in range(w):
            if i >> y & 1 and i >> (h + x) & 1 and C[y][x] == "
                ret += 1
    if ret == k:
        ans += 1

print(ans)

Solution (Python):
import copy
def get_list(n):
  l = []
  for _ in range(6):
    if n & 0x01: l.append(1)
    else:l.append(0)
    n=n >> 1
  
  return l

def count_black(l,h,w):
  res=0
  for _h in range(h):
    for _w in range(w):
      if l[_h][_w]=='

  return res

def main():
  H,W,K=map(int,input().split())
  c=[list(input()) for _ in range(H)]
  max_h,max_w=2**H-1,2**W-1
  ans=0
  for h2 in range(max_h):
    for w2 in range(max_w):
      count_black=0
      for h in range(H):
        for w in range(W):
          if (h2 >> h & 1) or (w2 >> w & 1):
            
            pass
          else:
            if c[h][w]=='
              count_black+=1
      if count_black==K: ans+=1
  print(ans)
  pass
if __name__ == '__main__':
  main()

Solution (Python):
import copy
import itertools

def main():
    H, W, K = map(int, input().split())
    
    C = [[1 if v == '
    ans = 0
    
    for x in range(2**H):
        for y in range(2**W):
            cnt = 0
            c = copy.deepcopy(C)
            for h in range(H):
                if(x >> h) & 1:
                    for w in range(W):
                        c[h][w] = 0
            for w in range(W):
                if(y >> w) & 1:
                    for h in range(H):
                        c[h][w] = 0
            
            cnt = sum(list(itertools.chain.from_iterable(c)))
            if cnt == K:
                ans += 1
    print(ans)
 
if __name__ == '__main__':
    main()

Solution (Python):
h, w, k = map(int, input().split())
C = [input() for i in range(h)]
ans = 0

for rows in range(1 << h):
    for cols in range(1 << w):
        cnt = 0
        for i in range(h):
            if (rows >> i) & 1: continue
            for j in range(w):
                if (cols >> j) & 1:
                    continue
                else:
                    if C[i][j] == "
        if cnt == k: ans += 1

print(ans)

Solution (Python):
H,W,K =map(int,input().split()) 
L = [list(input()) for i in range(H)]
from itertools import product
li = [0,1]
ans = 0
for h in product(li,repeat = H):
    for w in product(li,repeat = W):
        cnt = 0
        for j in range(H):
            for i in range(W):
                if h[j] == 0 and w[i] == 0:
                    if L[j][i] == "
                        cnt +=1
        if cnt == K:
            ans +=1
print(ans)

Solution (Python):
from itertools import product

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

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

print(ans)

Solution (Python):
H,W,K =map(int,input().split()) 
L = [list(input()) for i in range(H)]
ans = 0
for h in range(1<<H):
    for w in range(1<<W):
        cnt = 0
        for j in range(H):
            for i in range(W):
                if h>>j&1 == 0 and w>>i&1 == 0:
                    if L[j][i] == "
                        cnt +=1
        if cnt == K:
            ans +=1
print(ans)

Solution (Python):
import numpy as np

H,W,K=map(int,input().split())
b=[]
for i in range(H):
    _=input()
    temp=_.replace('
    b.append(list(map(int,temp)))

area=np.array(b)

ans=0

for h in range (2**H):
    select_H=[] 

    for i in range (H):
        if (h>>i) & 1==1:
            select_H.append(1)
        else:
            select_H.append(0)
    sHarr=np.array(select_H)
    delsHarr=np.where(sHarr==1) 
    area_afterDelsH=np.delete(area,delsHarr,axis=0) 
            

    for w in range (2**W):
        select_W=[] 
        for j in range (W):
            if (w>>j) &1 ==1:
                select_W.append(1)
            else:
                select_W.append(0)
        sWarr=np.array(select_W)
        delsWarr=np.where(sWarr==1) 
        area_afterDelsHsW=np.delete(area_afterDelsH,delsWarr,axis=1)

        if np.sum(area_afterDelsHsW)==K:
            ans+=1

print(ans)

Solution (Python):
H, W, K = map(int, input().split())
matrix = [input() for _ in range(H)]
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 (maskC >> j) & 1 == 0 and matrix[i][j] == "
					black += 1

		if black == K:
			ans += 1

print(ans)

Solution (Python):
h,*c=open(0)
h,w,k=map(int,h.split())
print(sum(k==sum(y>>w+z//w&y>>z%w&('.'>c[z//w][z%w])for z in range(h*w))for y in range(1<<h+w)))

Solution (Python):
h,*c=open(0)
h,w,k=map(int,h.split())
print(sum(k==sum(y>>w+z//w&y>>z%w&('.'>c[z//w][z%w])for z in range(h*w))for y in range(1<<h+w)))

Solution (Python):
from itertools import product

def input2():
	return map(int,input().split())
  
h,w,k=input2()
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): 
		count=0
		
		for row in range(h):
			for col in range(w):
				if C[row][col]=="
					count+=1
		if count==k:
			ans+=1
print(ans)

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


cnt =0;
for i in range(2**H) :
    for j in range(2**W) :
        k = 0;
        for x in range(H) :
            for y in range(W) :
                idxx = (i >> x)%2;
                idxy = (j>>y)%2;
                if c[x][y] == '
                    k = k +1;
        if k == K :
            cnt = cnt + 1;
print(cnt);

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

  result = 0
  for i in range(1 << h):
    for j in range(1 << w):
      cnt = 0
      for n in range(h):
        if i >> n & 1:
          continue

        for m in range(w):
          if j >> m & 1:
            continue

          if C[n][m] == '
            cnt += 1

      if cnt == k:
        result += 1

  print(result)


if __name__ == "__main__":
  main()

Solution (Python):
import copy

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

c = []
for i in range(1, h+1):
  l = input()
  for j in range(len(l)):
    if l[j] == "
      c.append((i, j+1))

combs = []
n_comb = 2**(h+w)
for n in range(n_comb):
  combs.append(format(n, f"0{h+w}b"))

for comb in combs:
  cc = copy.copy(c)
  h_choice = comb[:h]
  w_choice = comb[h:]
  for n, i in enumerate(h_choice):
    if i == "1":
      cc = [cell for cell in cc if cell[0] != n+1]
  for n, j in enumerate(w_choice):
    if j == "1":
      cc = [cell for cell in cc if cell[1] != n+1]
      
  if len(cc) == k:
    ans += 1
    
print(ans)

Solution (Python):
from itertools import combinations

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

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

ans = 0


for i in range(H+1):
    for j in range(W+1):
        for sh in combinations(range(H), i):
            for sw in combinations(range(W), j):
                v = 0
                for h in sh:
                    for w in sw:   
                        if field[h][w] == '
                            v += 1
                if v == K:
                    ans += 1            
print(ans)

Solution (Python):



h, w, k = map(int, input().split())
c = [input() for i in range(h)]
ans = 0
for si in range(2 ** h):
    for sj in range(2 ** w):
        count = 0
        for i in range(h):
            for j in range(w):
                if si>>i & 1:
                    continue
                if sj>>j & 1:
                    continue
                if c[i][j] == "
                    count += 1
        if count == k:
            ans += 1
print(ans)

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

c = [0] * H
for i in range(H):
    c[i] = input()

count = 0
for rows in range(1 << H):
    for cols in range(1 << W):
        black = 0
        for i in range(H):
            if (rows >> i) % 2 == 1:
                continue
            for j in range(W):
                if (cols >> j) % 2 == 1:
                    continue
                black += c[i][j] == '
        if black == K:
            count += 1
print(count)

Solution (Python):
import numpy as np
h,w,k = map(int,input().split())
c = []
for _ in range(h):
  row = [1 if a=='
  c.append(row)
c = np.array(c).reshape(h,w)
ans = 0
for bith in range(1<<h+w):
  d = np.copy(c)
  for i in range(h+w):
    if (bith>>i)&1:
      if i<h:
        d[i]=0
      else:
        d[:,i-h]=0
  if np.sum(d)==k:
    ans += 1
print(ans)

Solution (Python):

h,w,k=map(int,input().split())
l=[list(input()) for i in range(h)]
res=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==0 and (ww>>j)&1==0:
     if l[i][j]=='
      cnt+=1
  if cnt==k:
   res+=1
print(res)

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

ans = 0
for paint_h in range(2 ** H):
    for paint_w in range(2 ** W):
        cnt = 0
        for h in range(H):
            for w in range(W):
                if (paint_h >> h) & 1 == 0 and (paint_w >> w) & 1 == 0:
            
            
                    if board[h][w] == "
                        cnt += 1
        if cnt == K: 
            ans += 1
print(ans)

Solution (Python):
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq
from itertools import combinations as comb

def subsets(L):
    for i in range(len(L) + 1):
        for c in comb(L, i):
            yield c


def ri():
    return int(input())

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


def solve():
    h, w, k = rl()
    grid = []
    for i in range(h):
        grid.append(input())


    def test(rows, cols):
        blacks = 0
        for i in range(h):
            if i in rows:
                continue
            for j in range(w):
                if j in cols:
                    continue
                if grid[i][j] == "
                    blacks += 1
        return blacks

    ans = 0
    for rowset in subsets(range(h)):
        for colset in subsets(range(w)):
            if test(rowset, colset) == k:
                ans += 1

    print (ans)





mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()

Solution (Python):
import numpy as np

H, W, K = map(int, input().split())
lis = [[] for i in range(H)]
for i in range(H):
  st = input()
  for j in range(W):
  	lis[i].append(st[j])

lis = np.array(lis)
total_black = np.count_nonzero(lis == "
row_black = np.count_nonzero(lis == "
column_black = np.count_nonzero(lis == "
ans = 0

for i in range(2**H):
  for j in range(2**W):
    black = 0
    for k in range(H):
      if (i >> k)&1:
        black += row_black[k]
      for l in range(W):
        if not k and (j >> l)&1:
          black += column_black[l]
        if (i >> k)&1 and (j >> l)&1:
          black -= np.count_nonzero(lis[k][l] == "
    if K == total_black - black:
      ans += 1
                  
print(ans)

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

ans = 0

for h in range(2**H):
    for w in range(2**W):
        h_s = bin(h)[2:].zfill(6)[::-1]
        w_s = bin(w)[2:].zfill(6)[::-1]
        cnt = 0
        for i, c in enumerate(C):
            for j, a in enumerate(c):
                if h_s[i] == "0"\
                and w_s[j] == "0"\
                and a == "
                    cnt += 1
        if cnt == K:
            ans += 1

print(ans)

Solution (Python):
h, w, k=map(int, input().split())
table=list(input() for i in range(h))

ans=0
cnt=0

for i in range(2**h):
    for j in range(2**w):
        for s in range(h):
            for t in range(w):
                if table[s][t]=="
                    cnt+=1
        
        if cnt==k:
            ans+=1

        cnt=0
print(ans)

Solution (Python):
import sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip()

def main():
    h, w, k = map(int, input().split())
    c = []
    ans = 0
    for _ in range(h):
        c.append(list(input()))
    grid = np.array(c)
    for i in range(2**(w+h)):
        tmp = grid.copy()
        row, col = [], []
        for j in range(w+h):
            if (i >> j) & 1:
                if j < w:
                    col.append(j)
                else:
                    row.append(j-w)
        tmp = np.delete(tmp, row, 0)
        tmp = np.delete(tmp, col, 1)
        if np.sum(tmp == '
            ans += 1
    print(ans)
    
if __name__ == '__main__':
    main()

Solution (Python):
H, W, K = map(int, input().split())
A = []
ans = 0
black = 0
for i in range(H):
  A.append(list(input()))

for i in range(1 << H):
  for j in range(1 << W):
    black = 0
    for m in range(H):
      for n in range(W):
        if A[m][n] == "
          black += 1
    if black == K:
      ans += 1
      
print(ans)

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

for i in range(2**h):
    for j in range(2**w):
        cnt = 0
        for l in range(h):
            for m in range(w):
                if c[l][m] == '
                    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 i in range(1<<H):
    for j in range(1<<W):
        count = 0
        for h in range(H):
            for w in range(W):
                if ((i>>h)& 1) or ((j>>w)& 1) or C[h][w] == ".":
                    continue
                count += 1
        if count == K:
            ans += 1
print(ans)

Solution (Python):
h, w, k = map(int, input().split())
lis = []

for i in range(h):
    lis.append(input())

ans = 0

for rows in range(1 << h):
    for cols in range(1 << w):
        b = 0
        for i in range(h):
            if (rows >> i) & 1 == 1:
                continue
            for j in range(w):
                if (cols >> j) & 1 == 1:
                    continue
                
                if lis[i][j] == "
                    b += 1
        
        if b == k:
            ans += 1


print(ans)

Solution (Python):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

h,w,k=mp()
grid=[]
for i in range(h):
    grid.append(input())
ans=0
for i in range(2**h):
    for j in range(2**w):
        c=0
        for x in range(h):
            for y in range(w):
                if ((i>>x)&1) and ((j>>y)&1) and grid[x][y]=="
                    c+=1
        if c==k:
            ans+=1
print(ans)

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

cnt = 0
for rows in range(1 << H):
    for cols in range(1 << W):
        black = 0
        for i in range(H):
            if (rows >> i) % 2 == 1:
                continue
            for j in range(W):
                if (cols >> j) % 2 == 1:
                    continue
                black += c[i][j] == '
        if black == K:
            cnt += 1
print(cnt)

Solution (Python):
import copy

def to_vector(bit):
    res = []
    id = 0
    while(bit > 0):
        if bit & 1: res.append(id)
        id += 1
        bit >>= 1
    return res


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

c = []
for _ in range(H):
    c.append(list(input()))

ans = 0
for row_bit in range(2 << (H-1)):
    for column_bit in range(2 << (W-1)):
        c_now = copy.deepcopy(c)
        row_vector = to_vector(row_bit)
        column_vector = to_vector(column_bit)
        
        for h in range(H):
            for w in range(W):
                if h in row_vector or w in column_vector:
                    c_now[h][w] = "."

        cnt = 0
        for X in c_now: cnt += X.count("
        
        if cnt == K: ans += 1

print(ans)

Solution (Python):
import copy
import itertools

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

def check(c, k):
  cnt = 0
  for i in range(len(c)):
    cnt += c[i].count('
  if cnt == k:
    return True
  else:
    return False

def make_list(c, h, w):
  for h_ in h:
    c[h_] = ['*'] * len(c[h_])
  for w_ in w:
    for i in range(len(c)):
      c[i][w_] = '*'
  return c

cnt = 0

for i in range(h):
  h_comb = list(itertools.combinations(range(h), i))
  for j in range(w):
    w_comb = list(itertools.combinations(range(w), j))
    for h_ in h_comb:
      for w_ in w_comb:
        c_ = copy.deepcopy(c)
        c_ = make_list(c_, h_, w_)
        if check(c_, k):
          cnt += 1

print(cnt)

Solution (Python):
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

H, W, K = MAP()
grid = [[]] * H
for i in range(H):
    grid[i] = list(input())

ans = 0
for bit1 in range(1<<H):
    for bit2 in range(1<<W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if grid[i][j] == '
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
c = [input() for i in range(H)]
"""                                                                                                                                  
H = 6                                                                                                                                
W = 6                                                                                                                                
K = 3                                                                                                                                
c = ['...
     '...
     '
     '...
     '...
     '...
"""
ret = 0
for i in range(2**H):
    for j in range(2**W):
        num = 0
        mask_h = str(bin(i))[2:].zfill(H)
        mask_w = str(bin(j))[2:].zfill(W)
        for  k in range(H):
            if mask_h[k] == '0': continue
            for l in range(W):
                if mask_w[l] == '0': continue
                if c[k][l] == '
                    num += 1
        if num == K:
            ret += 1

print (ret)

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

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

def check(rows, cols):
  black = 0
  for i in range(h):
    if i in rows: continue
    for j in range(w):
      if j in cols: continue
      if maze[i][j] == "
        black += 1

  return black == k

res = 0

for i in range(1<<h):
  paint_rows = []
  for j in range(h):
    if (i>>j)&1:
      paint_rows.append(j)

  for n in range(1<<w):

    paint_cols = []
    for m in range(w):
      if (n>>m)&1:
        paint_cols.append(m)

    if check(paint_rows, paint_cols):
      res += 1

print(res)

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

Solution (Python):
H, W, K = map(int,input().split())
c = []
for i in range(H):
    c.append(list(input()))
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) == 1 and ((maskC >> j) & 1) == 1 and c[i][j] == '
        if black == K: ans+=1
print(ans)

Solution (Python):





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

c = []
ans = 0





for i in range(H):
    c.append(list(input()))

for i in range(2**H): 

    for j in range(2**W): 

        now = 0
        for x in range(H): 
            for y in range(W): 

                
                
                
                
                
                if i >> x & 1 and j >> y & 1 and c[x][y] == "
                    now += 1

        
        if now == K:
            ans += 1

print (ans)