


import unittest

from knapsack import greedy_knapsack as kp


class 	_a							(      unittest.TestCase      ):

							def 				lowerCamelCase_			(							self:     Dict							)      ->       Any:





									"""simple docstring"""







									lowercase__						=				[10, 20, 30, 40, 50, 60]
									lowercase__						=				[2, 4, 6, 8, 10, 12]
									lowercase__						=				100
									self.assertEqual(kp.calc_profit(UpperCamelCase_   ,						UpperCamelCase_   ,						UpperCamelCase_							)   ,						210							)

							def 				lowerCamelCase_			(							self:     Optional[Any]							)      ->       int:





									"""simple docstring"""







									self.assertRaisesRegex(UpperCamelCase_   ,						'''max_weight must greater than zero.'''							)

							def 				lowerCamelCase_			(							self:     Optional[Any]							)      ->       List[str]:





									"""simple docstring"""







									self.assertRaisesRegex(UpperCamelCase_   ,						'''Weight can not be negative.'''							)

							def 				lowerCamelCase_			(							self:     str							)      ->       Union[str, Any]:





									"""simple docstring"""







									self.assertRaisesRegex(UpperCamelCase_   ,						'''Profit can not be negative.'''							)

							def 				lowerCamelCase_			(							self:     int							)      ->       Optional[int]:





									"""simple docstring"""







									self.assertRaisesRegex(UpperCamelCase_   ,						'''max_weight must greater than zero.'''							)


							def 				lowerCamelCase_			(							self:     Any							)      ->       Any:





									"""simple docstring"""







									self.assertRaisesRegex(
									    UpperCamelCase_   ,						'''The length of profit and weight must be same.'''							)


if __name__ == "__main__":
			unittest.main()






lowerCAmelCase	=							[sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)]
def       _a			(				SCREAMING_SNAKE_CASE					):


		"""simple docstring"""




		lowercase__						=				0
		while number:
				# Increased Speed Slightly by checking every 5 digits together.
				sum_of_digits_squared += DIGITS_SQUARED[number % 10_00_00]
				number //= 10_00_00

		return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
lowerCAmelCase	=							[None] * 1000_0000
lowerCAmelCase	=							True
lowerCAmelCase	=							False
def       _a			(				SCREAMING_SNAKE_CASE					):


		"""simple docstring"""




		if CHAINS[number - 1] is not None:
				return CHAINS[number - 1]  # type: ignore

		lowercase__						=				chain(next_number(SCREAMING_SNAKE_CASE					)					)
		lowercase__						=				number_chain

		while number < 10_00_00_00:
				lowercase__						=				number_chain
				number *= 10

		return number_chain
def       _a			(				SCREAMING_SNAKE_CASE = 10_00_00_00					):


		"""simple docstring"""




		for i in range(1						,    SCREAMING_SNAKE_CASE					):
				if CHAINS[i] is None:
						chain(i + 1					)

		return CHAINS[:number].count(SCREAMING_SNAKE_CASE					)


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			print(f"""{solution() = }""")


