


'''simple docstring'''



import argparse
from collections import defaultdict

import yaml


__UpperCAmelCase      :Any			    =       "docs/source/en/_toctree.yml"




def      _a     (						_lowercase :     Any  ):





     '''simple docstring'''






     __UpperCAmelCase     :			Optional[Any]  							=      defaultdict(_lowercase  )
     for doc in model_doc:
          counts[doc["local"]] += 1
     __UpperCAmelCase     :			str  							=      [key for key, value in counts.items() if value > 1]

     __UpperCAmelCase     :			Dict  							=      []
     for duplicate_key in duplicates:
          __UpperCAmelCase     :			Optional[int]  							=      list({doc['''title'''] for doc in model_doc if doc['''local'''] == duplicate_key}  )
          if len(_lowercase  ) > 1:
               raise ValueError(
                   F'{duplicate_key} is present several times in the documentation table of content at '
                   '''`docs/source/en/_toctree.yml` with different *Title* values. Choose one of those and remove the '''
                   '''others.'''  )
          # Only add this once
          new_doc.append({'''local''': duplicate_key, '''title''': titles[0]}  )

     # Add none duplicate-keys
     new_doc.extend([doc for doc in model_doc if counts[doc['''local''']] == 1]  )

     # Sort
     return sorted(_lowercase      , key=lambda _lowercase  : s["title"].lower()  )




def      _a     (						_lowercase :     Optional[Any]=False  ):





     '''simple docstring'''






     with open(_lowercase      , encoding='''utf-8'''  ) as f:
          __UpperCAmelCase     :			Dict  							=      yaml.safe_load(f.read()  )

     # Get to the API doc
     __UpperCAmelCase     :			Tuple  							=      0
     while content[api_idx]["title"] != "API":
          api_idx += 1
     __UpperCAmelCase     :			Optional[Any]  							=      content[api_idx]['''sections''']

     # Then to the model doc
     __UpperCAmelCase     :			Optional[int]  							=      0
     while api_doc[model_idx]["title"] != "Models":
          model_idx += 1

     __UpperCAmelCase     :			Optional[int]  							=      api_doc[model_idx]['''sections''']

     __UpperCAmelCase     :			Any  							=      [(idx, section) for idx, section in enumerate(_lowercase  ) if '''sections''' in section]
     __UpperCAmelCase     :			Any  							=      False
     for idx, modality_doc in modalities_docs:
          __UpperCAmelCase     :			str  							=      modality_doc['''sections''']
          __UpperCAmelCase     :			str  							=      clean_model_doc_toc(_lowercase  )

          if old_modality_doc != new_modality_doc:
               __UpperCAmelCase     :			Optional[int]  							=      True
               if overwrite:
                    __UpperCAmelCase     :			Any  							=      new_modality_doc

     if diff:
          if overwrite:
               __UpperCAmelCase     :			Optional[Any]  							=      model_doc
               __UpperCAmelCase     :			List[Any]  							=      api_doc
               with open(_lowercase      , '''w'''      , encoding='''utf-8'''  ) as f:
                    f.write(yaml.dump(_lowercase      , allow_unicode=_lowercase  )  )
          else:
               raise ValueError(
                   '''The model doc part of the table of content is not properly sorted, run `make style` to fix this.'''  )


if __name__ == "__main__":
      __UpperCAmelCase      :Any			    =       argparse.ArgumentParser()
      parser.add_argument("--fix_and_overwrite", action="store_true", help="Whether to fix inconsistencies.")
      __UpperCAmelCase      :Optional[Any]			    =       parser.parse_args()

      check_model_doc(args.fix_and_overwrite)



'''simple docstring'''



def      _a     (						_lowercase :     List[str]  ):





     '''simple docstring'''






     __UpperCAmelCase     :			str  							=      1
     __UpperCAmelCase     :			List[str]  							=      2
     while i * i <= n:
          __UpperCAmelCase     :			Optional[Any]  							=      0
          while n % i == 0:
               n //= i
               multiplicity += 1
          n_divisors *= multiplicity + 1
          i += 1
     if n > 1:
          n_divisors *= 2
     return n_divisors




def      _a     (						):





     '''simple docstring'''






     __UpperCAmelCase     :			Optional[Any]  							=      1
     __UpperCAmelCase     :			List[Any]  							=      1

     while True:
          i += 1
          t_num += i

          if count_divisors(_lowercase  ) > 500:
               break

     return t_num


if __name__ == "__main__":
      print(solution())