


'''simple docstring'''

def _SCREAMING_SNAKE_CASE   (A						,				A						,				A						,				A ) -> int:






       """simple docstring"""







       return len_board * len_board_column * row + column

def _SCREAMING_SNAKE_CASE   (A						,				A						,				A						,				A						,				A						,				A						,				) -> bool:






       """simple docstring"""







       if board[row][column] != word[word_index]:
              return False

       if word_index == len(A ) - 1:
              return True

       lowercase__       =				[(0, 1), (0, -1), (-1, 0), (1, 0)]
       lowercase__       =				len(A )
       lowercase__       =				len(board[0] )
       for direction in traverts_directions:
              lowercase__       =				row + direction[0]
              lowercase__       =				column + direction[1]
              if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
                     continue

              lowercase__       =				get_point_key(A						,				A						,				A						,				A )
              if key in visited_points_set:
                     continue

              visited_points_set.add(A )
              if exits_word(A						,				A						,				A						,				A						,				word_index + 1						,				A ):
                     return True

              visited_points_set.remove(A )

       return False

def _SCREAMING_SNAKE_CASE   (A						,				A ) -> bool:






       """simple docstring"""







       lowercase__       =				(
           '''The board should be a non empty matrix of single chars strings.'''
       )

       lowercase__       =				len(A )
       if not isinstance(A						,				A ) or len(A ) == 0:
              raise ValueError(A )

       for row in board:
              if not isinstance(A						,				A ) or len(A ) == 0:
                     raise ValueError(A )

              for item in row:
                     if not isinstance(A						,				A ) or len(A ) != 1:
                            raise ValueError(A )

    # Validate word
       if not isinstance(A						,				A ) or len(A ) == 0:
              raise ValueError(
                  '''The word parameter should be a string of length greater than 0.''' )

       lowercase__       =				len(board[0] )
       for i in range(A ):
              for j in range(A ):
                     if exits_word(
                         A						,				A						,				A						,				A						,				0						,				{get_point_key(A						,				A						,				A						,				A )} ):
                            return True

       return False


if __name__ == "__main__":
 import doctest

 doctest.testmod()








'''simple docstring'''

from __future__ import annotations

from collections import Counter

def _SCREAMING_SNAKE_CASE   (A ) -> list[int]:






       """simple docstring"""







       lowercase__       =				[True] * n
       lowercase__       =				False
       lowercase__       =				False
       lowercase__       =				True

       for i in range(3						,				int(n**0.5 + 1 )						,				2 ):
              lowercase__       =				i * 2
              while index < n:
                     lowercase__       =				False
                     lowercase__       =				index + i

       lowercase__       =				[2]

       for i in range(3						,				A						,				2 ):
              if is_prime[i]:
                     primes.append(A )

       return primes

def _SCREAMING_SNAKE_CASE   (A ) -> list[list[int]]:






       """simple docstring"""







       lowercase__       =				str(A )
       lowercase__       =				[]
       lowercase__       =				['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']

       for duplicate in Counter(A ) - Counter(set(A ) ):
              lowercase__       =				[int(number_str.replace(A						,				A ) ) for digit in digits]
              replacements.append(A )

       return replacements

def _SCREAMING_SNAKE_CASE   (A = 8 ) -> int:






       """simple docstring"""







       lowercase__       =				set()

       # Filter primes with less than 3 replaceable digits
       lowercase__       =				{
           x for x in set(prime_sieve(1_000_000 ) ) if len(str(A ) ) - len(set(str(A ) ) ) >= 3
       }

       for prime in primes:
              if prime in numbers_checked:
                     continue

              lowercase__       =				digit_replacements(A )

              for family in replacements:
                     numbers_checked.update(A )
                     lowercase__       =				primes.intersection(A )

                     if len(A ) != family_length:
                            continue

                     return min(A )

       return -1


if __name__ == "__main__":
 print(solution())




