




from __future__ import annotations

from collections import deque





class 					__lowerCamelCase			:




    """simple docstring"""

    def __init__(			self	:	Any  ,      SCREAMING_SNAKE_CASE__	:	list[str]  ) ->			Optional[int]:
         lowerCAmelCase__            =					[]
         self.adlist.append(
             {"value": "", "next_states": [], "fail_state": 0, "output": []}  )

         for keyword in keywords:
              self.add_keyword(SCREAMING_SNAKE_CASE__  )
         self.set_fail_transitions()


    def   a (			self	:	List[str]  ,      SCREAMING_SNAKE_CASE__	:	int  ,      SCREAMING_SNAKE_CASE__	:	str  ) ->			int | None:
         for state in self.adlist[current_state]["next_states"]:
              if char == self.adlist[state]["value"]:
                   return state
         return None


    def   a (			self	:	List[str]  ,      SCREAMING_SNAKE_CASE__	:	str  ) ->			None:
         lowerCAmelCase__            =					0
         for character in keyword:
              lowerCAmelCase__            =					self.find_next_state(SCREAMING_SNAKE_CASE__  ,      SCREAMING_SNAKE_CASE__  )
              if next_state is None:
                   self.adlist.append(
                       {
                           "value": character,
                           "next_states": [],
                           "fail_state": 0,
                           "output": [],
                       }  )
                   self.adlist[current_state]["next_states"].append(len(self.adlist  ) - 1  )
                   lowerCAmelCase__            =					len(self.adlist  ) - 1
              else:
                   lowerCAmelCase__            =					next_state
         self.adlist[current_state]["output"].append(SCREAMING_SNAKE_CASE__  )


    def   a (			self	:	Tuple  ) ->			None:
         lowerCAmelCase__            =					deque()
         for node in self.adlist[0]["next_states"]:
              q.append(SCREAMING_SNAKE_CASE__  )
              lowerCAmelCase__            =					0
         while q:
              lowerCAmelCase__            =					q.popleft()
              for child in self.adlist[r]["next_states"]:
                   q.append(SCREAMING_SNAKE_CASE__  )
                   lowerCAmelCase__            =					self.adlist[r]["fail_state"]
                   while (
                       self.find_next_state(SCREAMING_SNAKE_CASE__  ,      self.adlist[child]["value"]  ) is None
                       and state != 0
                   ):
                        lowerCAmelCase__            =					self.adlist[state]["fail_state"]
                   lowerCAmelCase__            =					self.find_next_state(
                       SCREAMING_SNAKE_CASE__  ,      self.adlist[child]["value"]  )
                   if self.adlist[child]["fail_state"] is None:
                        lowerCAmelCase__            =					0
                   lowerCAmelCase__            =					(
                       self.adlist[child]["output"]
                       + self.adlist[self.adlist[child]["fail_state"]]["output"]
                   )


    def   a (			self	:	int  ,      SCREAMING_SNAKE_CASE__	:	str  ) ->			dict[str, list[int]]:
         lowerCAmelCase__            =					{}  # returns a dict with keywords and list of its occurrences
         lowerCAmelCase__            =					0
         for i in range(len(SCREAMING_SNAKE_CASE__  )  ):
              while (
                  self.find_next_state(SCREAMING_SNAKE_CASE__  ,      string[i]  ) is None
                  and current_state != 0
              ):
                   lowerCAmelCase__            =					self.adlist[current_state]["fail_state"]
              lowerCAmelCase__            =					self.find_next_state(SCREAMING_SNAKE_CASE__  ,      string[i]  )
              if next_state is None:
                   lowerCAmelCase__            =					0
              else:
                   lowerCAmelCase__            =					next_state
                   for key in self.adlist[current_state]["output"]:
                        if key not in result:
                             lowerCAmelCase__            =					[]
                        result[key].append(i - len(SCREAMING_SNAKE_CASE__  ) + 1  )
         return result


if __name__ == "__main__":
     import doctest

     doctest.testmod()







from math import factorial






def 				_UpperCAmelCase			(    A = 20     ):




   '''simple docstring'''

   UpperCAmelCase__						=2 * n  # middle entry of odd rows starting at row 3 is the solution for n = 1,
   # 2, 3,...
   UpperCAmelCase__						=n // 2

   return int(factorial(A     ) / (factorial(A     ) * factorial(n - k     ))     )


if __name__ == "__main__":
    import sys

    if len(sys.argv) == 1:
        print(solution(20))
    else:
        try:
            UpperCamelCase_												=	int(sys.argv[1])
            print(solution(n))
        except ValueError:
            print('Invalid entry - please enter a number.')



