

from __future__ import annotations

import math






class 	UpperCAmelCase__		:






  """simple docstring"""


  def __init__(							self						:		List[Any]     ,       __lowerCamelCase						:		int )		->							None:
       SCREAMING_SNAKE_CASE__   =   size
       # approximate the overall size of segment tree with given value
       SCREAMING_SNAKE_CASE__   =   [0 for i in range(0     ,       4 * size )]
       # create array to store lazy update
       SCREAMING_SNAKE_CASE__   =   [0 for i in range(0     ,       4 * size )]
       SCREAMING_SNAKE_CASE__   =   [0 for i in range(0     ,       4 * size )]  # flag for lazy update






  def 				lowercase_		(							self						:		Any     ,       __lowerCamelCase						:		int )		->							int:
       return idx * 2






  def 				lowercase_		(							self						:		List[str]     ,       __lowerCamelCase						:		int )		->							int:
       return idx * 2 + 1






  def 				lowercase_		(							self						:		Optional[Any]     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		list[int] )		->							None:
       if left_element == right_element:
            SCREAMING_SNAKE_CASE__   =   a[left_element - 1]
       else:
            SCREAMING_SNAKE_CASE__   =   (left_element + right_element) // 2
            self.build(self.left(__lowerCamelCase )     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase )
            self.build(self.right(__lowerCamelCase )     ,       mid + 1     ,       __lowerCamelCase     ,       __lowerCamelCase )
            SCREAMING_SNAKE_CASE__   =   max(
                self.segment_tree[self.left(__lowerCamelCase )]     ,       self.segment_tree[self.right(__lowerCamelCase )] )






  def 				lowercase_		(							self						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int )		->							bool:
       if self.flag[idx] is True:
            SCREAMING_SNAKE_CASE__   =   self.lazy[idx]
            SCREAMING_SNAKE_CASE__   =   False
            if left_element != right_element:
                 SCREAMING_SNAKE_CASE__   =   self.lazy[idx]
                 SCREAMING_SNAKE_CASE__   =   self.lazy[idx]
                 SCREAMING_SNAKE_CASE__   =   True
                 SCREAMING_SNAKE_CASE__   =   True

       if right_element < a or left_element > b:
            return True
       if left_element >= a and right_element <= b:
            SCREAMING_SNAKE_CASE__   =   val
            if left_element != right_element:
                 SCREAMING_SNAKE_CASE__   =   val
                 SCREAMING_SNAKE_CASE__   =   val
                 SCREAMING_SNAKE_CASE__   =   True
                 SCREAMING_SNAKE_CASE__   =   True
            return True
       SCREAMING_SNAKE_CASE__   =   (left_element + right_element) // 2
       self.update(self.left(__lowerCamelCase )     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase )
       self.update(self.right(__lowerCamelCase )     ,       mid + 1     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase )
       SCREAMING_SNAKE_CASE__   =   max(
           self.segment_tree[self.left(__lowerCamelCase )]     ,       self.segment_tree[self.right(__lowerCamelCase )] )
       return True






  def 				lowercase_		(							self						:		Union[str, Any]     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int     ,       __lowerCamelCase						:		int )		->							int | float:
       if self.flag[idx] is True:
            SCREAMING_SNAKE_CASE__   =   self.lazy[idx]
            SCREAMING_SNAKE_CASE__   =   False
            if left_element != right_element:
                 SCREAMING_SNAKE_CASE__   =   self.lazy[idx]
                 SCREAMING_SNAKE_CASE__   =   self.lazy[idx]
                 SCREAMING_SNAKE_CASE__   =   True
                 SCREAMING_SNAKE_CASE__   =   True
       if right_element < a or left_element > b:
            return -math.inf
       if left_element >= a and right_element <= b:
            return self.segment_tree[idx]
       SCREAMING_SNAKE_CASE__   =   (left_element + right_element) // 2
       SCREAMING_SNAKE_CASE__   =   self.query(self.left(__lowerCamelCase )     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase )
       SCREAMING_SNAKE_CASE__   =   self.query(self.right(__lowerCamelCase )     ,       mid + 1     ,       __lowerCamelCase     ,       __lowerCamelCase     ,       __lowerCamelCase )
       return max(__lowerCamelCase     ,       __lowerCamelCase )







  def __str__(							self						:		List[str] )		->							str:
       return str([self.query(1     ,       1     ,       self.size     ,       __lowerCamelCase     ,       __lowerCamelCase ) for i in range(1     ,       self.size + 1 )] )


if __name__ == "__main__":
       _SCREAMING_SNAKE_CASE					:  Tuple             =      [1, 2, -4, 7, 3, -5, 6, 11, -20, 9, 14, 15, 5, 2, -8]
       _SCREAMING_SNAKE_CASE					:  Union[str, Any]             =      15
       _SCREAMING_SNAKE_CASE					:  List[Any]             =      SegmentTree(size)
       segt.build(1, 1, size, A)
       print(segt.query(1, 1, size, 4, 6))
       print(segt.query(1, 1, size, 7, 11))
       print(segt.query(1, 1, size, 7, 12))
       segt.update(1, 1, size, 1, 3, 111)
       print(segt.query(1, 1, size, 1, 15))
       segt.update(1, 1, size, 7, 8, 235)
       print(segt)





from ...configuration_utils import PretrainedConfig
from ...utils import logging


_SCREAMING_SNAKE_CASE					:  Any             =      logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE					:  Optional[Any]             =      {
    '''google/vivit-b-16x2-kinetics400''': (
        '''https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json'''
    ),
    # See all Vivit models at https://huggingface.co/models?filter=vivit
}






class 	UpperCAmelCase__		(	A__	):






  """simple docstring"""


  a									= "vivit"






  def __init__(							self						:		str     ,       __lowerCamelCase						:		List[Any]=224     ,       __lowerCamelCase						:		Optional[int]=32     ,       __lowerCamelCase						:		Tuple=[2, 16, 16]     ,       __lowerCamelCase						:		Union[str, Any]=3     ,       __lowerCamelCase						:		Optional[Any]=768     ,       __lowerCamelCase						:		Any=12     ,       __lowerCamelCase						:		Optional[Any]=12     ,       __lowerCamelCase						:		List[str]=3072     ,       __lowerCamelCase						:		Any="gelu_fast"     ,       __lowerCamelCase						:		Union[str, Any]=0.0     ,       __lowerCamelCase						:		int=0.0     ,       __lowerCamelCase						:		str=0.02     ,       __lowerCamelCase						:		Any=1e-06     ,       __lowerCamelCase						:		Dict=True     ,       **__lowerCamelCase						:		Any     ,       )		->							List[str]:
       SCREAMING_SNAKE_CASE__   =   hidden_size
       SCREAMING_SNAKE_CASE__   =   num_hidden_layers
       SCREAMING_SNAKE_CASE__   =   num_attention_heads
       SCREAMING_SNAKE_CASE__   =   intermediate_size
       SCREAMING_SNAKE_CASE__   =   hidden_act
       SCREAMING_SNAKE_CASE__   =   hidden_dropout_prob
       SCREAMING_SNAKE_CASE__   =   attention_probs_dropout_prob
       SCREAMING_SNAKE_CASE__   =   initializer_range
       SCREAMING_SNAKE_CASE__   =   layer_norm_eps

       SCREAMING_SNAKE_CASE__   =   image_size
       SCREAMING_SNAKE_CASE__   =   num_frames
       SCREAMING_SNAKE_CASE__   =   tubelet_size
       SCREAMING_SNAKE_CASE__   =   num_channels
       SCREAMING_SNAKE_CASE__   =   qkv_bias

       super().__init__(**__lowerCamelCase )


