"""simple docstring"""




import copy
import os

import cva
import numpy as np
from matplotlib import pyplot as plt

class    a_   :




					def __init__(						self    :  Optional[int]  ):
							lowerCAmelCase__   = """"""
							lowerCAmelCase__   = """"""
							lowerCAmelCase__   = []
							lowerCAmelCase__   = 0
							lowerCAmelCase__   = 256
							lowerCAmelCase__   = 0
							lowerCAmelCase__   = 0
							lowerCAmelCase__   = 0
							lowerCAmelCase__   = 0




					def     _SCREAMING_SNAKE_CASE    (						self    :  Any	,    snake_case__    :  List[Any]  ):
							lowerCAmelCase__   = cva.imread(snake_case__	,    0  )
							lowerCAmelCase__   = copy.deepcopy(self.img  )
							lowerCAmelCase__ ,       lowerCAmelCase__ ,       lowerCAmelCase__   = plt.hist(self.img.ravel()	,    256	,    [0, 256]	,    label="""x"""  )
							lowerCAmelCase__   = np.sum(snake_case__  )
							for i in range(len(snake_case__  )  ):
									lowerCAmelCase__   = x[i] / self.k
									self.sk += prk
									lowerCAmelCase__   = (self.L - 1) * self.sk
									if self.rem != 0:
											lowerCAmelCase__   = int(last % last  )
									lowerCAmelCase__   = int(last + 1 if self.rem >= 0.5 else last  )
									self.last_list.append(snake_case__  )
									lowerCAmelCase__   = int(np.ma.count(self.img  ) / self.img[1].size  )
									lowerCAmelCase__   = self.img[1].size
							for i in range(self.number_of_cols  ):
									for j in range(self.number_of_rows  ):
											lowerCAmelCase__   = self.img[j][i]
											if num != self.last_list[num]:
													lowerCAmelCase__   = self.last_list[num]
							cva.imwrite("""output_data/output.jpg"""	,    self.img  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Any  ):
							plt.hist(self.img.ravel()	,    256	,    [0, 256]  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Optional[Any]  ):
							cva.imshow("""Output-Image"""	,    self.img  )
							cva.imshow("""Input-Image"""	,    self.original_image  )
							cva.waitKey(5000  )
							cva.destroyAllWindows()


if __name__ == "__main__":
			__lowerCAmelCase     :				Optional[Any]    				=    os.path.join(os.path.basename(__file__), "image_data/input.jpg")
			__lowerCAmelCase     :				Optional[int]    				=    ConstantStretch()
			stretcher.stretch(file_path)
			stretcher.plot_histogram()
			stretcher.show_image()





"""simple docstring"""




from itertools import permutations







def 				_UpperCAmelCase		(							lowerCamelCase__  ):





		"""simple docstring"""




		if num[3] % 2 != 0:
				return False

		if (num[2] + num[3] + num[4]) % 3 != 0:
				return False

		if num[5] % 5 != 0:
				return False

		lowerCAmelCase__   = [7, 11, 13, 17]
		for i, test in enumerate(lowerCamelCase__  ):
				if (num[i + 4] * 100 + num[i + 5] * 10 + num[i + 6]) % test != 0:
						return False
		return True







def 				_UpperCAmelCase		(							lowerCamelCase__ = 10  ):





		"""simple docstring"""




		return sum(
		    int("""""".join(map(lowerCamelCase__      ,	lowerCamelCase__  )  )  )
		    for num in permutations(range(lowerCamelCase__  )  )
		    if is_substring_divisible(lowerCamelCase__  )  )


if __name__ == "__main__":
			print(F"{solution() = }")




