
'''simple docstring'''
def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							_snake_case       =  [0 for i in range(len(_lowerCAmelCase				)				)]

							# initialize interval's left pointer and right pointer
							_snake_case       =  0, 0

							for i in range(1							, len(_lowerCAmelCase				)				):
														# case when current index is inside the interval
														if i <= right_pointer:
																					_snake_case       =  min(right_pointer - i + 1							, z_result[i - left_pointer]				)
																					_snake_case       =  min_edge

														while go_next(_lowerCAmelCase							, _lowerCAmelCase							, _lowerCAmelCase				):
																					z_result[i] += 1

														# if new index's result gives us more right interval,
														# we've to update left_pointer and right_pointer
														if i + z_result[i] - 1 > right_pointer:
																					_snake_case       =  i, i + z_result[i] - 1

							return z_result






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):
							return i + z_result[i] < len(_lowerCAmelCase				) and s[z_result[i]] == s[i + z_result[i]]






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):
							_snake_case       =  0
							# concatenate 'pattern' and 'input_str' and call z_function
							# with concatenated string
							_snake_case       =  z_function(pattern + input_str				)

							for val in z_result:
														# if value is greater then length of the pattern string
														# that means this index is starting position of substring
														# which is equal to pattern string
														if val >= len(_lowerCAmelCase				):
																					answer += 1

							return answer


if __name__ == "__main__":
				import doctest

				doctest.testmod()

'''simple docstring'''
import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey


class       _lowerCAmelCase   :







							'''simple docstring'''

							def __init__(self  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  )					->       List[str]:
														if dst_width < 0 or dst_height < 0:
																					raise ValueError("""Destination width/height should be > 0"""  )

														_snake_case       =  img
														_snake_case       =  img.shape[1]
														_snake_case       =  img.shape[0]
														_snake_case       =  dst_width
														_snake_case       =  dst_height

														_snake_case       =  self.src_w / self.dst_w
														_snake_case       =  self.src_h / self.dst_h

														_snake_case       =  _snake_case       =  (
														    np.ones((self.dst_h, self.dst_w, 3)  ,  np.uinta  ) * 255
														)

							def 	lowercase							(self  )					->       List[Any]:
														for i in range(self.dst_h  ):
																					for j in range(self.dst_w  ):
																												_snake_case       =  self.img[self.get_y(UpperCAmelCase  )][self.get_x(UpperCAmelCase  )]

							def 	lowercase							(self  ,  UpperCAmelCase  )					->       int:
														return int(self.ratio_x * x  )





							def 	lowercase							(self  ,  UpperCAmelCase  )					->       int:
														return int(self.ratio_y * y  )


if __name__ == "__main__":
				__lowerCAmelCase							,    __lowerCAmelCase												=	800, 600
				__lowerCAmelCase												=	imread('image_data/lena.jpg', 1)
				__lowerCAmelCase												=	NearestNeighbour(im, dst_w, dst_h)
				n.process()

				imshow(
				    f'''Image resized from: {im.shape[1]}x{im.shape[0]} to {dst_w}x{dst_h}''', n.output
				)
				waitKey(0)
				destroyAllWindows()