
"""simple docstring"""







def       A_      (       lowercase    ,			lowercase   )  ->				int:


     """simple docstring"""







     return int((input_a, input_a).count(0   ) != 0   )




def       A_      (       )  ->				None:


     """simple docstring"""







     assert nand_gate(0    ,			0   ) == 1
     assert nand_gate(0    ,			1   ) == 1
     assert nand_gate(1    ,			0   ) == 1
     assert nand_gate(1    ,			1   ) == 0


if __name__ == "__main__":
       print(nand_gate(0, 0))
       print(nand_gate(0, 1))
       print(nand_gate(1, 0))
       print(nand_gate(1, 1))



"""simple docstring"""







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 		UpperCAmelCase_						(unittest.TestCase    ):
 """simple docstring"""




 def 	a   (			self							:			Any			)->       int:



      """simple docstring"""

      UpperCAmelCase_    :     Optional[Any]            =	[[1, 2, 4], [1, 2, 3, 4]]
      UpperCAmelCase_    :     Union[str, Any]            =	DisjunctiveConstraint(a_			)
      self.assertTrue(isinstance(dc.token_ids  , a_			)			)

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

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




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



      """simple docstring"""

      UpperCAmelCase_    :     Tuple            =	[[1, 2], [1, 2, 3, 4]]

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




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



      """simple docstring"""

      UpperCAmelCase_    :     Optional[int]            =	[[1, 2, 3], [1, 2, 4]]

      UpperCAmelCase_    :     Dict            =	DisjunctiveConstraint(a_			)

      UpperCAmelCase_       ,UpperCAmelCase_       ,UpperCAmelCase_    :     int            =	dc.update(1			)
      UpperCAmelCase_    :     str            =	stepped is True and completed is False and reset is False
      self.assertTrue(a_			)
      self.assertTrue(not dc.completed			)
      self.assertTrue(dc.current_seq == [1]			)

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

      UpperCAmelCase_       ,UpperCAmelCase_       ,UpperCAmelCase_    :     Union[str, Any]            =	dc.update(3			)
      UpperCAmelCase_    :     str            =	stepped is True and completed is True and reset is False
      self.assertTrue(a_			)
      self.assertTrue(dc.completed			)  # Completed!
      self.assertTrue(dc.current_seq == [1, 2, 3]			)






 def 	a   (			self							:			List[Any]			)->       List[Any]:



      """simple docstring"""

      UpperCAmelCase_    :     Optional[int]            =	[[1, 2, 3], [1, 2, 4, 5], [1, 2, 5]]

      UpperCAmelCase_    :     Tuple            =	DisjunctiveConstraint(a_			)

      UpperCAmelCase_       ,UpperCAmelCase_       ,UpperCAmelCase_    :     List[Any]            =	dc.update(1			)
      self.assertTrue(not dc.completed			)
      self.assertTrue(dc.current_seq == [1]			)

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

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

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

      dc.reset()

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

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

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

