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

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

c = [list(input()) for _ in range(h)]

ans = 0


for row in range(2**h):
    for column in range(2**w):
        count = 0
        
        for i in range(h):
            for j in range(w):
                if ((row >> i)&1) == 0 and ((column >> j)&1) == 0 and c[i][j] == '
                    count += 1
        if count == k:
            ans += 1

print(ans)

Solution (Python):
import copy

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

c = []
for j in range(h):
    tmpc = input()
    tmpc = [1 if i=='
    c.append(tmpc)


cnt = 0
for i in range(2**h):
    for j in range(2**w):
        buc = copy.deepcopy(c)
        sumc = 0
        for k in range(h):
            if i >> k & 1 == 1:
                c[k] = [0] * w    
        for l in range(j):
            if j >> l & 1 == 1:
                for m in range(h):
                    c[m][l] = 0
        for l in range(h):
            sumc += sum(c[l])
        c = copy.deepcopy(buc)
        if sumc == K:
            cnt += 1
print(cnt)

Solution (Python):
import numpy as np

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

count = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        target = data.copy()
        row = list(bin(i)[2:].zfill(h))
        for p in range(h):
            if row[p] == '1':
                target[p, :] = '.'
        col = list(bin(j)[2:].zfill(w))
        for q in range(w):
            if col[q] == '1':
                target[:, q] = '.'

        if np.count_nonzero(target == '
            count += 1
print(count)

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

ans = 0
for maskH in range(1 << H):
    for maskW in range(1 << W):
        cnt = 0
        for h in range(H):
            for w in range(W):
                if (maskH >> h) & 1 == 1:
                    continue
                if (maskW >> w) & 1 == 1:
                    continue
                if C[h][w] == "
                    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 maskR in range(2 ** H):
    for maskC in range(2 ** W):
        black = 0
        for i in range(H):
            for j in range(W):
                if ((maskR >> i) & 1) == 0 and ((maskC >> 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())

c = []
for i in range(h):
    c.append(input())
ans = 0




'''
入力例1

2 3 2
..


に対して
print(c)
を実行すると
['..
と出力される
'''
for i in range(pow(2, h)):
    for j in range(pow(2, w)):
        count = 0
        for p in range(h):
            for q in range(w):
                if ((i & (1 << p)) == 0 and (j & (1 << q)) == 0 and c[p][q] == '
                    count += 1
        
        if (k == count):
            ans += 1

print(ans)

Solution (Python):
import numpy as np

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

c = [list(str(input())) for _ in range(h)]
c = np.array(c)
ans = 0

for i in range(2 ** w):  
    for j in range(2 ** h):  
        mas = c.copy()
        for p in range(w):
            for q in range(h):
                if (i >> p) & 1:
                    mas[:, p] = "0"
                if (j >> q) & 1:
                    mas[q, :] = "0"
        
        cnt = np.count_nonzero(mas == "
        if cnt == k:
            ans += 1

print(ans)

Solution (Python):
from itertools import product

H, W, K = map(int, input().split(' '))
C = [list(input()) for _ in range(H)]
ans = 0
for row_bit in product(range(2), repeat=H):
    for col_bit in product(range(2), repeat=W):
        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):
import sys


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


def main():
    def get_binary(num, digit): return bin(num)[2:].zfill(digit)

    def count_blacks(mat, bin_str_h, bin_str_w):
        count = 0
        for h_i, row in enumerate(mat):
            if (bin_str_h[h_i] == "0"):
                continue
            for w_i, cell in enumerate(row):
                if (bin_str_w[w_i] == "1" and cell == "
                    count += 1

        return count

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

    for h in range(2**H):
        for w in range(2**W):
            h_bin = get_binary(h, H)
            w_bin = get_binary(w, W)
            if (count_blacks(mat, h_bin, w_bin) == K):
                ans_count += 1

    print(ans_count)


if __name__ == "__main__":
    main()

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


points = 0
for row in range(2**H):
    for col in range(2**W):
        k_pra = 0
        for i in range(H):
            for j in range(W):
                if row&(1<<i)==0 and col&(1<<j)==0 and c[i][j]=='
                    k_pra += 1
        if K == k_pra:
            points += 1

print(points)

Solution (Python):
def get_binaly_arr(num,digit):
    return list(bin(num)[2:].zfill(digit))

def get_droped_mat(mat,binaly_arr,direction):
    if direction == "H":
        return [mat[i] for i in range(len(mat)) if binaly_arr[i] != "0" ]
    elif direction == "W": 
        return [[arr[i] for i in range(len(arr)) if binaly_arr[i] != "0" ] for arr in mat]
    else :
        print("INVALID DIRECTION!")

def count_black(mat):
    return sum([sum([1 for item in arr if item == "
    
if __name__ == "__main__":
    H,W,K = list(map(int,input().split()))
    c = []
    for i in range(0,H):
        c.append(list(input()))

    H_pattern_num = 2 ** H
    W_pattern_num = 2 ** W
    count = 0
    ite_num = 0
    for i in range(0,H_pattern_num):
        for j in range(0,W_pattern_num):
            
            H_binaly_arr = get_binaly_arr(i,H)
            W_binaly_arr = get_binaly_arr(j,W)

            mat_temp = c.copy()
            mat_temp = get_droped_mat(c,H_binaly_arr,direction="H")
            mat_temp = get_droped_mat(mat_temp,W_binaly_arr,direction="W")
            if K == count_black(mat_temp):
                count += 1
    print(count)

Solution (Python):
import copy

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

ans = 0
for bitrow in range(2**H):
    c1 = copy.deepcopy(matrix)
    for i in range(H):
        if bitrow >> i & 1:
            for column in range(W):
                c1[i][column] = '.'
        
    for bitcolumn in range(2**W):
        c2 = copy.deepcopy(c1)
        for j in range(W):
            if bitcolumn >> j & 1:
                for row in range(H):
                    c2[row][j] = '.'
                        
        
        black = 0
        for row in c2:
            for st in row:
                if st == '
                    black += 1
        
        if black == K:
            ans += 1
print(ans)

Solution (Python):
import numpy as np

a = input().split()
H = int(a[0])
W = int(a[1])
K = int(a[2])
  
b = []
for i in range(H):
  line = input()
  row = []
  for j in range(W):
    if line[j] == ".":
      row.append(0)    
    elif line[j] == "
      row.append(1)
  b.append(row)
b = np.array(b)

r = np.zeros(H)
c = np.zeros(W)

def plus1(x):
  x[0] += 1
  for i in range(len(x)):
    if i < len(x)-1:
      if x[i] == 2:
        x[i] = 0
        x[i+1] += 1
      

count = 0
while r[-1] < 2:
  while c[-1] < 2:
    
    if K == np.dot(r,(np.dot(b,c))):
      count += 1
    plus1(c)
  c = np.zeros_like(c)
  plus1(r)
    
print(count)

Solution (Python):
h,w,k=map(int,input().split())
c=[list(input()) for _ in range(h)]
ans=0
for row in range(1<<h):
  for col in range(1<<w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if (row&(1<<i))==0 and (col&(1<<j))==0 and c[i][j]=="
          cnt+=1
    if cnt==k:
      ans+=1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
X = []
for i in range(H):
  x = list(input())
  X.append(x)
 
def HandV():
  ans = 0
  for h in range(2**H): 
    for w in range(2**W):
      cnt=0
      for i in range(H):
        for j in range(W):
          if (h>>i)&1==0 and (w>>j)&1==0:
            if X[i][j]=='
              cnt+=1
      if cnt==K:
        ans+=1
  print(ans)
HandV()

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

c = []
answer = 0
for i in range(H):
    c.append(input())

for i in range(2**H):
    for j in range(2**W):
        count = 0
        for m in range(H):
            for n in range(W):
                if ((i >> m) & 1) and ((j >> n) & 1) and c[m][n] == '
                    count = count + 1
        if count == K:
            answer = answer + 1

print(answer)

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

row=[format(x, '06b') for x in range(2**h)]
column=[format(x, '06b') for x in range(2**w)]

shacnt=0
ans=0

for r in row:
    for c in column:
        shacnt=0
        for gyou in range(1,h+1):
            for retu in range(1,w+1):
                if r[-gyou]=="1" and c[-retu]=="1" and a[gyou-1][retu-1]=="
                    shacnt+=1
        if shacnt==k:
            ans+=1

print(ans)

Solution (Python):
import copy
[h,w,k] = [int(i) for i in input().split()]
c = []
for i in range(h):
    tmp = input()
    tmp_ls = []
    for j in range(len(tmp)):
        tmp_ls.append(tmp[j])
    c.append(tmp_ls)
cnt = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        tmp = copy.deepcopy(c)
        cnt_b = 0
        bin_h = bin(i)[2:]
        bin_h = "0" * (h - len(bin_h)) + bin_h
        bin_w = bin(j)[2:]
        bin_w = "0" * (w - len(bin_w)) + bin_w
        
        for p in range(h):
            for q in range(w):
                if bin_h[p]== "1" or bin_w[q] == "1":
                    tmp[p][q] = "."
        
        for p in range(h):
            for q in range(w):
                if tmp[p][q] == "
                    cnt_b += 1
        
        if cnt_b == k:
            cnt += 1
print(cnt)

Solution (Python):
import numpy as np
import collections
import copy
H,W,K = map(int, input().split())
data_list = [list(input()) for i in range(H)]
data_np = np.array(data_list)
count = 0
for i in range(2 ** H):
  for k in range(2 ** W):
    data_tmp = copy.deepcopy(data_np)
    for j in range(0,H):
      if i >> j & 1:
        data_tmp[j,:] = '.'
    for l in range(0,W):
      if k >> l & 1:
        data_tmp[:,l] = '.'
    if (np.count_nonzero(data_tmp == '
      count = count+ 1
print(count)

Solution (Python):
from itertools import product

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

def f(i_skip, j_skip):
  cnt = 0
  for i in range(H):
    if i_skip[i] == 1:
      continue
    for j in range(W):
      if j_skip[j] == 1:
        continue
      elif C[i][j] == '
        cnt += 1
  return cnt == K

ans = 0
cnt = 0
for i_skip in product(range(2), repeat=H):
  for j_skip in product(range(2), repeat=W):
    ans += int(f(i_skip, j_skip))
print(ans)

Solution (Python):
import copy

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

ans = 0
for x in range(2**h):
    for y in range(2**w):
        cnt = 0
        tmp = copy.deepcopy(c)
        for i in range(h):
            if x >> i & 1:
                tmp[i] = ['r']*w
        for j in range(w):
            if y >> j & 1:
                for i in range(h):
                    tmp[i][j] = 'r'
        for i in range(h):
            for j in range(w):
                if tmp[i][j] == '
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)

Solution (Python):
from itertools import product
def check(C,p,q,H,W):
    ret = 0
    for i in range(H):
        if p[i] == 1:
            continue
        for j in range(W):
            if q[j] == 1:
                continue
            if C[i][j] == "
                ret += 1
    return ret

def main():
    H, W, K = map( int, input().split())
    C = [ list( input()) for _ in range(H)]
    ans = 0
    for p in product(range(2), repeat=H):
        for q in product(range(2), repeat=W):
            if check(C,p,q,H,W) == K:
                ans += 1
    print(ans)
if __name__ == '__main__':
    main()

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

def HandV():
  ans = 0
  for h in range(2**H): 
    for w in range(2**W):
      cnt=0
      for i in range(H):
        for j in range(W):
          if (h>>i)&1==0 and (w>>j)&1==0:
            if X[i][j]=='
              cnt+=1
      if cnt==K:
        ans+=1
  print(ans)
HandV()

Solution (Python):
h,w,k = map(int,input().split())
mat = []
for i in range(h):
	mat.append(list(input()))
cnt = 0
for row in range((1 << h) - 1):
	for col in range((1 << w) - 1):
		black = 0
		for i in range(h):
			for j in range(w):
				if ((row >> i) & 1 == 0) and ((col >> j) & 1 ==0):
					if mat[i][j] == "
						black+=1 
		if black == k:
			cnt+=1
print(cnt)

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

count = 0

for row in range((1 << H) - 1):
    for col in range((1 << W) - 1):
        black = 0
        for i in range(H):
            for j in range(W):
                if ((row >> i) & 1) == 0 and ((col >> j) & 1) == 0:
                    if C[i][j] == '
                        black += 1
        if black == K:
            count += 1

print(count)

Solution (Python):

import sys
input = lambda: sys.stdin.readline().strip()

h, w, k = [int(x) for x in input().split()]
g = [input() for _ in range(h)]
ans = 0
for r in range(1 << h):
    for c in range(1 << w):
        if sum(1 for i in range(h) for j in range(w) if (r & (1 << i)) == 0 and (c & (1 << j)) and g[i][j] == '
            ans += 1
print(ans)

Solution (Python):
from itertools import product
import numpy as np

H, W, K = [int(n) for n in input().split()]
arr = np.zeros((H, W))
count = 0

for h in range(H):
    row = input()
    arr[h, :] = np.array([0 if mark=='.' else 1 for mark in row])

for row_onehot, col_onehot in product(product(range(2), repeat=H), product(range(2), repeat=W)):
    row_indexes = np.argwhere(np.array(row_onehot)==1).flatten()
    col_indexes = np.argwhere(np.array(col_onehot)==1).flatten()
    arr_ = arr.copy()
    for row_idx in row_indexes:
        arr_[row_idx, :] = 0
    for col_idx in col_indexes:
        arr_[:, col_idx] = 0
    if arr_.sum() == K:
        count += 1

print(count)

Solution (Python):
import copy
H,W,K = list(map(int,input().rstrip().split(' ')))
MASU = [list(input()) for _ in range(H)]
H2_li = []
W2_li = []
C_black = 0
for i in range(2**H):
    H2 = []
    for j in range(H):
        if ((i>>j)&1):H2.append(1)
        else:H2.append(0)
    H2_li.append(H2)
for i in range(2**W):
    W2 = []
    for j in range(W):
        if ((i>>j)&1):W2.append(1)
        else:W2.append(0)
    W2_li.append(W2)

for h2 in H2_li:
    for w2 in W2_li:
        masu = copy.deepcopy(MASU)
        for i,h in enumerate(h2):
            if h == 1:
                masu[i] = ['r']*W
        for i,w in enumerate(w2):
            if w == 1:
                for k in range(H):
                    masu[k][i] = 'r'
        count = 0
        for h in range(H):
            for w in range(W):
                if masu[h][w]=='
        if count == K:C_black+=1

print(C_black)

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

count = 0

for row in range((1 << H) - 1):
    for col in range((1 << W) - 1):
        black = 0
        for i in range(H):
            for j in range(W):
                if ((row >> i) & 1) == 0 and ((col >> j) & 1) == 0:
                    if C[i][j] == '
                        black += 1
        if black == K:
            count += 1

print(count)

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

ans = 0
for rbit in range(1 << h):
    for cbit in range(1 << w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (rbit >> i) & 1 == 0 and (cbit >> j) & 1 == 0 and table[i][j] == '
                    black += 1
        if black == k:
            ans += 1
print(ans)

Solution (Python):


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

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

Solution (Python):
h, w, k = map(int, input().split())
matrix = [list(input()) for i in range(h)]
ans = 0
for paint_h in range(1 << h):
    for paint_w in range(1 << 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 matrix[i][j] == "
                        cnt += 1
        if cnt == k:
            ans += 1

print(ans)

Solution (Python):
h, w, k = map(int, input().split())
grid = [input() for _ in range(h)]
n = h + w 
ans = 0
for bit in range(1<<n):
    cnt = 0
    for i in range(h):
        for j in range(w):
            if (bit >> i) & 1 :
                if (bit >> h + j) & 1:
                    if grid[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)]
black = 0
ans = 0

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

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
from operator import itemgetter
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
H,W,K = LI()
C = []
ans = 0

for l in [S() for _ in range(H)]:
	C.append(list(l))

for i in range(2**(H+W)):
	c = copy.deepcopy(C)
	sum = 0
	for j in range(H+W):
		if ((i>>j)&1):
			if j < H:
				for d in range(W):
					c[j][d] = '.'
			else:
				for d in range(H):
					c[d][j-H] = '.'
	for l in c:
		for w in l:
			if w == '
				sum += 1
	if sum == K:
		ans += 1
print(ans)

Solution (Python):
import copy as cp
import itertools as itr
import numpy as np

H,W,K=map(int, input().split())
c=np.array([list(input()) for l in range(H)])
cnt=0

cnt=np.count_nonzero(c == '

hi=list(itr.product(range(2),repeat=H))
vi=list(itr.product(range(2),repeat=W))

ans=0

for i in range(len(hi)):
  for j in range(len(vi)):
    c1=cp.deepcopy(c)
    for i1 in range(H):
      if hi[i][i1]==1:
        c1[i1]='x'      
    for j1 in range(W):
      if vi[j][j1]==1:
        c1[:,j1]='x'
    cnt2=np.count_nonzero(c1 == '
    if cnt2==K:
      ans+=1
          
      
      

print(ans)

Solution (Python):


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

black = 0
ans = 0

for bit_h in range(2**h):
    for bit_w in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if ((bit_h >> i) & 1) and ((bit_w >> j) & 1) and c[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)]

from itertools import product
h_bits=list(product([0,1], repeat=h))
w_bits=list(product([0,1], repeat=w))

ans=0
for h_bit in h_bits:
    for w_bit in w_bits:
        tmp_cnt=0
        for i, h_b in enumerate(h_bit):
            for j, w_b in enumerate(w_bit):
                if h_b==0 and w_b==0 and c[i][j]=="
                    tmp_cnt+=1
        if tmp_cnt==k:
            ans+=1
print(ans)

Solution (Python):


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

black = 0
ans = 0

for bit_h in range(2**h):
    for bit_w in range(2**w):
        black = 0
        for i in range(h):
            if not ((bit_h >> i) & 1):
                continue
            for j in range(w):
                if not ((bit_w >> j) & 1):
                    continue
                if c[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)]

black = 0
H = []
W = []
ans = 0

for bit_h in range(2**h):
    for bit_w in range(2**w):
        black = 0
        for i in range(h):
            if ((bit_h >> i) & 1) == 1:
                continue
            for j in range(w):
                if ((bit_w >> 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())
c_ij = []
for i in range(H):
    c_ij.append(list(input()))


ans = 0

for i in range(2**H):
    for j in range(2**W):
        c = copy.deepcopy(c_ij)
        for ii in range(H):
            if ((i>>ii) & 1):
                for jj in range(W):
                    c[ii][jj] = "."

        for jj in range(W):
            if ((j>>jj) & 1):
                for ii in range(H):
                    c[ii][jj] = "."


        memo = 0
        for ii in range(H):
            for jj in range(W):
                if c[ii][jj] == "
                    memo+= 1

        if memo == K:
            ans += 1

print(ans)

Solution (Python):
h,w,k=map(int,input().split())
c=[list(input()) for _ in range(h)]
from itertools import combinations as co
g=[[-1]]
for i in range(1,h+1):
  g+=co(range(h),i)
r=[[-1]]
for i in range(1,w+1):
  r+=co(range(w),i)
ans=0
for gl in g:
  for rl in r:
    t=0
    for i in range(h):
      if i not in gl:
        for j in range(w):
          if j not in rl:
            t+=(c[i][j]=='
    ans+=(t==k)
print(ans)

Solution (Python):


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

Solution (Python):



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())
masu=[]
ans=0
for i in range(h):
  slist=list(map(str,input()))
  masu.append(slist)
for i in range(2**h):
  for j in range(2**w):
    black=0
    for m in range(h):
      for n in range(w):
        if ((i >> m) & 1) and ((j >> n)&1) and masu[m][n]=='
          black+=1
    if black==k:
        ans+=1
print(ans)

Solution (Python):



from itertools import product

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


ans = 0






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

print(ans)

Solution (Python):



from itertools import product

h, w, k = map(int, input().split())
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):
import sys



import bisect


import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
import numpy as np

h, w, k = rl()
a=[list(rs()) for _ in range(h)]
ans=0
for i in range(1<<h+w):
    c = np.array(a[:])
    for n in range(h+w):
        if i>>n&1:
            if n>=h:
                c[:,n-h-1]="*"
            else:
                c[n-1,:]="*"
    cnt=0
    for y in range(h):
        for x in range(w):
            if c[y][x]=="
                cnt+=1
    if cnt==k:
        ans+=1
print(ans)

Solution (Python):
import numpy as np
from itertools import product
 
h, w, k = map(int, input().split())
grid = np.array([list(map(str, input().rstrip())) for _ in range(h)])
 
ans = 0
for i in np.array(list(product([0, 1], repeat=h)), dtype=np.bool):
    for j in np.array(list(product([0, 1], repeat=w)), dtype=np.bool):
        if np.any(i) and np.any(j):
            arr = grid[i].copy()
            arr = arr[:, j]
            arr = arr.flatten()
            if np.where(arr == "
                ans += 1
 
print(ans)

Solution (Python):
from copy import deepcopy
h, w, k = map(int, input().split())
c = []
for i in range(h):
    c.append(list(input()))
ans = 0
for mask_row in range(2 ** h):
    for mask_col in range(2 ** w):
        c_copy = deepcopy(c)
        for row in range(h):
            if mask_row & (1 << row):
                for col in range(w):
                    c_copy[row][col] = '.'
        for col in range(w):
            if mask_col & (1 << col):
                for row in range(h):
                    c_copy[row][col] = '.'
        black = 0
        for row in range(h):
            for col in range(w):
                if c_copy[row][col] == '
                    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)]

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

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

ans = 0
for maskh in range((1<<H)-1):
  for maskw in range((1<<W)-1):
    black = 0
    for i in range(H):
      for j in range(W):
        
        if (maskh >> i) & 1 == 0 and (maskw >> 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())
c = [input() for _ in range(H)]

ans = 0
for i in range(1 << H+W):
    hcnt = []
    wcnt = []
    cnt = 0
    for j in range(H+W):
        if (i >> j) % 2 == 0:
            continue
        if j < H:
            hcnt.append(j)
        else:
            wcnt.append(j-H)
    for j in hcnt:
        for k in wcnt:
            if c[j][k] == "
                cnt += 1
    
    if cnt == K:
        ans += 1

print(ans)

Solution (Python):
import itertools
import numpy as np

N, W, K = map(int, input().split())
g_all = np.array([list(input()) for i in range(N)])

K_all = np.count_nonzero(g_all == '
count = 0

def dfs(i, g):
    if (i < N):
        g[i, :] = ['r'] * W
    else:
        g[:, i - N] = ['r'] * N
    return g

g = g_all

for L in range(2 ** (N + W)):
    g = g_all.copy()
    for i in range(N + W):
        if (i < N):
            if ((L >> i) & 1):
                g[i, :] = ['r'] * W
        else:
            if ((L >> i) & 1):
                g[:, i - N] = ['r'] * N
    if np.count_nonzero(g == '
        count += 1
print(count)

Solution (Python):
import numpy as np
H, W, K = [int(x) for x in input().split(" ")]
C = np.array([
  [True if x == "
  for _ in range(H)
], dtype=bool)

count = 0
for i in range(2**(H + W)):
    indicator = [i & 2**j != 0 for j in range(H + W)]
    Cc = C.copy()
    Cc[indicator[:H], :] = False
    Cc[:, indicator[H:]] = False
    if np.sum(Cc) == K:
        count += 1
print(count)

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 i2 in range(h):
            for j2 in range(w):
                if c[i2][j2]=='
                    black +=1
        if black == k:
            ans+=1
print(ans)

Solution (Python):
H,W,K=map(int,input().split())
x = [input() for i 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 x[i][j] == '
                    cnt +=1
        if K== cnt:
            ans +=1
            
print(ans)