

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 			lowercase    (	unittest.TestCase      ):




				def    a							( self	):
											# For consistency across different places the DisjunctiveConstraint is called,
											# dc.token_ids is a list of integers. It is also initialized only by integers.

											snake_case_          =   [[1, 2, 4], [1, 2, 3, 4]]
											snake_case_          =   DisjunctiveConstraint(snake_case	)
											self.assertTrue(isinstance(dc.token_ids				,       snake_case	)	)

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

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




				def    a							( self	):
											# We can't have constraints that are complete subsets of another. This leads to a preverse
											# interpretation of "constraint fulfillment": does generating [1,2,3] fulfill the constraint?
											# It would mean that it generated [1,2] which fulfills it, but it's in the middle of potentially
											# fulfilling [1,2,3,4]. If we believe that [1,2,3] does fulfill the constraint, then the algorithm
											# will necessarily never reach [1,2,3,4], giving users a false sense of control (better to just not allow it).
											snake_case_          =   [[1, 2], [1, 2, 3, 4]]

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




				def    a							( self	):
											snake_case_          =   [[1, 2, 3], [1, 2, 4]]

											snake_case_          =   DisjunctiveConstraint(snake_case	)

											snake_case_    ,   snake_case_    ,   snake_case_          =   dc.update(1	)
											snake_case_          =   stepped is True and completed is False and reset is False
											self.assertTrue(snake_case	)
											self.assertTrue(not dc.completed	)
											self.assertTrue(dc.current_seq == [1]	)

											snake_case_    ,   snake_case_    ,   snake_case_          =   dc.update(2	)
											snake_case_          =   stepped is True and completed is False and reset is False
											self.assertTrue(snake_case	)
											self.assertTrue(not dc.completed	)
											self.assertTrue(dc.current_seq == [1, 2]	)

											snake_case_    ,   snake_case_    ,   snake_case_          =   dc.update(3	)
											snake_case_          =   stepped is True and completed is True and reset is False
											self.assertTrue(snake_case	)
											self.assertTrue(dc.completed	)  # Completed!
											self.assertTrue(dc.current_seq == [1, 2, 3]	)




				def    a							( self	):
											snake_case_          =   [[1, 2, 3], [1, 2, 4, 5], [1, 2, 5]]

											snake_case_          =   DisjunctiveConstraint(snake_case	)

											snake_case_    ,   snake_case_    ,   snake_case_          =   dc.update(1	)
											self.assertTrue(not dc.completed	)
											self.assertTrue(dc.current_seq == [1]	)

											snake_case_    ,   snake_case_    ,   snake_case_          =   dc.update(2	)
											self.assertTrue(not dc.completed	)
											self.assertTrue(dc.current_seq == [1, 2]	)

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

											snake_case_    ,   snake_case_    ,   snake_case_          =   dc.update(5	)
											self.assertTrue(dc.completed	)  # Completed!
											self.assertTrue(dc.current_seq == [1, 2, 4, 5]	)

											dc.reset()

											snake_case_    ,   snake_case_    ,   snake_case_          =   dc.update(1	)
											self.assertTrue(not dc.completed	)
											self.assertTrue(dc.remaining() == 3	)
											self.assertTrue(dc.current_seq == [1]	)

											snake_case_    ,   snake_case_    ,   snake_case_          =   dc.update(2	)
											self.assertTrue(not dc.completed	)
											self.assertTrue(dc.remaining() == 2	)
											self.assertTrue(dc.current_seq == [1, 2]	)

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







def  __lowerCamelCase     (			UpperCamelCase__				):







							'''simple docstring'''






							snake_case_          =   1
							snake_case_          =   2
							while i * i <= n:
														snake_case_          =   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  __lowerCamelCase     (			):







							'''simple docstring'''






							snake_case_          =   1
							snake_case_          =   1

							while True:
														i += 1
														t_num += i

														if count_divisors(UpperCamelCase__				) > 500:
																					break

							return t_num


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




