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):
h, w, k = map(int, input().split())
C = []
for _ in range(h): C.append(input())
ans = 0
for bit in range(1<<(h+w)):
    c = 0
    for i in range(w, h+w):
        for j in range(w):
            if bit>>i & 1 and bit>>j & 1: c += C[i-w][j] == '
    if c == k: ans += 1
print(ans)

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

for i in range(2**H-1):
  for j in range(2**W-1):
    h=list(str(format(i,"b").zfill(H)))
    w=list(str(format(j,"b").zfill(W)))
    black=0
    for l in range(H):
      for m in range(W):
        if h[l]=="0" and w[m]=="0":
          if board[l][m]=="
            black+=1
    if black==K:
      ans+=1
print(ans)

Solution (Python):
import numpy as np
h,w,k = map(int,input().split())
c = []
for _ in range(h):
    c.append(list(input()))
c = np.array(c)
c = 1*(c == "

def test(c,y,x):
    d = c.copy()
    for i in range(h):
        if (1 << i) & y:
            d[i,:] = 0
    for i in range(w):
        if (1 << i) & x:
            d[:,i] = 0
    return (d.sum() == k)
asum = 0
for y in range(1 << h):
    for x in range(1 << w):
        asum += test(c,y,x)
print(asum)

Solution (Python):
import numpy as np
h,w,k=map(int,input().split())
trout=np.zeros((h,w))
cnt=0
for i in range(h):
  a=list(input())
  for j in range(w):
    if a[j]=="
      trout[i][j]=1
    else:
      trout[i][j]=0
for i in range(2**(h+w)):
  test=np.copy(trout)
  for j in range(h+w):
    if (i>>j)&1:
      if h+w-j>h:
        test[:,w-j-1]=0
      else:
        test[h+w-j-1,:]=0
  if test.sum()==k:
    cnt+=1
print(cnt)

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

ans = 0

for h_1 in range(2**h):
    for w_1 in range(2**w):
        black = 0

        for i in range(h):
            for j in range(w):
                if (h_1 >> i) & 1 == 0 and (w_1 >> j) & 1 == 0 and mas[i][j] == '
                    black += 1
        if black == k:
            ans += 1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
C = [input() for i in range(H)]
ctoi = lambda x: 1 if x == '
F = list(list(map(ctoi, c)) for c in C)
ans = 0
for b1 in range(1<<H):
    for b2 in range(1<<W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if b1 & (1<<i) and b2 & (1<<j):
                    cnt += F[i][j]
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
import numpy as np

H, W, K = list(map(int, input().split()))
C = []
for i in range(H) :
  C.append(list(map(lambda c : 1 if c == "
C = np.array(C)
ans = 0
for i in range(2**H) :
  for j in range(2**W) :
    C_copy = C.copy()
    for ii in range(H+1) :
      if i & int(2**(ii)) :
        C_copy[ii-1, :] = 0
    for jj in range(W+1) :
      if j & int(2**(jj)) :
        C_copy[:, jj-1] = 0
    if np.sum(C_copy) == K :
      ans += 1
    
  
print(ans)

Solution (Python):
h,w,k = map(int,input().split())
line = [input() for i in range(h)]
ans = 0
for i in range(1<<h):
    for j in range(1<<w):
        cnt = 0
        for ii in range(h):
            if i&(1<<ii):continue
            for jj in range(w):
                if j&(1<<jj):continue
                if line[ii][jj] == "
                    cnt += 1  
        if cnt == k:
            ans += 1
print(ans)

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

counts = []

for hp in range(2 ** h):
  for wp in range(2 ** w):
    tt = copy.deepcopy(t)
    for hs in range(h + 1):
      for ws in range(w + 1):
        if hs > 0:
          hb = 1 << (hs - 1)
          if hp & hb > 0:
            for wi in range(w):
              tt[hs - 1][wi] = '.'
        if ws > 0:
          wb = 1 << (ws - 1)
          if wp & wb > 0:
            for hi in range(h):
              tt[hi][ws - 1] = '.'
    total = 0
    for hh in range(h):
      for ww in range(w):
        if tt[hh][ww] == '
          total += 1
    counts.append(total)
print(counts.count(k))

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

a = [list(input()) for _ in range(H)] 


ans = 0
for i in range(2**H): 
    for j in range(2**W): 
        count = 0
        for s in range(H):
            for t in range(W):
                if(i >> s)&1 and (j>>t) & 1 and a[s][t] =="
                    count += 1
        if count == K:
            ans += 1
print(ans)

Solution (Python):
import sys
 
def main():
  H,W,K = map(int,input().split())
  a = []
  for i in range(H):
    a.append(sys.stdin.readline())
    
  ans = 0
  for i in range(2**H):
    for j in range(2**W):
      cnt = 0
      for s in range(H):
        for t in range(W):
          if(i >> s) & 1 and (j >> t) & 1 and a[s][t] == "
            cnt += 1
      if cnt == K :
        ans += 1
  print(ans)
  
if __name__ == "__main__":
  main()

Solution (Python):
import sys

import math
import collections

import bisect
import itertools
import fractions

import copy

import decimal

import queue



sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7


ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))



eps = 10 ** (-9)


def main():
    h, w, k = ns()
    c = [list(input()) for _ in range(h)]

    ans = 0
    for i in range(2 ** w):
        wlist = [1 for _ in range(w)]
        for t in range(w):
            if i >> t & 1:
                wlist[t] = 0

        for j in range(2 ** h):
            hlist = [1 for _ in range(h)]
            for t in range(h):
                if j >> t & 1:
                    hlist[t] = 0

            cnt = 0
            for x in range(w):
                for y in range(h):
                    if c[y][x] == "
                        cnt += 1

            if cnt == k:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, W, K = map(int, readline().split())
C = np.frombuffer(read(), 'S1').reshape(H, -1)[:, :W]

C = 1 * (C == b'

def f(C, x, y):
    D = C.copy()
    for i in range(H):
        if x & (1 << i):
            D[i] = 0
    for i in range(W):
        if y & (1 << i):
            D[:, i] = 0
    return D.sum() == K

ans = 0
for x in range(1 << H):
    for y in range(1 << W):
        ans += f(C, x, y)
print(ans)

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

sheet = []

cnt = 0

def getPatterns(n):
    ans = []
    for i in range(2 ** n):
        op = ["-"] * n  
        for j in range(n):
            if ((i >> j) & 1):
                op[n - 1 - j] = "+"  
        ans.append(op)
    
    return ans


for i in range(H):
    s = input()
    cnt += s.count('
    a = []
    for j in range(W):
        a.append(s[j])
    sheet.append(a)

H_pattern = getPatterns(H)
W_pattern = getPatterns(W)

test_sheet = []

ans = 0


for i in H_pattern:
    test_sheet = []
    for x in range(len(i)):
        if i[x] == "-":
            test_sheet.append(sheet[x])
    for j in W_pattern:
        test_cnt = 0
        for y in range(len(j)):
            if j[y] == "-":
                for z in test_sheet:
                    if z[y] == "
                        test_cnt += 1
        if test_cnt == K:
            ans += 1

print(ans)

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

      d = [c[x][:] for x in range(h)]

      for p in range(h):
         bit = (1 << p)
         if i & bit > 0: 
            for x in range(w): d[p][x] = '*'

      for q in range(w):
         bit = (1 << q)
         if j & bit > 0: 
            for x in range(h): d[x][q] = '*'

      s = 0
      for p in range(h):
         for q in range(w): 
            if d[p][q] == '

      if s == k: ans += 1

print(ans)

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

      d = [c[x][:] for x in range(h)]

      for p in range(h):
         bit = (1 << p)
         if i & bit > 0: 
            for x in range(w): d[p][x] = '*'

      for q in range(w):
         bit = (1 << q)
         if j & bit > 0: 
            for x in range(h): d[x][q] = '*'

      s = 0
      for p in range(h):
         for q in range(w): 
            if d[p][q] == '

      if s == k: ans += 1

print(ans)

Solution (Python):
import sys
from io import StringIO
import unittest

import numpy as np

def resolve():
    H, W, K = map(int, input().split())
    c = np.array([list(input()) for _ in range(H)])
    h_list = [np.count_nonzero(cc == '
    w_list = [np.count_nonzero(cc == '
    ans = 0
    total = sum(w_list)

    for i in range(2 ** H):
        for j in range(2 ** W):
            tmp_ans = 0
            tmp_h = []
            tmp_w = []

            for k in range(H):
                if ((i >> k) & 1):  
                    tmp_ans += h_list[k]
                    tmp_h.append(k)

            for l in range(W):
                if ((j >> l) & 1):  
                    tmp_ans += w_list[l]
                    tmp_w.append(l)

            for hh in tmp_h:
                for ww in tmp_w:
                    if c[hh, ww] == '
                        tmp_ans -= 1

            if total - tmp_ans == K:
                ans += 1
    
    print(ans)


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

    def test_入力例_1(self):
        input = """2 3 2
..

        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2 3 4
..

        output = """1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """2 2 3


        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """6 6 8
..
.




        output = """208"""
        self.assertIO(input, output)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    H, W, K = map(int, input().split())
    C = [list(input()) for _ in range(H)]
    answer = 0
    for i in range(2 ** H):
        for j in range(2 ** W):
            black = 0
            for h in range(H):
                for w in range(W):
                    if (i >> h) & 1 == 0 and (j >> w) & 1 == 0 and C[h][w] == "
                        black += 1
            if black == K:
                answer += 1
    print(answer)


if __name__ == "__main__":
    main()

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

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

Solution (Python):
import sys 

def A():
  n = int(sys.stdin.readline().rstrip())
  charge = (n+999)//1000 * 1000 - n
  print(charge)


from collections import Counter
def B():
  n, *s = sys.stdin.read().split() 
  c = Counter(s)
  for v in 'AC, WA, TLE, RE'.split(', '):
    print(f'{v} x {c[v]}')


def C():
  h, w, k = map(int, sys.stdin.readline().split())
  c = [sys.stdin.readline().rstrip() for _ in range(h)]
  tot = 0
  for i in range(1<<h):
    for j in range(1<<w):
      cnt = 0
      for y in range(h):
        for x in range(w):
          if i>>y & 1 or j>>x & 1:
            continue 
          cnt += c[y][x] ==  '
      tot += cnt == k
  print(tot)


def D():
  pass


def E():
  pass


def F():
  pass

if __name__ == "__main__":
  
  
  C()
  D()
  E()
  F()

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

for h_1 in range(1 << h):
    for w_1 in range(1 << w):
        black = 0

        for i in range(h):
            for j in range(w):
                if (h_1 >> i) & 1 == 0 and (w_1 >> j) & 1 == 0 and lines[i][j] == '
                    black += 1
        if black == k:
            ans += 1
print(ans)

Solution (Python):
import itertools

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

ans = 0
for ht in itertools.product((0, 1), repeat=H):
    for wt in itertools.product((0, 1), repeat=W):
        black = 0
        for h, w in itertools.product(range(H), range(W)):
            if C[h][w] == '
                black += 1
        if black == K:
            ans += 1
print(ans)

Solution (Python):
from itertools import product
h,w,k=map(int,input().split())
M=[input() for i in range(h)]
ans=0
for m in M:
    ans+=m.count('
H=[]
W=[]
for i in range(h):
    H.append(M[i].count('
for i in range(w):
    cnt=0
    for j in range(h):
        if M[j][i]=='
            cnt+=1
    W.append(cnt)

a=0
for A in product([0,1],repeat=h):
    for B in product([0,1],repeat=w):
        ANS=ans
        for i in range(h):
            if A[i]==1:
                ANS-=H[i]
        for j in range(w):
            if B[j]==1:
                ANS-=W[j]

        for i in range(h):
            for j in range(w):
                if M[i][j]=='
                    ANS+=1

        if ANS==k:
            a+=1

print(a)

Solution (Python):


HWK = input().split()
H = int(HWK[0])
W = int(HWK[1])
K = int(HWK[2])

image = [0]*H*W



for row in range(H):
    c_values = input()
    for col in range(W):
        if c_values[col] == ".":
            image[W*row + col] = 1
        if c_values[col] == "
            image[W*row + col] = 0

result = 0
for i in range(2**H):
    for j in range(2**W):
        rows = [int(x) for x in bin(i)[2:]] 
        rows = max((H - len(rows)), 0)*[0] + rows

        cols = [int(x) for x in bin(j)[2:]]
        cols = max((W - len(cols), 0))*[0] + cols
        
        count_black = 0
        for row in range(H):
            for col in range(W):
                if rows[row] == 0:
                    continue
                if cols[col] == 0:
                    continue
                if image[row*W + col] == 0:
                    count_black += 1
        if count_black == K:
            result += 1



print(result)

Solution (Python):


HWK = input().split()
H = int(HWK[0])
W = int(HWK[1])
K = int(HWK[2])

image = [0]*H*W



for row in range(H):
    c_values = input()
    for col in range(W):
        if c_values[col] == ".":
            image[W*row + col] = 1
        if c_values[col] == "
            image[W*row + col] = 0

result = 0
for i in range(2**H):
    for j in range(2**W):
        rows = [int(x) for x in bin(i)[2:]] 
        rows = max((H - len(rows)), 0)*[0] + rows

        cols = [int(x) for x in bin(j)[2:]]
        cols = max((W - len(cols), 0))*[0] + cols
        
        count_black = 0
        for row in range(H):
            for col in range(W):
                if rows[row] == 0:
                    continue
                if cols[col] == 0:
                    continue
                if image[row*W + col] == 0:
                    count_black += 1
        if count_black == K:
            result += 1



print(result)

Solution (Python):


import bisect
import copy
import collections
import heapq
import itertools
import math
import numpy as np
from operator import itemgetter
import scipy.misc
import sys

"""

N, X = map(int, input().split())
x = list(map(int, input().split()))
S = [input() for n in range(N)]
C_ = [list(map(str, input().split())) for n in range(H)]
A = [list(map(int, input().split())) for n in range(H)]

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())
"""


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

def main():
    C_ = np.array(C)
    row_list = collections.deque()
    for n in range(2**H):
        row_list.append([h for h in range(H) if not (n>>h) & 1])
    col_list = collections.deque()
    for n in range(2**W):
        col_list.append([w for w in range(W) if not (n>>w) & 1])
    buf_col_list = list(col_list)
    ans = 0
    while row_list:
        rows = row_list.pop()
        col_list = collections.deque(buf_col_list)
        while col_list:
            cols = col_list.pop()
            cnt = 0
            for h in rows:
                for w in cols:
                    if C_[h,w] == "
                        cnt+=1
            if cnt == K:
                ans+=1
    print(ans)
    return
    

if __name__ == '__main__':
    main()

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    h,w,k = LI()
    aa = [[c == '

    t = [(i,j) for j in range(w) for i in range(h) if aa[i][j]]

    r = 0
    for ii in range(2**h):
        ia = [((ii >> i) & 1) == 0 for i in range(h)]
        u = [v[1] for v in t if ia[v[0]]]
        if len(u) < k:
            continue

        for jj in range(2**w):
            ja = [((jj >> j) & 1) == 0 for j in range(w)]
            if sum(1 for v in u if ja[v]) == k:
                r += 1

    return r


print(main())

Solution (Python):
import copy
h, w, k = map(int,input().split())
dot_map = []
result = 0

for i in range(h):
    tmp_input = list(input())
    dot_map.append(tmp_input)

for h_i in range(2 ** h):
    tmp_dot_map = copy.deepcopy(dot_map)
    for h_degit in range(h):
        if bin(h_i >> h_degit)[-1] == "1":
            tmp_dot_map[h_degit] = list("." * w)

    for w_i in range(2 ** w):
        sharp_counter = 0
        tmp_dot_map_2 = copy.deepcopy(tmp_dot_map)
        for w_degit in range(w):
            if bin(w_i >> w_degit)[-1] == "1":
                for h_draw in range(h):
                    tmp_dot_map_2[h_draw][w_degit] = "."

        for h_s in range(h):
            for w_s in range(w):
                if tmp_dot_map_2[h_s][w_s] == "
                        sharp_counter += 1
        if sharp_counter == k:
            result += 1
        
print(result)

Solution (Python):
H,W,K = map(int,input().split())
data_list = [list(input()) for i in range(H)]
ans = 0
for i in range(1<<H):
    for j in range(1<<W):
        Black = 0
        for ii in range(H):
            for jj in range(W):
                if(data_list[ii][jj] == "
                    Black+=1
        if(Black == K):
            ans += 1

print(ans)

Solution (Python):
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

h, w, k = map(int, input().split())
rows = [input() for _ in range(h)]
for i in range(2**h):
    for j in range(2**w):
        chk = 0
        for ii in range(h):
            for jj in range(w):
                if (i >> ii) & 1:
                    if (j >>jj) & 1:
                        if rows[ii][jj] == "
                            chk += 1
        if chk == k:
            ans += 1
print(ans)

Solution (Python):

H, W, K = map(int, input().split())
dot=[list(input()) for i in range(H)]
ans = 0

for R in range(2**H):
    for C in range(2**W):
        blk = 0
        for i in range(H):
            for j in range(W):
                 if ((R >> i) & 1) == 0 and ((C >> j) & 1) == 0 and dot[i][j] == '
                    blk += 1
        if blk == 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(2 ** H):
  for j in range(2 ** W):
    B = 0
    for k in range(H):
      for l in range(W):
        if (i >> k) & 1 == 0 and (j >> l) & 1 == 0 and c[k][l] == '
          B += 1
              
    if B == K:
      ans += 1
print(ans)

Solution (Python):
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
INF = 1000000000000

h,w,k = LI()
c = [S() for _ in range(h)]

result = 0
for i in range(1 << h):
    for j in range(1 << w):
        count = 0
        for y in range(h):
            if(i & (1 << y)):
                for x in range(w):
                    if(j & (1 << x)):
                        if(c[y][x] == '
                            count += 1
        if(count == k):
            result += 1

print(result)

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

ans = 0
for ib in range(1<<H):
  for jb in range(1<<W):
    cnt = 0
    for i in range(H):
      for j in range(W):
        
        if (ib>>i&1): continue
        if (jb>>j&1): continue
        if arr[i][j] == "
    if cnt == K: ans += 1
print(ans)

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


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

ans = 0
for i in range(2**H):
    for j in range(2**W):
        cnt = 0
        for s in range(H):
            for t in range(W):
                if (i >> s) & 1 and (j >> t) & 1 and C[s][t] == "
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
def main():
    import sys
    readline = sys.stdin.buffer.readline
    sys.setrecursionlimit(10 ** 7)

    from itertools import product

    h, w, k = map(int, readline().split())
    c = [readline().rstrip().decode() for _ in range(h)]
    cnt = 0
    for bit_y in product([0, 1], repeat=h):
        for bit_x in product([0, 1], repeat=w):
            memo = 0
            for i, cc in enumerate(c):
                if bit_y[i] == 1:
                    continue
                for j, dc in enumerate(cc):
                    if dc == '
                        memo += 1
            if memo == k:
                cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
from collections import deque  
from collections import defaultdict  
from heapq import heapify, heappush, heappop, heappushpop  
from bisect import bisect_left, bisect_right  
sys.setrecursionlimit(int(1e+6))
MOD = int(1e+9) + 7



def main():
    H, W, K = i2nn()
    nnn = []
    for _ in range(H):
        s = i2s()
        nn = [1 if c == '
        nnn.append(nn)
    def rec(ii, jj, ret):
        if len(ii) < W:
            ret = rec(ii + [0], jj, ret)
            ret = rec(ii + [1], jj, ret)
            return ret
        if len(jj) < H:
            ret = rec(ii, jj + [0], ret)
            ret = rec(ii, jj + [1], ret)
            return ret
        nnn2 = [[n for n in nn] for nn in nnn]
        for k, i in enumerate(ii):
            if i == 1:
                for l in range(H):
                    nnn2[l][k] = 0
        for k, j in enumerate(jj):
            if j == 1:
                for l in range(W):
                    nnn2[k][l] = 0
        n = 0
        for i in range(H):
            for j in range(W):
                if nnn2[i][j] == 1:
                    n += 1
        if n == K:
            ret += 1
        else:
            ret += 0
        return ret
    ret = rec([], [], 0)

    print(ret)

main()

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

ans = 0
for y_bit in range(2**H):
    for x_bit in range(2**W):
        cnt = 0
        for y in range(H):
            for x in range(W):
                if (y_bit >> y) & 1:
                    continue
                if (x_bit >> x) & 1:
                    continue

                if c[y][x] == '
                    cnt += 1
        if cnt == K:
            ans += 1

print(ans)

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

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

Solution (Python):
h, w, K = map(int, input().split())
c = []
for i in range(h):
  a = list(str(input()))
  c.append(a)
cnt = 0
blk = 0
for i in range(2 ** h):
  for j in range(2 ** w):
    for k in range(h):
      for l in range(w):
        if ((i >> k) & 1 == False) and ((j >> l) & 1 == False) and (c[k][l] == '
          blk += 1
    if blk == K:
      cnt += 1
    blk = 0
print(cnt)

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

rows = []
for _ in range(h):
  row = list(input())
  rows.append(row)

hh = 2 ** h
ww = 2 ** w

result = 0
for i in range(hh):
  for j in range(ww):
    i_bin = format(i, '06b')
    j_bin = format(j, '06b')
    counter = 0
    for k in range(h):
      for l in range(w):
        if i_bin[-k-1] == '0' and j_bin[-l-1] == '0':
          if rows[k][l] == '
            counter += 1
    if counter == K:
      
      result += 1
      
print(result)

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

for i in range(h):
    temp = list(input())
    c.append(temp)

ans = 0

for i in range(2**h):
    list_i = list(bin(i)[2:])
    list_i = [int(x) for x in list_i]
    while len(list_i) != h:
        list_i.insert(0, 0)
    for j in range(2**w):
        temp = 0
        list_j = list(bin(j)[2:])
        list_j = [int(x) for x in list_j]
        while len(list_j) != w:
            list_j.insert(0, 0)
        for k in range(w):
            for l in range(h):

                if c[l][k] == '
                    temp += 1
        if temp == t:
            ans += 1

print(ans)

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

ans = 0
for i in range(1 << h):
    for j in range(1 << w):
        black = 0
        for x in range(h):
            for y in range(w):
                if (i >> x) & 1 or (j >> y) & 1:
                    continue
                if f[x][y] == "
                    black += 1
        if black == k:
            ans += 1

print(ans)

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

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

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

grid = []
for _ in range(h):
  row = input()
  grid.append(row)
  
res = 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 grid[i][j] == '
          black += 1
    if black == k:
      res += 1
      
print(res)

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

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

ans = 0
for i in range(H+1):
    for j in range(W+1):
        for a in itertools.combinations(list(range(H)), i):
            for b in itertools.combinations(list(range(W)), j):
                count = 0
                for n in a:
                    for m in b:
                        if base[n][m] == "
                            count += 1
                        else:
                            pass
                if count == K:
                    ans += 1
print(ans)

Solution (Python):
import itertools
H,W,K=map(int,input().split())
 
C=[]
 
for i in range(H):
  C.append(input())
 
ans=0
for i in range(H+1):
  for j in range(W+1):
    for n in itertools.combinations(list(range(H)),i):
      for m in itertools.combinations(list(range(W)),j):
        count = 0
        for a in n:
          for b in m:
            if(C[a][b]=="
                count+=1
        if(count == K):
          ans += 1
print(ans)