
'''simple docstring'''







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






class  lowerCAmelCase__   (  nn.Module     ):
					lowerCAmelCase_        =     42
					lowerCAmelCase_        =     jnp.floataa






					def 	_snake_case    (   self		):


											"""simple docstring"""





											lowercase_	:     Optional[Any]													=       nn.Conv(
											    self.out_channels				,							kernel_size=(3, 3)				,							strides=(1, 1)				,							padding=((1, 1), (1, 1))				,							dtype=self.dtype				,							)






					def __call__(   self				,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											lowercase_						, lowercase_						, lowercase_						, lowercase_	:     Optional[Any]													=       hidden_states.shape
											lowercase_	:     Dict													=       jax.image.resize(
											    __SCREAMING_SNAKE_CASE				,							shape=(batch, height * 2, width * 2, channels)				,							method='''nearest'''				,							)
											lowercase_	:     Optional[Any]													=       self.conv(__SCREAMING_SNAKE_CASE		)
											return hidden_states







class  lowerCAmelCase__   (  nn.Module     ):
					lowerCAmelCase_        =     42
					lowerCAmelCase_        =     jnp.floataa






					def 	_snake_case    (   self		):


											"""simple docstring"""





											lowercase_	:     Optional[Any]													=       nn.Conv(
											    self.out_channels				,							kernel_size=(3, 3)				,							strides=(2, 2)				,							padding=((1, 1), (1, 1))				,							dtype=self.dtype				,							)






					def __call__(   self				,							__SCREAMING_SNAKE_CASE		):


											"""simple docstring"""





											lowercase_	:     Tuple													=       self.conv(__SCREAMING_SNAKE_CASE		)
											return hidden_states







class  lowerCAmelCase__   (  nn.Module     ):
					lowerCAmelCase_        =     42
					lowerCAmelCase_        =     None
					lowerCAmelCase_        =     0.0
					lowerCAmelCase_        =     None
					lowerCAmelCase_        =     jnp.floataa






					def 	_snake_case    (   self		):


											"""simple docstring"""





											lowercase_	:     Union[str, Any]													=       self.in_channels if self.out_channels is None else self.out_channels

											lowercase_	:     Dict													=       nn.GroupNorm(num_groups=32				,							epsilon=1E-5		)
											lowercase_	:     int													=       nn.Conv(
											    __SCREAMING_SNAKE_CASE				,							kernel_size=(3, 3)				,							strides=(1, 1)				,							padding=((1, 1), (1, 1))				,							dtype=self.dtype				,							)

											lowercase_	:     Optional[Any]													=       nn.Dense(__SCREAMING_SNAKE_CASE				,							dtype=self.dtype		)

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

											lowercase_	:     Union[str, Any]													=       self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

											lowercase_	:     List[Any]													=       None
											if use_nin_shortcut:
																	lowercase_	:     Tuple													=       nn.Conv(
																	    __SCREAMING_SNAKE_CASE				,							kernel_size=(1, 1)				,							strides=(1, 1)				,							padding='''VALID'''				,							dtype=self.dtype				,							)






					def __call__(   self				,							__SCREAMING_SNAKE_CASE				,							__SCREAMING_SNAKE_CASE				,							__SCREAMING_SNAKE_CASE=True		):


											"""simple docstring"""





											lowercase_	:     Union[str, Any]													=       hidden_states
											lowercase_	:     List[str]													=       self.norma(__SCREAMING_SNAKE_CASE		)
											lowercase_	:     Optional[int]													=       nn.swish(__SCREAMING_SNAKE_CASE		)
											lowercase_	:     Dict													=       self.conva(__SCREAMING_SNAKE_CASE		)

											lowercase_	:     Dict													=       self.time_emb_proj(nn.swish(__SCREAMING_SNAKE_CASE		)		)
											lowercase_	:     Tuple													=       jnp.expand_dims(jnp.expand_dims(__SCREAMING_SNAKE_CASE				,							1		)				,							1		)
											lowercase_	:     Dict													=       hidden_states + temb

											lowercase_	:     Dict													=       self.norma(__SCREAMING_SNAKE_CASE		)
											lowercase_	:     Tuple													=       nn.swish(__SCREAMING_SNAKE_CASE		)
											lowercase_	:     int													=       self.dropout(__SCREAMING_SNAKE_CASE				,							__SCREAMING_SNAKE_CASE		)
											lowercase_	:     Union[str, Any]													=       self.conva(__SCREAMING_SNAKE_CASE		)

											if self.conv_shortcut is not None:
																	lowercase_	:     Any													=       self.conv_shortcut(__SCREAMING_SNAKE_CASE		)

											return hidden_states + residual





'''simple docstring'''







_lowercase :  int    							=       [sum(int(c, 1_0) ** 2 for c in i.__str__()) for i in range(1_0_0_0_0_0)]
def 					snake_case_		(				__SCREAMING_SNAKE_CASE					: int							):



						"""simple docstring"""





						lowercase_	:     Optional[int]													=       0
						while number:
												# Increased Speed Slightly by checking every 5 digits together.
												sum_of_digits_squared += DIGITS_SQUARED[number % 100000]
												number //= 100000

						return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
_lowercase :  list[bool | None]    							=       [None] * 1_0_0_0_0_0_0_0
_lowercase :  List[str]    							=       True
_lowercase :  Optional[int]    							=       False
def 					snake_case_		(				__SCREAMING_SNAKE_CASE					: int							):



						"""simple docstring"""





						if CHAINS[number - 1] is not None:
												return CHAINS[number - 1]  # type: ignore

						lowercase_	:     Tuple													=       chain(next_number(__SCREAMING_SNAKE_CASE							)							)
						lowercase_	:     Union[str, Any]													=       number_chain

						while number < 10000000:
												lowercase_	:     int													=       number_chain
												number *= 10

						return number_chain
def 					snake_case_		(				__SCREAMING_SNAKE_CASE					: int = 10000000							):



						"""simple docstring"""





						for i in range(1      ,      __SCREAMING_SNAKE_CASE							):
												if CHAINS[i] is None:
																		chain(i + 1							)

						return CHAINS[:number].count(__SCREAMING_SNAKE_CASE							)


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							print(f"""{solution() = }""")



