





"""simple docstring"""
from collections import defaultdict






class  _SCREAMING_SNAKE_CASE:




       def __init__(						self		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)      ->				Dict:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :Any		    =  total  # total no of tasks (N)

             # DP table will have a dimension of (2^M)*N
             # initially all values are set to -1
             __SCREAMING_SNAKE_CASE       :Tuple		    =  [
                 [-1 for i in range(total + 1							)] for j in range(2 ** len(SCREAMING_SNAKE_CASE__							)							)
             ]

             __SCREAMING_SNAKE_CASE       :List[Any]		    =  defaultdict(SCREAMING_SNAKE_CASE__							)  # stores the list of persons for each task

             # final_mask is used to check if all persons are included by setting all bits
             # to 1
             __SCREAMING_SNAKE_CASE       :Dict		    =  (1 << len(SCREAMING_SNAKE_CASE__							)) - 1




       def    _UpperCamelCase					(						self		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)      ->				str:





             """simple docstring"""






             if mask == self.final_mask:
                   return 1

             # if not everyone gets the task and no more tasks are available, return 0
             if task_no > self.total_tasks:
                   return 0

             # if case already considered
             if self.dp[mask][task_no] != -1:
                   return self.dp[mask][task_no]

             # Number of ways when we don't this task in the arrangement
             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  self.count_ways_until(SCREAMING_SNAKE_CASE__		,task_no + 1							)

             # now assign the tasks one by one to all possible persons and recursively
             # assign for the remaining tasks.
             if task_no in self.task:
                   for p in self.task[task_no]:
                         # if p is already given a task
                         if mask & (1 << p):
                               continue

                         # assign this task to p and change the mask value. And recursively
                         # assign tasks with the new mask value.
                         total_ways_util += self.count_ways_until(mask | (1 << p)		,task_no + 1							)

        # save the value.
             __SCREAMING_SNAKE_CASE       :Dict		    =  total_ways_util

             return self.dp[mask][task_no]




       def    _UpperCamelCase					(						self		,SCREAMING_SNAKE_CASE__							)      ->				Dict:





             """simple docstring"""






             for i in range(len(SCREAMING_SNAKE_CASE__							)							):
                   for j in task_performed[i]:
                         self.task[j].append(SCREAMING_SNAKE_CASE__							)

        # call the function to fill the DP table, final answer is stored in dp[0][1]
             return self.count_ways_until(0		,1							)


if __name__ == "__main__":
  lowerCamelCase_       =		5  # total no of tasks (the value of N)

  # the list of tasks that can be done by M persons.
  lowerCamelCase_       =		[[1, 3, 4], [1, 2, 5], [3, 4]]
  print(
      AssignmentUsingBitmask(task_performed, total_tasks).count_no_of_ways(
          task_performed
      )
  )






"""simple docstring"""
import colorsys

from PIL import Image  # type: ignore



def 					__lowerCamelCase       (							a_					:		float			,       a_					:		float			,       a_					:		int							)      ->				float:
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  x
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  y
      for step in range(a_							):  # noqa: B007
            __SCREAMING_SNAKE_CASE       :Dict		    =  a * a - b * b + x
            __SCREAMING_SNAKE_CASE       :Tuple		    =  2 * a * b + y
            __SCREAMING_SNAKE_CASE       :Dict		    =  a_new

            # divergence happens for all complex number with an absolute value
            # greater than 4
            if a * a + b * b > 4:
                  break
      return step / (max_step - 1)



def 					__lowerCamelCase       (							a_					:		float							)      ->				tuple:
      if distance == 1:
            return (0, 0, 0)
      else:
            return (2_55, 2_55, 2_55)



def 					__lowerCamelCase       (							a_					:		float							)      ->				tuple:
      if distance == 1:
            return (0, 0, 0)
      else:
            return tuple(round(i * 2_55							) for i in colorsys.hsv_to_rgb(a_			,       1			,       1							)							)



def 					__lowerCamelCase       (							a_					:		int = 8_00			,       a_					:		int = 6_00			,       a_					:		float = -0.6			,       a_					:		float = 0			,       a_					:		float = 3.2			,       a_					:		int = 50			,       a_					:		bool = True			,       )      ->				Image.Image:
      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  Image.new('''RGB'''			,       (image_width, image_height)							)
      __SCREAMING_SNAKE_CASE       :Tuple		    =  img.load()

      # loop through the image-coordinates
      for image_x in range(a_							):
            for image_y in range(a_							):
                  # determine the figure-coordinates based on the image-coordinates
                  __SCREAMING_SNAKE_CASE       :Dict		    =  figure_width / image_width * image_height
                  __SCREAMING_SNAKE_CASE       :str		    =  figure_center_x + (image_x / image_width - 0.5) * figure_width
                  __SCREAMING_SNAKE_CASE       :Tuple		    =  figure_center_y + (image_y / image_height - 0.5) * figure_height

                  __SCREAMING_SNAKE_CASE       :List[Any]		    =  get_distance(a_			,       a_			,       a_							)

                  # color the corresponding pixel based on the selected coloring-function
                  if use_distance_color_coding:
                        __SCREAMING_SNAKE_CASE       :Optional[int]		    =  get_color_coded_rgb(a_							)
                  else:
                        __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  get_black_and_white_rgb(a_							)

      return img


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  # colored version, full figure
  lowerCamelCase_       =		get_image()

  # uncomment for colored version, different section, zoomed in
  # img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
  # figure_width = 0.8)

  # uncomment for black and white version, full figure
  # img = get_image(use_distance_color_coding = False)

  # uncomment to save the image
  # img.save("mandelbrot.png")

  img.show()