




UpperCAmelCase_						=[sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)]



def       UpperCAmelCase       (     _snake_case							):
							lowerCAmelCase   =		0
							while number:
														# Increased Speed Slightly by checking every 5 digits together.
														sum_of_digits_squared += DIGITS_SQUARED[number % 100000]
														number //= 100000

							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
UpperCAmelCase_						=[None] * 1000_0000
UpperCAmelCase_						=True
UpperCAmelCase_						=False



def       UpperCAmelCase       (     _snake_case							):

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

							lowerCAmelCase   =		chain(next_number(_snake_case							)							)
							lowerCAmelCase   =		number_chain

							while number < 10000000:
														lowerCAmelCase   =		number_chain
														number *= 10

							return number_chain



def       UpperCAmelCase       (     _snake_case = 10000000							):
							for i in range(1						, _snake_case							):
														if CHAINS[i] is None:
																					chain(i + 1							)

							return CHAINS[:number].count(_snake_case							)


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		print(F'''{solution() = }''')









from collections.abc import Sequence



def       UpperCAmelCase       (     _snake_case						, _snake_case = False							):
							if not arr:
														return 0

							lowerCAmelCase   =		0 if allow_empty_subarrays else float('''-inf'''							)
							lowerCAmelCase   =		0.0
							for num in arr:
														lowerCAmelCase   =		max(0 if allow_empty_subarrays else num						, curr_sum + num							)
														lowerCAmelCase   =		max(_snake_case						, _snake_case							)

							return max_sum


if __name__ == "__main__":
		from doctest import testmod

		testmod()

		UpperCAmelCase_						=[-2, 1, -3, 4, -1, 2, 1, -5, 4]
		print(F'''{max_subarray_sum(nums) = }''')



