






"""simple docstring"""


def    lowerCAmelCase							(       __UpperCamelCase						,			__UpperCamelCase					):




  """simple docstring"""







  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
  __A		     =					plaintext.lower()
  __A		     =					key.lower()
  __A		     =					0
  __A		     =					0
  __A		     =					''''''
  while plaintext_iterator < len(__UpperCamelCase					):
    if (
        ord(plaintext[plaintext_iterator]					) < 9_7
        or ord(plaintext[plaintext_iterator]					) > 1_2_2
    ):
      ciphertext += plaintext[plaintext_iterator]
      plaintext_iterator += 1
    elif ord(key[key_iterator]					) < 9_7 or ord(key[key_iterator]					) > 1_2_2:
      key_iterator += 1
    else:
      ciphertext += chr(
          (
              (ord(plaintext[plaintext_iterator]					) - 9_7 + ord(key[key_iterator]					))
              - 9_7
          )
          % 2_6
          + 9_7					)
      key_iterator += 1
      plaintext_iterator += 1
  return ciphertext



def    lowerCAmelCase							(       __UpperCamelCase						,			__UpperCamelCase					):




  """simple docstring"""







  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'''					)

  __A		     =					key.lower()
  __A		     =					0
  __A		     =					0
  __A		     =					''''''
  while ciphertext_iterator < len(__UpperCamelCase					):
    if (
        ord(ciphertext[ciphertext_iterator]					) < 9_7
        or ord(ciphertext[ciphertext_iterator]					) > 1_2_2
    ):
      plaintext += ciphertext[ciphertext_iterator]
    else:
      plaintext += chr(
          (ord(ciphertext[ciphertext_iterator]					) - ord(key[key_iterator]					)) % 2_6
          + 9_7					)
      key += chr(
          (ord(ciphertext[ciphertext_iterator]					) - ord(key[key_iterator]					)) % 2_6
          + 9_7					)
      key_iterator += 1
    ciphertext_iterator += 1
  return plaintext


if __name__ == "__main__":
       import doctest

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









import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


UpperCAmelCase :				Any							=1000_0000_0000
UpperCAmelCase :				Any							=1_0000

UpperCAmelCase			,			UpperCAmelCase :				Tuple							=os.path.split(__file__)
UpperCAmelCase :				Tuple							=os.path.join(RESULTS_BASEPATH, """results""", RESULTS_FILENAME.replace(""".py""", """.json"""))



def  _lowerCAmelCase     (_lowerCAmelCase ,						_lowerCAmelCase):
					UpperCamelCase_			= pa.Table.from_pydict({"col": [0] * chunk_size})
					UpperCamelCase_			= pa.concat_tables([table] * (num_examples // chunk_size))
					return datasets.Dataset(_lowerCAmelCase ,						fingerprint="table_100B")


@dataclass
class    _lowercase :
				'''simple docstring'''







				lowercase__     =    42
				lowercase__     =    42
				lowercase__     =    42
				lowercase__     =    42

				def    _lowerCamelCase       (			self     ):

									'''simple docstring'''


									UpperCamelCase_			= np.random.default_rng(self.seed     )
									UpperCamelCase_			= rng.integers(low=self.low  ,			high=self.high  ,			size=self.size     ).tolist()

				def __iter__(			self     ):

									'''simple docstring'''


									return iter(self._sampled_values     )

				def __len__(			self     ):

									'''simple docstring'''


									return self.size




@get_duration
def  _lowerCAmelCase     (_lowerCAmelCase):
					UpperCamelCase_			= dataset[0]



@get_duration
def  _lowerCAmelCase     (_lowerCAmelCase):
					UpperCamelCase_			= dataset[-1]



@get_duration
def  _lowerCAmelCase     (_lowerCAmelCase):
					UpperCamelCase_			= dataset[range(len(_lowerCAmelCase) // 2 ,						len(_lowerCAmelCase) // 2 + 10_24)]



@get_duration
def  _lowerCAmelCase     (_lowerCAmelCase):
					UpperCamelCase_			= dataset[RandIter(0 ,						len(_lowerCAmelCase) ,						10_24 ,						seed=42)]



def  _lowerCAmelCase     ():
					UpperCamelCase_			= {"num examples": SPEED_TEST_N_EXAMPLES}
					UpperCamelCase_			= (get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
					print("generating dataset")
					UpperCamelCase_			= generate_100B_dataset(num_examples=_lowerCAmelCase ,						chunk_size=_lowerCAmelCase)
					print("Functions")
					for func in functions:
										print(func.__name__)
										UpperCamelCase_			= func(_lowerCAmelCase)

					with open(_lowerCAmelCase ,						"wb") as f:
										f.write(json.dumps(_lowerCAmelCase).encode("utf-8"))


if __name__ == "__main__":  # useful to run the profiler
	benchmark_table_100B()
