


'''simple docstring'''
from manim import *
class   lowercase      (				A__   ):

		"""simple docstring"""

		def        lowerCAmelCase__							(						self				):

							'''simple docstring'''


							UpperCamelCase__  :Tuple				   =					Rectangle(height=0.5       ,  width=0.5				)
							UpperCamelCase__  :List[str]				   =					Rectangle(height=0.25       ,  width=0.25				)
							UpperCamelCase__  :str				   =					Rectangle(height=0.46       ,  width=0.46				).set_stroke(width=0				)

							UpperCamelCase__  :Any				   =					[mem.copy() for i in range(6				)]
							UpperCamelCase__  :int				   =					[mem.copy() for i in range(6				)]
							UpperCamelCase__  :Optional[int]				   =					VGroup(*UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)
							UpperCamelCase__  :Tuple				   =					VGroup(*UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)
							UpperCamelCase__  :Dict				   =					VGroup(UpperCamelCase_       ,  UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)
							UpperCamelCase__  :Union[str, Any]				   =					Text('''CPU'''       ,  font_size=24				)
							UpperCamelCase__  :Optional[int]				   =					Group(UpperCamelCase_       ,  UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0.5       ,  aligned_edge=UpperCamelCase_				)
							cpu.move_to([-2.5, -0.5, 0]				)
							self.add(UpperCamelCase_				)

							UpperCamelCase__  :Union[str, Any]				   =					[mem.copy() for i in range(4				)]
							UpperCamelCase__  :Union[str, Any]				   =					VGroup(*UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)
							UpperCamelCase__  :Any				   =					Text('''GPU'''       ,  font_size=24				)
							UpperCamelCase__  :Optional[int]				   =					Group(UpperCamelCase_       ,  UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0.5       ,  aligned_edge=UpperCamelCase_				)
							gpu.move_to([-1, -1, 0]				)
							self.add(UpperCamelCase_				)

							UpperCamelCase__  :Dict				   =					[mem.copy() for i in range(6				)]
							UpperCamelCase__  :Union[str, Any]				   =					VGroup(*UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)

							UpperCamelCase__  :Any				   =					Text('''Model'''       ,  font_size=24				)
							UpperCamelCase__  :str				   =					Group(UpperCamelCase_       ,  UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0.5       ,  aligned_edge=UpperCamelCase_				)
							model.move_to([3, -1.0, 0]				)
							self.add(UpperCamelCase_				)

							UpperCamelCase__  :Dict				   =					[]
							UpperCamelCase__  :List[Any]				   =					[]
							UpperCamelCase__  :Dict				   =					[]

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

												UpperCamelCase__  :List[str]				   =					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_				)

							UpperCamelCase__  :Union[str, Any]				   =					[mem.copy() for i in range(6				)]
							UpperCamelCase__  :Tuple				   =					VGroup(*UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)

							UpperCamelCase__  :Union[str, Any]				   =					Text('''Loaded Checkpoint'''       ,  font_size=24				)
							UpperCamelCase__  :int				   =					Group(UpperCamelCase_       ,  UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0.5       ,  aligned_edge=UpperCamelCase_				)
							checkpoint.move_to([3, 0.5, 0]				)

							self.add(UpperCamelCase_				)

							UpperCamelCase__  :str				   =					[]
							UpperCamelCase__  :int				   =					[]

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

												UpperCamelCase__  :Optional[Any]				   =					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_				)

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

							UpperCamelCase__  :Any				   =					MarkupText(
							    F'''<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model'''       ,  font_size=18       ,  )

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

							self.add(UpperCamelCase_       ,  UpperCamelCase_				)

							UpperCamelCase__  :Tuple				   =					MarkupText(
							    F'''<span fgcolor=\'{BLUE}\'>●</span> Checkpoint'''       ,  font_size=18       ,  )

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

							UpperCamelCase__  :Optional[Any]				   =					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=24       ,  )
							step_a.move_to([2, 2, 0]				)

							UpperCamelCase__  :List[str]				   =					[meta_mem.copy() for i in range(6				)]
							UpperCamelCase__  :Union[str, Any]				   =					[meta_mem.copy() for i in range(6				)]
							UpperCamelCase__  :str				   =					VGroup(*UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)
							UpperCamelCase__  :List[Any]				   =					VGroup(*UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)
							UpperCamelCase__  :int				   =					VGroup(UpperCamelCase_       ,  UpperCamelCase_				).arrange(UpperCamelCase_       ,  buff=0				)
							UpperCamelCase__  :str				   =					Text('''Disk'''       ,  font_size=24				)
							UpperCamelCase__  :Optional[Any]				   =					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				)				)

							UpperCamelCase__  :Optional[int]				   =					[]
							for i, rect in enumerate(UpperCamelCase_				):
												UpperCamelCase__  :Union[str, Any]				   =					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_				)				)

							UpperCamelCase__  :List[str]				   =					MarkupText(F'''Then, the checkpoint is removed from memory\nthrough garbage collection.'''       ,  font_size=24				)
							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'''
from __future__ import annotations

import math


def      a (     __a					,   __a					,   __a					,   __a					,   __a  )    ->      int:



					'''simple docstring'''






					if depth < 0:
										raise ValueError('''Depth cannot be less than 0'''  )

					if len(__a  ) == 0:
										raise ValueError('''Scores cannot be empty'''  )

					if depth == height:
										return scores[node_index]

					if is_max:
										return max(
										    minimax(depth + 1					,   node_index * 2					,   __a					,   __a					,   __a  )					,   minimax(depth + 1					,   node_index * 2 + 1					,   __a					,   __a					,   __a  )					,   )

					return min(
					    minimax(depth + 1					,   node_index * 2					,   __a					,   __a					,   __a  )					,   minimax(depth + 1					,   node_index * 2 + 1					,   __a					,   __a					,   __a  )					,   )


def      a (     )    ->      None:



					'''simple docstring'''






					UpperCamelCase__  :str				   =					[90, 23, 6, 33, 21, 65, 123, 34423]
					UpperCamelCase__  :List[Any]				   =					math.log(len(__a  )					,   2  )
					print('''Optimal value : '''					,   end=''''''  )
					print(minimax(0					,   0					,   __a					,   __a					,   __a  )  )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		main()