def 					__lowerCAmelCase		(  __lowerCamelCase	:    Tuple	)  ->						int:
					__lowerCAmelCase	   =abs(lowerCamelCase__	)
					__lowerCAmelCase	   =0
					while n > 0:
										res += n % 10
										n //= 10
					return res






def 					__lowerCAmelCase		(  __lowerCamelCase	:    Tuple	)  ->						int:
					__lowerCAmelCase	   =abs(lowerCamelCase__	)
					return n if n < 10 else n % 10 + sum_of_digits(n // 10	)






def 					__lowerCAmelCase		(  __lowerCamelCase	:    Any	)  ->						int:
					return sum(int(lowerCamelCase__	) for c in str(abs(lowerCamelCase__	)	)	)






def 					__lowerCAmelCase		(  )  ->						None:
					from collections.abc import Callable
					from timeit import timeit

					def benchmark_a_function(__lowerCamelCase	:    Tuple				,   __lowerCamelCase	:    List[str]	) -> None:
										__lowerCAmelCase	   =f"""{func.__name__}({value})"""
										__lowerCAmelCase	   =timeit(f"""__main__.{call}"""				,   setup="""import __main__"""	)
										print(f"""{call:56} = {func(lowerCamelCase__	)} -- {timing:.4f} seconds"""	)

					for value in (262144, 1125899906842624, 1267650600228229401496703205376):
										for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
															benchmark_a_function(lowerCamelCase__				,   lowerCamelCase__	)
										print()


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				benchmark()









import PIL.Image
import PIL.ImageOps
from packaging import version
from PIL import Image


if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('''9.1.0'''):
				lowercase_	       =			{
				    '''linear''': PIL.Image.Resampling.BILINEAR,
				    '''bilinear''': PIL.Image.Resampling.BILINEAR,
				    '''bicubic''': PIL.Image.Resampling.BICUBIC,
				    '''lanczos''': PIL.Image.Resampling.LANCZOS,
				    '''nearest''': PIL.Image.Resampling.NEAREST,
				}
else:
				lowercase_	       =			{
				    '''linear''': PIL.Image.LINEAR,
				    '''bilinear''': PIL.Image.BILINEAR,
				    '''bicubic''': PIL.Image.BICUBIC,
				    '''lanczos''': PIL.Image.LANCZOS,
				    '''nearest''': PIL.Image.NEAREST,
				}






def 					__lowerCAmelCase		(  __lowerCamelCase	:    List[str]	)  ->						int:
					__lowerCAmelCase	   =(images / 2 + 0.5).clamp(0				,   1	)
					__lowerCAmelCase	   =images.cpu().permute(0				,   2				,   3				,   1	).float().numpy()
					__lowerCAmelCase	   =numpy_to_pil(__lowerCamelCase	)
					return images






def 					__lowerCAmelCase		(  __lowerCamelCase	:    str	)  ->						str:
					if images.ndim == 3:
										__lowerCAmelCase	   =images[None, ...]
					__lowerCAmelCase	   =(images * 255).round().astype("""uint8"""	)
					if images.shape[-1] == 1:
										# special case for grayscale (single channel) images
										__lowerCAmelCase	   =[Image.fromarray(image.squeeze()				,   mode="""L"""	) for image in images]
					else:
										__lowerCAmelCase	   =[Image.fromarray(__lowerCamelCase	) for image in images]

					return pil_images




