






'''simple docstring'''
import flax.linen as nn
import jax
import jax.numpy as jnp







class 	UpperCamelCase__					(     nn.Module			):

		"""simple docstring"""
		UpperCAmelCase__     			=						42
		UpperCAmelCase__     			=						jnp.floataa




		def       snake_case     ( self						:						List[Any]    ):







							"""simple docstring"""
							_lowercase			= nn.Conv(
							    self.out_channels							,    kernel_size=(3, 3)							,    strides=(1, 1)							,    padding=((1, 1), (1, 1))							,    dtype=self.dtype							,    )




		def __call__( self						:						Union[str, Any]							,    __A						:						Tuple    ):







							"""simple docstring"""
							_lowercase	,			_lowercase	,			_lowercase	,			_lowercase			= hidden_states.shape
							_lowercase			= jax.image.resize(
							    __UpperCamelCase							,    shape=(batch, height * 2, width * 2, channels)							,    method="nearest"							,    )
							_lowercase			= self.conv(__UpperCamelCase    )
							return hidden_states







class 	UpperCamelCase__					(     nn.Module			):

		"""simple docstring"""
		UpperCAmelCase__     			=						42
		UpperCAmelCase__     			=						jnp.floataa




		def       snake_case     ( self						:						Optional[Any]    ):







							"""simple docstring"""
							_lowercase			= nn.Conv(
							    self.out_channels							,    kernel_size=(3, 3)							,    strides=(2, 2)							,    padding=((1, 1), (1, 1))							,    dtype=self.dtype							,    )




		def __call__( self						:						Optional[Any]							,    __A						:						Dict    ):







							"""simple docstring"""
							_lowercase			= self.conv(__UpperCamelCase    )
							return hidden_states







class 	UpperCamelCase__					(     nn.Module			):

		"""simple docstring"""
		UpperCAmelCase__     			=						42
		UpperCAmelCase__     			=						None
		UpperCAmelCase__     			=						0.0
		UpperCAmelCase__     			=						None
		UpperCAmelCase__     			=						jnp.floataa




		def       snake_case     ( self						:						Union[str, Any]    ):







							"""simple docstring"""
							_lowercase			= self.in_channels if self.out_channels is None else self.out_channels

							_lowercase			= nn.GroupNorm(num_groups=3_2							,    epsilon=1e-5    )
							_lowercase			= nn.Conv(
							    __UpperCamelCase							,    kernel_size=(3, 3)							,    strides=(1, 1)							,    padding=((1, 1), (1, 1))							,    dtype=self.dtype							,    )

							_lowercase			= nn.Dense(__UpperCamelCase							,    dtype=self.dtype    )

							_lowercase			= nn.GroupNorm(num_groups=3_2							,    epsilon=1e-5    )
							_lowercase			= nn.Dropout(self.dropout_prob    )
							_lowercase			= nn.Conv(
							    __UpperCamelCase							,    kernel_size=(3, 3)							,    strides=(1, 1)							,    padding=((1, 1), (1, 1))							,    dtype=self.dtype							,    )

							_lowercase			= self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

							_lowercase			= None
							if use_nin_shortcut:
												_lowercase			= nn.Conv(
												    __UpperCamelCase							,    kernel_size=(1, 1)							,    strides=(1, 1)							,    padding="VALID"							,    dtype=self.dtype							,    )




		def __call__( self						:						Any							,    __A						:						str							,    __A						:						List[str]							,    __A						:						List[str]=True    ):







							"""simple docstring"""
							_lowercase			= hidden_states
							_lowercase			= self.norma(__UpperCamelCase    )
							_lowercase			= nn.swish(__UpperCamelCase    )
							_lowercase			= self.conva(__UpperCamelCase    )

							_lowercase			= self.time_emb_proj(nn.swish(__UpperCamelCase    )    )
							_lowercase			= jnp.expand_dims(jnp.expand_dims(__UpperCamelCase							,    1    )							,    1    )
							_lowercase			= hidden_states + temb

							_lowercase			= self.norma(__UpperCamelCase    )
							_lowercase			= nn.swish(__UpperCamelCase    )
							_lowercase			= self.dropout(__UpperCamelCase							,    __UpperCamelCase    )
							_lowercase			= self.conva(__UpperCamelCase    )

							if self.conv_shortcut is not None:
												_lowercase			= self.conv_shortcut(__UpperCamelCase    )

							return hidden_states + residual




import functools





def a(lowercase__      ,			lowercase__						):





	'''simple docstring'''

	# Validation
	if not isinstance(lowercase__      ,			lowercase__						) or not all(isinstance(lowercase__      ,			lowercase__						) for day in days						):
		raise ValueError('The parameter days should be a list of integers'						)

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

	if len(lowercase__						) == 0:
		return 0

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

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

	snake_case_   		=			set(lowercase__						)

	@functools.cache
	def dynamic_programming(lowercase__						) -> 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()
