"""simple docstring"""





import math


class 					UpperCAmelCase__     :


      def __init__(       self		,      a							)	-> str:
             lowercase__      :		Union[str, Any]          =     len(a							)
             lowercase__      :		List[Any]          =     [0] * (
                 4 * self.N
             )  # approximate the overall size of segment tree with array N
             self.build(1		,      0		,      self.N - 1							)


      def 		_UpperCAmelCase	(       self		,      a							)	-> List[Any]:
             return idx * 2


      def 		_UpperCAmelCase	(       self		,      a							)	-> Tuple:
             return idx * 2 + 1


      def 		_UpperCAmelCase	(       self		,      a		,      a		,      a							)	-> Optional[Any]:  # noqa: E741
             if l == r:
                    lowercase__      :		int          =     A[l]
             else:
                    lowercase__      :		str          =     (l + r) // 2
                    self.build(self.left(a							)		,      a		,      a							)
                    self.build(self.right(a							)		,      mid + 1		,      a							)
                    lowercase__      :		str          =     max(self.st[self.left(a							)]		,      self.st[self.right(a							)]							)


      def 		_UpperCAmelCase	(       self		,      a		,      a		,      a							)	-> List[Any]:
             return self.update_recursive(1		,      0		,      self.N - 1		,      a - 1		,      b - 1		,      a							)


      def 		_UpperCAmelCase	(       self		,      a		,      a		,      a		,      a		,      a		,      a							)	-> str:  # noqa: E741
             if r < a or l > b:
                    return True
             if l == r:
                    lowercase__      :		Dict          =     val
                    return True
             lowercase__      :		int          =     (l + r) // 2
             self.update_recursive(self.left(a							)		,      a		,      a		,      a		,      a		,      a							)
             self.update_recursive(self.right(a							)		,      mid + 1		,      a		,      a		,      a		,      a							)
             lowercase__      :		Optional[int]          =     max(self.st[self.left(a							)]		,      self.st[self.right(a							)]							)
             return True


      def 		_UpperCAmelCase	(       self		,      a		,      a							)	-> Optional[int]:
             return self.query_recursive(1		,      0		,      self.N - 1		,      a - 1		,      b - 1							)


      def 		_UpperCAmelCase	(       self		,      a		,      a		,      a		,      a		,      a							)	-> Any:  # noqa: E741
             if r < a or l > b:
                    return -math.inf
             if l >= a and r <= b:
                    return self.st[idx]
             lowercase__      :		Dict          =     (l + r) // 2
             lowercase__      :		str          =     self.query_recursive(self.left(a							)		,      a		,      a		,      a		,      a							)
             lowercase__      :		Any          =     self.query_recursive(self.right(a							)		,      mid + 1		,      a		,      a		,      a							)
             return max(a		,      a							)


      def 		_UpperCAmelCase	(       self							)	-> Tuple:
             lowercase__      :		Dict          =     []
             for i in range(1		,      N + 1							):
                    show_list += [self.query(a		,      a							)]
             print(a							)


if __name__ == "__main__":
       _UpperCamelCase       :						Dict     =   [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
       _UpperCamelCase       :						int     =   15
       _UpperCamelCase       :						Optional[int]     =   SegmentTree(A)
       print(segt.query(4, 6))
       print(segt.query(7, 11))
       print(segt.query(7, 12))
       segt.update(1, 3, 1_11)
       print(segt.query(1, 15))
       segt.update(7, 8, 2_35)
       segt.show_data()


"""simple docstring"""





import torch

from transformers import PreTrainedModel

from .custom_configuration import CustomConfig, NoSuperInitConfig


class 					UpperCAmelCase_     (   _a):
      lowerCamelCase__		:   List[str]			  =  CustomConfig


      def __init__(       self		,      a							)	-> Optional[int]:
             super().__init__(a							)
             lowercase__      :		Any          =     torch.nn.Linear(config.hidden_size		,      config.hidden_size							)


      def 		_UpperCAmelCase	(       self		,      a							)	-> Union[str, Any]:
             return self.linear(a							)


      def 		_UpperCAmelCase	(       self		,      a							)	-> Tuple:
             pass





class 					UpperCAmelCase_     (   _a):
      lowerCamelCase__		:   Optional[int]			  =  NoSuperInitConfig


      def __init__(       self		,      a							)	-> int:
             super().__init__(a							)
             lowercase__      :		List[Any]          =     torch.nn.Linear(config.attribute		,      config.attribute							)


      def 		_UpperCAmelCase	(       self		,      a							)	-> Optional[int]:
             return self.linear(a							)


      def 		_UpperCAmelCase	(       self		,      a							)	-> Optional[Any]:
             pass

