



from typing import List

import PIL
import torch
from PIL import Image

from ...configuration_utils import ConfigMixin
from ...models.modeling_utils import ModelMixin
from ...utils import PIL_INTERPOLATION







class 				a_    (						_snake_case   ,					_snake_case							):

						def __init__(       self      :Dict)						->   List[Any]:
												super().__init__()

												self.register_buffer('''watermark_image'''  ,		torch.zeros((62, 62, 4)))
												UpperCAmelCase_					=	None




						def       __a			(       self      :Optional[int]  ,		_lowercase      :Union[str, Any]  ,		_lowercase      :Optional[int]=None)						->   Optional[int]:
												# copied from https://github.com/deep-floyd/IF/blob/b77482e36ca2031cb94dbca1001fc1e6400bf4ab/deepfloyd_if/modules/base.py#L287

												UpperCAmelCase_					=	images[0].height
												UpperCAmelCase_					=	images[0].width

												UpperCAmelCase_					=	sample_size or h

												UpperCAmelCase_					=	min(h / sample_size  ,		w / sample_size)
												UpperCAmelCase_				, UpperCAmelCase_					=	(int(h / coef), int(w / coef)) if coef < 1 else (h, w)

												UpperCAmelCase_				, UpperCAmelCase_					=	1024**2, img_w * img_h
												UpperCAmelCase_					=	(Sa / Sa) ** 0.5
												UpperCAmelCase_				, UpperCAmelCase_				, UpperCAmelCase_					=	int(K * 62), img_w - int(14 * K), img_h - int(14 * K)

												if self.watermark_image_as_pil is None:
																		UpperCAmelCase_					=	self.watermark_image.to(torch.uinta).cpu().numpy()
																		UpperCAmelCase_					=	Image.fromarray(a__  ,		mode='''RGBA''')
																		UpperCAmelCase_					=	watermark_image

												UpperCAmelCase_					=	self.watermark_image_as_pil.resize(
												    (wm_size, wm_size)  ,		PIL_INTERPOLATION['''bicubic''']  ,		reducing_gap=a__)

												for pil_img in images:
																		pil_img.paste(a__  ,		box=(wm_x - wm_size, wm_y - wm_size, wm_x, wm_y)  ,		mask=wm_img.split()[-1])

												return images












"""simple docstring"""






from collections import defaultdict

def    __lowerCamelCase     (							SCREAMING_SNAKE_CASE = 5				)		->							int:






       """simple docstring"""




       _UpperCAmelCase			     =  defaultdict(SCREAMING_SNAKE_CASE				)
       _UpperCAmelCase			     =  0

       while True:
              _UpperCAmelCase			     =  get_digits(SCREAMING_SNAKE_CASE				)
              freqs[digits].append(SCREAMING_SNAKE_CASE				)

              if len(freqs[digits]				) == max_base:
                     _UpperCAmelCase			     =  freqs[digits][0] ** 3
                     return base

              num += 1

def    __lowerCamelCase     (							SCREAMING_SNAKE_CASE				)		->							str:






       """simple docstring"""




       return "".join(sorted(str(num**3				)				)				)


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






