




lowerCamelCase       :	Union[str, Any]									=     range(2, 20 + 1)
lowerCamelCase       :	Optional[Any]									=     [10**k for k in range(ks[-1] + 1)]
lowerCamelCase       :	dict[int, dict[int, list[list[int]]]]									=     {}

def     _SCREAMING_SNAKE_CASE    (							lowercase			: List[str]			,							lowercase			: Optional[Any]			,							lowercase			: Any			,							lowercase			: Tuple  ):


      '''simple docstring'''



      lowerCamelCase_	  =					sum(a_i[j] for j in range(lowercase			,							len(lowercase  )  )  )
      lowerCamelCase_	  =					sum(a_i[j] * base[j] for j in range(min(len(lowercase  )			,							lowercase  )  )  )

      lowerCamelCase_  ,       lowerCamelCase_	  =					0, 0
      lowerCamelCase_	  =					n - i

      lowerCamelCase_	  =					memo.get(lowercase  )

      if sub_memo is not None:
            lowerCamelCase_	  =					sub_memo.get(lowercase  )

            if jumps is not None and len(lowercase  ) > 0:
                  # find and make the largest jump without going over
                  lowerCamelCase_	  =					-1
                  for _k in range(len(lowercase  ) - 1			,							-1			,							-1  ):
                        if jumps[_k][2] <= k and jumps[_k][1] <= max_dn:
                              lowerCamelCase_	  =					_k
                              break

                  if max_jump >= 0:
                        lowerCamelCase_  ,       lowerCamelCase_  ,       lowerCamelCase_	  =					jumps[max_jump]
                        # since the difference between jumps is cached, add c
                        lowerCamelCase_	  =					diff + c
                        for j in range(min(lowercase			,							len(lowercase  )  )  ):
                              lowerCamelCase_  ,       lowerCamelCase_	  =					divmod(lowercase			,							10  )
                        if new_c > 0:
                              add(lowercase			,							lowercase			,							lowercase  )

            else:
                  lowerCamelCase_	  =					[]
      else:
            lowerCamelCase_	  =					{c: []}
            lowerCamelCase_	  =					sub_memo

      if dn >= max_dn or c + diff >= base[k]:
            return diff, dn

      if k > ks[0]:
            while True:
                  # keep doing smaller jumps
                  lowerCamelCase_  ,       lowerCamelCase_	  =					next_term(lowercase			,							k - 1			,							i + dn			,							lowercase  )
                  diff += _diff
                  dn += terms_jumped

                  if dn >= max_dn or c + diff >= base[k]:
                        break
      else:
            # would be too small a jump, just compute sequential terms instead
            lowerCamelCase_  ,       lowerCamelCase_	  =					compute(lowercase			,							lowercase			,							i + dn			,							lowercase  )
            diff += _diff
            dn += terms_jumped

      lowerCamelCase_	  =					sub_memo[c]

      # keep jumps sorted by # of terms skipped
      lowerCamelCase_	  =					0
      while j < len(lowercase  ):
            if jumps[j][1] > dn:
                  break
            j += 1

      # cache the jump for this value digitsum(b) and c
      sub_memo[c].insert(lowercase			,							(diff, dn, k)  )
      return (diff, dn)

def     _SCREAMING_SNAKE_CASE    (							lowercase			: List[Any]			,							lowercase			: List[Any]			,							lowercase			: Optional[Any]			,							lowercase			: Optional[int]  ):


      '''simple docstring'''



      if i >= n:
            return 0, i
      if k > len(lowercase  ):
            a_i.extend([0 for _ in range(k - len(lowercase  )  )]  )

      # note: a_i -> b * 10^k + c
      # ds_b -> digitsum(b)
      # ds_c -> digitsum(c)
      lowerCamelCase_	  =					i
      lowerCamelCase_  ,       lowerCamelCase_  ,       lowerCamelCase_	  =					0, 0, 0
      for j in range(len(lowercase  )  ):
            if j >= k:
                  ds_b += a_i[j]
            else:
                  ds_c += a_i[j]

      while i < n:
            i += 1
            lowerCamelCase_	  =					ds_c + ds_b
            diff += addend
            lowerCamelCase_	  =					0
            for j in range(lowercase  ):
                  lowerCamelCase_	  =					a_i[j] + addend
                  lowerCamelCase_  ,       lowerCamelCase_	  =					divmod(lowercase			,							10  )

                  ds_c += a_i[j]

            if addend > 0:
                  break

      if addend > 0:
            add(lowercase			,							lowercase			,							lowercase  )
      return diff, i - start_i

def     _SCREAMING_SNAKE_CASE    (							lowercase			: Union[str, Any]			,							lowercase			: Optional[int]			,							lowercase			: List[str]  ):


      '''simple docstring'''



      for j in range(lowercase			,							len(lowercase  )  ):
            lowerCamelCase_	  =					digits[j] + addend
            if s >= 10:
                  lowerCamelCase_  ,       lowerCamelCase_	  =					divmod(lowercase			,							10  )
                  lowerCamelCase_	  =					addend // 10 + quotient
            else:
                  lowerCamelCase_	  =					s
                  lowerCamelCase_	  =					addend // 10

            if addend == 0:
                  break

      while addend > 0:
            lowerCamelCase_  ,       lowerCamelCase_	  =					divmod(lowercase			,							10  )
            digits.append(lowercase  )

def     _SCREAMING_SNAKE_CASE    (							lowercase			: int = 10**15  ):


      '''simple docstring'''



      lowerCamelCase_	  =					[1]
      lowerCamelCase_	  =					1
      lowerCamelCase_	  =					0
      while True:
            lowerCamelCase_  ,       lowerCamelCase_	  =					next_term(lowercase			,							20			,							i + dn			,							lowercase  )
            dn += terms_jumped
            if dn == n - i:
                  break

      lowerCamelCase_	  =					0
      for j in range(len(lowercase  )  ):
            a_n += digits[j] * 10**j
      return a_n


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









import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available
from . import BaseDiffusersCLICommand

def     _SCREAMING_SNAKE_CASE    (							lowercase			: Optional[Any]  ):


      '''simple docstring'''



      return EnvironmentCommand()







class 						A(		UpperCamelCase     ):



 '''simple docstring'''


 @staticmethod
 def        a__				(       A_      :						ArgumentParser						)     ->			str:

       """simple docstring"""






       lowerCamelCase_	  =					parser.add_parser('env'						)
       download_parser.set_defaults(func=A_						)

 def        a__				(       self      :						Optional[Any]						)     ->			Any:

       """simple docstring"""






       lowerCamelCase_	  =					huggingface_hub.__version__

       lowerCamelCase_	  =					'not installed'
       lowerCamelCase_	  =					'NA'
       if is_torch_available():
             import torch

             lowerCamelCase_	  =					torch.__version__
             lowerCamelCase_	  =					torch.cuda.is_available()

       lowerCamelCase_	  =					'not installed'
       if is_transformers_available():
             import transformers

             lowerCamelCase_	  =					transformers.__version__

       lowerCamelCase_	  =					'not installed'
       if is_accelerate_available():
             import accelerate

             lowerCamelCase_	  =					accelerate.__version__

       lowerCamelCase_	  =					'not installed'
       if is_xformers_available():
             import xformers

             lowerCamelCase_	  =					xformers.__version__

       lowerCamelCase_	  =					{
           '`diffusers` version': version,
           'Platform': platform.platform(),
           'Python version': platform.python_version(),
           'PyTorch version (GPU?)': f"""{pt_version} ({pt_cuda_available})""",
           'Huggingface_hub version': hub_version,
           'Transformers version': transformers_version,
           'Accelerate version': accelerate_version,
           'xFormers version': xformers_version,
           'Using GPU in script?': '<fill in>',
           'Using distributed or parallel set-up in script?': '<fill in>',
       }

       print('\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n'						)
       print(self.format_dict(A_						)						)

       return info





 @staticmethod
 def        a__				(       A_      :						Dict						)     ->			Any:

       """simple docstring"""






       return "\n".join([f"""- {prop}: {val}""" for prop, val in d.items()]						) + "\n"



