


class 				snake_case__:







      '''simple docstring'''




      def __init__(				self   ,						__lowercase							)					->    None:
          lowerCAmelCase_ :      List[Any]    				=				len(__lowercase							)
          lowerCAmelCase_ :      Optional[Any]    				=				[0] * len_array

          if len_array > 0:
              lowerCAmelCase_ :      Optional[int]    				=				array[0]

          for i in range(1   ,						__lowercase							):
              lowerCAmelCase_ :      Tuple    				=				self.prefix_sum[i - 1] + array[i]




      def 						lowercase_ (				self   ,						__lowercase   ,						__lowercase							)					->    int:
          if start == 0:
              return self.prefix_sum[end]

          return self.prefix_sum[end] - self.prefix_sum[start - 1]




      def 						lowercase_ (				self   ,						__lowercase							)					->    bool:
          lowerCAmelCase_ :      List[str]    				=				{0}
          for sum_item in self.prefix_sum:
              if sum_item - target_sum in sums:
                  return True

              sums.add(__lowercase							)

          return False


if __name__ == "__main__":
      import doctest

      doctest.testmod()



import copy

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


_UpperCAmelCase			:  str     =logging.get_logger(__name__)







class 				snake_case__(							UpperCAmelCase__							):







						'''simple docstring'''




						SCREAMING_SNAKE_CASE__      :  Optional[int]					=							"""encoder-decoder"""
						SCREAMING_SNAKE_CASE__      :  str					=							True




						def __init__(				self   ,						**__lowercase							)					->    Union[str, Any]:
										super().__init__(**__lowercase							)
										assert (
										    "encoder" in kwargs and "decoder" in kwargs
										), "Config has to be initialized with encoder and decoder config"
										lowerCAmelCase_ :      str    				=				kwargs.pop('''encoder'''							)
										lowerCAmelCase_ :      int    				=				encoder_config.pop('''model_type'''							)
										lowerCAmelCase_ :      Optional[Any]    				=				kwargs.pop('''decoder'''							)
										lowerCAmelCase_ :      Optional[Any]    				=				decoder_config.pop('''model_type'''							)

										from ..auto.configuration_auto import AutoConfig

										lowerCAmelCase_ :      Union[str, Any]    				=				AutoConfig.for_model(__lowercase   ,						**__lowercase							)
										lowerCAmelCase_ :      List[str]    				=				AutoConfig.for_model(__lowercase   ,						**__lowercase							)
										lowerCAmelCase_ :      Any    				=				True




						@classmethod
						def 						lowercase_ (				cls   ,						__lowercase   ,						__lowercase   ,						**__lowercase							)					->    PretrainedConfig:
										logger.info('''Set `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config'''							)
										lowerCAmelCase_ :      int    				=				True
										lowerCAmelCase_ :      List[Any]    				=				True

										return cls(encoder=encoder_config.to_dict()   ,						decoder=decoder_config.to_dict()   ,						**__lowercase							)




						def 						lowercase_ (				self							)					->    Any:
										lowerCAmelCase_ :      Optional[Any]    				=				copy.deepcopy(self.__dict__							)
										lowerCAmelCase_ :      List[str]    				=				self.encoder.to_dict()
										lowerCAmelCase_ :      Dict    				=				self.decoder.to_dict()
										lowerCAmelCase_ :      Optional[Any]    				=				self.__class__.model_type
										return output