


def       _lowerCAmelCase    (				lowerCAmelCase_				:int				)->None:
   '''simple docstring'''






   snake_case_            =       generate_pascal_triangle(_lowercase				)
   for row_idx in range(_lowercase				):
      # Print left spaces
      for _ in range(num_rows - row_idx - 1				):
         print(end=" "				)
      # Print row values
      for col_idx in range(row_idx + 1				):
         if col_idx != row_idx:
            print(triangle[row_idx][col_idx]		,    end=" "				)
         else:
            print(triangle[row_idx][col_idx]		,    end=""				)
      print()



def       _lowerCAmelCase    (				lowerCAmelCase_				:int				)->list[list[int]]:
   '''simple docstring'''






   if not isinstance(_lowercase		,    _lowercase				):
      raise TypeError("The input value of \'num_rows\' should be \'int\'"				)

   if num_rows == 0:
      return []
   elif num_rows < 0:
      raise ValueError(
          "The input value of \'num_rows\' should be greater than or equal to 0"				)

   snake_case_            =       []
   for current_row_idx in range(_lowercase				):
      snake_case_            =       populate_current_row(_lowercase		,    _lowercase				)
      triangle.append(_lowercase				)
   return triangle



def       _lowerCAmelCase    (				lowerCAmelCase_				:list[list[int]]		,    lowerCAmelCase_				:int				)->list[int]:
   '''simple docstring'''






   snake_case_            =       [-1] * (current_row_idx + 1)
   # first and last elements of current row are equal to 1
   snake_case_     ,     snake_case_            =       1, 1
   for current_col_idx in range(1		,    _lowercase				):
      calculate_current_element(
          _lowercase		,    _lowercase		,    _lowercase		,    _lowercase				)
   return current_row



def       _lowerCAmelCase    (				lowerCAmelCase_				:list[list[int]]		,    lowerCAmelCase_				:list[int]		,    lowerCAmelCase_				:int		,    lowerCAmelCase_				:int		,    )->None:
   '''simple docstring'''






   snake_case_            =       triangle[current_row_idx - 1][current_col_idx - 1]
   snake_case_            =       triangle[current_row_idx - 1][current_col_idx]
   snake_case_            =       above_to_left_elt + above_to_right_elt



def       _lowerCAmelCase    (				lowerCAmelCase_				:int				)->list[list[int]]:
   '''simple docstring'''






   if not isinstance(_lowercase		,    _lowercase				):
      raise TypeError("The input value of \'num_rows\' should be \'int\'"				)

   if num_rows == 0:
      return []
   elif num_rows < 0:
      raise ValueError(
          "The input value of \'num_rows\' should be greater than or equal to 0"				)

   snake_case_            =       [[1]]

   for row_index in range(1		,    _lowercase				):
      snake_case_            =       [0] + result[-1] + [0]
      snake_case_            =       row_index + 1
      # Calculate the number of distinct elements in a row
      snake_case_            =       sum(divmod(_lowercase		,    2				)				)
      snake_case_            =       [
          temp_row[i - 1] + temp_row[i] for i in range(1		,    distinct_elements + 1				)
      ]
      snake_case_            =       row_first_half[: (row_index + 1) // 2]
      row_second_half.reverse()
      snake_case_            =       row_first_half + row_second_half
      result.append(_lowercase				)

   return result



def       _lowerCAmelCase    (				)->None:
   '''simple docstring'''






   from collections.abc import Callable
   from timeit import timeit

   def benchmark_a_function(lowerCAmelCase_				:Callable		,    lowerCAmelCase_				:int				) -> None:
      snake_case_            =       F'''{func.__name__}({value})'''
      snake_case_            =       timeit(F'''__main__.{call}'''		,    setup="import __main__"				)
      # print(f"{call:38} = {func(value)} -- {timing:.4f} seconds")
      print(F'''{call:38} -- {timing:.4f} seconds'''				)

   for value in range(15				):  # (1, 7, 14):
      for func in (generate_pascal_triangle, generate_pascal_triangle_optimized):
         benchmark_a_function(_lowercase		,    _lowercase				)
      print()


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   benchmark()








"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowercase_							=							{
    'configuration_mobilebert': [
        'MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'MobileBertConfig',
        'MobileBertOnnxConfig',
    ],
    'tokenization_mobilebert': ['MobileBertTokenizer'],
}

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							=							['MobileBertTokenizerFast']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							=							[
		    'MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'MobileBertForMaskedLM',
		    'MobileBertForMultipleChoice',
		    'MobileBertForNextSentencePrediction',
		    'MobileBertForPreTraining',
		    'MobileBertForQuestionAnswering',
		    'MobileBertForSequenceClassification',
		    'MobileBertForTokenClassification',
		    'MobileBertLayer',
		    'MobileBertModel',
		    'MobileBertPreTrainedModel',
		    'load_tf_weights_in_mobilebert',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							=							[
		    'TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'TFMobileBertForMaskedLM',
		    'TFMobileBertForMultipleChoice',
		    'TFMobileBertForNextSentencePrediction',
		    'TFMobileBertForPreTraining',
		    'TFMobileBertForQuestionAnswering',
		    'TFMobileBertForSequenceClassification',
		    'TFMobileBertForTokenClassification',
		    'TFMobileBertMainLayer',
		    'TFMobileBertModel',
		    'TFMobileBertPreTrainedModel',
		]


if TYPE_CHECKING:
		from .configuration_mobilebert import (
		    MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    MobileBertConfig,
		    MobileBertOnnxConfig,
		)
		from .tokenization_mobilebert import MobileBertTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_mobilebert_fast import MobileBertTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_mobilebert import (
				    MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    MobileBertForMaskedLM,
				    MobileBertForMultipleChoice,
				    MobileBertForNextSentencePrediction,
				    MobileBertForPreTraining,
				    MobileBertForQuestionAnswering,
				    MobileBertForSequenceClassification,
				    MobileBertForTokenClassification,
				    MobileBertLayer,
				    MobileBertModel,
				    MobileBertPreTrainedModel,
				    load_tf_weights_in_mobilebert,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_mobilebert import (
				    TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFMobileBertForMaskedLM,
				    TFMobileBertForMultipleChoice,
				    TFMobileBertForNextSentencePrediction,
				    TFMobileBertForPreTraining,
				    TFMobileBertForQuestionAnswering,
				    TFMobileBertForSequenceClassification,
				    TFMobileBertForTokenClassification,
				    TFMobileBertMainLayer,
				    TFMobileBertModel,
				    TFMobileBertPreTrainedModel,
				)

else:
		import sys

		lowercase_							=							_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)