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 itertools
import copy

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

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

b = [1, 0]
Bit = list(itertools.product(b, repeat = H+W))


ans = 0

for i in range(len(Bit)):
    tmp = copy.deepcopy(graph)
    
    cnt = 0
    for h in range(H):
        if Bit[i][h] == 1:
            for j in range(W):
                tmp[h][j] = "."
    for w in range(H, H+W):
        if Bit[i][w] == 1:
            for j in range(H):
                tmp[j][w-H] = "."
    for j in range(H):
        cnt += tmp[j].count("
    
    if cnt == K:
        ans += 1
    
        
print(ans)

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

import copy

h,w,k = mi()
masu = [[] for i in range(h)]

class masusu:
    def __init__(self,w,h,masu):
        self.w = w
        self.h = h
        self.masu = masu

    def calcBlack(self,hpat,wpat):
        masuc = copy.deepcopy( self.masu)
        for i in range(h):
            if (hpat >> i) & 1:
                masuc[i] = [0]*w
            for j in range(w):
                if (wpat >> j) & 1:
                    for l in range(h):
                        masuc[l][j] = 0
        
        sumtmp = 0
        for i in range(h):
            sumtmp += sum(masuc[i])
        return sumtmp


for i in range(h):
    c = input()
    for j in range(w):
        if c[j] == '.':
            masu[i].append(0)
        else:
            masu[i].append(1)

m = masusu(w,h,masu)

ans = 0
for hpat in range((2**h)-1):
    for wpat in range((2**w)-1):
        sumBlack = m.calcBlack(hpat,wpat)

        if sumBlack == k:
            ans +=1

print(ans)

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

for h_ptn in range(2 ** H):
  for w_ptn in range(2 ** W):
    cnt = 0
    
    for h in range(H):
      for w in range(W):
        if (h_ptn >> h) & 1 == 0 and (w_ptn >> w) & 1 == 0:
          if C[h][w] == '
            cnt += 1
    if cnt == K:
      ans += 1
print(ans)

Solution (Python):
import copy

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

all_list = []
for h in range(H):
    h_list = []
    tmp = input()
    for i in range(len(tmp)):
        if(tmp[i] == ('.')):
            h_list.append(0)
        else:
            h_list.append(1)
    all_list.append(h_list)

cnt = 0
for i_b in range(2 ** H):
    for j_b in range(2 ** W):
        cnt_tmp = 0
        all_list_tmp = copy.deepcopy(all_list)
        for i in range(H):
            if((i_b >> i) & 1):
                for j_tmp in range(W):
                    all_list_tmp[i][j_tmp] = 3
        for j in range(W):
            if((j_b >> j) & 1):
                for i_tmp in range(H):
                    all_list_tmp[i_tmp][j] = 3
        
        for i in range(H):
            cnt_tmp += all_list_tmp[i].count(1)
        if(cnt_tmp == K):
            cnt += 1

print(cnt)

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

 
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 init_map[i][j] == "
                        cnt += 1
        if cnt == K:
            ans += 1
print(ans)

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

ans = 0
def check(a):
    global ans
    tmp = 0
    for i in range(H):
        for j in range(W):
            if a[i] and a[H+j] and C[i][j] == "
                tmp += 1
    ans += 1 if tmp == K else 0

def dfs(a):
    if len(a) == H+W:
        check(a)
        return
    for i in range(2):
        dfs(a+[i])

dfs([])
print(ans)

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

ans = 0
def check(h, w):
    global ans
    tmp = 0
    for i in range(H):
        for j in range(W):
            if h[i] and w[j] and C[i][j] == "
                tmp += 1
    ans += 1 if tmp == K else 0

def dfs(h, w):
    if len(h) < H:
        for i in range(2):
            dfs(h+[i],w)
    elif len(w) < W:
        for i in range(2):
            dfs(h,w+[i],)
    else:
        check(h, w)
    return


dfs([],[])
print(ans)

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

ans = 0
def check(h, w):
    global ans
    tmp = 0
    for i in range(H):
        for j in range(W):
            if h[i] and w[j] and C[i][j] == "
                tmp += 1
    ans += 1 if tmp == K else 0

def dfs(h,w,hidx,widx):
    if hidx < H:
        for i in range(2):
            dfs(h+[i],w,hidx+1,widx)
    elif widx < W:
        for i in range(2):
            dfs(h,w+[i],hidx,widx+1)
    else:
        check(h, w)
    return


dfs([],[],0,0)
print(ans)

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):
    rows = [i for i in range(H) if x & (1<<i)]
    cols = [i for i in range(W) if y & (1<<i)]
    D = C[rows][:,cols]
    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, p = map(int,input().split())
F = []
for i in range(h):
    F.append(list(input()))
    
ih = [i for i in range(h)]
iw = [i for i in range(w)]
ans = 0
for i in range(2 ** h):
    l_h = []
    for j in range(h):
        if ((i >> j) & 1):  
            l_h.append(ih[j])
    for j in range(2 ** w):
        l_w = []
        for k in range(w):
            if ((j >> k) & 1):  
                l_w.append(iw[k])
        tmp = 0
        for u in l_h:
            for v in l_w:
                if F[u][v] == "
                    tmp += 1
        
        if tmp == p:
            
            ans += 1

print(ans)

Solution (Python):



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

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

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

def main():
    H, W, K = rli()
    grid = []
    for i in range(H):
        grid.append(input())
    ans = 0
    for mh in range(0, 2**H):
        for mw in range(0, 2**W):
            cnt = 0
            for h in range(H):
                for w in range(W):
                    if grid[h][w] == '
                        cnt += 1
            if cnt == K:
                ans += 1
    print(ans)



if __name__ == '__main__':
    main()

Solution (Python):
import itertools,copy
h,w,k = map(int,input().split())
C = [list(input()) for i in range(h)]
ans = 0
for bith in range(2**h):
  for bitw in range(2**w):
    Ccopy = copy.deepcopy(C)
    for high in range(h):
      if (1 & bith>>high):
        for i in range(w):
          Ccopy[high][i] = "."
    for width in range(w):
      if (1 & bitw>>width):
        for i in range(h):
          Ccopy[i][width] = "."
    if list(itertools.chain.from_iterable(Ccopy)).count("
      ans += 1
print(ans)

Solution (Python):
import numpy as np
h,w,k=map(int,input().split())
c=[]
blacks=0
for hi in range(h):
    c.append(list(input()))
    blacks+=c[-1].count('
c=np.array(c)

x=h+w
bx=2**x
ans=0
max_ansi=0
for i in range(bx):
    bin_x=bin(i)[2:].zfill(x)

    line=[]
    row=[]
    ansi=0
    for j in range(h):
        if(bin_x[j]=='1'):
            line.append(j)
    for j in range(w):
        if(bin_x[h+j]=='1'):
            row.append(j)
    line=np.array(line)
    row=np.array(row)
    not_line=np.array(list(set([i for i in range(h)]) - set(line)))

    for j in range(x):
        if(bin_x[j]=='1'):
            if(j<h):
                ansi+=np.count_nonzero(c[j,:]=='
            elif(len(not_line)>0):
                m=j-h
                ansi+=np.count_nonzero(c[not_line[:],m]=='
    ansi=blacks-ansi
    if(ansi==k):
        ans+=1

print(ans)

Solution (Python):
import copy
import itertools
from itertools import product

def main():
    
    H, W, K = map(int, input().split())
    
    C = [[1 if v == '
    ans = 0
    
    HC = list(product([0,1], repeat=H))
    WC = list(product([0,1], repeat=W))
    
    c = copy.deepcopy(C)
    for hc in HC:
        for wc in WC:
            cnt = 0
            for hi, h in enumerate(hc):
                if h == 1:
                    for w in range(W):
                        c[hi][w] = 0
            for wi, w in enumerate(wc):
                if w == 1:
                    for h in range(H):
                        c[h][wi] = 0
            
            cnt = sum(list(itertools.chain.from_iterable(c)))
            if cnt == K:
                ans += 1
            c = copy.deepcopy(C)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import copy

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

def countBlack(g):
    result = 0
    for row in g:
        result += row.count("
    return result

choices = list(range(h)) + list(range(w))


def checkChoice(path):
    curGrid = copy.deepcopy(grid)
    for i in range(h):
        if path[i]:
            for j in range(w):
                curGrid[i][j] = "r"
    for j in range(h, len(choices)):
        if path[j]:
            curCol = j - h
            for i in range(h):
                curGrid[i][curCol] = "r"
    return countBlack(curGrid) == k

result = 0
def solve(i, path):
    global result
    if i == len(choices):
        result += checkChoice(path)
    else:
        path.append(True)
        solve(i + 1, path)
        path.pop()
        path.append(False)
        solve(i + 1, path)
        path.pop()

solve(0, [])
print(result)

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

t=0	
for h in range(2**H):
  for w in range(2**W):
    b=0
    for i in range(H):
      if h&2**i:
        continue
      for j in range(W):
        if w&2**j:
          continue
        if C[i][j]=='
          b+=1
    if b==K:
      t+=1

print(t)

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

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


import numpy as np
D = np.array(D)

count = 0
for bit_H in range(2**H):
    for bit_W in range(2**W):
        C = D.copy()
        for h in range(H):
            mask = 1 << h
            if bit_H & mask:
                C[h, :] = 'h'    
        for w in range(W):
            mask = 1 << w
            if bit_W & mask:
                C[:, w] = 'w'
            
        if np.count_nonzero(C == '
            count += 1

print(count)

Solution (Python):

import numpy as np
H,W,K=map(int,input().split())

D=np.zeros([H,W])

for i in range(H):
    C=input()
    for j in range(W):
        if C[j]=="
            D[i,j]=1


ans=0

for i in range(2**H):
    h="{:06b}".format(i)
    for j in range(2**W):
        w="{:06b}".format(j)

        d=D.copy()
        for hi in range(H):
            if h[5-hi]=="1":
                d[hi,:]=0
        for wi in range(W):
            if w[5-wi]=="1":
                d[:,wi]=0
        
        if d.sum()==K: ans+=1



print(ans)

Solution (Python):
h, w, k = map(int, input().split())
c = [input() for i in range(h)]
a = 0
for i in range(2**h):
    for j in range(2**w):
        b = 0
        hb = format(i, '12b')
        wb = format(j, '12b')
        for m in range(h):
            for l in range(w):
                if hb[-m-1] == '1' and wb[-l-1] == '1' and c[m][l] == '
                    b += 1
        if b == k:
            a += 1
print(a)

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

field = [list(input()) for i in range(h)]

ans = 0
for maskr in range(0, 1<<h):
    for maskc in range(0, 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 field[i][j] == '
                    black +=1
        if black == k:
            ans += 1
print(ans)

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

for paint_h in range(2**h):
  for paint_w in range(2**w):
    cut=0
    for i in range(h):
      for j in range(w):
        if (paint_h>>i)&1==0 and (paint_w>>j)&1==0:
          if c[i][j]=='
            cut+=1
    if cut==k:
      ans+=1
print(ans)

Solution (Python):
from itertools import product

h,w,k = map(int, input().split())
g = [['']*w for _ in range(h)]
for i in range(h):
    g[i] = input()

res = 0
for p in product((0,1), repeat = h):
    for q in product((0,1), repeat = w):
        black = 0
        for i in range(h):
            for j in range(w):
                if p[i] == 1 and q[j] == 1 and g[i][j] == '
                    black += 1
        if black == k:
            res += 1
print(res)

Solution (Python):
import itertools
def MI(): return map(int, input().split())
H,W,K=MI()
Map=[input() for _ in range(H)]
ans=0
for gyou in itertools.product([0,1],repeat=H):
  for retsu in itertools.product([0,1],repeat=W):
    count=0
    for i in range(H):
      for j in range(W):
        if gyou[i] and retsu[j]:
          if Map[i][j]=='
            count+=1
    if count==K:
      ans+=1
print(ans)

Solution (Python):
n, m, k = map(int, input().split())
cells = [[''] * m for i in range(n)]

def count_black(num1, num2):
    num1 = bin(num1)[2:].rjust(n, '0')
    num2 = bin(num2)[2:].rjust(m, '0')
    blacky = 0
    for i in range(n):
        for j in range(m):
            if num1[i] != '1' and num2[j] != '1' and cells[i][j] == '
                blacky += 1
    return blacky == k

def get_ways(r, c):
    result = 0
    for i in range(0, 2 ** r):
        for j in range(0, 2 ** c):
            ans = count_black(i, j)
            result += 1 if ans else 0
    return result

for i in range(n):
    string = input()
    for j in range(m):
        cells[i][j] = string[j]

num_ways = get_ways(n, m)
print(num_ways)

Solution (Python):


def main():
    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):
            count = 0
            for n in range(H):
                for m in range(W):
                    if ((i >> n) & 1) == 0 and ((j >> m) & 1) == 0 and C[n][m] == '
                        count += 1

            if count == K:
                ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import itertools
def MI(): return map(int, input().split())
H,W,K=MI()
Map=[input() for _ in range(H)]
ans=0
for gyou in range(1<<H):
  for retsu in range(1<<W):
    count=0
    for i in range(H):
      if (gyou>>i)&1:
        for j in range(W):
          if (retsu>>j)&1:
            if Map[i][j]=='
              count+=1
    if count==K:
      ans+=1
print(ans)

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

def num2bi(x, k):
  out=format(x, '0'+str(k)+'b')
  return out

ans=0
for x in range(2**H):
  for y in range(2**W):
    p=num2bi(x, H)
    q=num2bi(y, W)
    cnt=0
    for s in range(H):
      for t in range(W):
        if p[s]=='0' and q[t]=='0' and c[s][t]=='
          cnt+=1
          
    if cnt==K:
      ans+=1
      
print(ans)

Solution (Python):
def MI(): return map(int, input().split())
H,W,K=MI()
Map=[input() for _ in range(H)]
ans=0
for gyou in range(1<<H):
  for retsu in range(1<<W):
    count=0
    for i in range(H):
      for j in range(W):
        if (gyou>>i)&1 and (retsu>>j)&1:
          if Map[i][j]=='
            count+=1
    if count==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 b1 in range(2**h):
    for b2 in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (b1 >> i) & 1 == 0 and (b2 >> j) & 1 == 0 and c[i][j] == "
                    black +=1
                    
        if black == k:
            ans += 1

print(ans)

Solution (Python):
h,w,k=map(int,input().split())
a=[input() for _ in range(h)]
ans=0
for H in range(2**h):
    for W in range(2**w):
        c=0
        for i in range(h):
            for j in range(w):
                if H>>i&1 and W>>j&1 and a[i][j]=="
                    c+=1
        if c==k:
            ans+=1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

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

res = 0

for r in range(1<<h):
    for g in range(1<<w):
        tmp = 0
        for i in range(h):
            for j in range(w):
                if c[i][j] == '
                    tmp += 1
        if tmp == k:
            res += 1

print(res)

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

Solution (Python):
import sys
input = sys.stdin.readline

h,w,k = map(int,input().split())
M=[input().rstrip() for _ in range(h)]
ans = 0
for ib in range(1<<h):
    for jb in range(1<<w):
        cc = 0 
        for i in range(h):
            if ib&(1<<i):continue
            for j in range(w):
                if jb&(1<<j):continue
                cc+=M[i][j]=='
        if cc==k:
            ans+=1
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


H, W, K = MI()
C = [input() for _ in range(H)]

def count(red_x, red_y):
    cnt = 0
    for i in range(H):
        if i in red_x:
            continue
        for j in range(W):
            if j in red_y:
                continue
            if C[i][j] == '
                cnt += 1
    return cnt

ans = 0
for i in range(2 ** H):
    red_x = []
    for j in range(H):
        if (i >> j) & 1:
            red_x.append(j)
    for k in range(2 ** W):
        red_y = []
        for l in range(W):
            if (k >> l) & 1:
                red_y.append(l)
        if count(red_x, red_y) == K:
            ans += 1
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

ans = 0
for b1 in range(2**h):
    for b2 in range(2**w):
        cnt = 0
        for i in range(h):
            for j in range(w):
                if (b1 & (1 << i) == 0) and (b2 & (1 << j) == 0):
                    if s[i][j] == '
                        cnt += 1
        if cnt == k:
            ans += 1

print(ans)

Solution (Python):
import sys

(h, w, k) = map(int, sys.stdin.readline().strip().split())

list_matrix = [sys.stdin.readline()[:-1] for _ in range(h)]

ans = 0
for check_row in range(1 << h):  
    for check_column in range(1 << w):
        num_black = 0
        for i in range(h):
            for j in range(w):
                if (check_row >> i) & 1 == 0 and (check_column >> j) & 1 == 0 and list_matrix[i][j] == '
                    num_black += 1
        if num_black == k:
            ans += 1

print(ans)

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

ans = 0
for row in range(1 << H):
    R = set([i for i in range(H) if (row & (1 << i)) != 0])
    for col in range(1 << W):
        C = set([i for i in range(W) if (col & (1 << i)) != 0])

        cnt = 0
        for h in range(H):
            for w in range(W):
                if A[h][w] == '.' or h in R or w in C:
                    continue
                cnt += 1

        if cnt == K:
            ans += 1

print(ans)

Solution (Python):
h,w,k=[int(x) for x in input().rstrip().split()]
tate=[]
yoko=[]
l=[]
ans=0
for i in range(h):
  c=[x for x in input()]
  l.append(c)
  bl=0
  for s in c:
    if s=="
      bl+=1
  yoko.append(bl)

for i in range(w):
  bl=0
  for j in range(h):
    if l[j][i]=="
      bl+=1
  tate.append(bl)



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

Solution (Python):
H,W,K = map(int,input().split())
C = [0]*H
 
for i in range(H):
    C[i] = list(str(input()))
    
 
    
def gyotsubushi(n,E):
    if I[n] == 1:
        E[n] = ['R']*W
        
        
def retsutsubushi(n,E):
    if J[n] == 1:
        for i in range(H):
            E[i][n] = 'R'
stock = []
counter = 0
import copy
for i0 in range(2):
    for i1 in range(2):
        for i2 in range(2):
            for i3 in range(2):
                for i4 in range(2):
                    for i5 in range(2):
                        for j0 in range(2):
                            for j1 in range(2):
                                for j2 in range(2):
                                    for j3 in range(2):
                                        for j4 in range(2):
                                            for j5 in range(2):
                                                preI = [i0,i1,i2,i3,i4,i5]
                                                preJ = [j0,j1,j2,j3,j4,j5]
                                                I = preI[0:H]
                                                J = preJ[0:W]
                                                if I+J in stock:
                                                    break
                                                stock.append(I+J)
                                                D = copy.deepcopy(C)
                                                
                                                for i in range(H):
                                                    gyotsubushi(i,D)
                                                for j in range(W):
                                                    retsutsubushi(j,D)
                                                
                                                count = 0
                                                for i in range(H):
                                                    for j in range(W):
                                                        if D[i][j] == '
                                                            count += 1
                                                if count == K:
                                                    counter += 1
 
    
print(counter)

Solution (Python):
H,W,K=map(int,input().split())
s=[list(i)for i in [input() for i in range(H)]]
a=2**H-1
b=2**W-1
count=0
ans=0
for niti in range(2**(H+W)-1):
    count=0
    for i in range(H):
        for j in range(W):
            if niti>>i&1:
                continue
            if niti>>j+H&1:
                continue
            if s[i][j]=="
                count+=1
    if count==K:
        ans+=1
print(ans)

Solution (Python):
h,w,k = (int(a) for a in input().split())
g = [list(input()) for _ in range(h)]
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 2 ** x & i > 0 and 2 ** y & j > 0 :
                    if g[x][y] == "
                        c += 1
        if c == k :
            ans += 1

print(ans)

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

Hrange = 2**H
Wrange = 2**W
ans = 0
for h in range(Hrange):
	for w in range(Wrange):
		cnt = 0
		for i in range(H):
			for j in range(W):
				if c[i][j]=='
					cnt+=1
		if(cnt==K):
			ans+=1

print(ans)

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

ans = 0

for h in range(2**H-1):
    for w in range(2**W-1):
        black = 0
        for i in range(H):
            for j in range(W):
                if ((h>>i) & 1) == 0 and ((w>>j) & 1) == 0 and C[i][j] == '
                    black += 1
        if black == K:
            ans += 1

print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

h,w,k = inpl()
s = [input() for _ in range(h)]
bl = sum(1 if x == '
res = 0
for yy in itertools.product([0,1], repeat = h):
    for xx in itertools.product([0,1], repeat = w):
        cnt = 0
        seen = set()
        for i,y in enumerate(yy):
            if y:
                for j in range(w):
                    if (i,j) in seen:
                        continue
                    seen.add((i,j))
                    if s[i][j] == '
                        cnt += 1
        for j,x in enumerate(xx):
            if x:
                for i in range(h):
                    if (i,j) in seen:
                        continue
                    seen.add((i,j))
                    if s[i][j] == '
                        cnt += 1
        if bl-cnt == k:
            res += 1
print(res)

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())
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())
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):
def main():
    H, W, K = map(int, input().split())
    c = [input() for _ in range(H)]

    ans = 0
    for maskH in range((1 << H) - 1):
        for maskW in range((1 << W) - 1):
            black = 0
            for h in range(H):
                for w in range(W):
                    if (maskH >> h) & 1 == 0 and (maskW >> w) & 1 == 0 and c[h][w] == '
                        black += 1
            
            if black == K: ans += 1

    print(ans)


if __name__ == '__main__':
    main()

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

    answer = 0
for row in range(2 ** H):
    for column in range(2 ** W):
        black = 0
        for i in range(H):
            for j in range(W):
                if (row >> i) % 2 == 1:
                    continue
                if (column >> j) % 2 == 1:
                    continue
                if C[i][j] == "
                    black += 1
        if black == K:
            answer += 1

print(answer)

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

for i in range(h):
    hwi = input()
    masi = []
    for j in range(w):
        if hwi[j] == "
            masi.append(1)
        else:
            masi.append(0)

    mas_su += sum(masi)
    mas.append(masi)

l = 2**(h+w)
ans = 0

for i in range(l):
    test = copy.deepcopy(mas)
    num = 0
    for j in range(h+w):
        if ((i >> j) & 1):
            if j < h:
                for p in range(w):
                    if test[j][p]==1:
                        test[j][p] = 0
                        num += 1
            else:
                for p in range(h):
                    if test[p][j-h]==1:
                        test[p][j-h] = 0
                        num += 1
    if mas_su-num == 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()

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 itertools
h, w, k = map(int, input().split())
table = [list(input()) for _ in range(h)]
ans = 0
for ptr_h in itertools.product([0, 1], repeat=h):
    for ptr_w in itertools.product([0, 1], repeat=w):
        cnt = 0
        for i in range(h):
            for j in range(w):
                if ptr_h[i] == 0 and ptr_w[j] == 0:
                    if table[i][j] == "
                        cnt += 1
        if cnt == k:
            ans += 1
print(ans)

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

for I in range(2**H):
  for J in range(2**W):
    black = 0
    for i in range(H):
      for j in range(W):
        if (I>>i)&1 == 0 and (J>>j)&1 == 0 and c[i][j] == "
          black += 1
    if black == K:
      ans += 1
print(ans)