



__A             =(1, 1_5_3, 3_7_0, 3_7_1, 1_6_3_4, 2_4_6_7_8_0_5_1, 1_1_5_1_3_2_2_1_9_0_1_8_7_6_3_9_9_2_5_6_5_0_9_5_5_9_7_9_7_3_9_7_1_5_2_2_4_0_1)
__A             =(-1_5_3, -1, 0, 1.2, 2_0_0, "A", [], {}, None)

def 	a						(				_UpperCAmelCase							: int						):







		'''simple docstring'''





		if not isinstance(_UpperCAmelCase			,       _UpperCAmelCase						) or n < 1:
				return False

		# Initialization of sum and number of digits.
		__UpperCAmelCase   :					List[str]													=     0
		__UpperCAmelCase   :					Optional[int]													=     0
		__UpperCAmelCase   :					str													=     n
		# Calculation of digits of the number
		while temp > 0:
				number_of_digits += 1
				temp //= 10
		# Dividing number into separate digits and find Armstrong number
		__UpperCAmelCase   :					Optional[Any]													=     n
		while temp > 0:
				__UpperCAmelCase   :					Union[str, Any]													=     temp % 10
				total += rem**number_of_digits
				temp //= 10
		return n == total

def 	a						(				_UpperCAmelCase							: int						):







		'''simple docstring'''





		if not isinstance(_UpperCAmelCase			,       _UpperCAmelCase						) or n < 1:
				return False

		# Init a "histogram" of the digits
		__UpperCAmelCase   :					List[Any]													=     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
		__UpperCAmelCase   :					str													=     0
		__UpperCAmelCase   :					Dict													=     0
		__UpperCAmelCase   :					List[str]													=     n
		while temp > 0:
				__UpperCAmelCase							, __UpperCAmelCase   :					List[str]													=     divmod(_UpperCAmelCase			,       10						)
				digit_histogram[rem] += 1
				digit_total += 1

		for cnt, i in zip(_UpperCAmelCase			,       range(len(_UpperCAmelCase						)						)						):
				total += cnt * i**digit_total

		return n == total

def 	a						(				_UpperCAmelCase							: int						):







		'''simple docstring'''





		if not isinstance(_UpperCAmelCase			,       _UpperCAmelCase						) or n < 1:
				return False
		__UpperCAmelCase   :					int													=     len(str(_UpperCAmelCase						)						)  # the power that all digits will be raised to
		# check if sum of each digit multiplied expo times is equal to number
		return n == sum(int(_UpperCAmelCase						) ** expo for i in str(_UpperCAmelCase						)						)

def 	a						(				):







		'''simple docstring'''





		__UpperCAmelCase   :					Tuple													=     int(input('''Enter an integer to see if it is an Armstrong number: '''						).strip()						)
		print(f'{num} is {"" if armstrong_number(_UpperCAmelCase						) else "not "}an Armstrong number.'						)
		print(f'{num} is {"" if narcissistic_number(_UpperCAmelCase						) else "not "}an Armstrong number.'						)
		print(f'{num} is {"" if pluperfect_number(_UpperCAmelCase						) else "not "}an Armstrong number.'						)


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				main()










from __future__ import annotations

import random
from collections.abc import Iterable
from typing import Any, Generic, TypeVar

__A             =TypeVar("T", bound=bool)

class 		UpperCAmelCase__      (      Generic[T]       ):




			'''simple docstring'''






			def __init__(       self							:			List[Any]	,	a_							:			T			):
					'''simple docstring'''





					__UpperCAmelCase   :					T													=     value
					__UpperCAmelCase   :					RandomizedHeapNode[T] | None													=     None
					__UpperCAmelCase   :					RandomizedHeapNode[T] | None													=     None




			@property
			def 			snake_case__					(       self							:			Any			):
					'''simple docstring'''





					return self._value




			@staticmethod
			def 			snake_case__					(       a_							:			RandomizedHeapNode[T] | None	,	a_							:			RandomizedHeapNode[T] | None			):
					'''simple docstring'''





					if not roota:
							return roota

					if not roota:
							return roota

					if roota.value > roota.value:
							__UpperCAmelCase							, __UpperCAmelCase   :					int													=     roota, roota

					if random.choice([True, False]			):
							__UpperCAmelCase							, __UpperCAmelCase   :					Union[str, Any]													=     roota.right, roota.left

					__UpperCAmelCase   :					Optional[Any]													=     RandomizedHeapNode.merge(roota.left	,	a_			)

					return roota

class 		UpperCAmelCase__      (      Generic[T]       ):




			'''simple docstring'''






			def __init__(       self							:			Tuple	,	a_							:			Iterable[T] | None = ()			):
					'''simple docstring'''





					__UpperCAmelCase   :					RandomizedHeapNode[T] | None													=     None

					if data:
							for item in data:
									self.insert(a_			)




			def 			snake_case__					(       self							:			List[str]	,	a_							:			T			):
					'''simple docstring'''





					__UpperCAmelCase   :					Optional[Any]													=     RandomizedHeapNode.merge(self._root	,	RandomizedHeapNode(a_			)			)




			def 			snake_case__					(       self							:			Optional[int]			):
					'''simple docstring'''





					__UpperCAmelCase   :					Optional[Any]													=     self.top()

					if self._root is None:
							return None

					__UpperCAmelCase   :					Tuple													=     RandomizedHeapNode.merge(self._root.left	,	self._root.right			)

					return result




			def 			snake_case__					(       self							:			Any			):
					'''simple docstring'''





					if not self._root:
							raise IndexError('''Can\'t get top element for the empty heap.'''			)
					return self._root.value




			def 			snake_case__					(       self							:			Optional[Any]			):
					'''simple docstring'''





					__UpperCAmelCase   :					str													=     None




			def 			snake_case__					(       self							:			Tuple			):
					'''simple docstring'''





					__UpperCAmelCase   :					List[Any]													=     []
					while self:
							result.append(self.pop()			)

					return result




			def __bool__(       self							:			List[Any]			):
					'''simple docstring'''





					return self._root is not None


if __name__ == "__main__":
				import doctest

				doctest.testmod()





