Problem:
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.

Incorrect submission (verdict: Wrong Answer):
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  5 21:10:49 2020

@author: Aruto Hosaka
"""


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

# H,W,K = 6,6,8
# C = ['..##..', '.#..#.', '#....#', '######', '#....#', '#....#']

# H,W,K = 6,6,8
# C = [['..##..'], ['.#..#.'], ['#....#'], ['######'], ['#....#'], ['#....#']]

Cn = [[0 for w in range(W)] for h in range (H)]

for h in range(H):
    for w in range(W):
        if C[h][w] == '.':
            Cn[h][w] = 0
        else:
            Cn[h][w] = 1

counter1 = 0

ii = 0

for i in range(2**H):

    for j in range(2**W):
    # for j in range(2):
        i = ii
        for h in reversed(range(H)):
            if i >= 2**h:
                for w2 in range(W):
                    Cn[h][w2] = 0
                i += -2**h
        for w in reversed(range(W)):
            if j >= 2**w:
                for h2 in range(H):
                    Cn[h2][w] = 0
                j += -2**w
        counter = 0
        for h in range(H):    
            counter += sum(Cn[h])
        
        print(Cn)
        print(counter)
        if counter == K:
            counter1 += 1
        
        for h in range(H):
            for w in range(W):
                if C[h][w] == '.':
                    Cn[h][w] = 0
                else:
                    Cn[h][w] = 1
    ii += 1

Fixed, accepted submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Jul  5 21:10:49 2020

@author: Aruto Hosaka
"""


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

# H,W,K = 6,6,8
# C = ['..##..', '.#..#.', '#....#', '######', '#....#', '#....#']

# H,W,K = 6,6,8
# C = [['..##..'], ['.#..#.'], ['#....#'], ['######'], ['#....#'], ['#....#']]

Cn = [[0 for w in range(W)] for h in range (H)]

for h in range(H):
    for w in range(W):
        if C[h][w] == '.':
            Cn[h][w] = 0
        else:
            Cn[h][w] = 1

counter1 = 0

ii = 0

for i in range(2**H):

    for j in range(2**W):
    # for j in range(2):
        i = ii
        for h in reversed(range(H)):
            if i >= 2**h:
                for w2 in range(W):
                    Cn[h][w2] = 0
                i += -2**h
        for w in reversed(range(W)):
            if j >= 2**w:
                for h2 in range(H):
                    Cn[h2][w] = 0
                j += -2**w
        counter = 0
        for h in range(H):    
            counter += sum(Cn[h])
        
        if counter == K:
            counter1 += 1
        
        for h in range(H):
            for w in range(W):
                if C[h][w] == '.':
                    Cn[h][w] = 0
                else:
                    Cn[h][w] = 1
    ii += 1
print(counter1)