_lowerCamelCase    :      Any	 =						{
    """A""": ("""ABCDEFGHIJKLM""", """NOPQRSTUVWXYZ"""),
    """B""": ("""ABCDEFGHIJKLM""", """NOPQRSTUVWXYZ"""),
    """C""": ("""ABCDEFGHIJKLM""", """ZNOPQRSTUVWXY"""),
    """D""": ("""ABCDEFGHIJKLM""", """ZNOPQRSTUVWXY"""),
    """E""": ("""ABCDEFGHIJKLM""", """YZNOPQRSTUVWX"""),
    """F""": ("""ABCDEFGHIJKLM""", """YZNOPQRSTUVWX"""),
    """G""": ("""ABCDEFGHIJKLM""", """XYZNOPQRSTUVW"""),
    """H""": ("""ABCDEFGHIJKLM""", """XYZNOPQRSTUVW"""),
    """I""": ("""ABCDEFGHIJKLM""", """WXYZNOPQRSTUV"""),
    """J""": ("""ABCDEFGHIJKLM""", """WXYZNOPQRSTUV"""),
    """K""": ("""ABCDEFGHIJKLM""", """VWXYZNOPQRSTU"""),
    """L""": ("""ABCDEFGHIJKLM""", """VWXYZNOPQRSTU"""),
    """M""": ("""ABCDEFGHIJKLM""", """UVWXYZNOPQRST"""),
    """N""": ("""ABCDEFGHIJKLM""", """UVWXYZNOPQRST"""),
    """O""": ("""ABCDEFGHIJKLM""", """TUVWXYZNOPQRS"""),
    """P""": ("""ABCDEFGHIJKLM""", """TUVWXYZNOPQRS"""),
    """Q""": ("""ABCDEFGHIJKLM""", """STUVWXYZNOPQR"""),
    """R""": ("""ABCDEFGHIJKLM""", """STUVWXYZNOPQR"""),
    """S""": ("""ABCDEFGHIJKLM""", """RSTUVWXYZNOPQ"""),
    """T""": ("""ABCDEFGHIJKLM""", """RSTUVWXYZNOPQ"""),
    """U""": ("""ABCDEFGHIJKLM""", """QRSTUVWXYZNOP"""),
    """V""": ("""ABCDEFGHIJKLM""", """QRSTUVWXYZNOP"""),
    """W""": ("""ABCDEFGHIJKLM""", """PQRSTUVWXYZNO"""),
    """X""": ("""ABCDEFGHIJKLM""", """PQRSTUVWXYZNO"""),
    """Y""": ("""ABCDEFGHIJKLM""", """OPQRSTUVWXYZN"""),
    """Z""": ("""ABCDEFGHIJKLM""", """OPQRSTUVWXYZN"""),
}





def 		__lowerCamelCase							(UpperCAmelCase__   :							str     ):
					return [alphabet[char] for char in key.upper()]





def 		__lowerCamelCase							(UpperCAmelCase__   :							str					,       UpperCAmelCase__   :							str     ):
					SCREAMING_SNAKE_CASE				=				""
					SCREAMING_SNAKE_CASE				=				0
					SCREAMING_SNAKE_CASE				=				generate_table(a__     )
					for char in words.upper():
										cipher += get_opponent(table[count]					,       a__     )
										SCREAMING_SNAKE_CASE				=				(count + 1) % len(a__     )
					return cipher





def 		__lowerCamelCase							(UpperCAmelCase__   :							str					,       UpperCAmelCase__   :							str     ):
					return encrypt(a__					,       a__     )





def 		__lowerCamelCase							(UpperCAmelCase__   :							tuple[str, str]					,       UpperCAmelCase__   :							str     ):
					SCREAMING_SNAKE_CASE				=				0 if char in table[0] else 1
					SCREAMING_SNAKE_CASE				=				table[row].index(a__     )
					return row, col





def 		__lowerCamelCase							(UpperCAmelCase__   :							tuple[str, str]					,       UpperCAmelCase__   :							str     ):
					SCREAMING_SNAKE_CASE	,      SCREAMING_SNAKE_CASE				=				get_position(a__					,       char.upper()     )
					if row == 1:
										return table[0][col]
					else:
										return table[1][col] if row == 0 else char


if __name__ == "__main__":
							import doctest

							doctest.testmod()  # Fist ensure that all our tests are passing...
							_lowerCamelCase    :      Optional[int]	 =						input('''Enter key: ''').strip()
							_lowerCamelCase    :      Optional[Any]	 =						input('''Enter text to encrypt: ''').strip()
							_lowerCamelCase    :      Optional[int]	 =						encrypt(key, text)

							print(f"""Encrypted: {cipher_text}""")
							print(f"""Decrypted with key: {decrypt(key, cipher_text)}""")










'''simple docstring'''
import torch

from diffusers import HeunDiscreteScheduler
from diffusers.utils import torch_device

from .test_schedulers import SchedulerCommonTest






class        SCREAMING_SNAKE_CASE(				__A     ):
       snake_case_ :     Any    =					(HeunDiscreteScheduler,)
       snake_case_ :     Any    =					10

       def     snake_case__			(    self					,		**lowerCamelCase__     )    ->					int:

           """simple docstring"""



           __lowercase							=						{
               """num_train_timesteps""": 1100,
               """beta_start""": 0.00_01,
               """beta_end""": 0.02,
               """beta_schedule""": """linear""",
           }

           config.update(**lowerCamelCase__     )
           return config

       def     snake_case__			(    self     )    ->					Optional[Any]:

           """simple docstring"""



           for timesteps in [10, 50, 100, 1000]:
               self.check_over_configs(num_train_timesteps=lowerCamelCase__     )

       def     snake_case__			(    self     )    ->					Dict:

           """simple docstring"""



           for beta_start, beta_end in zip([0.0_00_01, 0.00_01, 0.0_01]					,		[0.00_02, 0.0_02, 0.02]     ):
               self.check_over_configs(beta_start=lowerCamelCase__					,		beta_end=lowerCamelCase__     )

       def     snake_case__			(    self     )    ->					Any:

           """simple docstring"""



           for schedule in ["linear", "scaled_linear", "exp"]:
               self.check_over_configs(beta_schedule=lowerCamelCase__     )

       def     snake_case__			(    self     )    ->					int:

           """simple docstring"""



           for clip_sample_range in [1.0, 2.0, 3.0]:
               self.check_over_configs(clip_sample_range=lowerCamelCase__					,		clip_sample=lowerCamelCase__     )

       def     snake_case__			(    self     )    ->					Optional[int]:

           """simple docstring"""



           for prediction_type in ["epsilon", "v_prediction", "sample"]:
               self.check_over_configs(prediction_type=lowerCamelCase__     )

       def     snake_case__			(    self     )    ->					str:

           """simple docstring"""



           __lowercase							=						self.scheduler_classes[0]
           __lowercase							=						self.get_scheduler_config()
           __lowercase							=						scheduler_class(**lowerCamelCase__     )

           scheduler.set_timesteps(self.num_inference_steps     )

           __lowercase							=						self.dummy_model()
           __lowercase							=						self.dummy_sample_deter * scheduler.init_noise_sigma
           __lowercase							=						sample.to(lowerCamelCase__     )

           for i, t in enumerate(scheduler.timesteps     ):
               __lowercase							=						scheduler.scale_model_input(lowerCamelCase__					,		lowerCamelCase__     )

               __lowercase							=						model(lowerCamelCase__					,		lowerCamelCase__     )

               __lowercase							=						scheduler.step(lowerCamelCase__					,		lowerCamelCase__					,		lowerCamelCase__     )
               __lowercase							=						output.prev_sample

           __lowercase							=						torch.sum(torch.abs(lowerCamelCase__     )     )
           __lowercase							=						torch.mean(torch.abs(lowerCamelCase__     )     )

           if torch_device in ["cpu", "mps"]:
               assert abs(result_sum.item() - 0.12_33     ) < 1E-2
               assert abs(result_mean.item() - 0.00_02     ) < 1E-3
           else:
               # CUDA
               assert abs(result_sum.item() - 0.12_33     ) < 1E-2
               assert abs(result_mean.item() - 0.00_02     ) < 1E-3

       def     snake_case__			(    self     )    ->					str:

           """simple docstring"""



           __lowercase							=						self.scheduler_classes[0]
           __lowercase							=						self.get_scheduler_config(prediction_type="""v_prediction"""     )
           __lowercase							=						scheduler_class(**lowerCamelCase__     )

           scheduler.set_timesteps(self.num_inference_steps     )

           __lowercase							=						self.dummy_model()
           __lowercase							=						self.dummy_sample_deter * scheduler.init_noise_sigma
           __lowercase							=						sample.to(lowerCamelCase__     )

           for i, t in enumerate(scheduler.timesteps     ):
               __lowercase							=						scheduler.scale_model_input(lowerCamelCase__					,		lowerCamelCase__     )

               __lowercase							=						model(lowerCamelCase__					,		lowerCamelCase__     )

               __lowercase							=						scheduler.step(lowerCamelCase__					,		lowerCamelCase__					,		lowerCamelCase__     )
               __lowercase							=						output.prev_sample

           __lowercase							=						torch.sum(torch.abs(lowerCamelCase__     )     )
           __lowercase							=						torch.mean(torch.abs(lowerCamelCase__     )     )

           if torch_device in ["cpu", "mps"]:
               assert abs(result_sum.item() - 4.6_9_3_4E-0_7     ) < 1E-2
               assert abs(result_mean.item() - 6.1_1_1_2E-1_0     ) < 1E-3
           else:
               # CUDA
               assert abs(result_sum.item() - 4.6_9_3_4_2_8_6_5_0_1_7_0_9_7_2E-0_7     ) < 1E-2
               assert abs(result_mean.item() - 0.00_02     ) < 1E-3

       def     snake_case__			(    self     )    ->					Dict:

           """simple docstring"""



           __lowercase							=						self.scheduler_classes[0]
           __lowercase							=						self.get_scheduler_config()
           __lowercase							=						scheduler_class(**lowerCamelCase__     )

           scheduler.set_timesteps(self.num_inference_steps					,		device=lowerCamelCase__     )

           __lowercase							=						self.dummy_model()
           __lowercase							=						self.dummy_sample_deter.to(lowerCamelCase__     ) * scheduler.init_noise_sigma

           for t in scheduler.timesteps:
               __lowercase							=						scheduler.scale_model_input(lowerCamelCase__					,		lowerCamelCase__     )

               __lowercase							=						model(lowerCamelCase__					,		lowerCamelCase__     )

               __lowercase							=						scheduler.step(lowerCamelCase__					,		lowerCamelCase__					,		lowerCamelCase__     )
               __lowercase							=						output.prev_sample

           __lowercase							=						torch.sum(torch.abs(lowerCamelCase__     )     )
           __lowercase							=						torch.mean(torch.abs(lowerCamelCase__     )     )

           if str(lowerCamelCase__     ).startswith("""cpu"""     ):
               # The following sum varies between 148 and 156 on mps. Why?
               assert abs(result_sum.item() - 0.12_33     ) < 1E-2
               assert abs(result_mean.item() - 0.00_02     ) < 1E-3
           elif str(lowerCamelCase__     ).startswith("""mps"""     ):
               # Larger tolerance on mps
               assert abs(result_mean.item() - 0.00_02     ) < 1E-2
           else:
               # CUDA
               assert abs(result_sum.item() - 0.12_33     ) < 1E-2
               assert abs(result_mean.item() - 0.00_02     ) < 1E-3




       def     snake_case__			(    self     )    ->					Union[str, Any]:

           """simple docstring"""



           __lowercase							=						self.scheduler_classes[0]
           __lowercase							=						self.get_scheduler_config()
           __lowercase							=						scheduler_class(**lowerCamelCase__					,		use_karras_sigmas=lowerCamelCase__     )

           scheduler.set_timesteps(self.num_inference_steps					,		device=lowerCamelCase__     )

           __lowercase							=						self.dummy_model()
           __lowercase							=						self.dummy_sample_deter.to(lowerCamelCase__     ) * scheduler.init_noise_sigma
           __lowercase							=						sample.to(lowerCamelCase__     )

           for t in scheduler.timesteps:
               __lowercase							=						scheduler.scale_model_input(lowerCamelCase__					,		lowerCamelCase__     )

               __lowercase							=						model(lowerCamelCase__					,		lowerCamelCase__     )

               __lowercase							=						scheduler.step(lowerCamelCase__					,		lowerCamelCase__					,		lowerCamelCase__     )
               __lowercase							=						output.prev_sample

           __lowercase							=						torch.sum(torch.abs(lowerCamelCase__     )     )
           __lowercase							=						torch.mean(torch.abs(lowerCamelCase__     )     )

           assert abs(result_sum.item() - 0.0_00_15     ) < 1E-2
           assert abs(result_mean.item() - 1.9_8_6_9_5_5_4_5_3_5_0_3_4_6_9_5E-0_7     ) < 1E-2




