




"""simple docstring"""

from cva import destroyAllWindows, imread, imshow, waitKey




def       snake_case__	(       lowerCAmelCase   :		int				,					lowerCAmelCase   :		int		):
					__snake_case      ,      __snake_case          =	img.shape[0], img.shape[1]

					def to_grayscale(lowerCAmelCase   :		List[str]				,					lowerCAmelCase   :		Optional[Any]				,					lowerCAmelCase   :		Optional[int]		):
										return 0.2_1_2_6 * red + 0.5_8_7 * green + 0.1_1_4 * blue

					def normalize(lowerCAmelCase   :		Tuple		):
										return min(lowerCAmelCase				,					255		)

					for i in range(lowerCAmelCase		):
										for j in range(lowerCAmelCase		):
															__snake_case          =	int(to_grayscale(*img[i][j]		)		)
															__snake_case          =	[
															    normalize(lowerCAmelCase		),
															    normalize(greyscale + factor		),
															    normalize(greyscale + 2 * factor		),
															]

					return img


if __name__ == "__main__":
		# read original image
		UpperCamelCase__ :    str 					=							{
		    percentage: imread("image_data/lena.jpg", 1) for percentage in (10, 20, 30, 40)
		}

		for percentage, img in images.items():
				make_sepia(img, percentage)

		for percentage, img in images.items():
				imshow(f'Original image with sepia (factor: {percentage})', img)

		waitKey(0)
		destroyAllWindows()








"""simple docstring"""

from functools import lru_cache




@lru_cache
def       snake_case__	(       lowerCAmelCase   :		int		):
					if not isinstance(lowerCAmelCase				,					lowerCAmelCase		):
										raise TypeError("""k must be an integer."""		)
					if k < 0:
										raise ValueError("""k integer must be greater or equal to zero."""		)
					if k == 0:
										return 0
					elif k == 1:
										return 1
					else:
										return fibonacci(k - 1		) + fibonacci(k - 2		)




def       snake_case__	(       lowerCAmelCase   :		list				,					lowerCAmelCase   :		int		):
					__snake_case          =	len(lowerCAmelCase		)
					# Find m such that F_m >= n where F_i is the i_th fibonacci number.
					__snake_case          =	0
					while True:
										if fibonacci(lowerCAmelCase		) >= len_list:
															__snake_case          =	i
															break
										i += 1
					__snake_case          =	0
					while fibb_k > 0:
										__snake_case          =	min(
										    offset + fibonacci(fibb_k - 1		)				,					len_list - 1		)  # Prevent out of range
										__snake_case          =	arr[index_k]
										if item_k_1 == val:
															return index_k
										elif val < item_k_1:
															fibb_k -= 1
										elif val > item_k_1:
															offset += fibonacci(fibb_k - 1		)
															fibb_k -= 2
					else:
										return -1


if __name__ == "__main__":
		import doctest

		doctest.testmod()


