





'''simple docstring'''

def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	List[Any]					     =     ''''''
      for i in table:
            res += inp[i - 1]
      return res




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      return data[1:] + data[0]




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Union[str, Any]					     =     ''''''
      for i in range(len(lowerCAmelCase_	)	):
            if a[i] == b[i]:
                  res += "0"
            else:
                  res += "1"
      return res




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Dict					     =     int('''0b''' + data[0] + data[-1]			,      2	)
      _snake_case		:	Union[str, Any]					     =     int('''0b''' + data[1:3]			,      2	)
      return bin(s[row][col]	)[2:]




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	int					     =     message[:4]
      _snake_case		:	List[Any]					     =     message[4:]
      _snake_case		:	List[Any]					     =     apply_table(lowerCAmelCase_			,      lowerCAmelCase_	)
      _snake_case		:	List[str]					     =     xor(lowerCAmelCase_			,      lowerCAmelCase_	)
      _snake_case		:	Optional[Any]					     =     apply_sbox(lowerCAmelCase_			,      temp[:4]	)  # noqa: E741
      _snake_case		:	List[str]					     =     apply_sbox(lowerCAmelCase_			,      temp[4:]	)
      _snake_case		:	int					     =     '''0''' * (2 - len(lowerCAmelCase_	)) + l  # noqa: E741
      _snake_case		:	Dict					     =     '''0''' * (2 - len(lowerCAmelCase_	)) + r
      _snake_case		:	List[Any]					     =     apply_table(l + r			,      lowerCAmelCase_	)
      _snake_case		:	Dict					     =     xor(lowerCAmelCase_			,      lowerCAmelCase_	)
      return temp + right


if __name__ == "__main__":
   UpperCAmelCase					:		Union[str, Any]		=							input('Enter 10 bit key: ')
   UpperCAmelCase					:		Union[str, Any]		=							input('Enter 8 bit message: ')

   UpperCAmelCase					:		str		=							[6, 3, 7, 4, 8, 5, 1_0, 9]
   UpperCAmelCase					:		str		=							[3, 5, 2, 7, 4, 1_0, 1, 9, 8, 6]
   UpperCAmelCase					:		Dict		=							[2, 4, 3, 1]
   UpperCAmelCase					:		str		=							[2, 6, 3, 1, 4, 8, 5, 7]
   UpperCAmelCase					:		Union[str, Any]		=							[4, 1, 3, 5, 7, 2, 8, 6]
   UpperCAmelCase					:		List[str]		=							[4, 1, 2, 3, 2, 3, 4, 1]
   UpperCAmelCase					:		Dict		=							[[1, 0, 3, 2], [3, 2, 1, 0], [0, 2, 1, 3], [3, 1, 3, 2]]
   UpperCAmelCase					:		Optional[int]		=							[[0, 1, 2, 3], [2, 0, 1, 3], [3, 0, 1, 0], [2, 1, 0, 3]]

   # key generation
   UpperCAmelCase					:		Dict		=							apply_table(key, paa_table)
   UpperCAmelCase					:		Optional[int]		=							temp[:5]
   UpperCAmelCase					:		Dict		=							temp[5:]
   UpperCAmelCase					:		int		=							left_shift(left)
   UpperCAmelCase					:		str		=							left_shift(right)
   UpperCAmelCase					:		Dict		=							apply_table(left + right, pa_table)
   UpperCAmelCase					:		str		=							left_shift(left)
   UpperCAmelCase					:		str		=							left_shift(right)
   UpperCAmelCase					:		List[str]		=							left_shift(left)
   UpperCAmelCase					:		Union[str, Any]		=							left_shift(right)
   UpperCAmelCase					:		Optional[Any]		=							apply_table(left + right, pa_table)

   # encryption
   UpperCAmelCase					:		Tuple		=							apply_table(message, IP)
   UpperCAmelCase					:		Dict		=							function(expansion, sa, sa, keya, temp)
   UpperCAmelCase					:		List[Any]		=							temp[4:] + temp[:4]
   UpperCAmelCase					:		Union[str, Any]		=							function(expansion, sa, sa, keya, temp)
   UpperCAmelCase					:		Union[str, Any]		=							apply_table(temp, IP_inv)
   print('Cipher text is:', CT)

   # decryption
   UpperCAmelCase					:		List[Any]		=							apply_table(CT, IP)
   UpperCAmelCase					:		Union[str, Any]		=							function(expansion, sa, sa, keya, temp)
   UpperCAmelCase					:		Optional[int]		=							temp[4:] + temp[:4]
   UpperCAmelCase					:		Union[str, Any]		=							function(expansion, sa, sa, keya, temp)
   UpperCAmelCase					:		Optional[Any]		=							apply_table(temp, IP_inv)
   print('Plain text after decypting is:', PT)









'''simple docstring'''

from random import randint
from tempfile import TemporaryFile

import numpy as np




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	List[Any]					     =     0
      if start < end:
            _snake_case		:	List[Any]					     =     randint(lowerCAmelCase_			,      lowerCAmelCase_	)
            _snake_case		:	Any					     =     a[end]
            _snake_case		:	List[str]					     =     a[pivot]
            _snake_case		:	Optional[int]					     =     temp

            _snake_case     ,							_snake_case		:	List[Any]					     =     _in_place_partition(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)
            count += _in_place_quick_sort(lowerCAmelCase_			,      lowerCAmelCase_			,      p - 1	)
            count += _in_place_quick_sort(lowerCAmelCase_			,      p + 1			,      lowerCAmelCase_	)
      return count




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Optional[Any]					     =     0
      _snake_case		:	Optional[int]					     =     randint(lowerCAmelCase_			,      lowerCAmelCase_	)
      _snake_case		:	Tuple					     =     a[end]
      _snake_case		:	Optional[Any]					     =     a[pivot]
      _snake_case		:	Union[str, Any]					     =     temp
      _snake_case		:	Union[str, Any]					     =     start - 1
      for index in range(lowerCAmelCase_			,      lowerCAmelCase_	):
            count += 1
            if a[index] < a[end]:  # check if current val is less than pivot value
                  _snake_case		:	Optional[int]					     =     new_pivot_index + 1
                  _snake_case		:	Optional[Any]					     =     a[new_pivot_index]
                  _snake_case		:	Tuple					     =     a[index]
                  _snake_case		:	str					     =     temp

      _snake_case		:	Any					     =     a[new_pivot_index + 1]
      _snake_case		:	str					     =     a[end]
      _snake_case		:	Optional[int]					     =     temp
      return new_pivot_index + 1, count


UpperCAmelCase					:		Dict		=							TemporaryFile()
UpperCAmelCase					:		Dict		=							1_0_0  # 1000 elements are to be sorted


UpperCAmelCase,       UpperCAmelCase					:		str		=							0, 1  # mean and standard deviation
UpperCAmelCase					:		Optional[Any]		=							np.random.normal(mu, sigma, p)
np.save(outfile, X)
print('The array is')
print(X)


outfile.seek(0)  # using the same array
UpperCAmelCase					:		int		=							np.load(outfile)
UpperCAmelCase					:		Optional[int]		=							len(M) - 1
UpperCAmelCase					:		str		=							_in_place_quick_sort(M, 0, r)

print(
    'No of Comparisons for 100 elements selected from a standard normal distribution'
    'is :'
)
print(z)


