

import numpy as np
import torch
from imwatermark import WatermarkEncoder


# Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66
_UpperCAmelCase	:     Dict		       = 0b10_11_00_11_11_10_11_00_10_01_00_00_01_11_10_11_10_11_00_01_10_01_11_10
# bin(x)[2:] gives bits of x as str, use int to convert them to 0/1
_UpperCAmelCase	:     Any		       = [int(bit) for bit in bin(WATERMARK_MESSAGE)[2:]]







class 				lowercase       :




				def __init__(      self ):
											snake_case_           =					WATERMARK_BITS
											snake_case_           =					WatermarkEncoder()

											self.encoder.set_watermark('bits'   ,     self.watermark )




				def 					a							(      self   ,     snake_case ):
											# can't encode images that are smaller than 256
											if images.shape[-1] < 256:
																		return images

											snake_case_           =					(255 * (images / 2 + 0.5)).cpu().permute(0   ,     2   ,     3   ,     1 ).float().numpy()

											snake_case_           =					[self.encoder.encode(snake_case   ,     'dwtDct' ) for image in images]

											snake_case_           =					torch.from_numpy(np.array(snake_case ) ).permute(0   ,     3   ,     1   ,     2 )

											snake_case_           =					torch.clamp(2 * (images / 255 - 0.5)   ,     min=-1.0   ,     max=1.0 )
											return images







def       __lowerCamelCase			(				UpperCamelCase__ = 50000000   ):







							'''simple docstring'''






							snake_case_           =					set()
							snake_case_           =					int((limit - 24) ** (1 / 2)   )

							snake_case_           =					set(range(3     ,							prime_square_limit + 1     ,							2   )   )
							primes.add(2   )
							for p in range(3     ,							prime_square_limit + 1     ,							2   ):
														if p not in primes:
																					continue
														primes.difference_update(set(range(p * p     ,							prime_square_limit + 1     ,							UpperCamelCase__   )   )   )

							for primea in primes:
														snake_case_           =					primea * primea
														for primea in primes:
																					snake_case_           =					primea * primea * primea
																					if square + cube >= limit - 16:
																												break
																					for primea in primes:
																												snake_case_           =					primea * primea * primea * primea
																												snake_case_           =					square + cube + tetr
																												if total >= limit:
																																			break
																												ret.add(UpperCamelCase__   )

							return len(UpperCamelCase__   )


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




