

import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
   import torch

   from transformers.generation import DisjunctiveConstraint



@require_torch
class SCREAMING_SNAKE_CASE     (  unittest.TestCase			):
  """simple docstring"""






  def 	SCREAMING_SNAKE_CASE   (      self			:   Optional[Any]   )							->     Dict:






     """simple docstring"""







     __lowerCAmelCase  :      Tuple    =						[[1, 2, 4], [1, 2, 3, 4]]
     __lowerCAmelCase  :      Any    =						DisjunctiveConstraint(lowerCAmelCase   )
     self.assertTrue(isinstance(dc.token_ids	,							lowerCAmelCase   )   )

     with self.assertRaises(lowerCAmelCase   ):
        DisjunctiveConstraint(torch.LongTensor([[1, 2, 4], [1, 2, 3]]   )   )

     with self.assertRaises(lowerCAmelCase   ):
        DisjunctiveConstraint([torch.LongTensor([1, 2, 4]   ), torch.LongTensor([1, 2, 3, 4, 5]   )]   )







  def 	SCREAMING_SNAKE_CASE   (      self			:   List[str]   )							->     Any:






     """simple docstring"""







     __lowerCAmelCase  :      Optional[Any]    =						[[1, 2], [1, 2, 3, 4]]

     with self.assertRaises(lowerCAmelCase   ):
        DisjunctiveConstraint(lowerCAmelCase   )  # fails here







  def 	SCREAMING_SNAKE_CASE   (      self			:   Union[str, Any]   )							->     str:






     """simple docstring"""







     __lowerCAmelCase  :      List[Any]    =						[[1, 2, 3], [1, 2, 4]]

     __lowerCAmelCase  :      List[Any]    =						DisjunctiveConstraint(lowerCAmelCase   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      List[str]    =						dc.update(1   )
     __lowerCAmelCase  :      Optional[Any]    =						stepped is True and completed is False and reset is False
     self.assertTrue(lowerCAmelCase   )
     self.assertTrue(not dc.completed   )
     self.assertTrue(dc.current_seq == [1]   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      int    =						dc.update(2   )
     __lowerCAmelCase  :      int    =						stepped is True and completed is False and reset is False
     self.assertTrue(lowerCAmelCase   )
     self.assertTrue(not dc.completed   )
     self.assertTrue(dc.current_seq == [1, 2]   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      Any    =						dc.update(3   )
     __lowerCAmelCase  :      int    =						stepped is True and completed is True and reset is False
     self.assertTrue(lowerCAmelCase   )
     self.assertTrue(dc.completed   )  # Completed!
     self.assertTrue(dc.current_seq == [1, 2, 3]   )







  def 	SCREAMING_SNAKE_CASE   (      self			:   Dict   )							->     List[str]:






     """simple docstring"""







     __lowerCAmelCase  :      Tuple    =						[[1, 2, 3], [1, 2, 4, 5], [1, 2, 5]]

     __lowerCAmelCase  :      Dict    =						DisjunctiveConstraint(lowerCAmelCase   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      Dict    =						dc.update(1   )
     self.assertTrue(not dc.completed   )
     self.assertTrue(dc.current_seq == [1]   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      Optional[int]    =						dc.update(2   )
     self.assertTrue(not dc.completed   )
     self.assertTrue(dc.current_seq == [1, 2]   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      str    =						dc.update(4   )
     self.assertTrue(not dc.completed   )
     self.assertTrue(dc.current_seq == [1, 2, 4]   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      Union[str, Any]    =						dc.update(5   )
     self.assertTrue(dc.completed   )  # Completed!
     self.assertTrue(dc.current_seq == [1, 2, 4, 5]   )

     dc.reset()

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      Optional[Any]    =						dc.update(1   )
     self.assertTrue(not dc.completed   )
     self.assertTrue(dc.remaining() == 3   )
     self.assertTrue(dc.current_seq == [1]   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      Optional[Any]    =						dc.update(2   )
     self.assertTrue(not dc.completed   )
     self.assertTrue(dc.remaining() == 2   )
     self.assertTrue(dc.current_seq == [1, 2]   )

     __lowerCAmelCase   ,__lowerCAmelCase   ,__lowerCAmelCase  :      Optional[Any]    =						dc.update(5   )
     self.assertTrue(dc.completed   )  # Completed!
     self.assertTrue(dc.remaining() == 0   )
     self.assertTrue(dc.current_seq == [1, 2, 5]   )





def      snake_case_				()      ->     List[Any]:
   for n in range(1 ,       1_0_0_0_0_0_0					):
      yield n * (n + 1) // 2





def      snake_case_				(__A					:						Dict					)      ->     Tuple:
   __lowerCAmelCase  :      Optional[int]    =						1
   __lowerCAmelCase  :      Optional[int]    =						2
   while i * i <= n:
      __lowerCAmelCase  :      Optional[int]    =						0
      while n % i == 0:
         n //= i
         multiplicity += 1
      divisors_count *= multiplicity + 1
      i += 1
   if n > 1:
      divisors_count *= 2
   return divisors_count





def      snake_case_				()      ->     Dict:
   return next(i for i in triangle_number_generator() if count_divisors(__A					) > 5_0_0					)


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


