
"""simple docstring"""







def    __lowerCAmelCase    (_UpperCamelCase		):
	__lowerCAmelCase      :						Optional[int]						      =				generate_pascal_triangle(_UpperCamelCase		)
	for row_idx in range(_UpperCamelCase		):
		# 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    (_UpperCamelCase		):

	if not isinstance(_UpperCamelCase	,  _UpperCamelCase		):
		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'		)

	__lowerCAmelCase      :						list[list[int]]						      =				[]
	for current_row_idx in range(_UpperCamelCase		):
		__lowerCAmelCase      :						int						      =				populate_current_row(_UpperCamelCase	,  _UpperCamelCase		)
		triangle.append(_UpperCamelCase		)
	return triangle
def    __lowerCAmelCase    (_UpperCamelCase	,  _UpperCamelCase		):
	__lowerCAmelCase      :						Any						      =				[-1] * (current_row_idx + 1)
	# first and last elements of current row are equal to 1
	__lowerCAmelCase      :						Optional[int]						      =				1, 1
	for current_col_idx in range(1	,  _UpperCamelCase		):
		calculate_current_element(
		    _UpperCamelCase	,  _UpperCamelCase	,  _UpperCamelCase	,  _UpperCamelCase		)
	return current_row
def    __lowerCAmelCase    (_UpperCamelCase	,  _UpperCamelCase	,  _UpperCamelCase	,  _UpperCamelCase	,  ):
	__lowerCAmelCase      :						Tuple						      =				triangle[current_row_idx - 1][current_col_idx - 1]
	__lowerCAmelCase      :						int						      =				triangle[current_row_idx - 1][current_col_idx]
	__lowerCAmelCase      :						Tuple						      =				above_to_left_elt + above_to_right_elt
def    __lowerCAmelCase    (_UpperCamelCase		):

	if not isinstance(_UpperCamelCase	,  _UpperCamelCase		):
		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'		)

	__lowerCAmelCase      :						list[list[int]]						      =				[[1]]

	for row_index in range(1	,  _UpperCamelCase		):
		__lowerCAmelCase      :						Dict						      =				[0] + result[-1] + [0]
		__lowerCAmelCase      :						List[str]						      =				row_index + 1
		# Calculate the number of distinct elements in a row
		__lowerCAmelCase      :						Optional[int]						      =				sum(divmod(_UpperCamelCase	,  2		)		)
		__lowerCAmelCase      :						Any						      =				[
		    temp_row[i - 1] + temp_row[i] for i in range(1	,  distinct_elements + 1		)
		]
		__lowerCAmelCase      :						Tuple						      =				row_first_half[: (row_index + 1) // 2]
		row_second_half.reverse()
		__lowerCAmelCase      :						Dict						      =				row_first_half + row_second_half
		result.append(_UpperCamelCase		)

	return result
def    __lowerCAmelCase    ():
	from collections.abc import Callable
	from timeit import timeit

	def benchmark_a_function(_UpperCamelCase	,  _UpperCamelCase		) -> None:
		__lowerCAmelCase      :						Any						      =				F"{func.__name__}({value})"
		__lowerCAmelCase      :						Union[str, Any]						      =				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(_UpperCamelCase	,  _UpperCamelCase		)
		print()


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					benchmark()

"""simple docstring"""







lowerCamelCase__        =		"""0.21.0"""

from .accelerator import Accelerator
from .big_modeling import (
    cpu_offload,
    cpu_offload_with_hook,
    disk_offload,
    dispatch_model,
    init_empty_weights,
    init_on_device,
    load_checkpoint_and_dispatch,
)
from .data_loader import skip_first_batches
from .launchers import debug_launcher, notebook_launcher
from .state import PartialState
from .utils import (
    DeepSpeedPlugin,
    DistributedDataParallelKwargs,
    DistributedType,
    FullyShardedDataParallelPlugin,
    GradScalerKwargs,
    InitProcessGroupKwargs,
    find_executable_batch_size,
    infer_auto_device_map,
    is_rich_available,
    load_checkpoint_in_model,
    synchronize_rng_states,
)


if is_rich_available():
							from .utils import rich