code: 
  
  
  
  
  
  '''simple docstring'''
  
  
  _lowerCamelCase				:	int				    =       {
      '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    __a (     UpperCAmelCase    )      ->list[tuple[str, str]]:
  
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  
  	return [alphabet[char] for char in key.upper()]
  
  
  
  
  def    __a (     UpperCAmelCase       ,			UpperCAmelCase    )      ->str:
  
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  
  	A							  =      """"""
  	A							  =      0
  	A							  =      generate_table(UpperCAmelCase    )
  	for char in words.upper():
  		cipher += get_opponent(table[count]       ,			UpperCAmelCase    )
  		A							  =      (count + 1) % len(UpperCAmelCase    )
  	return cipher
  
  
  
  
  def    __a (     UpperCAmelCase       ,			UpperCAmelCase    )      ->str:
  
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  
  	return encrypt(UpperCAmelCase       ,			UpperCAmelCase    )
  
  
  
  
  def    __a (     UpperCAmelCase       ,			UpperCAmelCase    )      ->tuple[int, int]:
  
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  
  	A							  =      0 if char in table[0] else 1
  	A							  =      table[row].index(UpperCAmelCase    )
  	return row, col
  
  
  
  
  def    __a (     UpperCAmelCase       ,			UpperCAmelCase    )      ->str:
  
  
  
  	"""simple docstring"""
  
  
  
  
  
  
  
  	A  ,    A							  =      get_position(UpperCAmelCase       ,			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				:	Any				    =       input('Enter key: ').strip()
  				_lowerCamelCase				:	List[Any]				    =       input('Enter text to encrypt: ').strip()
  				_lowerCamelCase				:	Any				    =       encrypt(key, text)
  
  				print(f"Encrypted: {cipher_text}")
  				print(f"Decrypted with key: {decrypt(key, cipher_text)}")
  
  
style_context: 
  
  
  
  
  
  '''simple docstring'''
  
  
  import torch
  
  from diffusers import KDPMaAncestralDiscreteScheduler
  from diffusers.utils import torch_device
  
  from .test_schedulers import SchedulerCommonTest
  
  
  
  class 							__UpperCAmelCase  (       A__						):
  
  
  
  
  
  
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		__lowerCAmelCase 				=    (KDPMaAncestralDiscreteScheduler,)
  		__lowerCAmelCase 				=    10
  
  
  
  
  
  
  
  		def        A     (self						:      Any      ,      **_lowerCAmelCase						:      List[Any]      ):
  			A							  =      {
  			    """num_train_timesteps""": 1100,
  			    """beta_start""": 0.0_001,
  			    """beta_end""": 0.02,
  			    """beta_schedule""": """linear""",
  			}
  
  			config.update(**_lowerCAmelCase      )
  			return config
  
  
  
  
  
  
  
  		def        A     (self						:      Dict      ):
  			for timesteps in [10, 50, 100, 1000]:
  				self.check_over_configs(num_train_timesteps=_lowerCAmelCase      )
  
  
  
  
  
  
  
  		def        A     (self						:      Optional[int]      ):
  			for beta_start, beta_end in zip([0.00_001, 0.0_001, 0.001]      ,      [0.0_002, 0.002, 0.02]      ):
  				self.check_over_configs(beta_start=_lowerCAmelCase      ,      beta_end=_lowerCAmelCase      )
  
  
  
  
  
  
  
  		def        A     (self						:      Tuple      ):
  			for schedule in ["linear", "scaled_linear"]:
  				self.check_over_configs(beta_schedule=_lowerCAmelCase      )
  
  
  
  
  
  
  
  		def        A     (self						:      Dict      ):
  			if torch_device == "mps":
  				return
  			A							  =      self.scheduler_classes[0]
  			A							  =      self.get_scheduler_config()
  			A							  =      scheduler_class(**_lowerCAmelCase      )
  
  			scheduler.set_timesteps(self.num_inference_steps      )
  
  			A							  =      torch.manual_seed(0      )
  
  			A							  =      self.dummy_model()
  			A							  =      self.dummy_sample_deter * scheduler.init_noise_sigma
  			A							  =      sample.to(_lowerCAmelCase      )
  
  			for i, t in enumerate(scheduler.timesteps      ):
  				A							  =      scheduler.scale_model_input(_lowerCAmelCase      ,      _lowerCAmelCase      )
  
  				A							  =      model(_lowerCAmelCase      ,      _lowerCAmelCase      )
  
  				A							  =      scheduler.step(_lowerCAmelCase      ,      _lowerCAmelCase      ,      _lowerCAmelCase      ,      generator=_lowerCAmelCase      )
  				A							  =      output.prev_sample
  
  			A							  =      torch.sum(torch.abs(_lowerCAmelCase      )      )
  			A							  =      torch.mean(torch.abs(_lowerCAmelCase      )      )
  
  			assert abs(result_sum.item() - 13_849.3_877      ) < 1e-2
  			assert abs(result_mean.item() - 18.0_331      ) < 5e-3
  
  
  
  
  
  
  
  		def        A     (self						:      Union[str, Any]      ):
  			for prediction_type in ["epsilon", "v_prediction"]:
  				self.check_over_configs(prediction_type=_lowerCAmelCase      )
  
  
  
  
  
  
  
  		def        A     (self						:      Dict      ):
  			if torch_device == "mps":
  				return
  			A							  =      self.scheduler_classes[0]
  			A							  =      self.get_scheduler_config(prediction_type="""v_prediction"""      )
  			A							  =      scheduler_class(**_lowerCAmelCase      )
  
  			scheduler.set_timesteps(self.num_inference_steps      )
  
  			A							  =      self.dummy_model()
  			A							  =      self.dummy_sample_deter * scheduler.init_noise_sigma
  			A							  =      sample.to(_lowerCAmelCase      )
  
  			A							  =      torch.manual_seed(0      )
  
  			for i, t in enumerate(scheduler.timesteps      ):
  				A							  =      scheduler.scale_model_input(_lowerCAmelCase      ,      _lowerCAmelCase      )
  
  				A							  =      model(_lowerCAmelCase      ,      _lowerCAmelCase      )
  
  				A							  =      scheduler.step(_lowerCAmelCase      ,      _lowerCAmelCase      ,      _lowerCAmelCase      ,      generator=_lowerCAmelCase      )
  				A							  =      output.prev_sample
  
  			A							  =      torch.sum(torch.abs(_lowerCAmelCase      )      )
  			A							  =      torch.mean(torch.abs(_lowerCAmelCase      )      )
  
  			assert abs(result_sum.item() - 328.9_970      ) < 1e-2
  			assert abs(result_mean.item() - 0.4_284      ) < 1e-3
  
  
  
  
  
  
  
  		def        A     (self						:      Optional[int]      ):
  			if torch_device == "mps":
  				return
  			A							  =      self.scheduler_classes[0]
  			A							  =      self.get_scheduler_config()
  			A							  =      scheduler_class(**_lowerCAmelCase      )
  
  			scheduler.set_timesteps(self.num_inference_steps      ,      device=_lowerCAmelCase      )
  			A							  =      torch.manual_seed(0      )
  
  			A							  =      self.dummy_model()
  			A							  =      self.dummy_sample_deter.to(_lowerCAmelCase      ) * scheduler.init_noise_sigma
  
  			for t in scheduler.timesteps:
  				A							  =      scheduler.scale_model_input(_lowerCAmelCase      ,      _lowerCAmelCase      )
  
  				A							  =      model(_lowerCAmelCase      ,      _lowerCAmelCase      )
  
  				A							  =      scheduler.step(_lowerCAmelCase      ,      _lowerCAmelCase      ,      _lowerCAmelCase      ,      generator=_lowerCAmelCase      )
  				A							  =      output.prev_sample
  
  			A							  =      torch.sum(torch.abs(_lowerCAmelCase      )      )
  			A							  =      torch.mean(torch.abs(_lowerCAmelCase      )      )
  
  			assert abs(result_sum.item() - 13_849.3_818      ) < 1e-1
  			assert abs(result_mean.item() - 18.0_331      ) < 1e-3
  
  