


'''simple docstring'''


import flax.linen as nn
import jax
import jax.numpy as jnp






class 		lowerCAmelCase__	(	nn.Module		):
			lowerCAmelCase       :		int
			lowerCAmelCase       :		jnp.dtype				      =   jnp.floataa




			def 							lowerCAmelCase__			(						self     :   List[str]       )      ->List[str]:



					'''simple docstring'''







					_UpperCAmelCase						:				Any	    =					nn.Conv(
					    self.out_channels		,     kernel_size=(3, 3)		,     strides=(1, 1)		,     padding=((1, 1), (1, 1))		,     dtype=self.dtype		,     )






			def __call__(						self     :   List[str]		,     lowerCamelCase__     :   Dict       )      ->Optional[int]:



					'''simple docstring'''







					_UpperCAmelCase    ,			_UpperCAmelCase    ,			_UpperCAmelCase    ,			_UpperCAmelCase						:				Dict	    =					hidden_states.shape
					_UpperCAmelCase						:				Optional[int]	    =					jax.image.resize(
					    lowerCamelCase__		,     shape=(batch, height * 2, width * 2, channels)		,     method="nearest"		,     )
					_UpperCAmelCase						:				Optional[Any]	    =					self.conv(lowerCamelCase__       )
					return hidden_states






class 		lowerCAmelCase__	(	nn.Module		):
			lowerCAmelCase       :		int
			lowerCAmelCase       :		jnp.dtype				      =   jnp.floataa




			def 							lowerCAmelCase__			(						self     :   Union[str, Any]       )      ->Optional[int]:



					'''simple docstring'''







					_UpperCAmelCase						:				Dict	    =					nn.Conv(
					    self.out_channels		,     kernel_size=(3, 3)		,     strides=(2, 2)		,     padding=((1, 1), (1, 1))		,     dtype=self.dtype		,     )






			def __call__(						self     :   Optional[int]		,     lowerCamelCase__     :   Optional[Any]       )      ->Dict:



					'''simple docstring'''







					_UpperCAmelCase						:				int	    =					self.conv(lowerCamelCase__       )
					return hidden_states






class 		lowerCAmelCase__	(	nn.Module		):
			lowerCAmelCase       :		int
			lowerCAmelCase       :		int				      =   None
			lowerCAmelCase       :		float				      =   0.0
			lowerCAmelCase       :		bool				      =   None
			lowerCAmelCase       :		jnp.dtype				      =   jnp.floataa




			def 							lowerCAmelCase__			(						self     :   int       )      ->Any:



					'''simple docstring'''







					_UpperCAmelCase						:				Optional[Any]	    =					self.in_channels if self.out_channels is None else self.out_channels

					_UpperCAmelCase						:				Dict	    =					nn.GroupNorm(num_groups=32		,     epsilon=1E-5       )
					_UpperCAmelCase						:				List[str]	    =					nn.Conv(
					    lowerCamelCase__		,     kernel_size=(3, 3)		,     strides=(1, 1)		,     padding=((1, 1), (1, 1))		,     dtype=self.dtype		,     )

					_UpperCAmelCase						:				Any	    =					nn.Dense(lowerCamelCase__		,     dtype=self.dtype       )

					_UpperCAmelCase						:				int	    =					nn.GroupNorm(num_groups=32		,     epsilon=1E-5       )
					_UpperCAmelCase						:				List[str]	    =					nn.Dropout(self.dropout_prob       )
					_UpperCAmelCase						:				Optional[Any]	    =					nn.Conv(
					    lowerCamelCase__		,     kernel_size=(3, 3)		,     strides=(1, 1)		,     padding=((1, 1), (1, 1))		,     dtype=self.dtype		,     )

					_UpperCAmelCase						:				Tuple	    =					self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

					_UpperCAmelCase						:				Dict	    =					None
					if use_nin_shortcut:
							_UpperCAmelCase						:				str	    =					nn.Conv(
							    lowerCamelCase__		,     kernel_size=(1, 1)		,     strides=(1, 1)		,     padding="VALID"		,     dtype=self.dtype		,     )






			def __call__(						self     :   Optional[Any]		,     lowerCamelCase__     :   Union[str, Any]		,     lowerCamelCase__     :   List[str]		,     lowerCamelCase__     :   str=True       )      ->Optional[int]:



					'''simple docstring'''







					_UpperCAmelCase						:				str	    =					hidden_states
					_UpperCAmelCase						:				Union[str, Any]	    =					self.norma(lowerCamelCase__       )
					_UpperCAmelCase						:				List[str]	    =					nn.swish(lowerCamelCase__       )
					_UpperCAmelCase						:				Tuple	    =					self.conva(lowerCamelCase__       )

					_UpperCAmelCase						:				List[str]	    =					self.time_emb_proj(nn.swish(lowerCamelCase__       )       )
					_UpperCAmelCase						:				List[Any]	    =					jnp.expand_dims(jnp.expand_dims(lowerCamelCase__		,     1       )		,     1       )
					_UpperCAmelCase						:				int	    =					hidden_states + temb

					_UpperCAmelCase						:				Dict	    =					self.norma(lowerCamelCase__       )
					_UpperCAmelCase						:				Tuple	    =					nn.swish(lowerCamelCase__       )
					_UpperCAmelCase						:				str	    =					self.dropout(lowerCamelCase__		,     lowerCamelCase__       )
					_UpperCAmelCase						:				Dict	    =					self.conva(lowerCamelCase__       )

					if self.conv_shortcut is not None:
							_UpperCAmelCase						:				int	    =					self.conv_shortcut(lowerCamelCase__       )

					return hidden_states + residual







'''simple docstring'''


def        __lowerCAmelCase       (__lowerCAmelCase = 50      ):
		_UpperCAmelCase						:				Tuple	    =					[[0] * 3 for _ in range(length + 1      )]

		for row_length in range(length + 1      ):
				for tile_length in range(2					,       5      ):
						for tile_start in range(row_length - tile_length + 1      ):
								different_colour_ways_number[row_length][tile_length - 2] += (
								    different_colour_ways_number[row_length - tile_start - tile_length][
								        tile_length - 2
								    ]
								    + 1
								)

		return sum(different_colour_ways_number[length]      )


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



