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):
import copy
H, W, K = map(int, input().split())
C = list(input() for _ in range(H))
ans = 0
for cnt in range(2**(H+W)):
    h = []
    w = []
    tmp = 0
    for i in range(H):
        if cnt >> i & 1:
            h += [i]
    for i in range(W):
        if cnt >> (i+H) & 1:
            w += [i]
    for i in range(H):
        for j in range(W):
            if (C[i][j] == "
                tmp += 1
    if tmp == K:
        ans += 1
print(ans)

Solution (Python):

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

cl=[list(input()) for i in range(h)]
import itertools
import copy
def countBlack(l):
    res=0
    for li in l:
        res+= li.count('
    return res

rows=[0,1]
cols=[0,1]
ans=0
for rowpt in itertools.product(rows,repeat=h):
    for colpt in itertools.product(cols,repeat=w):
        cl_temp=copy.deepcopy(cl)
        
        for i in range(h):
            if rowpt[i]==1:
                for j in range(w):
                    cl_temp[i][j]='r'
        for j in range(w):
            if colpt[j]==1:
                for i in range(h):
                    cl_temp[i][j]='r'
        if countBlack(cl_temp)==k:
            ans+=1
print(ans)

Solution (Python):


import itertools
import collections
from decimal import Decimal
from functools import reduce





def main():
    H, W, k = input_list()
    maze = [list(input()) for _ in range(H)]
    ans = 0
    for row_bit in itertools.product(range(2), repeat=H):
        for col_bit in itertools.product(range(2), repeat=W):
            cnt = 0
            for row in range(H):
                for col in range(W):
                    if maze[row][col] == "
                        cnt += 1
            if cnt == k:
                ans += 1
    print(ans)


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def bfs(H, W, black_cells, dist):
    d = 0
    while black_cells:
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w] = d + 1
                black_cells.append((new_h, new_w))
    return d


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


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()

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

c = []
b_h = [0] * H
b_w = [0] * W
b = 0

for h in range(H):
    c.append(input().rstrip())
    for w in range(W):
        if c[h][w] == "
            b_h[h] += 1
            b_w[w] += 1
            b += 1

ans = 0
for hi in range(2 ** H):
    for wi in range(2 ** W):
        bsum = b

        for h in range(H):
            if hi & (2 ** h) != 0:
                bsum -= b_h[h]
                for w in range(W):
                    if wi & 2 ** w != 0:
                        if c[h][w] == '
                            bsum += 1

        for w in range(W):
            if wi & (2 ** w) != 0:
                bsum -= b_w[w]

        if bsum == K:
            ans += 1

print(ans)

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

sum=0
X = 2**H-1
Y = 2**W-1

x=X
while(x):
    y=Y
    while(y):
        S=0
        for i in range(H):
            for j in range(W):
                if B[i][j]=='
                    S+=1
        if S==K:
            sum+=1
        y = (y-1) & 2**W-1
    x = (x-1) & 2**H-1
print(sum)

Solution (Python):

from itertools import combinations

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

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

count = 0
g = 0
for cr in range(2**H):
    G = [G_[r][:] for r in range(H)]
    
    for r in range(H):
        if cr & (1 << r):
            G[r] = list('R' * W)
    
    for cc in range(2**W):
        G0 = [G[r][:] for r in range(H)]
        for c in range(W):
            if cc & (1 << c):
                for r in range(H):
                    G0[r][c] = 'R'
        b = sum(r.count("
        if b == K:
            count += 1
        g+=1
print(count)

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 = map(int,input().split())
c = []
for a in range(h):
  c.append(list(input()))
res = 0

for i in range(2 ** h):
  for j in range(2 ** w):
    i_s = []
    j_s = []
    for x in range(h):  
      if ((i >> x) & 1): 
        i_s.append(x)  
    for y in range(w):  
      if ((j >> y) & 1): 
        j_s.append(y)  
    b_s = 0
    for i_t in i_s:
      for j_t in j_s:
        if c[i_t][j_t] == "
          b_s += 1
    if b_s == k:
      res += 1
print(res)

Solution (Python):
H, W, K = map(int, input().split())
C = []
for _ in range(H): C.append([c for c in input()])
ans = 0
for i in range(1<<H):
   for j in range(1<<W):
       cnt = 0
       for m in range(H):
           for n in range(W):
               if i>>m&1: continue
               if j>>n&1: continue
               if C[m][n] == '
       if cnt == K: ans += 1
print(ans)

Solution (Python):
h, w, k = map(int, input().split())
c = list(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):
h,w,k=map(int,input().split())
c=[list(input())for i in range(h)]
d=0
for i in range(2**h):
    for j in range(2**w):
        x=bin(i)[2:]
        y=bin(j)[2:]
        x="0"*(h-len(x))+x
        y="0"*(w-len(y))+y
        p=0
        for s in range(h):
            for t in range(w):
                if x[s]==y[t]=="0" and c[s][t]=="
                    p+=1
        if p==k:
           d+=1
print(d)

Solution (Python):
H,W,K=map(int,input().split())
c = []
ans = 0

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

for i in range(2**H):
    for j in range(2**W):
        tmp = 0
        for h in range(H):
            for w in range(W):
                if 2**h & i >0 and 2**w & j >0:
                    if c[h][w] == "
                        tmp += 1

        if tmp == K:
            ans += 1

print(ans)

Solution (Python):
A = list(map(int, input().split()))
H = A[0]
W = A[1]
K = A[2]

colors = []
for line in range(H):
    color = input()
    color = list(color)
    colors.append(color)
ans = 0
for i in range(2**H):
    for j in range(2**W):
        cnt = 0
        for k in range(H):
            for l in range(W):
                if list(format(i,"0"+str(H)+"b"))[k] == "0" and list(format(j,"0"+str(W)+"b"))[l] == "0":
                    if colors[k][l] == "
                        cnt += 1
        if cnt == K:
            ans+= 1
print(ans)

Solution (Python):
h, w, k = map(int, input().split())
A =[]
for i in range(h):
    a = input()
    A.append([a[i] == "
ans = 0
for bit in range(1 << h):
    for tib in range(1 << w):
        now = 0
        for i in range(h):
            for j in range(w):
                if(bit >> i) & 1 == 0 and (tib >> j) & 1 == 0 and A[i][j] == True: now += 1
        if now == k: ans += 1
print(ans)

Solution (Python):
import itertools
h,w,k=map(int,input().split())
lst=[list(input()) for i in range(h)]
lst2=[lst[i] for i in range(h)]

pin=0
for i in range(h):
  pin+=lst[i].count('

ans=0

for hei in itertools.product(range(2),repeat=h):
  for wid in itertools.product(range(2),repeat=w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if hei[i]==1 and wid[j]==1 and lst[i][j]=="
          cnt+=1
    
    if cnt==k:
      ans+=1

    
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
table = []
ans = 0
for _ in range(H):
    li = input()
    table.append(li)
for i in range(2**H):
    for j in range(2**W):
        counter = 0
        for k in range(H):
            for l in range(W):
                if (i>>k)&1 and (j>>l)&1 and table[k][l] == "
                    counter += 1
        if counter == K:
            ans += 1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
B = [list(input()) for _ in range(H)]
T = 0
for i_1 in range(2**H):
  for i_2 in range(2**W):
    X = [j_1 for j_1 in range(H) if (i_1>>j_1)&1]
    Y = [j_2 for j_2 in range(W) if (i_2>>j_2)&1]
    S = 0
    for x in X:
      for y in Y:
        if B[x][y]=="
          S += 1
    if S==K:
      T += 1
print(T)

Solution (Python):
import copy
 
H, W, K = map(int, input().split())
tiles = [list(input()) for _ in range(H)]
count  = 0
 
for num in range(2**(H+W)):
  copied_tiles = copy.deepcopy(tiles)
  for i in range(H+W):
    if num>>i&1:
      if i < H:
        for j in range(W):
          copied_tiles[i][j] = 'R'
      else:
        for j in range(H):
          copied_tiles[j][i-H] = 'R'
  black_c = 0
  for i in range(H):
    for j in range(W):
      if copied_tiles[i][j] == '
        black_c += 1
  if black_c == K:
    count += 1
print(count)

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

ans=0

for bit in range(1<<h):
    for tib in range(1<<w):
        now=0
        for i in range(h):
            for j in range(w):
                if (bit>>i) &1==0 and (tib>>j)&1==0 and A[i][j]==1: now+=1
        if now==k : ans+=1
print(ans)

Solution (Python):
import itertools

h,w,k=map(int,input().split())
matrix=[]
for i in range(h):
	s=list(input())
	matrix.append(s)
hlist=[]
for i in range(h):
	hlist.append(i)
wlist=[]
for i in range(w):
	wlist.append(i)
rows=[]
cols=[]
for i in range(h+1):
	obj=itertools.combinations(hlist, i)
	rows+=list(obj)
for i in range(w+1):
	obj=itertools.combinations(wlist, i)
	cols+=list(obj)
ans=0
for i in rows:
	for j in cols:
		count=0
		for a in range(h):
			for b in range(w):
				if(matrix[a][b]=='
					count+=1
		if(count==k):
			ans+=1
print(ans)

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

    

    for row in range(2 ** H):
        for column in range(2 ** W):
            cnt = 0
            for i in range(H):
                for j in range(W):
                    if row >> i & 1:
                        continue
                    if column >> j & 1:
                        continue
                    if c[i][j] == "
                        cnt += 1
            if cnt == K:
                ans += 1
    print(ans)


if __name__ == "__main__":
    main()

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

ans = 0

for i in range(2**h):
    for j in range(2**w):
        count = 0
        for m in range(h):
            for l in range(w):
                if (i>>m)&1==0 and (j>>l)&1==0 and grid[m][l] == "
                    count+=1
        if count == k: ans+=1
print(ans)

Solution (Python):
import copy
H,W,K=map(int,input().split())
L=[[x for x in input()] for i in range(H)]
ans=0
for i in range(2**H):
    for j in range(2**W):
        C=copy.deepcopy(L)
        for k in range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l in range(W):
            if (j>>l&1):
                for m in range(H):
                    C[m][l]="r"
        count=0
        for p in range(H):
            for q in range(W):
                if C[p][q]=="
                    count+=1
        if count==K:
            ans+=1
print(ans)

Solution (Python):
import copy
H,W,K=input().split()
H=int(H)
W=int(W)
K=int(K)
C= [list(input()) for i in range(H)]
counter=0
for j in range(1<<H+W):
    D=copy.deepcopy(C)
    for k in range(H+W):
        mask=1<<k
        if j&mask!=0:
            if k<W:
                for l in range(H):
                    D[l][k]='R'
            else:
                for m in range(W):
                    D[k-W][m]='R'
    black=sum(D,[]).count('
    if black==K:
        counter+=1
print(counter)

Solution (Python):
import copy

H,W,K = input().split()
H = int(H)
W = int(W)
K = int(K)
c = list(input() for i in range(H))
for j in range(H):
    c[j] = list(c[j])
    
def wise(a,masu):
    for w in range(W):
        masu[a][w] = 'r'
    return masu
        
def hight(b,ban):
    for h in range(H):
        ban[h][b] = 'r'    
    return ban

count = 0

for j in range(1<<(H+W)):
    bunsin = copy.deepcopy(c)
    for k in range((H+W)):
        mask = 1 << k
        if j & mask != 0:
            if k < W:
                hight(k, bunsin)
                
            else :
                wise(k - W, bunsin)
              
    new_c = []
    for l in range(H):
        for m in range(W):
            new_c.append(bunsin[l][m])
    count_black = new_c.count('
    if count_black == K:
        count += 1
print(count)

Solution (Python):
from itertools import product

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


def n_black(fillh, fillw):
    n = 0
    for ih, iw in product(range(h), range(w)):
        if (not fillh[ih]) and (not fillw[iw]) and c[ih][iw] == "
            n += 1
    return n


answer = 0
for fillh, fillw in product(
    product([True, False], repeat=h), product([True, False], repeat=w)
):
    if n_black(fillh, fillw) == k:
        answer += 1
print(answer)

Solution (Python):

import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]







def count(li):
    black = 0
    for i in range(h):
        for j in range(w):
            if li[i][j] == "
                ans += 1
    return black
        
h,w,k = MI()
c = [list(input()) for _ in range(h)]
ans = 0
for bit in range(1<<h):
    for bit2 in range(1<<w):
        black = 0
        for i in range(h):
            for j in range(w):
                if ((bit >> i) & 1) == 0 and ((bit2 >> j) & 1) == 0:
                    if c[i][j] == "
                        black += 1
        if black == k:
            ans += 1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
H, W, K = map(int, input().split())
S = [input()[:-1] for _ in [0]*H]
N = H+W
ans = 0
for bitH in range(1 << H):
    T = []
    for h in range(H):
        if bitH >> h & 1:
            T.append(S[h])

    for bitW in range(1 << W):
        cnt = 0
        for w in range(W):
            if bitW >> w & 1:
                for t in T:
                    cnt += 1 if t[w] == "

        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):




import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7


'''for i in range(10):
    j=i-(i&(-i))
    print(j)
    k=j-(j&(-j))
    print(k)
    print()'''
import copy
H,W,K=map(int,input().split())
L=[[x for x in input().rstrip()] for i in range(H)]
ans=0

for i in range(2**H):
    for j in range(2**W):
        C=copy.deepcopy(L)
        
        for k in range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l in range(W):
            if (j>>l&1):
                for m in range(H):
                    C[m][l]="r"
        count=0
        for p in range(H):
            for q in range(W):
                if C[p][q]=="
                    count+=1
        if count==K:
            ans+=1
print(ans)

Solution (Python):
from math import factorial as fact
import math
import sys
from itertools import product
import numpy as np
from collections import Counter
import datetime
from collections import deque
from bisect import bisect_left, bisect_right
import heapq




def input1():
	return int(input())


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


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

def swap(a,b):
	tmp=a
	a=b
	b=tmp
	return a,b

H,W,K=input2()
c=[list(input()) for _ in range(H)]

ans=0

for row_line in product(range(2),repeat=H): 
	for col_line 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):
from itertools import product
h,w,k=map(int,input().split())
a=0
c=[[0 if l=='.' else 1 for l in input()] for _ in range(h)]
for i in product([0,1] , repeat=h):
  for j in product([0,1] , repeat=w):
    b=0
    for H,W in product(range(h),range(w)):
      b+=c[H][W]*i[H]*j[W]
    if b == k:
      a+=1
print(a)

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

for i in range(2 ** H - 1):
    for j in range(2 ** W - 1):
        sum = 0
        for ih in range(H):
            if 2 ** ih & i > 0:
                continue
            for iw in range(W):
                if 2 ** iw & j > 0:
                    continue
                if c[ih][iw] == '
                    sum += 1
        if sum == K:
            cnt += 1

print(cnt)

Solution (Python):
import copy
H,W,K=map(int,input().split())
L=[]
for i in range(H):
  L_=list(input())
  L.append(L_)

cnt=0
for i in  range(2**H):
  l=copy.deepcopy(L)
  
  for k in range(H):
    if (i>>k)&1:
      l[k]=['.']*W
    
  for j in range(2**W):
    ll=copy.deepcopy(l)
   
    for m in range(W):
      if (j>>m)&1:
        for n in range(H):
          if ll[n][m]=='
            ll[n][m]='.'
            
    counted=0
    for o in range(H):
      counted+=ll[o].count('
    
    if counted==K:
      cnt+=1    

print(cnt)

Solution (Python):
from itertools import product
h, w, k = map(int, input().split())
c = [[1 if j == '
print(sum(sum(c[i][j]*br[i]*bc[j] for i, j in product(range(h), range(w))) == k for br in product([0, 1], repeat=h) for bc in product([0, 1], repeat=w)))

Solution (Python):
from itertools import product
h, w, k = map(int, input().split())
c = [[1 if j == '
cnt = 0
for br in product([0, 1], repeat=h):
    for bc in product([0, 1], repeat=w):
        if sum(c[i][j]*br[i]*bc[j] for i, j in product(range(h), range(w))) == k:
            cnt += 1
print(cnt)

Solution (Python):
h,w,k = map(int,input().split())
ls = [str(input()) for _ in range(h)]
a = [[] for _ in range(2**h)]
b = [[] for _ in range(2**w)]
for i in range(2**h):
    for j in range(h):
        if (i>>j)&1:
            a[i].append(j)
for s in range(2**w):
    for l in range(w):
        if (s>>l)&1:
            b[s].append(l)
p = 0
for e in range(2**h):
    for f in range(2**w):
        cnt = 0
        for g in range(len(ls)):
            if g not in a[e]:
                di = list(ls[g])
                for t in range(len(di)):
                    if t not in b[f]:
                        if di[t] == "
                            cnt += 1
        if cnt == k:
            p += 1
print(p)

Solution (Python):
H, W, K = [int(i) for i in input().split()]
a = [[] for i in range(H)]
for i in range(H):
    a[i] = list(input())
counter = 0
for i in range( 2 ** H):
    for p in range( 2 ** W):
        tmp = 0
        for j in range(H):
            for q in range(W):
                if ((i >> j) & 1):
                    if ((p >> q) & 1):
                        if a[j][q] == '
                            tmp += 1
        if tmp == K:
            counter += 1
print(counter)

Solution (Python):
import itertools

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

ans = 0

for hi in range(2**h):
  for wi in range(2**w):
    c_cp = [[n for n in i] for i in c]
    
    for hj in range(h):
      if (hi & (1<<hj)) != 0:
        c_cp[hj] = ['R' for n in c_cp[hj]]
    
    for wj in range(w):
      if (wi & (1<<wj)) != 0:
        for hk in range(h):
          c_cp[hk][wj] = 'R'
    
    cnt = list(itertools.chain.from_iterable(c_cp)).count('
    
    if cnt == k:
      ans += 1

print(ans)

Solution (Python):
import copy

H, W, K = map(int, input().split())
inputdata = [list(str(input())) for i in range(H)]
data = []
temp = []
give = 0

for x in inputdata:
  data.append(list(x))

for i in range(2 ** H):
  for j in range(2 ** W):
    ans = 0
    temp = copy.deepcopy(data)
    for m in range(H):
      for n in range(W):
        if ((int(bin(i)[2:]) >> m) & 1) or ((int(bin(j)[2:]) >> n) & 1):
          temp[m][n] = "@"
        if temp[m][n] == "
          ans += 1
    if ans == K:
      give += 1

print(give)

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 a in range(1<<H):
    for b in range(1<<W):
        cnt=0 
        for c in range(H):
            if a&(1<<c): 
                for d in range(W):
                 if b&(1<<d): 
                    cnt+=matrix[c][d]=='
        ans+=cnt==K
 
print(ans)

Solution (Python):

import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


for _ in range(int(input()) if not True else 1):
    
    
    
    
    
    h, w, k = map(int, input().split())
    a = []
    for __ in range(h):
        a += [[k for k in input()]]
    ans = 0
    for ch1 in range(2**h):
        for ch2 in range(2**w):
            rowchosen = binary(ch1, h)
            colchosen = binary(ch2, w)
            count = 0
            for i in range(h):
                for j in range(w):
                    if rowchosen[i] != '1' and colchosen[j] != '1' and a[i][j] == '
                        count += 1
            if count == k:ans+=1
    print(ans)

Solution (Python):


import sys
h,w,k=map(int,input().split())
a=list(sys.stdin.read().split())
ans=0
for i in range(2**h-1):
    for j in range(2**w-1):
        cnt=0
        for y in range(h):
            if i>>(y)&1:
                continue
            for x in range(w):
                if j>>(x)&1:
                    continue
                if a[y][x]=="
                  cnt+=1
                
        if cnt==k:
            ans+=1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
Matrix = list()
answer = 0

def main(H, W, Matrix, i, K):
    Blacl_Count = 0 
    Bin = format(i, '12b')
    for a, line in enumerate(Matrix):
        for b, raw in enumerate(line):
            if Bin[-(a+1)] == '1' or Bin[-(b+H+1)] == '1':
                continue
            elif raw == '
                Blacl_Count += 1
    if Blacl_Count == K:
        return 1
    else:
        return 0

for h in range(H):
    line = input()
    Matrix.append(line)

iteration = 2**(H+W)

for i in range(iteration):
    answer += main(H, W, Matrix,i, K)

print(answer)

Solution (Python):
from itertools import product

H,W,K=map(int,input().split())
masu=[input() for _ in range(H)]
ans=0
ROW=list(product([False,True],repeat=H))
COL=list(product([False,True],repeat=W))
for row in ROW:
  for col in COL:
    cnt=0
    for i in range(H):
      for j in range(W):
        if row[i]==False and col[j]==False and masu[i][j]=="
          cnt+=1
    if cnt==K:
      ans+=1
print(ans)

Solution (Python):
import itertools, copy
h,w,k = map(int, input().split())
c = []
for i in range(h):
    cc = list(input())
    c.append(cc)
li_h = range(h)
li_w = range(w)
count = 0
for n in range(0, len(li_h)+1):
    for conb_h in itertools.combinations(li_h, n):        
        for m in range(0, len(li_w)+1):
            for conb_w in itertools.combinations(li_w, m):
                ccc = copy.deepcopy(c)
                for i in list(conb_h):
                    for ii in range(w):
                        ccc[int(i)][ii] = '.'
                for j in list(conb_w):
                    for jj in range(h):
                        ccc[jj][int(j)] = '.'
                _count = 0
                for item in ccc:
                    _count += item.count('
                if _count == k:
                    count += 1
print(count)

Solution (Python):
import sys

h,w,k=map(int,next(sys.stdin).split())
a=list(sys.stdin)

ans=0
for y in range(1<<h):
    for x in range(1<<w):
        ct=0
        for i in range(h):
            if y&(1<<i): continue
            for j in range(w):
                if x&(1<<j): continue
                ct+=a[i][j]=='
        ans+=ct==k

print(ans)

Solution (Python):
def resolve():
    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):

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

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

            if now == K:
                ans += 1

    print(ans)


resolve()

Solution (Python):
h,w,k = map(int,input().split())
c = [list(input()) for i in range(h)]
ans = 0
for i in range(2**h):
    h_list = [False] * h
    for j in range(h):
        if (i >> j) & 1:
            h_list[h - 1 - j] = True
    
    for l in range(2**w):
        w_list = [False] * w
        for m in range(w):
            if (l >> m) & 1:
                w_list[w - 1 - m] = True

        cnt = 0
        for a in range(h):
            for b in range(w):
                if c[a][b] == '
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

h, w, k = map(int, input().split())
C = []
for _ in range(h): C.append(input())
from itertools import *
ans = 0
for bit in range(1<<(h+w)):
    c = 0
    for i, j in product(range(w, h+w), range(w)):
        if bit>>i & 1 and bit>>j & 1: c += C[i-w][j] == '
    if c == k: ans += 1
print(ans)