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

Solution (Python):
def main():
	H, W, K = [int(k) for k in input().split(" ")]
	C = []
	black_in_row = []
	black_in_col = [0] * W
	for i in range(H):
		C.append(list(input()))
		black_in_row.append(C[i].count("
		for j in range(W):
			if C[i][j] == "
				black_in_col[j] += 1

	black = sum(black_in_row)
	if black < K:
		print(0)
		return 0

	cnt = 0
	for i in range(2 ** H):
		row_bit = [f for f, b in enumerate(list(pad_zero(format(i, 'b'), H))) if b == "1"]
		r = sum([black_in_row[y] for y in row_bit])
		for j in range(2 ** W):
			col_bit = [f for f, b in enumerate(list(pad_zero(format(j, 'b'), W))) if b == "1"]
			c = sum([black_in_col[x] for x in col_bit])
			bl = black - r - c + sum([1 for p in row_bit for q in col_bit if C[p][q] == "
			if bl == K:
				cnt += 1
	print(cnt)


def pad_zero(s, n):
	s = str(s)
	return ("0" * n + s)[-n:]

main()

Solution (Python):
h,w,k = map(int,input().split())
A = [list(input()) for _ in range(h)]
ans = 0
for i in range(2**w):
    for j in range(2**h):
        grid = [k[:] for k in A]
        cnt = 0
        for p in range(h):
            if (j >> p) & 1:
                grid[p] = ["r"]*w
        for q in range(w):
            if (i >> q) & 1:
                for b in grid:
                    b[q] = "r"
        for x in grid:
            cnt += x.count("
        if cnt == k:
            ans += 1
print(ans)

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

for h_red in range(2**h):
    for w_red in range(2**w):
        
        cnt = 0
        
        
        for i in range(h):
            for j in range(w):
                
                
                
                
                
                
                if (h_red>>i)&1 == 0 and (w_red>>j)&1 == 0:
                    if grid[i][j] == '
                        cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
H,W,K=map(int,input().split())
c=[str(input())for i in range(H)]
ans=0
for maskH in range(2**H):
    for maskW in range(2**W):
        black=0
        for i in range(H):
            for j in range(W):
                if ((maskH>>i)&1)==1:
                    continue
                if ((maskW>>j)&1)==1:
                    continue
                if c[i][j]=='
                    black+=1
        if black==K:
            ans+=1
print(ans)

Solution (Python):
import copy
 
H, W, K = map(int, input().split())
tiles = [list(input()) for _ in range(H)]
answer  = 0

for h in range(2**H):
  for w in range(2**W):
    b_cnt = 0
    for i in range(H):
      for j in range(W):
        if not (h>>i&1 or w>>j&1) and tiles[i][j] == '
          b_cnt += 1
    if b_cnt == K:
      answer += 1
print(answer)

Solution (Python):
H, W, K = map(int, input().split(' '))
ls, rst = [], 0
for i in range(H):
    ls.append(input())
for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '
                    cnt += 1
        if cnt == K:
            rst += 1
print(rst)

Solution (Python):
H, W, K = map(int, input().split())
fi = []
for _ in range(H):
    s = input()
    fi.append(s)
a = 2 ** H
b = 2 ** W
total = 0

for i in range(a * b):
    lh = list()
    lw = list()

    for j in range(H):
        if i & (1 << j):
            lh.append(1)
        else:
            lh.append(0)
    for j in range(W):
        if i & (1 << (j + H)):
            lw.append(1)
        else:
            lw.append(0)
    
    

    cnt = 0
    for j in range(H):
        for l in range(W):
            if lh[j] == 1 or lw[l] == 1:
                continue
            if fi[j][l] == '
                cnt += 1
    
    if cnt == K:
        total += 1

print(total)

Solution (Python):
import copy
from collections import Counter

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



c = [[False for _ in range(w)] for _ in range(h)]
for i in range(h):
    s = input()
    for j in range(len(s)):
        if s[j] == '
            c[i][j] = True


cnt = 0
for i in range(2**h):
    tmp = copy.deepcopy(c)
    for j in range(h):
        if((i >> j) & 1):
            tmp[j] = [False for _ in range(w)] 

    for k in range(2**w):
        tmp2 = copy.deepcopy(tmp)
        for m in range(w):
            if((k >> m) & 1):
                for a in range(h):
                    tmp2[a][m] = False
            
        if sum(tmp2, []).count(True) == K:
            cnt += 1

print(cnt)

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

ans = 0
for i in range(1 << h):
    for j in range(1 << w):
        black = 0
        for x in range(h):
            for y in range(w):
                if (i >> x) & 1:
                    continue
                    
                if (j >> y) & 1:
                    continue
                    
                if c[x][y] == '
                    black += 1
        if black == 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):
        black = 0
        for x in range(h):
            for y in range(w):
                if (i >> x) & 1:
                    continue
                    
                if (j >> y) & 1:
                    continue
                    
                if c[x][y] == '
                    black += 1
        if black == k:
            ans += 1
print(ans)

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

cnt = 0

for h in range(1 << H):
    for w in range(1 << W):
        black = 0

        for i in range(H):
            if (h >> i) % 2 == 1:
                continue
            for j in range(W):
                if (w >> j) % 2 == 1:
                    continue

                black += cell[i][j] == '
        
        cnt += black == k

print(cnt)

Solution (Python):
WHITE = '.'
BLACK = '

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

ans = 0
for rows in range(2 ** H):
    for cols in range(2 ** W):
        cnt = 0
        for h in range(H):
            for w in range(W):
                if (rows >> h) & 1 or (cols >> w) & 1:
                    continue
                cnt += C[h][w] == BLACK
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
h,w,y=map(int,input().split())
c=[input() for _ in range(h)]
black=0
for i in range(h):
    for j in range(w):
        if c[i][j]=="
            black+=1
if black<y:
    print("0")
    exit()
hb=[]
wb=[]
for i in range(h):
    hb.append(c[i].count("
for i in range(w):
    count=0
    for j in range(h):
        if c[j][i]=="
            count+=1
    wb.append(count)
bit=[]
for i in range(2**(h+w)): 
    bit.append(bin(i)[2:].zfill(h+w))
ans=0
for i in bit:
    x=black
    for j in range(h):
        if i[j]=="1":
            for k in range(w):
                if i[h+k]=="1" and c[j][k]=="
                    x+=1
    for j in range(h):
        if i[j]=="1":
            x-=hb[j]
    for j in range(w):
        if i[h+j]=="1":
            x-=wb[j]
    if x==y:
        ans+=1
print(ans)

Solution (Python):
def solve():
    H,W,K = [int(i) for i in input().split()]
    grids = []
    for i in range(H):
        row = input()
        grids.append(row)

    import itertools
    rows = list(range(H))
    row_combis = set([])
    for i in range(H+1):
        tmp = itertools.combinations(rows, i)
        row_combis |= set(tmp)
    columns = list(range(W))
    column_combis = set([])
    for i in range(W+1):
        tmp = itertools.combinations(columns, i)
        column_combis |= set(tmp)

    ans = 0
    for row_combi in row_combis:
        for column_combi in column_combis:
            num_black = 0
            for i in range(H):
                for j in range(W):
                    if i in row_combi:
                        continue
                    if j in column_combi:
                        continue
                    if grids[i][j] == '
                        num_black += 1
            if num_black == K:
                ans += 1
    print(ans)


if __name__ == "__main__":
    solve()

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

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

for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '
                    cnt += 1
        if cnt == K:
            rst += 1
print(rst)

Solution (Python):
H, W, K = [int(x) for x in input().split()]

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

ans = 0
for h in range(2 ** H, 2 ** H + 2 ** H):
    bin_h = format(h, 'b')[1:]
    for w in range(2 ** W, 2 ** W + 2 ** W):
        bin_w = format(w, 'b')[1:]
        count = 0
        for i in range(H):
            for j in range(W):
                if bin_h[i] == '0' and bin_w[j] == '0' and C[i][j] == '
                    count += 1
        if count == K:
            ans += 1

print(ans)

Solution (Python):



from itertools import product
H, W, K = (int(x) for x in input().split())
C = [list(input()) for _ in range(H)] 
answer = 0

for row_bit in product(range(2), repeat=H):


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

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

h,w,k=nii()
c=[list(input()) for i in range(h)]

b_cnt=0
for i in c:
  b_cnt+=i.count('

ans=0
for i in range(2**h):
  for j in range(2**w):
    h_use=[]
    for ii in range(h):
      if (i>>ii)&1:
        h_use.append(ii)
    w_use=[]
    for jj in range(w):
      if (j>>jj)&1:
        w_use.append(jj)

    t_cnt=0
    for s in h_use:
      t_cnt+=c[s].count('
    for s in w_use:
      for t in range(h):
        if c[t][s]=='
          t_cnt+=1

    for s in h_use:
      for t in w_use:
        if c[s][t]=='
          t_cnt-=1

    if b_cnt-t_cnt==k:
      ans+=1

print(ans)

Solution (Python):
from itertools import product

h, w, k = map(int, input().split())
AL = []
count = 0
for i in range(h):
    c = list(input())
    AL.append(c)
for a in product(range(2), repeat=h):
    for b in product(range(2), repeat=w):
        black = 0
        for i in range(h):
            for j in range(w):
                if AL[i][j] == "
                    black += 1
        if k == black:
            count += 1
print(count)

Solution (Python):

import numpy as np
from itertools import combinations
H, W, K = map(int, input().split())
C=[input() for i in range(H)]
C_list=[list(C[i]) for i in range(H)]
C_cols=['c'+str(i) for i in range(H)]
C_rows=['r'+str(i) for i in range(W)]
C_comb=C_cols + C_rows

Comb=[]
for i in range(1, H+W):
    Comb+=combinations(C_comb,i)
    
result=0
for i in range(len(Comb)):
    C_array=np.array(C_list)
    for j in Comb[i]:
        if j[0]=='c':
            c_r=int(j[1:])
            C_array[c_r,:]='r'
        else:
            c_r=int(j[1:])
            C_array[:,c_r]='r'
    df_bool = (C_array=='
    result+= df_bool.sum()==K
    
if (np.array(C_list) =='
    result+=1
    
print(result)

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

for j in range(2**h):
    b1 = ['-']*h
    for k in range(h):
        if ((j>>k)&1):
            b1[h-1-k] = '+'
    for i in range(2**w):
        b2 = ['-']*w
        for k in range(w):
            if ((i>>k)&1):
                b2[w-1-k] = '+'
        val = 0
        for n in range(h):
            for m in range(w):
                if b1[n] == '-' and b2[m] == '-' and a[n][m] == '
                    val += 1
        if val == num:
            ans += 1
print(ans)

Solution (Python):

import sys
from itertools import combinations as comb
from itertools import chain
import numpy as np





def solve(H, W, K, C):
    answer = 0
    for hn in range(H + 1):
        for wn in range(W + 1):
            for h_idxs in comb(range(H), hn):
                for w_idxs in comb(range(W), wn):
                    cs = C.copy()
                    cs[h_idxs, :] = 0
                    cs[:, w_idxs] = 0
                    answer += cs.sum() == K
    return answer


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    H = int(next(tokens))
    W = int(next(tokens))
    K = int(next(tokens))
    C = np.array(
        [
            list(map(lambda x: {"
            for line in tokens
        ]
    )
    answer = solve(H, W, K, C)
    print(answer)


if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy


import heapq
sys.setrecursionlimit(10**6)

INF = 10**18
import bisect
import statistics
mod = 10**9+7


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

def bit(S, j):
    
    return (S>>j)&1

ans = 0
for i in range(1<<H):
    for j in range(1<<W):
        cc = copy.deepcopy(c)
        black = 0
        for ki in range(H):
            for kj in range(W):
                if bit(i,ki) == 1:
                    cc[ki] = ["r" for _ in range(W)]
                if bit(j,kj) == 1:
                    for ii in range(H):
                        cc[ii][kj] = "r"

        for ii in range(H):
            for jj in range(W):
                if cc[ii][jj] == "
                    black += 1

        if black == K:
            ans += 1

print(ans)

Solution (Python):
H, W, K = map(int, input().split(' '))
ls, rst = [], 0
for i in range(H):
    ls.append(input())
for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '
                    cnt += 1
        if cnt == K:
            rst += 1
print(rst)

Solution (Python):
import sys

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

c = []
for i in range(H):
    c.append(list(map(str, input().split()))[0])

o = 0
p = 0

for i in range(2**H):
    for j in range(2**W):
        o = 0
        for b,n in enumerate(bin(i)[2:].zfill(H)):
            for a,l in enumerate(bin(j)[2:].zfill(W)):
                if n == '0' and l == '0' and c[b][a]=='
                    o += 1
        if o == K:
            p += 1
print(p)

Solution (Python):
import itertools
a,b,c=map(int, input().split())
l = [input() for i in range(a)]

ans = 0
Ans = 0
for i in itertools.product((1,-1),repeat=a):
    for j in itertools.product((1,-1),repeat=b):
        for k in range(a):
            for m in range(b):
                if i[k] == j[m] == 1 and l[k][m] == '
                    ans += 1
        if ans == c:
            Ans += 1
        ans = 0
print(Ans)

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

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 numpy as np

h,w,k = map(int,input().split())
c = np.zeros((h,w)).astype('str')
for i in range(h):
    s = input()
    for j,a in enumerate(s):
        c[i,j] = a
        
cnt = 0
for o in range(2**h):
    for l in range(2**w):
        black = 0
        for m in range(h):
            for n in range(w):
                if ((o>>m)&1==0) and ((l>>n)&1==0) and (c[m,n]=='
                    black += 1
        if black == k:
            cnt += 1
print(cnt)

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

for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '
                    cnt += 1
        if cnt == K:
            rst += 1
print(rst)

Solution (Python):



def next_line():
    return input()


def next_int():
    return int(input())


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


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    h, w, k = map(int, input().split())
    ch = []
    for _ in range(h):
        ch.append(next_line())

    

    res = 0
    for i in range(1 << h):
        for j in range(1 << w):
            count = 0
            for l in range(h):
                for m in range(w):
                    if ch[l][m] == "
                        count += 1
            if count == k:
                res += 1
    print(res)


if __name__ == '__main__':
    main()

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

ans = 0
for i in range(2**H):
    for j in range(2**W):
        count = 0
        for k in range(H):
            for l in range(W):
                if (i>>k) & 1:
                    if (j>>l) & 1:
                        if c[k][l] == "
                           count += 1
        if count == K:
            ans += 1

print(ans)

Solution (Python):
import sys
import numpy as np
import itertools
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H,W,K=map(int,readline().split())
C=np.array(list(map(str,read().rstrip().decode().split())))
ans=0
for paint_H in itertools.product([0,1], repeat=H):
  for paint_W in itertools.product([0,1], repeat=W):
    cnt=0
    for i in range(H):
      for j in range(W):
        if paint_H[i]==0 and paint_W[j]==0 and C[i][j]=="
          cnt+=1
    if cnt==K:
      ans+=1
print(ans)

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

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

Solution (Python):
import itertools
H,W,K=map(int,input().split())
C=[input() for i in range(H)]
ans=0
for paint_H in itertools.product([0,1], repeat=H):
  for paint_W in itertools.product([0,1], repeat=W):
    cnt=0
    for i in range(H):
      for j in range(W):
        if paint_H[i]==0 and paint_W[j]==0 and C[i][j]=="
          cnt+=1
    if cnt==K:
      ans+=1
print(ans)

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

box, ans = [], 0

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


for i in range(1 << h):
    for j in range(1 << w):
        count = 0
    
        for H in range(h):
            if i >> H & 1:
                continue
            
            for W in range(w):
                if j >> W & 1:
                    continue
                
                if box[H][W] == '
                    count += 1
            
        if count == k:
            ans += 1

print(ans)

Solution (Python):
import itertools
H,W,K=map(int,input().split())
C=[input() for i in range(H)]
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]=="
        if(count == K):
          ans += 1
print(ans)

Solution (Python):
import itertools as it
n,m,k=list(map(int,input().split()))
S=[list(str(input())) for h in range(n)]
ans=0
for i in it.product([0,1],repeat=n):
  for j in it.product(range(2),repeat=m):
    count=0
    for h in range(n):
      for c in range(m):
        if S[h][c]=="
          count+=1
    if count==k:
      ans+=1
print(ans)

Solution (Python):
import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input=sys.stdin.readline


mo=10**9+7
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())









r,c,k=cin()
dc=dd(int)
dr=dd(int)
mat=[]
for i in range(r):
    s=sin().strip()
    dr[i]=s.count('
    mat.append(list(s))
total=sum(list(dr.values()))
for i in range(c):
    co=0
    for j in range(r):
        if(mat[j][i]=='
            co+=1
    dc[i]=co
ans=0
lr=lr=[o for o in range(r)]
lc=[o for o in range(c)]
for i in range(0,r+1):
    sur=0
    

    rowp=list(itertools.combinations(lr,i))


    for perrow in rowp:
        sur=0
        for indexr in perrow:
            sur+=dr[indexr]
        for j in range(0,c+1):
            suc=0
            colp=list(itertools.combinations(lc,j))
            for percol in colp:
                suc=0
                for indexc in percol:
                    co=0
                    for ro in range(r):
                        if(mat[ro][indexc]=='
                            co+=1
                    suc+=co
                if(total-sur-suc==k):

                    ans+=1
                        
                    
print(ans)

Solution (Python):

from itertools import combinations

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

for i in range(H):
	C.append(input())

count = 0
Count = 0



for k in range(1,H):
	for l in range(1,W):
		for i in combinations(list(range(1,H+1)),k):
			for j in combinations(list(range(1,W+1)),l):		
				count = 0
				for m in range(1,H+1):
					for n in range(1,W+1):
						if not(m in i) and not(n in j) and C[m-1][n-1] == '
							count += 1
				if K == count:
					Count += 1


for k in range(1,H):
	for i in combinations(list(range(1,H+1)),k):
		count =0
		for m in range(1,H+1):
			for n in range(1,W+1):
				if not(m in i) and C[m-1][n-1] == '
					count += 1
		if K == count:
			Count += 1


for l in range(1,W):
	for j in combinations(list(range(1,W+1)),l):
		count = 0
		for m in range(1,H+1):
			for n in range(1,W+1):
				if not(n in j) and C[m-1][n-1] == '
					count += 1
		if K == count:
			Count += 1



count = 0 
for m in range(1,H+1):
	for n in range(1,W+1):
		if C[m-1][n-1] == '
			count += 1
if K == count:
	Count += 1





print(Count)

Solution (Python):
def main():
    h,w,k = map(int,input().split())
    maze = [['.' for j in range(6)] for i in range(6)]


    for i in range(h):
        line = list(input())
        for j in range(w):
            maze[i][j] = line[j]
    
    

    ver = [0 for i in range(6)]
    hor = [0 for i in range(6)]
    horver = [[0 for i in range(6)] for j in range(6)]
    total = 0
    for i in range(6):
        for j in range(6):
            if maze[i][j] == '
                ver[j] += 1
                hor[i] += 1
                horver[i][j] = 1
                total += 1
    

    ans = 0
    for bit in range(2**(h+w)):
        tmp = total
        valid_hor = []
        for i in range(h):
            if (bit >> i & 1) == 1:
                valid_hor.append(i)
                tmp -= hor[i] 
        
        for j in range(h,h+w):
            if (bit >> j & 1) == 1:
                tmp -= ver[j-h]
                for i in valid_hor:
                    tmp += horver[i][j-h]
    
        if tmp == k:
            ans += 1

    print(ans)
    return 

if __name__ == '__main__':
    main()

Solution (Python):
from itertools import product

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

ans = 0

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

print(ans)

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

for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '
                    cnt += 1
        if cnt == K:
            rst += 1
print(rst)

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

counter_pattern = 0
for i in range(2 ** H):
    for j in range(2 ** W):
        counter_black = 0
        for h in range(H):
            for w in range(W):
                if L[h][w] == "
                    counter_black += 1
        if counter_black == K:
            counter_pattern += 1

print(counter_pattern)

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

for i in range(1<<h+w):
  x=0
  for j in range(h):
    for l in range(w):
      if i>>j & 1 and i>>l+h & 1:
        if c[j][l]=="
          x+=1
  if x==k:
    a+=1
print(a)

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

ans = 0

for mass_H in range(1 << H):
    for mass_W in range(1 << W):
        black = 0
        for i in range(H):
            for j in range(W):
                if ((mass_H >> i) & 1) == 0 and ((mass_W >> 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())

arr= [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 arr[i][j]=="
						cnt+=1

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

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

Solution (Python):
h,w,p=map(int,input().split())
A=[]
ans=0

for i in range(h):
    A.append(list(input()))

for i in range(2**h):
    hs=[False]*h
    for j in range(h):
        if ((i>>j)&1):
            hs[j]=True
    for k in range(2**w):
        ws=[False]*w
        for l in range(w):
            if ((k>>l)&1):
                ws[l]=True
        cnt=0
        for a in range(h):
            if hs[a]==True:
                for b in range(w):
                    if ws[b]==True:
                        if A[a][b]=='
                            cnt+=1
        if cnt==p:
            ans+=1
print(ans)

Solution (Python):
import numpy as np
import itertools as it

H,W,N = [int(i) for i in input().split()]
dat = np.array([list(input()) for i in range(H)], dtype=str)


emp_r = ["." for i in range(W)]
emp_c = ["." for i in range(H)]


def plot(dat, dict):
    for y in dict["row"]:
        dat[y,:] = emp_r
    for x in dict["col"]:
        dat[:,x] = emp_c
    return dat


def is_sat(dat):
    count = 0
    for y in range(W):
        for x in range(H):
            if dat[x, y] == "
                count += 1

    if count == N:
        return True
    else:
        return False










combs = it.product([bin(i) for i in range(2**H-1)], [bin(i) for i in range(2**W-1)])
count = 0
for comb in combs:
    rows = comb[0]
    cols = comb[1]
    rc_dict = {"row": [], "col": []}
    for j in range(H):
        if (int(rows, 0) >> j) & 1 == 1:
            rc_dict["row"].append(j)

    for j in range(W):
        if (int(cols, 0) >> j) & 1 == 1:
            rc_dict["col"].append(j)

    dat_c = plot(dat.copy(), rc_dict)
    if is_sat(dat_c):
        count += 1

print(count)

Solution (Python):

H, W, K = map(int, input().split(' '))
ls, rst = [], 0
for i in range(H):
    ls.append(input())
for i in range(1 << H):
    for j in range(1 << W):
        cnt = 0
        for s in range(H):
            if i >> s & 1:
                continue
            for t in range(W):
                if j >> t & 1:
                    continue
                if ls[s][t] == '
                    cnt += 1
        if cnt == K:
            rst += 1
print(rst)

Solution (Python):
import numpy as np

H,W,K = list(map(int, input().split()))
t=[]
for i in range(H):
    t.append([int(i) for i in input().replace(".","0").replace("

cnt = 0
for i in range(2**H):
    for j in range(2**W):
        d = np.array(t)
        i_2 = [int(k) for k in bin(i)[2:].rjust(H,"0")]
        j_2 = [ int(k) for k in bin(j)[2:].rjust(W,"0")]
        
        
        
        d= ((d.T)*i_2).T
        d= d*j_2
        
        num = d.sum()
        if num == K:
            cnt +=1
            
print(cnt)