




from manim import *






class      A     (						_lowerCAmelCase						):
     """simple docstring"""

     def 	__snake_case				(      self					:				Optional[Any]     )			->    Union[str, Any]:
           lowerCamelCase__ 					=			Rectangle(height=0.5		,					width=0.5     )
           lowerCamelCase__ 					=			Rectangle(height=0.46		,					width=0.46     ).set_stroke(width=0     )
           lowerCamelCase__ 					=			Rectangle(height=0.25		,					width=0.25     )

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

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

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

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

           lowerCamelCase__ 					=			[]
           lowerCamelCase__ 					=			[]

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

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

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

           self.add(*A__		,					*A__     )

           lowerCamelCase__ 					=			[meta_mem.copy() for i in range(6     )]
           lowerCamelCase__ 					=			[meta_mem.copy() for i in range(6     )]
           lowerCamelCase__ 					=			VGroup(*A__     ).arrange(A__		,					buff=0     )
           lowerCamelCase__ 					=			VGroup(*A__     ).arrange(A__		,					buff=0     )
           lowerCamelCase__ 					=			VGroup(A__		,					A__     ).arrange(A__		,					buff=0     )
           lowerCamelCase__ 					=			Text('Disk'		,					font_size=2_4     )
           lowerCamelCase__ 					=			Group(A__		,					A__     ).arrange(A__		,					buff=0.5		,					aligned_edge=A__     )
           disk.move_to([-4.0, -1.25, 0]     )
           self.add(A__		,					A__     )

           lowerCamelCase__ 					=			[]

           for i in range(6     ):
                 lowerCamelCase__ 					=			fill.copy().set_fill(A__		,					opacity=0.8     )
                 target.move_to(disk_left_col_base[i]     ).scale(0.5     )
                 cpu_disk_arr.append(A__     )

           self.add(*A__     )

           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=1_8		,					)

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

           self.add(A__		,					A__     )

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

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

           lowerCamelCase__ 					=			MarkupText(F"""The offloaded weights are all sent to the CPU."""		,					font_size=2_4     )
           step_a.move_to([2, 2, 0]     )

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

           for i in range(6     ):
                 lowerCamelCase__ 					=			cpu_disk_arr[i]
                 lowerCamelCase__ 					=			rect.copy().set_fill(A__		,					opacity=0.8     ).scale(2.0     )
                 cpa.generate_target()
                 cpa.target.move_to(model_base[i]     )

                 if i == 0:
                       rect.set_fill(A__		,					opacity=0.8     )
                       rect.generate_target()
                       rect.target.move_to(cpu_left_col_base[0]     ).scale(2.0     )

                       self.remove(
                           *A__		,					*A__		,					)

                 else:
                       rect.generate_target()
                       rect.target.move_to(cpu_left_col_base[i]     ).scale(2.0     )
                 self.play(MoveToTarget(A__     )		,					MoveToTarget(A__     )		,					model_base[i].animate.set_stroke(A__     )     )
           self.play(FadeOut(A__     )     )

           lowerCamelCase__ 					=			MarkupText(
               F"""Finally, hooks are added to each weight in the model\nto transfer the weights from CPU to GPU\n\t\tand back when needed."""		,					font_size=2_4		,					)
           step_a.move_to([2, 2, 0]     )

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

           lowerCamelCase__ 					=			[]
           lowerCamelCase__ 					=			[]
           for i in range(6     ):
                 lowerCamelCase__ 					=			Arrow(start=A__		,					end=A__		,					color=A__		,					buff=0.5     )
                 a.next_to(model_base[i].get_left()		,					A__		,					buff=0.2     )
                 arrows.append(A__     )
                 animations.append(Write(A__     )     )
           self.play(*A__     )
           self.wait()





def      lowerCAmelCase_     (					lowerCamelCase:    Optional[int]  )   ->     Union[str, Any]:


      '''simple docstring'''




      lowerCamelCase__ 					=			[7_01, 3_01, 1_32, 57, 23, 10, 4, 1]
      for gap in gaps:
            for i in range(lowerCamelCase       ,			len(lowerCamelCase  )  ):
                  lowerCamelCase__ 					=			collection[i]
                  lowerCamelCase__ 					=			i
                  while j >= gap and collection[j - gap] > insert_value:
                        lowerCamelCase__ 					=			collection[j - gap]
                        j -= gap
                  if j != i:
                        lowerCamelCase__ 					=			insert_value
      return collection


if __name__ == "__main__":
      from doctest import testmod

      testmod()
      __SCREAMING_SNAKE_CASE      :				List[Any]				      =input("""Enter numbers separated by a comma:\n""").strip()
      __SCREAMING_SNAKE_CASE      :				Dict				      =[int(item) for item in user_input.split(""",""")]
      print(shell_sort(unsorted))