




import os
import sys
import time

from . import transposition_cipher as trans_cipher

def   A   (   )			->				Union[str, Any]:
       lowerCamelCase     :   Union[str, Any]    				=      "Prehistoric Men.txt"
       lowerCamelCase     :   Dict    				=      "Output.txt"
       lowerCamelCase     :   List[Any]    				=      int(input("Enter key: "					)					)
       lowerCamelCase     :   List[str]    				=      input("Encrypt/Decrypt [e/d]: "					)

       if not os.path.exists(_SCREAMING_SNAKE_CASE					):
              print(f'''File {input_file} does not exist. Quitting...'''					)
              sys.exit()
       if os.path.exists(_SCREAMING_SNAKE_CASE					):
              print(f'''Overwrite {output_file}? [y/n]'''					)
              lowerCamelCase     :   Tuple    				=      input("> "					)
              if not response.lower().startswith("y"					):
                     sys.exit()

       lowerCamelCase     :   str    				=      time.time()
       if mode.lower().startswith("e"					):
              with open(_SCREAMING_SNAKE_CASE					) as f:
                     lowerCamelCase     :   List[Any]    				=      f.read()
              lowerCamelCase     :   Union[str, Any]    				=      trans_cipher.encrypt_message(_SCREAMING_SNAKE_CASE				,_SCREAMING_SNAKE_CASE					)
       elif mode.lower().startswith("d"					):
              with open(_SCREAMING_SNAKE_CASE					) as f:
                     lowerCamelCase     :   Dict    				=      f.read()
              lowerCamelCase     :   int    				=      trans_cipher.decrypt_message(_SCREAMING_SNAKE_CASE				,_SCREAMING_SNAKE_CASE					)

       with open(_SCREAMING_SNAKE_CASE				,"w"					) as output_obj:
              output_obj.write(_SCREAMING_SNAKE_CASE					)

       lowerCamelCase     :   Union[str, Any]    				=      round(time.time() - start_time				,2					)
       print(("Done (", total_time, "seconds )")					)


if __name__ == "__main__":
       main()












from itertools import compress, repeat
from math import ceil, sqrt

def   A   (   _SCREAMING_SNAKE_CASE					)			->				list[int]:

       if num <= 2:
              return []
       if num == 3:
              return [2]

       # Odd sieve for numbers in range [3, num - 1]
       lowerCamelCase     :   str    				=      bytearray(B"\x01"					) * ((num >> 1) - 1)

       for i in range(3				,int(sqrt(_SCREAMING_SNAKE_CASE					)					) + 1				,2					):
              if sieve[(i >> 1) - 1]:
                     lowerCamelCase     :   Tuple    				=      i**2
                     lowerCamelCase     :   str    				=      repeat(
                         0				,ceil((num - i_squared) / (i << 1)					)					)

       return [2] + list(compress(range(3				,_SCREAMING_SNAKE_CASE				,2					)				,_SCREAMING_SNAKE_CASE					)					)


if __name__ == "__main__":
       import doctest

       doctest.testmod()






