

"""simple docstring"""






def 		A_	(   __UpperCamelCase     :				str       ,	__UpperCamelCase     :				str				):
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''plaintext must be a string'''				)
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''key must be a string'''				)

		if not plaintext:
				raise ValueError('''plaintext is empty'''				)
		if not key:
				raise ValueError('''key is empty'''				)

		key += plaintext
		lowercase										=							plaintext.lower()
		lowercase										=							key.lower()
		lowercase										=							0
		lowercase										=							0
		lowercase										=							''''''
		while plaintext_iterator < len(__UpperCamelCase				):
				if (
				    ord(plaintext[plaintext_iterator]				) < 97
				    or ord(plaintext[plaintext_iterator]				) > 1_22
				):
						ciphertext += plaintext[plaintext_iterator]
						plaintext_iterator += 1
				elif ord(key[key_iterator]				) < 97 or ord(key[key_iterator]				) > 1_22:
						key_iterator += 1
				else:
						ciphertext += chr(
						    (
						        (ord(plaintext[plaintext_iterator]				) - 97 + ord(key[key_iterator]				))
						        - 97
						    )
						    % 26
						    + 97				)
						key_iterator += 1
						plaintext_iterator += 1
		return ciphertext
def 		A_	(   __UpperCamelCase     :				str       ,	__UpperCamelCase     :				str				):
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''ciphertext must be a string'''				)
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''key must be a string'''				)

		if not ciphertext:
				raise ValueError('''ciphertext is empty'''				)
		if not key:
				raise ValueError('''key is empty'''				)

		lowercase										=							key.lower()
		lowercase										=							0
		lowercase										=							0
		lowercase										=							''''''
		while ciphertext_iterator < len(__UpperCamelCase				):
				if (
				    ord(ciphertext[ciphertext_iterator]				) < 97
				    or ord(ciphertext[ciphertext_iterator]				) > 1_22
				):
						plaintext += ciphertext[ciphertext_iterator]
				else:
						plaintext += chr(
						    (ord(ciphertext[ciphertext_iterator]				) - ord(key[key_iterator]				)) % 26
						    + 97				)
						key += chr(
						    (ord(ciphertext[ciphertext_iterator]				) - ord(key[key_iterator]				)) % 26
						    + 97				)
						key_iterator += 1
				ciphertext_iterator += 1
		return plaintext


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							__lowerCAmelCase				      =   int(input('''Type 1 to encrypt or 2 to decrypt:'''))
							if operation == 1:
														__lowerCAmelCase				      =   input('''Typeplaintext to be encrypted:\n''')
														__lowerCAmelCase				      =   input('''Type the key:\n''')
														print(encrypt(plaintext, key))
							elif operation == 2:
														__lowerCAmelCase				      =   input('''Type the ciphertext to be decrypted:\n''')
														__lowerCAmelCase				      =   input('''Type the key:\n''')
														print(decrypt(ciphertext, key))
							decrypt('''jsqqs avvwo''', '''coffee''')


"""simple docstring"""






from manim import *
class 	_lowerCAmelCase    (      __snake_case       ):

							def 					_lowerCAmelCase  ( self       :    Dict    )   ->    Tuple:

									"""simple docstring"""
									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    ):
											rect.set_stroke(a    )

											lowercase										=							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    )

									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.0, -1.25, 0]    )
									self.add(a ,		a    )

									lowercase										=							[]

									for i in range(6    ):
											lowercase										=							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    )

									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"""The offloaded weights are all sent to the CPU.""" ,		font_size=24    )
									step_a.move_to([2, 2, 0]    )

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

									for i in range(6    ):
											lowercase										=							cpu_disk_arr[i]
											lowercase										=							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    )    )

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

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

									lowercase										=							[]
									lowercase										=							[]
									for i in range(6    ):
											lowercase										=							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()