


"""simple docstring"""







from manim import *




class 			UpperCamelCase_     (			UpperCamelCase):

	"""simple docstring"""





	def   UpperCAmelCase_				(			self      :    List[str]       )	->     Optional[int]:
						__SCREAMING_SNAKE_CASE						       =    Rectangle(height=0.5      ,      width=0.5       )
						__SCREAMING_SNAKE_CASE						       =    Rectangle(height=0.25      ,      width=0.25       )
						__SCREAMING_SNAKE_CASE						       =    Rectangle(height=0.46      ,      width=0.46       ).set_stroke(width=0       )

						__SCREAMING_SNAKE_CASE						       =    [mem.copy() for i in range(6       )]
						__SCREAMING_SNAKE_CASE						       =    [mem.copy() for i in range(6       )]
						__SCREAMING_SNAKE_CASE						       =    VGroup(*UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )
						__SCREAMING_SNAKE_CASE						       =    VGroup(*UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )
						__SCREAMING_SNAKE_CASE						       =    VGroup(UpperCAmelCase__      ,      UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )
						__SCREAMING_SNAKE_CASE						       =    Text("CPU"      ,      font_size=2_4       )
						__SCREAMING_SNAKE_CASE						       =    Group(UpperCAmelCase__      ,      UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0.5      ,      aligned_edge=UpperCAmelCase__       )
						cpu.move_to([-2.5, -0.5, 0]       )
						self.add(UpperCAmelCase__       )

						__SCREAMING_SNAKE_CASE						       =    [mem.copy() for i in range(4       )]
						__SCREAMING_SNAKE_CASE						       =    VGroup(*UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )
						__SCREAMING_SNAKE_CASE						       =    Text("GPU"      ,      font_size=2_4       )
						__SCREAMING_SNAKE_CASE						       =    Group(UpperCAmelCase__      ,      UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0.5      ,      aligned_edge=UpperCAmelCase__       )
						gpu.move_to([-1, -1, 0]       )
						self.add(UpperCAmelCase__       )

						__SCREAMING_SNAKE_CASE						       =    [mem.copy() for i in range(6       )]
						__SCREAMING_SNAKE_CASE						       =    VGroup(*UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )

						__SCREAMING_SNAKE_CASE						       =    Text("Model"      ,      font_size=2_4       )
						__SCREAMING_SNAKE_CASE						       =    Group(UpperCAmelCase__      ,      UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0.5      ,      aligned_edge=UpperCAmelCase__       )
						model.move_to([3, -1.0, 0]       )
						self.add(UpperCAmelCase__       )

						__SCREAMING_SNAKE_CASE						       =    []
						__SCREAMING_SNAKE_CASE						       =    []
						__SCREAMING_SNAKE_CASE						       =    []

						for i, rect in enumerate(UpperCAmelCase__       ):
											rect.set_stroke(UpperCAmelCase__       )

											__SCREAMING_SNAKE_CASE						       =    Rectangle(height=0.46 / 4      ,      width=0.46 / 3       ).set_stroke(width=0.0       ).set_fill(UpperCAmelCase__      ,      opacity=0.7       )

											if i == 0:
																cpu_target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT       )      ,      buff=0.02      ,      direction=UpperCAmelCase__       )
																cpu_target.set_x(cpu_target.get_x() + 0.1       )
											elif i == 3:
																cpu_target.next_to(model_cpu_arr[0]      ,      direction=UpperCAmelCase__      ,      buff=0.0       )
											else:
																cpu_target.next_to(model_cpu_arr[i - 1]      ,      direction=UpperCAmelCase__      ,      buff=0.0       )
											self.add(UpperCAmelCase__       )
											model_cpu_arr.append(UpperCAmelCase__       )

						self.add(*UpperCAmelCase__      ,      *UpperCAmelCase__      ,      *UpperCAmelCase__       )

						__SCREAMING_SNAKE_CASE						       =    [mem.copy() for i in range(6       )]
						__SCREAMING_SNAKE_CASE						       =    VGroup(*UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )

						__SCREAMING_SNAKE_CASE						       =    Text("Loaded Checkpoint"      ,      font_size=2_4       )
						__SCREAMING_SNAKE_CASE						       =    Group(UpperCAmelCase__      ,      UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0.5      ,      aligned_edge=UpperCAmelCase__       )
						checkpoint.move_to([3, 0.5, 0]       )

						self.add(UpperCAmelCase__       )

						__SCREAMING_SNAKE_CASE						       =    []
						__SCREAMING_SNAKE_CASE						       =    []

						for i, rect in enumerate(UpperCAmelCase__       ):
											__SCREAMING_SNAKE_CASE						       =    fill.copy().set_fill(UpperCAmelCase__      ,      opacity=0.7       )
											target.move_to(UpperCAmelCase__       )
											ckpt_arr.append(UpperCAmelCase__       )

											__SCREAMING_SNAKE_CASE						       =    target.copy()
											if i < 5:
																cpu_target.move_to(cpu_left_col_base[i + 1]       )
											else:
																cpu_target.move_to(cpu_right_col_base[i - 5]       )
											ckpt_cpu_arr.append(UpperCAmelCase__       )
						self.add(*UpperCAmelCase__      ,      *UpperCAmelCase__       )

						__SCREAMING_SNAKE_CASE						       =    Square(side_length=2.2       )
						key.move_to([-5, 2, 0]       )

						__SCREAMING_SNAKE_CASE						       =    MarkupText(
						    F"""<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"""      ,      font_size=1_8      ,      )

						key_text.move_to([-5, 2.4, 0]       )

						self.add(UpperCAmelCase__      ,      UpperCAmelCase__       )

						__SCREAMING_SNAKE_CASE						       =    MarkupText(
						    F"""<span fgcolor='{BLUE}'>●</span> Checkpoint"""      ,      font_size=1_8      ,      )

						blue_text.next_to(UpperCAmelCase__      ,      DOWN * 2.4      ,      aligned_edge=key_text.get_left()       )
						self.add(UpperCAmelCase__       )

						__SCREAMING_SNAKE_CASE						       =    MarkupText(
						    F"""Based on the passed in configuration, weights are stored in\na variety of np.memmaps on disk or to a particular device."""      ,      font_size=2_4      ,      )
						step_a.move_to([2, 2, 0]       )

						__SCREAMING_SNAKE_CASE						       =    [meta_mem.copy() for i in range(6       )]
						__SCREAMING_SNAKE_CASE						       =    [meta_mem.copy() for i in range(6       )]
						__SCREAMING_SNAKE_CASE						       =    VGroup(*UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )
						__SCREAMING_SNAKE_CASE						       =    VGroup(*UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )
						__SCREAMING_SNAKE_CASE						       =    VGroup(UpperCAmelCase__      ,      UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0       )
						__SCREAMING_SNAKE_CASE						       =    Text("Disk"      ,      font_size=2_4       )
						__SCREAMING_SNAKE_CASE						       =    Group(UpperCAmelCase__      ,      UpperCAmelCase__       ).arrange(UpperCAmelCase__      ,      buff=0.5      ,      aligned_edge=UpperCAmelCase__       )
						disk.move_to([-4.0, -1.25, 0]       )
						self.play(Write(UpperCAmelCase__      ,      run_time=3       )      ,      Write(UpperCAmelCase__      ,      run_time=1       )      ,      Create(UpperCAmelCase__      ,      run_time=1       )       )

						__SCREAMING_SNAKE_CASE						       =    []
						for i, rect in enumerate(UpperCAmelCase__       ):
											__SCREAMING_SNAKE_CASE						       =    rect.copy()
											target.generate_target()
											target.target.move_to(disk_left_col_base[i]       ).scale(0.5       )
											animations.append(MoveToTarget(UpperCAmelCase__      ,      run_time=1.5       )       )
						self.play(*UpperCAmelCase__       )

						self.play(FadeOut(UpperCAmelCase__       )       )

						__SCREAMING_SNAKE_CASE						       =    MarkupText(F"""Then, the checkpoint is removed from memory\nthrough garbage collection."""      ,      font_size=2_4       )
						step_a.move_to([2, 2, 0]       )

						self.play(Write(UpperCAmelCase__      ,      run_time=3       )       )

						self.play(
						    FadeOut(UpperCAmelCase__      ,      UpperCAmelCase__      ,      *UpperCAmelCase__      ,      *UpperCAmelCase__       )      ,      )

						self.wait()




"""simple docstring"""







def        UpperCAmelCase__	(lowerCAmelCase_  ,						lowerCAmelCase_       ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE						       =    [0 for i in range(r + 1       )]
					# nc0 = 1
					__SCREAMING_SNAKE_CASE						       =    1
					for i in range(1  ,						n + 1       ):
										# to compute current row from previous row.
										__SCREAMING_SNAKE_CASE						       =    min(lowerCAmelCase_  ,						lowerCAmelCase_       )
										while j > 0:
															c[j] += c[j - 1]
															j -= 1
					return c[r]



print(binomial_coefficient(n=1_0, r=5))
