


"""simple docstring"""


from __future__ import annotations




def   snake_case		(     UpperCamelCase__       :						list[list[int]]    )   ->      bool:
      lowerCamelCase					:					Dict        =	len(UpperCamelCase__    )
      # We need to create solution object to save path.
      lowerCamelCase					:					Any        =	[[0 for _ in range(UpperCamelCase__    )] for _ in range(UpperCamelCase__    )]
      lowerCamelCase					:					Dict        =	run_maze(UpperCamelCase__			,				0			,				0			,				UpperCamelCase__    )
      if solved:
            print("""\n""".join(str(UpperCamelCase__    ) for row in solutions    )    )
      else:
            print("""No solution exists!"""    )
      return solved




def   snake_case		(     UpperCamelCase__       :						list[list[int]]			,				UpperCamelCase__       :						int			,				UpperCamelCase__       :						int			,				UpperCamelCase__       :						list[list[int]]    )   ->      bool:
      lowerCamelCase					:					Any        =	len(UpperCamelCase__    )
      # Final check point.
      if i == j == (size - 1):
            lowerCamelCase					:					int        =	1
            return True

      lowerCamelCase					:					int        =	(not i < 0) and (not j < 0)  # Check lower bounds
      lowerCamelCase					:					Optional[int]        =	(i < size) and (j < size)  # Check upper bounds

      if lower_flag and upper_flag:
            # check for already visited and block points.
            lowerCamelCase					:					List[Any]        =	(not solutions[i][j]) and (not maze[i][j])
            if block_flag:
                  # check visited
                  lowerCamelCase					:					str        =	1

                  # check for directions
                  if (
                      run_maze(UpperCamelCase__			,				i + 1			,				UpperCamelCase__			,				UpperCamelCase__    )
                      or run_maze(UpperCamelCase__			,				UpperCamelCase__			,				j + 1			,				UpperCamelCase__    )
                      or run_maze(UpperCamelCase__			,				i - 1			,				UpperCamelCase__			,				UpperCamelCase__    )
                      or run_maze(UpperCamelCase__			,				UpperCamelCase__			,				j - 1			,				UpperCamelCase__    )
                  ):
                        return True

                  lowerCamelCase					:					Optional[int]        =	0
                  return False
      return False


if __name__ == "__main__":
    import doctest

    doctest.testmod()








"""simple docstring"""


import unittest

from knapsack import greedy_knapsack as kp


class 			A__	(						unittest.TestCase):


     """simple docstring"""

     def 		a__						(	self:						Optional[int]	)->    Union[str, Any]:
           lowerCamelCase					:					Tuple        =	[10, 20, 30, 40, 50, 60]
           lowerCamelCase					:					Union[str, Any]        =	[2, 4, 6, 8, 10, 12]
           lowerCamelCase					:					Union[str, Any]        =	100
           self.assertEqual(kp.calc_profit(__a     ,		__a     ,		__a	)     ,		210	)

     def 		a__						(	self:						str	)->    str:
           self.assertRaisesRegex(__a     ,		"""max_weight must greater than zero."""	)

     def 		a__						(	self:						str	)->    List[Any]:
           self.assertRaisesRegex(__a     ,		"""Weight can not be negative."""	)

     def 		a__						(	self:						Any	)->    Dict:
           self.assertRaisesRegex(__a     ,		"""Profit can not be negative."""	)

     def 		a__						(	self:						Optional[Any]	)->    List[Any]:
           self.assertRaisesRegex(__a     ,		"""max_weight must greater than zero."""	)







     def 		a__						(	self:						Optional[Any]	)->    Tuple:
           self.assertRaisesRegex(
               __a     ,		"""The length of profit and weight must be same."""	)


if __name__ == "__main__":
    unittest.main()




