"""simple docstring"""


from unittest import TestCase

from datasets import Dataset
from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters






def 			__UpperCAmelCase    (	):







  """simple docstring"""
  _UpperCAmelCase         =					{
      """repo_name""": ["""test_repo1""", """test_repo2""", """test_repo3"""],
      """path""": ["""test_1.py""", """test_2.py""", """unit_test.py"""],
      """content""": ["""a """ * 20, """a """ * 30, """b """ * 7],
  }
  _UpperCAmelCase         =					Dataset.from_dict(lowercase						)
  return dataset


class 				a (						lowerCAmelCase_      ):


    def    lowerCAmelCase_     (    self		:     int    ):
      _UpperCAmelCase         =					get_dataset()
      _UpperCAmelCase         =					make_duplicate_clusters(__lowerCAmelCase      , 0.85    )
      self.assertEqual(len(duplicate_clusters[0]    )      , 2    )


    def    lowerCAmelCase_     (    self		:     List[Any]    ):
      _UpperCAmelCase         =					get_dataset()
      _UpperCAmelCase       , _UpperCAmelCase         =					deduplicate_dataset(__lowerCAmelCase    )
      self.assertEqual(len(__lowerCAmelCase    )      , 2    )
      print(__lowerCAmelCase    )
      self.assertEqual(duplicate_clusters[0][0]["""copies"""]      , 2    )
      self.assertEqual(duplicate_clusters[0][0]["""is_extreme"""]      , __lowerCAmelCase    )

"""simple docstring"""


from math import pow






def 			__UpperCAmelCase    (	lowercase      ,lowercase      ,lowercase      ,lowercase      ,lowercase      ,):







  """simple docstring"""
  if current_sum == needed_sum:
    # If the sum of the powers is equal to needed_sum, then we have a solution.
    solutions_count += 1
    return current_sum, solutions_count

  _UpperCAmelCase         =					int(pow(lowercase      ,lowercase						)						)
  if current_sum + i_to_n <= needed_sum:
    # If the sum of the powers is less than needed_sum, then continue adding powers.
    current_sum += i_to_n
    _UpperCAmelCase       , _UpperCAmelCase         =					backtrack(
        lowercase      ,lowercase      ,current_number + 1      ,lowercase      ,lowercase						)
    current_sum -= i_to_n
  if i_to_n < needed_sum:
    # If the power of i is less than needed_sum, then try with the next power.
    _UpperCAmelCase       , _UpperCAmelCase         =					backtrack(
        lowercase      ,lowercase      ,current_number + 1      ,lowercase      ,lowercase						)
  return current_sum, solutions_count






def 			__UpperCAmelCase    (	lowercase      ,lowercase						):







  """simple docstring"""
  if not (1 <= needed_sum <= 10_00 and 2 <= power <= 10):
    raise ValueError(
        """Invalid input\n"""
        """needed_sum must be between 1 and 1000, power between 2 and 10."""						)

  return backtrack(lowercase      ,lowercase      ,1      ,0      ,0						)[1]  # Return the solutions_count


if __name__ == "__main__":
    import doctest

    doctest.testmod()
