Buggy python submission (verdict: Time Limit Exceeded):
import itertools
from copy import deepcopy
from dataclasses import dataclass, field
from typing import List


@dataclass
class Cell:
    i: int
    j: int
    color: str

    def to_red(self):
        return Cell(self.i, self.j, color='R')


@dataclass
class Board:
    cells: List[Cell] = field(default_factory=list)
    count: int = 0

    @classmethod
    def create(cls, H: int, W: int, C: List[str]):
        cells = []
        for i in range(H):
            for j in range(W):
                cell = Cell(i + 1, j + 1, C[i][j])
                cells.append(cell)

        return Board(cells)

    def count_black(self) -> int:
        return len([c for c in self.cells if c.color == '#'])

    def paint_row(self, row: int):
        new_cells = []

        for cell in self.cells:
            if cell.i == row:
                new_cells.append(cell.to_red())
            else:
                new_cells.append(cell)

        return Board(new_cells)

    def paint_col(self, col: int):
        new_cells = []

        for cell in self.cells:
            if cell.j == col:
                new_cells.append(cell.to_red())
            else:
                new_cells.append(cell)

        return Board(new_cells)


def actual(H, W, K, C):
    count = 0

    board_org = Board.create(H, W, C)

    patterns = list(itertools.product(range(2), repeat=H + W))

    for pattern in patterns:
        board = deepcopy(board_org)
        row_info = pattern[:H]
        col_info = pattern[H:]

        for row_idx, row in enumerate(row_info, start=1):
            if row == 1:
                board = board.paint_row(row_idx)

        for col_idx, col in enumerate(col_info, start=1):
            if col == 1:
                board = board.paint_col(col_idx)

        if board.count_black() == K:
            count += 1

    return count

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

print(actual(H, W, K, C))  

Fixed submission:
import itertools
from dataclasses import dataclass, field
from typing import List


@dataclass
class Cell:
    i: int
    j: int
    color: str

    def to_red(self):
        return Cell(self.i, self.j, color='R')


@dataclass
class Board:
    cells: List[Cell] = field(default_factory=list)
    count: int = 0

    @classmethod
    def create(cls, H: int, W: int, C: List[List[str]]):
        cells = []
        for i in range(H):
            for j in range(W):
                cell = Cell(i + 1, j + 1, C[i][j])
                cells.append(cell)

        return Board(cells)

    def count_black(self) -> int:
        return len([c for c in self.cells if c.color == '#'])

    def paint_row(self, row: int):
        new_cells = []

        for cell in self.cells:
            if cell.i == row:
                new_cells.append(cell.to_red())
            else:
                new_cells.append(cell)

        return Board(new_cells)

    def paint_col(self, col: int):
        new_cells = []

        for cell in self.cells:
            if cell.j == col:
                new_cells.append(cell.to_red())
            else:
                new_cells.append(cell)

        return Board(new_cells)


def actual(H, W, K, C):
    count = 0

    patterns = list(itertools.product(range(2), repeat=H + W))

    for pattern in patterns:
        board = Board.create(H, W, C)

        row_info = pattern[:H]
        col_info = pattern[H:]

        for row_idx, row in enumerate(row_info, start=1):
            if row == 1:
                board = board.paint_row(row_idx)

        for col_idx, col in enumerate(col_info, start=1):
            if col == 1:
                board = board.paint_col(col_idx)

        if board.count_black() == K:
            count += 1

    return count

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

print(actual(H, W, K, C))