'''simple docstring'''




import functools






def 				snake_case__							(			_A:					list[int]      ,   _A:					list[int] )    ->	int:

		'''simple docstring'''


		if not isinstance(_A      ,   _A ) or not all(isinstance(_A      ,   _A ) for day in days ):
				raise ValueError("""The parameter days should be a list of integers""" )

		if len(_A ) != 3 or not all(isinstance(_A      ,   _A ) for cost in costs ):
				raise ValueError("""The parameter costs should be a list of three integers""" )

		if len(_A ) == 0:
				return 0

		if min(_A ) <= 0:
				raise ValueError("""All days elements should be greater than 0""" )

		if max(_A ) >= 366:
				raise ValueError("""All days elements should be less than 366""" )

		lowerCAmelCase   					=  set(_A )

		@functools.cache
		def dynamic_programming(_A:					int ) -> int:
				if index > 365:
						return 0

				if index not in days_set:
						return dynamic_programming(index + 1 )

				return min(
				    costs[0] + dynamic_programming(index + 1 )      ,   costs[1] + dynamic_programming(index + 7 )      ,   costs[2] + dynamic_programming(index + 30 )      ,   )

		return dynamic_programming(1 )


if __name__ == "__main__":
						import doctest

						doctest.testmod()





'''simple docstring'''




def 				snake_case__							(			_A:					str )    ->	list[int]:

		'''simple docstring'''


		lowerCAmelCase   					=  [0 for i in range(len(_A ) )]

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

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

				while go_next(_A      ,   _A      ,   _A ):
						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:
						lowerCAmelCase					,     lowerCAmelCase   					=  i, i + z_result[i] - 1

		return z_result






def 				snake_case__							(			_A:					int      ,   _A:					list[int]      ,   _A:					str )    ->	bool:

		'''simple docstring'''


		return i + z_result[i] < len(_A ) and s[z_result[i]] == s[i + z_result[i]]






def 				snake_case__							(			_A:					str      ,   _A:					str )    ->	int:

		'''simple docstring'''


		lowerCAmelCase   					=  0
		# concatenate 'pattern' and 'input_str' and call z_function
		# with concatenated string
		lowerCAmelCase   					=  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(_A ):
						answer += 1

		return answer


if __name__ == "__main__":
						import doctest

						doctest.testmod()




