






'''simple docstring'''

import re

from flax.core.frozen_dict import freeze
from flax.traverse_util import flatten_dict, unflatten_dict
from jax.experimental import PartitionSpec as P


# Sentinels
SCREAMING_SNAKE_CASE__											=     object()

# For specifying empty leaf dict `{}`
SCREAMING_SNAKE_CASE__											=     object()







def 					lowercase__				(   __UpperCamelCase	,		__UpperCamelCase					)->				Optional[int]:
      UpperCamelCase       						=      tuple((re.compile(x + """$"""					) for x in qs)					)
      for i in range(len(__UpperCamelCase					) - len(__UpperCamelCase					) + 1					):
            UpperCamelCase       						=      [x.match(__UpperCamelCase					) for x, y in zip(__UpperCamelCase	,		ks[i:]					)]
            if matches and all(__UpperCamelCase					):
                  return True
      return False







def 					lowercase__				(   __UpperCamelCase					)->				Tuple:
      def replace(__UpperCamelCase	,		__UpperCamelCase					):
            for rule, replacement in rules:
                  if _match(__UpperCamelCase	,		__UpperCamelCase					):
                        return replacement
            return val

      return replace







def 					lowercase__				(   )->				Optional[int]:
      return [
          # embeddings
          (("transformer", "wpe", "embedding"), P("""mp"""	,		__UpperCamelCase					)),
          (("transformer", "wte", "embedding"), P("""mp"""	,		__UpperCamelCase					)),
          # atention
          (("attention", "(q_proj|k_proj|v_proj)", "kernel"), P(__UpperCamelCase	,		"""mp"""					)),
          (("attention", "out_proj", "kernel"), P("""mp"""	,		__UpperCamelCase					)),
          (("attention", "out_proj", "bias"), None),
          # mlp
          (("mlp", "c_fc", "kernel"), P(__UpperCamelCase	,		"""mp"""					)),
          (("mlp", "c_fc", "bias"), P("""mp"""					)),
          (("mlp", "c_proj", "kernel"), P("""mp"""	,		__UpperCamelCase					)),
          (("mlp", "c_proj", "bias"), None),
          # layer norms
          ((r"ln_\d+", "bias"), None),
          ((r"\d+", r"ln_\d+", "scale"), None),
          (("ln_f", "bias"), None),
          (("ln_f", "scale"), None),
      ]







def 					lowercase__				(   __UpperCamelCase					)->				List[Any]:
      UpperCamelCase       						=      _get_partition_rules()
      UpperCamelCase       						=      _replacement_rules(__UpperCamelCase					)
      UpperCamelCase       						=      {k: _unmatched for k in flatten_dict(__UpperCamelCase					)}
      UpperCamelCase       						=      {k: replace(__UpperCamelCase	,		__UpperCamelCase					) for k, v in initd.items()}
      assert _unmatched not in result.values(), "Incomplete partition spec."
      return freeze(unflatten_dict(__UpperCamelCase					)					)








'''simple docstring'''

from math import factorial







def 					lowercase__				(   __UpperCamelCase = 20					)->				int:
      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(__UpperCamelCase					) / (factorial(__UpperCamelCase					) * factorial(n - k					))					)


if __name__ == "__main__":
     import sys

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