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 collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    h,w,K = LI()
    c = [list(input()) for i in range(h)]
    for i in range(h):
        for j in range(w):
            if c[i][j] == "
                c[i][j] = 1
            else:
                c[i][j] = 0
    n = h+w
    ans = 0
    for b in range(1<<n):
        nc = [[i for i in j] for j in c]
        for i in range(n):
            if (b>>i)&1:
                if i < h:
                    for k in range(w):
                        nc[i][k] = 0
                else:
                    j = i-h
                    for k in range(h):
                        nc[k][j] = 0
        s = sum([sum(i) for i in nc])
        if s == K:
            ans += 1
    print(ans)
    return


if __name__ == "__main__":
    solve()

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

ans = 0
for R in range(2**H):
  for C in range(2**W):
    n = 0
    for y in range(H):
      if R>>y&1:
        for x in range(W):
          if C>>x&1:
            if c[y][x]=="
              n += 1
    if n==K:
      ans += 1
print(ans)

Solution (Python):
h, w, kk = map(int, input().split())
c = [[i == "
ans = 0
for i in range(2**h):
    for j in range(2**w):
        d =[x[:] for x in c]

        for k in range(h):
            if (i>>k)&1==1:
                for l in range(w):
                    d[k][l] = 0
        
        for k in range(w):
            if (j >> k) & 1 == 1:
                for l in range(h):
                    d[l][k] = 0
        
        if kk == sum(map(sum,d)):
            ans += 1
print(ans)

Solution (Python):
H, W, K = map(int, input().split())
c = [input().rstrip() for _ in range(H)]
ans = 0
for biti in range(1 << H):
    for bitj in range(1 << W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if c[i][j] == '
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
h,w,k=map(int,input().split())
ans=0
maze=[input()for i in range(h)]
for i in range(2**h):
    for j in range(2**w):
        tate={c for c in range(h)if (i>>c)%2 }
        yoko={c for c in range(w)if (j>>c)%2 }
        cnt=0
        for x in range(h):
            if x in tate:continue
            for y in range(w):
                if y in yoko:continue
                cnt+=int(maze[x][y]=="
        if cnt==k:ans+=1
print(ans)

Solution (Python):
from itertools import product
H,W,K=map(int, input().split())
C=[input()for _ in range(H)]
ans=0
for hp in product([True,False], repeat=H):
    for wp in product([True,False], repeat=W):
        cnt = 0
        for h in range(H):
            for w in range(W):
                if C[h][w]=="
                    cnt += 1
        if cnt==K:
            ans+=1
print(ans)

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

Solution (Python):
H,W,K=map(int,input().split())
S=[input() for i in range(H)]
P=0
Q=0
for i in range(1<<H):
  for j in range(1<<W):
    Q=0
    for k in range(H):
      for l in range(W):
        if S[k][l]=='
          Q+=1
    if Q==K:
      P+=1
print(P)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip('\n')

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

r = 0
for rows in range(1<<H):
	for cols in range(1<<W):
		bl = 0
		for y, l in enumerate(C):
			if rows & (1<<y): continue

			for x, c in enumerate(l):
				if cols & (1<<x): continue

				if c == '

		if bl == K:
			r += 1
print(r)

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    H, W, K = map(int, input().split())
    grid = []
    for _ in range(H):
        grid.append(input().rstrip('\n'))

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


if __name__ == '__main__':
    main()

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

ans = 0
for i in range(2**H):
    I = []
    for k in range(H):
        if i & (1<<k) > 0:
            I.append(k)
    for j in range(2**W):
        J = []
        for k in range(W):
            if j & (1<<k) > 0:
                J.append(k)
        cnt = 0
        for a in range(H):
            if a in I:
                continue
            for b in range(W):
                if b in J:
                    continue
                if C[a][b] == "
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

from decimal import *
import heapq
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

h, w, k = MAP()
c = [STR() for _ in range(h)]
ans = 0
for i in range(2 ** h):
    for j in range(2 ** w):
        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 copy
h, w, K = map(int, input().split())
g = [list(input()) for i in range(h)]
ans = 0
for i in range(2**h):

    i = format(i, "0{}b".format(h))
    for j in range(2**w):
        j = format(j, "0{}b".format(w))

        c = copy.deepcopy(g)
        for k in range(h):
            if i[k] == "1":
                for l in range(w):
                    c[k][l] = "."
        for k in range(w):
            if j[k] == "1":
                for l in range(h):
                    c[l][k] = "."

        count = 0
        for a in range(h):
            for b in range(w):
                if c[a][b] == "
                    count += 1

        if count == K:
            ans += 1

print(ans)

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

for i in range(2**H):
    for j in range(2**W):
        test=0
        for k in range(H*W):
            h=k//W
            w=k%W
            if i>>h&1==0 and j>>w&1==0:
                test+=(c[h][w]=="
        ans+=(test==K)

print(ans)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]





H, W, K = mi()
C = [input() for i in range(H)]

B_i = 2 ** H
B_j = 2 ** W

ans = 0
for x in range(B_i):
    for y in range(B_j):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if (x & (1 << i)) or y & (1 << j):
                    continue
                if C[i][j] == '
                    cnt += 1
        if cnt == K:
            ans += 1
                
print(ans)

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    H,W,K=MI()
    C=[]
    for i in range(H):
        c=input()
        C.append(c)
    
    import itertools
    ans=0
    for ite in itertools.product([0,1], repeat=H+W):
        temp=0
        for i in range(H):
            for j in range(W):
                if ite[i]==1 or ite[j+H]==1:
                    pass
                else:
                    if C[i][j]=="
                        temp+=1
        if temp==K:
            ans+=1
            
    print(ans)

main()

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 x in range(h):
			for y in range(w):
				if (i >> x) & 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())

c = []
ans = 0

for i in range(H):

    tmp =list(input())
    c.append(tmp)

for i in range(2**H):

    for j in range(2**W):

        now = 0
        for x in range(H):
            for y in range(W):

                if 2**x & i > 0 and 2**y & j > 0:
                    if c[x][y] == "
                        now += 1

        if now == K:
            ans += 1

print (ans)