






def     _snake_case    (__lowercase    ,      __lowercase    ,      __lowercase):

   def count_of_possible_combinations(__lowercase) -> int:
      if target < 0:
         return 0
      if target == 0:
         return 1
      return sum(count_of_possible_combinations(target - item) for item in array)

   return count_of_possible_combinations(__lowercase)






def     _snake_case    (__lowercase    ,      __lowercase    ,      __lowercase):

   def count_of_possible_combinations_with_dp_array(
       __lowercase    ,      __lowercase) -> int:
      if target < 0:
         return 0
      if target == 0:
         return 1
      if dp_array[target] != -1:
         return dp_array[target]
      UpperCamelCase_									=     sum(
          count_of_possible_combinations_with_dp_array(target - item    ,      __lowercase)
          for item in array)
      UpperCamelCase_									=     answer
      return answer

   UpperCamelCase_									=     [-1] * (target + 1)
   return count_of_possible_combinations_with_dp_array(__lowercase    ,      __lowercase)






def     _snake_case    (__lowercase    ,      __lowercase    ,      __lowercase):
   UpperCamelCase_									=     [0] * (target + 1)
   UpperCamelCase_									=     1

   for i in range(1    ,      target + 1):
      for j in range(__lowercase):
         if i - array[j] >= 0:
            dp_array[i] += dp_array[i - array[j]]

   return dp_array[target]


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 snake_case__      :	Optional[int]       	=      3
 snake_case__      :	Any       	=      5
 snake_case__      :	Any       	=      [1, 2, 5]
 print(combination_sum_iv(n, array, target))













from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
 if not (is_transformers_available() and is_torch_available()):
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 from ...utils.dummy_torch_and_transformers_objects import (
     ImageTextPipelineOutput,
     UniDiffuserPipeline,
 )
else:
 from .modeling_text_decoder import UniDiffuserTextDecoder
 from .modeling_uvit import UniDiffuserModel, UTransformeraDModel
 from .pipeline_unidiffuser import ImageTextPipelineOutput, UniDiffuserPipeline





