




from manim import *



class    lowercase_		(SCREAMING_SNAKE_CASE__ ):



						def 	__a					(			self	:   Union[str, Any]  ):

								"""simple docstring"""

								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(*snake_case__  ).arrange(snake_case__					,							buff=0  )
								SCREAMING_SNAKE_CASE_					      =							VGroup(*snake_case__  ).arrange(snake_case__					,							buff=0  )
								SCREAMING_SNAKE_CASE_					      =							VGroup(snake_case__					,							snake_case__  ).arrange(snake_case__					,							buff=0  )
								SCREAMING_SNAKE_CASE_					      =							Text('CPU'					,							font_size=24  )
								SCREAMING_SNAKE_CASE_					      =							Group(snake_case__					,							snake_case__  ).arrange(snake_case__					,							buff=0.5					,							aligned_edge=snake_case__  )
								cpu.move_to([-2.5, -0.5, 0]  )
								self.add(snake_case__  )

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

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

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

								SCREAMING_SNAKE_CASE_					      =							[]
								SCREAMING_SNAKE_CASE_					      =							[]
								SCREAMING_SNAKE_CASE_					      =							[]

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

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

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

								self.add(*snake_case__					,							*snake_case__					,							*snake_case__  )

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

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

								self.add(snake_case__  )

								SCREAMING_SNAKE_CASE_					      =							[]
								SCREAMING_SNAKE_CASE_					      =							[]

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

										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(snake_case__  )
								self.add(*snake_case__					,							*snake_case__  )

								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=18					,							)

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

								self.add(snake_case__					,							snake_case__  )

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

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

								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=24					,							)
								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(*snake_case__  ).arrange(snake_case__					,							buff=0  )
								SCREAMING_SNAKE_CASE_					      =							VGroup(*snake_case__  ).arrange(snake_case__					,							buff=0  )
								SCREAMING_SNAKE_CASE_					      =							VGroup(snake_case__					,							snake_case__  ).arrange(snake_case__					,							buff=0  )
								SCREAMING_SNAKE_CASE_					      =							Text('Disk'					,							font_size=24  )
								SCREAMING_SNAKE_CASE_					      =							Group(snake_case__					,							snake_case__  ).arrange(snake_case__					,							buff=0.5					,							aligned_edge=snake_case__  )
								disk.move_to([-4.0, -1.25, 0]  )
								self.play(Write(snake_case__					,							run_time=3  )					,							Write(snake_case__					,							run_time=1  )					,							Create(snake_case__					,							run_time=1  )  )

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

								self.play(FadeOut(snake_case__  )  )

								SCREAMING_SNAKE_CASE_					      =							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(snake_case__					,							run_time=3  )  )

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

								self.wait()





SCREAMING_SNAKE_CASE:     dict[tuple[int, int, int], int]									= {}


def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase    ,						lowerCAmelCase )->	int:

		# if we are absent twice, or late 3 consecutive days,
		# no further prize strings are possible
		if late == 3 or absent == 2:
				return 0

		# if we have no days left, and have not failed any other rules,
		# we have a prize string
		if days == 0:
				return 1

		# No easy solution, so now we need to do the recursive calculation

		# First, check if the combination is already in the cache, and
		# if yes, return the stored value from there since we already
		# know the number of possible prize strings from this point on
		SCREAMING_SNAKE_CASE_					      =							(days, absent, late)
		if key in cache:
				return cache[key]

		# now we calculate the three possible ways that can unfold from
		# this point on, depending on our attendance today

		# 1) if we are late (but not absent), the "absent" counter stays as
		# it is, but the "late" counter increases by one
		SCREAMING_SNAKE_CASE_					      =							_calculate(days - 1    ,						lowerCAmelCase    ,						late + 1 )

		# 2) if we are absent, the "absent" counter increases by 1, and the
		# "late" counter resets to 0
		SCREAMING_SNAKE_CASE_					      =							_calculate(days - 1    ,						absent + 1    ,						0 )

		# 3) if we are on time, this resets the "late" counter and keeps the
		# absent counter
		SCREAMING_SNAKE_CASE_					      =							_calculate(days - 1    ,						lowerCAmelCase    ,						0 )

		SCREAMING_SNAKE_CASE_					      =							state_late + state_absent + state_ontime

		SCREAMING_SNAKE_CASE_					      =							prizestrings
		return prizestrings


def 					_a							(					lowerCAmelCase = 30 )->	int:
		return _calculate(lowerCAmelCase    ,						absent=0    ,						late=0 )


if __name__ == "__main__":
						print(solution())