





from manim import *





class 					A_					(   UpperCAmelCase						):







       """simple docstring"""





       def  __UpperCAmelCase			(     self						:						str	)    ->       Union[str, Any]:
         _lowercase						    =			Rectangle(height=0.5    ,width=0.5	)
         _lowercase						    =			Rectangle(height=0.46    ,width=0.46	).set_stroke(width=0	)

         _lowercase						    =			Rectangle(height=0.25    ,width=0.25	)

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

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

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

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

         _lowercase						    =			[]
         _lowercase						    =			[]

         for i, rect in enumerate(__A	):
           _lowercase						    =			fill.copy().set_fill(__A    ,opacity=0.8	)
           target.move_to(__A	)
           model_arr.append(__A	)

           _lowercase						    =			Rectangle(height=0.46    ,width=0.46	).set_stroke(width=0.0	).set_fill(__A    ,opacity=0.8	)
           cpu_target.move_to(cpu_left_col_base[i]	)
           model_cpu_arr.append(__A	)

         self.add(*__A    ,*__A	)

         _lowercase						    =			[meta_mem.copy() for i in range(6	)]
         _lowercase						    =			[meta_mem.copy() for i in range(6	)]
         _lowercase						    =			VGroup(*__A	).arrange(__A    ,buff=0	)
         _lowercase						    =			VGroup(*__A	).arrange(__A    ,buff=0	)
         _lowercase						    =			VGroup(__A    ,__A	).arrange(__A    ,buff=0	)
         _lowercase						    =			Text('Disk'    ,font_size=24	)
         _lowercase						    =			Group(__A    ,__A	).arrange(__A    ,buff=0.5    ,aligned_edge=__A	)
         disk.move_to([-4, -1.25, 0]	)
         self.add(__A    ,__A	)

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

         _lowercase						    =			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(__A    ,__A	)

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

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

         _lowercase						    =			MarkupText(
             F"""Now watch as an input is passed through the model\nand how the memory is utilized and handled."""    ,font_size=24    ,)
         step_a.move_to([2, 2, 0]	)

         self.play(Write(__A	)	)

         _lowercase						    =			Square(0.3	)
         input.set_fill(__A    ,opacity=1.0	)
         input.set_stroke(width=0.0	)
         input.next_to(model_base[0]    ,__A    ,buff=0.5	)

         self.play(Write(__A	)	)

         input.generate_target()
         input.target.next_to(model_arr[0]    ,direction=__A    ,buff=0.02	)
         self.play(MoveToTarget(__A	)	)

         self.play(FadeOut(__A	)	)

         _lowercase						    =			Arrow(start=__A    ,end=__A    ,color=__A    ,buff=0.5	)
         a.next_to(model_arr[0].get_left()    ,__A    ,buff=0.2	)

         model_cpu_arr[0].generate_target()
         model_cpu_arr[0].target.move_to(gpu_rect[0]	)

         _lowercase						    =			MarkupText(
             F"""As the input reaches a layer, the hook triggers\nand weights are moved from the CPU\nto the GPU and back."""    ,font_size=24    ,)
         step_a.move_to([2, 2, 0]	)

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

         _lowercase						    =			{'run_time': 1, 'fade_in': True, 'fade_out': True, 'buff': 0.02}

         self.play(
             Write(__A	)    ,Circumscribe(model_arr[0]    ,color=__A    ,**__A	)    ,Circumscribe(model_cpu_arr[0]    ,color=__A    ,**__A	)    ,Circumscribe(gpu_rect[0]    ,color=__A    ,**__A	)    ,)
         self.play(MoveToTarget(model_cpu_arr[0]	)	)

         _lowercase						    =			a.copy()
         for i in range(6	):
           a_c.next_to(model_arr[i].get_right() + 0.02    ,__A    ,buff=0.2	)

           input.generate_target()
           input.target.move_to(model_arr[i].get_right() + 0.02	)

           _lowercase						    =			AnimationGroup(
               FadeOut(__A    ,run_time=0.5	)    ,MoveToTarget(__A    ,run_time=0.5	)    ,FadeIn(__A    ,run_time=0.5	)    ,lag_ratio=0.2	)

           self.play(__A	)

           model_cpu_arr[i].generate_target()
           model_cpu_arr[i].target.move_to(cpu_left_col_base[i]	)

           if i < 5:
             model_cpu_arr[i + 1].generate_target()
             model_cpu_arr[i + 1].target.move_to(gpu_rect[0]	)
             if i >= 1:
               _lowercase						    =			0.7

             self.play(
                 Circumscribe(model_arr[i]    ,**__A	)    ,Circumscribe(cpu_left_col_base[i]    ,**__A	)    ,Circumscribe(cpu_left_col_base[i + 1]    ,color=__A    ,**__A	)    ,Circumscribe(gpu_rect[0]    ,color=__A    ,**__A	)    ,Circumscribe(model_arr[i + 1]    ,color=__A    ,**__A	)    ,)
             if i < 1:
               self.play(
                   MoveToTarget(model_cpu_arr[i]	)    ,MoveToTarget(model_cpu_arr[i + 1]	)    ,)
             else:
               self.play(
                   MoveToTarget(model_cpu_arr[i]    ,run_time=0.7	)    ,MoveToTarget(model_cpu_arr[i + 1]    ,run_time=0.7	)    ,)
           else:
             model_cpu_arr[i].generate_target()
             model_cpu_arr[i].target.move_to(cpu_left_col_base[-1]	)
             input.generate_target()
             input.target.next_to(model_arr[-1].get_right()    ,RIGHT + 0.02    ,buff=0.2	)

             self.play(
                 Circumscribe(model_arr[-1]    ,color=__A    ,**__A	)    ,Circumscribe(cpu_left_col_base[-1]    ,color=__A    ,**__A	)    ,Circumscribe(gpu_rect[0]    ,color=__A    ,**__A	)    ,)

             self.play(MoveToTarget(model_cpu_arr[i]	)	)

           _lowercase						    =			a_c
           _lowercase						    =			a_c.copy()

         input.generate_target()
         input.target.next_to(model_base[-1]    ,RIGHT + 0.02    ,buff=0.5	)
         self.play(
             FadeOut(__A	)    ,FadeOut(__A    ,run_time=0.5	)    ,)

         _lowercase						    =			MarkupText(F"""Inference on a model too large for GPU memory\nis successfully completed."""    ,font_size=24	)
         step_a.move_to([2, 2, 0]	)

         self.play(Write(__A    ,run_time=3	)    ,MoveToTarget(__A	)	)

         self.wait()




'''simple docstring'''





import sys

__a  			=						(
    "73167176531330624919225119674426574742355349194934"
    "96983520312774506326239578318016984801869478851843"
    "85861560789112949495459501737958331952853208805511"
    "12540698747158523863050715693290963295227443043557"
    "66896648950445244523161731856403098711121722383113"
    "62229893423380308135336276614282806444486645238749"
    "30358907296290491560440772390713810515859307960866"
    "70172427121883998797908792274921901699720888093776"
    "65727333001053367881220235421809751254540594752243"
    "52584907711670556013604839586446706324415722155397"
    "53697817977846174064955149290862569321978468622482"
    "83972241375657056057490261407972968652414535100474"
    "82166370484403199890008895243450658541227588666881"
    "16427171479924442928230863465674813919123162824586"
    "17866458359124566529476545682848912883142607690042"
    "24219022671055626321111109370544217506941658960408"
    "07198403850962455444362981230987879927244284909188"
    "84580156166097919133875499200524063689912560717606"
    "05886116467109405077541002256983155200055935729725"
    "71636269561882670428252483600823257530420752963450"
)





def 		__snake_case(							_lowerCAmelCase = N						)						->					int:
      snake_case__    :       Dict       		= -sys.maxsize - 1
      for i in range(len(_lowerCAmelCase						) - 12						):
            snake_case__    :       Any       		= 1
            for j in range(13						):
                  product *= int(n[i + j]						)
            if product > largest_product:
                  snake_case__    :       List[str]       		= product
      return largest_product


if __name__ == "__main__":
       print(F"{solution() = }")
