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):
from sys import stdin
def main():
    
    readline=stdin.readline
    h,w,k=map(int,readline().split())
    grid=[readline().strip() for _ in range(h)]

    output_h=[]
    for i in range(1<<h):
        tmp=[]
        for j in range(h):
            if(i>>j)&1:
                tmp.append(j)
        output_h.append(tmp)
    
    output_w=[]
    for i in range(1<<w):
        tmp=[]
        for j in range(w):
            if(i>>j)&1:
                tmp.append(j)
        output_w.append(tmp)

    ans=0
    for li_h in output_h:
        for li_w in output_w:
            grid_after=[[True]*w for _ in range(h)]
            
            for i in li_h:
                for j in range(w):
                    grid_after[i][j]=False
            
            for j in li_w:
                for i in range(h):
                    grid_after[i][j]=False

            cnt=0
            for i in range(h):
                for j in range(w):
                    if grid_after[i][j]==True and grid[i][j]=="
                        cnt+=1
            
            if cnt==k:
                ans+=1

    print(ans)

if __name__=="__main__":
    main()

Solution (Python):

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]
ans = 0
for p_h in range(2**h):
    for p_w in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (p_h>>i)&1==0 and (p_w>>j)&1==0:
                    if c[i][j]=='
                        black +=1
        if black == k:
            ans += 1
print(ans)

Solution (Python):
H,W,K=map(int,input().split())
C=[input() for i in range(H)]
B=''.join(C).count('
from itertools import product
a=0
for p in product((0,1),repeat=H+W):
    b=B
    for h in range(H):
        for w in range(W):
            if C[h][w]=='
                b-=1
    if b==K:
        a+=1
print(a)

Solution (Python):
h,w,k=map(int,input().split())
c=[list(input()) for i in range(h)]
ans=0
for maskR in range(1<<h):
    for maskC in range(1<<w):
        black=0
        for i in range(h):
            for j in range(w):
                if ((maskR>>i)&1)==0 and ((maskC>>j)&1)==0 and c[i][j]=="
                    black+=1
        if black==k:
            ans+=1

print(ans)

Solution (Python):
H, W, K = map(int, input().split())
C = []
for h in range(0, H):
    c = str(input())
    C.append(c)
ans = 0
for h in range(0, 2**H):
    for w in range(0, 2**W):
        cnt = 0
        for i in range(0, H):
            for j in range(0, W):
                if ((h >> i) & 1) and ((w >> j) & 1) and (C[i][j] == '
                    cnt += 1
        if cnt == 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 maskR in range(1<<h):
    for maskC in range(1<<w):
        black=0
        for i in range(h):
            for j in range(w):
                if ((maskR>>i)&1)==0 and ((maskC>>j)&1)==0 and c[i][j]=='
                    black+=1
        if black==k:
            ans+=1
print(ans)

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

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

Solution (Python):
import copy
h,w,k=map(int,input().split())
data=[input() for i in range(h)]
ans=0
for i in range(2**h):
    for j in range(2**w):
        cp=copy.deepcopy(data)
        cnt=0
        for a in range(h):
          for l in range(w):
            if i>>a&1==1 and j>>l&1==1 and cp[a][l]=="
              cnt+=1
        if k==cnt:
          ans+=1
print(ans)

Solution (Python):
h, w, k= (int(x) for x in input().split())


ans=0
x=['' for i in range(h)]

for i in range(h):
  x[i]=input()


for i in range(2**w):
    w1 = format(i, 'b').zfill(w)
    
    for i in range(2**h):
        h1 = format(i, 'b').zfill(h)
    
        count=0
        for i in range(w):
            for j in range(h):
                if w1[i]=='0' and h1[j]=='0':
                    if x[j][i]=='
                        count+=1
        if count==k:
            ans+=1

print(ans)

Solution (Python):
import numpy as np

H,W,K = map(int,input().split())
lst = []
for i in range(H):
    s = input()
    lst = np.append(lst,[*s])
lst = lst.reshape(H,W)


ans = 0
for h in range(1 << H):
    for w in range(1 << W):
        tmp = lst.copy()
        for hh in range(H):
            for ww in range(W):
                if ((h >> hh) & 1) == 1:
                    tmp[-1-hh,:] = "!"
                if ((w >> ww) & 1) == 1:
                    tmp[:,-1-ww] = "!"    
        
        if np.count_nonzero(tmp == "
            ans += 1
        
print(ans)

Solution (Python):
from copy import deepcopy
h, w, k = map(int, input().split())
C = [[c for c in input()] for i in range(h)]

def subsets(n):
    result = [[]]
    for i in range(n):
        for j in range(len(result)):
            current = result[j]
            result.append(current+[i])
    return result

def countExceptForIndices(rows, columns):
    cnt = 0
    for i in range(h):
        if i in rows:
            continue
        for j in range(w):
            if j in columns:
                continue
            if C[i][j] == "
                cnt += 1
    return cnt
redRows = subsets(h)
redColumns = subsets(w)
ans = 0
for r in redRows:
    for j in redColumns:
        if countExceptForIndices(r, j) == k:
            ans += 1 
print (ans)

Solution (Python):
H, W, K = map(int, input().split())
C = []
for i in range(H):
    C.append(input().rstrip())
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 != 1 and (w>>j)&1 != 1 and C[i][j] == "
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
h, w, k = map(int, input().split())
char_c = [0] * h

for i in range(h):
    c = input()
    char_c[i] = list(c)

ans = 0
for row_bit in range(2 ** h):
    for col_bit in range(2 ** w):
        count = 0
        for row in range(h):
            if ((row_bit >> row) & 1):
                continue
            for col in range(w):
                if ((col_bit >> col) & 1):
                    continue
                
                if char_c[row][col] == '
                    count += 1
            
        if count == k:
            ans += 1
print(ans)

Solution (Python):
def solve(row, col, l, H, W):
	K = 0
	for x, r in enumerate(row):
		if r == 1:
			for y in range(W):
				if l[x][y] == '
					K += 1
					if col[y] == 1:
						K -= 1
	for y, c in enumerate(col):
		if c == 1:
			for x in range(H):
				if l[x][y] == '
					K += 1
	return K

H, W, K  = map(int, input().split(" "))
l = []
num_black = 0
for i in range(H):
	l2 = list(input())
	num_black += sum([1 if x == '
	l.append(l2)


answer = 0
for i in range(2 ** (H + W)):
	binary = bin(i)[2:]
	t = [0] * ((H + W) - len(binary)) + [int(x) for x in binary]
	rows = t[:H]
	cols = t[H:]
	k = solve(rows, cols, l, H, W)
	if num_black - k == K:
		answer += 1

print(answer)

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

Solution (Python):

import sys
input = sys.stdin.readline


def ceil(x):
    if x != int(x):
        x = int(x) + 1;
    return x;
    

def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b);


def nCr(n, k): 
    if(k > n - k): 
        k = n - k 
    res = 1
    for i in range(k): 
        res = res * (n - i) 
        res = res / (i + 1) 
    return int(res) 


def upper_bound(a, x, lo=0, hi = None):
    if hi == None:
        hi = len(a);
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x:
            lo = mid+1
        else:
            hi = mid
    return lo


def primefs(n):
    
    primes = {}
    while(n%2 == 0 and n > 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0 and n > 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    
    
    return primes


def power(x, y, p): 
    res = 1
    x = x % p  
    if (x == 0) : 
        return 0
    while (y > 0) : 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
        y = y >> 1      
        x = (x * x) % p 
    return res 


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









def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];
    
    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;




def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x


def sieve(n): 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime


MAXN = int(1e5 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    




def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret
    
    


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

def str_array():
    return input().strip().split();


MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');




h, w, k = int_array(); a = [];
for _ in range(h):
    a.append(list(input().strip()));

this = [i + 1 for i in range(h + w)];
perms = [[]];
for i in this:
    new = [];
    for x in perms:
        new.append( x.copy() + [i] );
    perms += new;

ans = 0;
for p in perms:
    mine = [];
    for xx in a:
        mine.append( xx.copy());
    for i in p:
        if i <= h:
            for j in range(w):
                mine[i - 1][j] = '.';
        else:
            for j in range(h):
                mine[j][i - h - 1] = '.';
    cnt = 0;
    for i in range(h):
        for j in range(w):
            if mine[i][j] == '
                cnt += 1;
    if cnt == k:
        ans += 1;
print(ans);

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

ans = 0
for h in range(1<<H):
    for w in range(1<<W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if (h & (1<<i)) == 0 and (w & (1<<j)) == 0:
                    if A[i][j] == '
                        cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
from itertools import product
h,w,k=map(int,input().split())
idxs=[]
cols=[0]*w
clis=[]
al=0
k_score=0
def nir(x):
  if x=='
  else:return 0
  
for _ in range(h):
  tmp=list(map(nir, list(input())))
  clis.append(tmp)
  idxs.append(sum(tmp))
  al+=sum(tmp)
  for q in range(w):
    cols[q]+=tmp[q]
uu=product((0,1),repeat=h+w)
for bits in uu:
  idd=[]
  coll=[]
  for i in range(h):
    if bits[i]==1:idd.append(i)
  
  for i in range(w):
    if bits[i+h]==1:coll.append(i)
  
  s=al
  if not coll:
    for x in idd:s-=idxs[x]
  elif not idd:
    for y in coll:s-=cols[y]
  else:
    for x in idd:s-=idxs[x]
    for y in coll:s-=cols[y]
    for x in idd:
      for y in coll:
        s+=clis[x][y]
        
  if s==k:k_score+=1
    
print(k_score)

Solution (Python):
import itertools

h,w,k=map(int,input().split())
board=[list(input()) for _ in range(h)]
ans=0
for bit_col in itertools.product(range(2),repeat=h):
  for bit_row in itertools.product(range(2),repeat=w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if bit_col[i]==0 and bit_row[j]==0 and board[i][j]=='
          cnt+=1
    if cnt==k:
      ans+=1
print(ans)

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

ans = 0
for h in range(1<<H):
    for w in range(1<<W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if (h>>i)&1 == 0 and (w>>j)&1 == 0:
                    if Bords[i][j] == "
                        cnt += 1
        if cnt == K:
            ans += 1
            
print(ans)

Solution (Python):
H, W, K=map(int,input().split())
F = [input() for _ in range(H)]
ans = 0
for i in range(2**H):
  for j in range(2**W):
    cnt = 0
    for ii in range(H):
      for jj in range(W):
        if (i>>ii)%2==0 or (j>>jj)%2==0 or F[ii][jj]==".":
          continue
        cnt+=1
    if cnt==K:
      ans+=1
print(ans)

Solution (Python):
H, W, K=map(int,input().split())
F = [input() for _ in range(H)]
ans = 0 
for i in range(2**H):
  for j in range(2**W):
    cnt = 0
    for ii in range(H):
      for jj in range(W):
        if (i>>ii)%2==0 or (j>>jj)%2==0 or F[ii][jj]==".":
          continue
        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 maskR in range((1 << h) - 1):
    for maskC in range((1 << w) - 1):
        black = 0
        for i in range(h):
            for j in range(w):
                if ((maskR >> i) & 1) == 0 and ((maskC >> j) & 1) == 0:
                    if c[i][j] == '
                        black += 1
        if black == k:
            ans += 1
print(ans)

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


all = 0
for i in c:
  all += i.count("

ans = 0

for hh in range(2 ** h):
  for ww in range(2 ** w):
    
    cnt = 0
    
    for i in range(h):
      for j in range(w):
        
        if (hh >> i) & 1 == 0 and (ww >> j) & 1 == 0:
          if c[i][j] == "
            cnt += 1
    if cnt == k:
      ans += 1
print(ans)

Solution (Python):
import itertools as it
H,W,N=map(int,input().split())
c=[list(input()) for t in range(H)]
ans=0
for con in it.product(range(2),repeat=H):
  for row in it.product(range(2),repeat=W):
    count=0
    for h in range(H):
      for w in range(W):
        if c[h][w]=='
          count+=1
    if count==N:
      ans+=1
print(ans)

Solution (Python):
import copy
h,w,k=map(int, input().split())
mat = []
for i in range(h):
  s = list(input())
  mat.append(s)
total = 0
for y in range(2**h):
  for x in range(2**w):
    mat2 = copy.deepcopy(mat)
    y_bin = bin(y)[2:].zfill(h)
    x_bin = bin(x)[2:].zfill(w)
    
    for r in range(len(y_bin)):
      if y_bin[r] == "1":
        for c in range(w):
          mat2[r][c] = "."
    for c in range(len(x_bin)):
      if x_bin[c] == "1":
        for r in range(h):
          mat2[r][c] = "."
    count = 0
    for r in range(h):
      for c in range(w):
        if mat2[r][c] == "
          count += 1
          
    if count == k:
      total += 1
print(total)

Solution (Python):
h,w,k=map(int,input().split())
c=[]
for i in range(h):
    c.append(list(input()))
z=0
for i in range(h):
    for j in range(w):
        if c[i][j]=='
            z+=1
ans=0
for i in range(1<<h):
    for j in range(1<<w):
        tmp=0
        for ii in range(h):
            for jj in range(w):
                if (i&(1<<ii) or j&(1<<jj)) and c[ii][jj]=='
                    tmp+=1
        if tmp+k==z:
            ans+=1
print(ans)

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

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

Solution (Python):
from itertools import product

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

board = [[1 if x == '

ans = 0

for row in product([0, 1], repeat=H):
    for col in product([0, 1], repeat=W):
        
        blacks = sum([board[h][w] * row[h] * col[w] for h in range(H) for w in range(W)])
        if blacks == K:
            ans += 1
print(ans)

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

ans = 0
for bit_y in range(2 ** h):
    for bit_x in range(2 ** w):
        block = 0
        for y in range(h):
            for x in range(w):
                
                if bit_y >> y & 1 or bit_x >> x & 1 or c[y][x] != '
                    continue
                block += 1
        if block == 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):
H, W, K = map(int, input().split())
c = []
for _ in range(H):
    ver = list(map(str,input()))
    c.append(ver)


ans = 0
n = H + W
for i in range(1<<H):
    for j in range(1<<W):
        cnt = 0
        for I in range(H):
            for J in range(W):
                if((i >> I) & 1):
                    continue
                if((j >> 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())
masu_list = []
ans = 0
for i in range(H):
    masu_list.append(input())
    
for tate in range(2**H):
    for yoko in range(2**W):
        black = 0
        for i in range(H):
            for j in range(W):
                if format(tate>>i,"b")[-1] == "0" and format(yoko>>j,"b")[-1] == "0" and masu_list[i][j] == "
                    black += 1
        if black == K:
            ans += 1
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):
def Bit_Loop():
    h,w,k = map(int,input().split())
    field = [input() for i in range(h)]
    ans = 0
    for i in range(2 ** h):
        for j in range(2 ** w):
            black = 0
            for s in  range(h):
                for t in range(w):
                    if ((((i >> s) & 1) == 0) and (((j >> t) & 1) == 0) and field[s][t] == '
                        black += 1
            if black == k:
                ans += 1
    print(ans)

if __name__ == "__main__":
    Bit_Loop()

Solution (Python):
import itertools
import numpy as np
h, w, k = map(int, input().split())

grid = []
row_l = []
column_l = [0 for _ in range(w)]
for i in range(h):
    tmp = list(input())
    grid.append(tmp)
    row_l.append(tmp.count("
    for j in range(w):
        if tmp[j] == "



row_l = np.array(row_l)
column_l = np.array(column_l)
def dup(il,jl):
    sum = 0
    for i in il:
        for j in jl:
            if grid[i][j] == "
    return sum

to_remove = sum(row_l)-k
ans = 0

for i_n in range(0, h+1):
    for j_n in range(0, w+1):
        for i in itertools.combinations(range(h), i_n):
            for j in itertools.combinations(range(w),j_n):
                if to_remove == sum(row_l[list(i)])+sum(column_l[list(j)])-dup(i,j):
                    ans += 1

print(ans)

Solution (Python):
h,w,k=map(int,input().split())
c=[]
for i in range(h):
    cc=input()
    c.append(cc)
ans=0
for i in range(1<<h):
    for j in range(1<<w):
        b=0
        for ii in range(h):
            for jj in range(w):
                if(((i>>ii)&1)==0 and ((j>>jj)&1)==0):
                    if(c[ii][jj]=="
        if(b==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 i in product([0,1],repeat=h):
  for j in product([0,1],repeat=w):
    temp=0
    for m in range(h):
      for n in range(w):
        if i[m]==0 and j[n]==0 and c[m][n]=="
          temp+=1
    if temp==k:
      ans+=1
print(ans)

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

def main():
    H,W,K = map(int, readline().split())
    C = [readline().strip() for _ in range(H)]
    
    ans = 0
    for i in range(2**H):
        for j in range(2**W):
            cnt = 0
            for s in range(H):
                for t in range(W):
                    if (i >> s) & 1 and (j >> t) & 1 and C[s][t] == "
                        cnt += 1
            if cnt == K:
                ans += 1

    print(ans)


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 bit in product((0, 1), repeat=H):
    for bit2 in product((0, 1), repeat=W):
        k = 0
        for i in range(H):
            for j in range(W):
                if C[i][j] == '
                    k += 1
        if k == K:
            ans += 1

print(ans)

Solution (Python):
H,W,K=map(int,input().split())
li=[input() for _ in range(H)]
ans=0
for ir in range(1<<H):
  for jr in range(1<<W):
    cnt=0
    for i in range(H):
      if (ir>>i)&1:continue
      for j in range(W):
        if (jr>>j)&1:continue
        cnt+=li[i][j]=="
    if cnt==K:
      ans+=1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
M = [input() for _ in range(H)]
ans = 0
for h in range(1 << H):
    hse = set()
    for hh in range(H):
        if h&(1<<hh):
            hse.add(hh)
    for w in range(1 << W):
        cnt = 0
        wse = set()
        for ww in range(W):
            if w&(1<<ww):
                wse.add(ww)
        for hhh in range(H):
            for www in range(W):
                if hhh in hse: continue
                if www in wse: continue
                if M[hhh][www] == "
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
C = []
for i in range(H):
  cs = input()
  C.append(cs)
s = set()
for i in range(H):
  for j in range(W):
    if C[i][j] == "
      s.add((i, j))
r = 0
for n in range(1<<(H+W)):
  si = set()
  sj = set()
  for i in range(H+W):
    if n&(1<<i) != 0:
      if i < H:
        si.add(i)
      else:
        sj.add(i-H)
  k = 0
  for i, j in s:
    if (i not in si) and (j not in sj):
      k += 1
  if k == K:
    r += 1
print(r)

Solution (Python):
import copy
H,W,K = map(int, input().split())
board = [0]*H

def retunuru(x):
    for j in range(H):
        if ((x>>j)&1):
            new_board_num[j] = [5]*W

def gyonuru(y):
    for l in range(W):
        if ((y>>l)&1):
            for a in range(H):
                new_board_num[a][l]=5

for i in range(H):
    board[i] = input()

board_num = [[0]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        if board[i][j]==".":
            board_num[i][j] = 0
        else:
            board_num[i][j] = 1


ans = 0
new_board_num = copy.deepcopy(board_num)
for i in range(2**H):
    total = 0
    for k in range(2**W):
        retunuru(i)
        gyonuru(k)
        for x in range(H):
            for y in range(W):
                if new_board_num[x][y]==1:
                    total+=1
        
        
        

        if total == K:
            ans +=1
            
        new_board_num = copy.deepcopy(board_num)

        total = 0
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
C = []
sum = 0
count = 0
ans = 0
for i in range(H):
    c = input()
    
    C.append(c)
    sum += c.count("

for h in range(2 ** H):
    for w in range(2 ** W):
        for h2 in range(H):
            if (h >> h2) & 1:
                continue
            for w2 in range(W):
                if (w >> w2) & 1:
                    continue
                if C[h2][w2] == "
                    count += 1
        if count == K:
            ans += 1
        count = 0

print(ans)

Solution (Python):
h, w, k = map(int, input().split())
c = []
for _ in range(h):
    c.append(list(input()))
def calc_black_cnt(maskR, maskC):
    cnt = 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] == '
                cnt += 1
    return cnt
ans = 0
for maskR in range(1<<h):
    for maskC in range(1<<w):
         if calc_black_cnt(maskR, maskC) == k:
                ans += 1
print(ans)

Solution (Python):
H,W,K = list(map(int,input().split()))
c = []
for i in range(H):
    c.append(list(input()))
ans = 0
H_pattern,W_pattern = 2**H,2**W
for i in range(0,H_pattern):
    for j in range(0,W_pattern):
        H_active_arr,W_active_arr=list(bin((H_pattern-1)&i)[2:].zfill(H)),list(bin((W_pattern-1)&j)[2:].zfill(W))
        count = 0
        for k,arr in enumerate(c):
            for l,item in enumerate(arr):
                if H_active_arr[k] == "1" and W_active_arr[l] == "1" and item == "
                    count += 1
        if count == K:
            ans += 1
print(ans)

Solution (Python):


import itertools
import numpy as np

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

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


c = np.array(c)

ans = 0
for h_flag in itertools.product([0, 1], repeat=h):
    h_flag = [i for i, j in enumerate(h_flag) if j == 1]
    for w_flag in itertools.product([0, 1], repeat=w):
        w_flag = [i for i, j in enumerate(w_flag) if j == 1]
        
        c_ = c[:]
        c_ = np.take(c_, h_flag, axis=0)
        
        c_ = np.take(c_, w_flag, axis=1)
        

        if np.sum(c_ == "
            ans += 1

print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    h, w, k = nm()
    ans = 0
    C = [ns() for _ in range(h)]

    def calc(bi, bj):
        res = 0
        for i in range(h):
            for j in range(w):
                if bi & (1 << i) and bj & (1 << j) and C[i][j] == '
                    res += 1
        return res


    for bi in range(1 << h):
        for bj in range(1 << w):
            ans += (calc(bi, bj) == k)
    print(ans)
    return

solve()

Solution (Python):

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

l=[list(input()) for i in range(h)]
rowl=[]
coll=[]

def count_black(l2d):
    res=0
    for l in l2d:
        res+=l.count('
    return res

for i in range(2**h):
    temp=[]
    for k in range(h):
        if ((i >> k) & 1):
            temp.append(k)
    rowl.append(temp)
for j in range(2**w):
    temp=[]
    for k in range(w):
        if ((j >> k) & 1):
            temp.append(k)
    coll.append(temp)

count=0

rowall=["r" for i in range(w)]
for row in rowl:
    for col in coll:
        test=copy.deepcopy(l)
        for i in row:
            test[i]=rowall
        for j in col:
            for i in range(h):
                test[i][j]='r'
        if count_black(test)==K:
            count+=1

print(count)

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

c = [input() for _ in range(H)]

ans = 0
for h in range(1 << H):
    for w in range(1 << W):
        k = 0
        for i in [i for i in range(H) if not h & (1 << i)]:
            for j in [j for j in range(W) if not w & (1 << j)]:
                if c[i][j] == "
                    k += 1
        if k == 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 col in range(2 ** w):
        a = [[0 for _ in range(w)] for _ in range(h)]
        for i in range(h):
            for j in range(w):
                if row & (1 << i) or col & (1 << j):
                    a[i][j] = '.'
                else:
                    a[i][j] = c[i][j]
        black = 0
        for line in a:
            for cell in line:
                if cell == '
                    black += 1
        if black == k:
            ans += 1
print(ans)