




from manim import *







class     __lowerCAmelCase (       __magic_name__ ):

			"""simple docstring"""







			def       lowercase_    (      self							)    ->      Any:



							'''simple docstring'''
							__lowerCamelCase		       =    Rectangle(height=0.5			,						width=0.5							)
							__lowerCamelCase		       =    Rectangle(height=0.46			,						width=0.46							).set_stroke(width=0							)

							__lowerCamelCase		       =    [mem.copy() for i in range(6							)]
							__lowerCamelCase		       =    [mem.copy() for i in range(6							)]
							__lowerCamelCase		       =    VGroup(*lowerCamelCase__							).arrange(lowerCamelCase__			,						buff=0							)
							__lowerCamelCase		       =    VGroup(*lowerCamelCase__							).arrange(lowerCamelCase__			,						buff=0							)
							__lowerCamelCase		       =    VGroup(lowerCamelCase__			,						lowerCamelCase__							).arrange(lowerCamelCase__			,						buff=0							)
							__lowerCamelCase		       =    Text('CPU'			,						font_size=24							)
							__lowerCamelCase		       =    Group(lowerCamelCase__			,						lowerCamelCase__							).arrange(lowerCamelCase__			,						buff=0.5			,						aligned_edge=lowerCamelCase__							)
							cpu.move_to([-2.5, -0.5, 0]							)
							self.add(lowerCamelCase__							)

							__lowerCamelCase		       =    [mem.copy() for i in range(4							)]
							__lowerCamelCase		       =    VGroup(*lowerCamelCase__							).arrange(lowerCamelCase__			,						buff=0							)
							__lowerCamelCase		       =    Text('GPU'			,						font_size=24							)
							__lowerCamelCase		       =    Group(lowerCamelCase__			,						lowerCamelCase__							).arrange(lowerCamelCase__			,						buff=0.5			,						aligned_edge=lowerCamelCase__							)
							gpu.move_to([-1, -1, 0]							)
							self.add(lowerCamelCase__							)

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

							__lowerCamelCase		       =    Text('Model'			,						font_size=24							)
							__lowerCamelCase		       =    Group(lowerCamelCase__			,						lowerCamelCase__							).arrange(lowerCamelCase__			,						buff=0.5			,						aligned_edge=lowerCamelCase__							)
							model.move_to([3, -1.0, 0]							)
							self.add(lowerCamelCase__							)

							__lowerCamelCase		       =    []
							for i, rect in enumerate(lowerCamelCase__							):
											rect.set_stroke(lowerCamelCase__							)
											# target = fill.copy().set_fill(YELLOW, opacity=0.7)
											# target.move_to(rect)
											# self.add(target)

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

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

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

							__lowerCamelCase		       =    Text('Loaded Checkpoint'			,						font_size=24							)
							__lowerCamelCase		       =    Group(lowerCamelCase__			,						lowerCamelCase__							).arrange(lowerCamelCase__			,						aligned_edge=lowerCamelCase__			,						buff=0.4							)
							checkpoint.move_to([3, 0.5, 0]							)

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

							__lowerCamelCase		       =    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(lowerCamelCase__			,						lowerCamelCase__							)

							__lowerCamelCase		       =    MarkupText(
							    f"""<span fgcolor='{BLUE}'>●</span> Checkpoint"""			,						font_size=18			,						)

							blue_text.next_to(lowerCamelCase__			,						DOWN * 2.4			,						aligned_edge=key_text.get_left()							)

							__lowerCamelCase		       =    MarkupText(
							    f"""Next, a <i><span fgcolor=\"{BLUE}\">second</span></i> model is loaded into memory,\nwith the weights of a <span fgcolor=\"{BLUE}\">single shard</span>."""			,						font_size=24			,						)
							step_a.move_to([2, 2, 0]							)
							self.play(Write(lowerCamelCase__							)			,						Write(lowerCamelCase__							)							)

							self.play(Write(lowerCamelCase__			,						run_time=1							)			,						Create(lowerCamelCase__			,						run_time=1							)							)

							__lowerCamelCase		       =    []
							__lowerCamelCase		       =    []
							for i, rect in enumerate(lowerCamelCase__							):
											__lowerCamelCase		       =    fill.copy().set_fill(lowerCamelCase__			,						opacity=0.7							)
											target.move_to(lowerCamelCase__							)
											first_animations.append(GrowFromCenter(lowerCamelCase__			,						run_time=1							)							)

											__lowerCamelCase		       =    target.copy()
											cpu_target.generate_target()
											if i < 5:
															cpu_target.target.move_to(cpu_left_col_base[i + 1]							)
											else:
															cpu_target.target.move_to(cpu_right_col_base[i - 5]							)
											second_animations.append(MoveToTarget(lowerCamelCase__			,						run_time=1.5							)							)

							self.play(*lowerCamelCase__							)
							self.play(*lowerCamelCase__							)
							self.wait()







"""simple docstring"""






from __future__ import annotations


def 			_lowercase				(  __snake_case					,__snake_case					,__snake_case					,__snake_case	)						->   list:
			__lowerCAmelCase      :  Dict												=       []
			__lowerCAmelCase						,	__lowerCAmelCase      :  Any												=       input_list[low:mid], input_list[mid : high + 1]
			while left and right:
						result.append((left if left[0] <= right[0] else right).pop(0	)	)
			__lowerCAmelCase      :  int												=       result + left + right
			return input_list


def 			_lowercase				(  __snake_case	)						->   list:
			if len(__snake_case	) <= 1:
						return input_list
			__lowerCAmelCase      :  int												=       list(__snake_case	)

			# iteration for two-way merging
			__lowerCAmelCase      :  Optional[int]												=       2
			while p <= len(__snake_case	):
						# getting low, high and middle value for merge-sort of single list
						for i in range(0					,len(__snake_case	)					,__snake_case	):
									__lowerCAmelCase      :  Union[str, Any]												=       i
									__lowerCAmelCase      :  Tuple												=       i + p - 1
									__lowerCAmelCase      :  Optional[Any]												=       (low + high + 1) // 2
									__lowerCAmelCase      :  Any												=       merge(__snake_case					,__snake_case					,__snake_case					,__snake_case	)
						# final merge of last two parts
						if p * 2 >= len(__snake_case	):
									__lowerCAmelCase      :  Optional[Any]												=       i
									__lowerCAmelCase      :  Union[str, Any]												=       merge(__snake_case					,0					,__snake_case					,len(__snake_case	) - 1	)
									break
						p *= 2

			return input_list


if __name__ == "__main__":
	__snake_case							:   Union[str, Any]      =    input('Enter numbers separated by a comma:\n').strip()
	if user_input == "":
		__snake_case							:   Optional[int]      =    []
	else:
		__snake_case							:   int      =    [int(item.strip()) for item in user_input.split(',')]
	print(iter_merge_sort(unsorted))