






import os

import numpy
import onnx






def   UpperCamelCase  (       snake_case__     :   Any	,snake_case__     :   str  ):




     '''simple docstring'''






     __snake_case			:Union[str, Any]          =						a.name
     __snake_case			:Dict          =						b.name

     __snake_case			:Dict          =						""""""
     __snake_case			:List[str]          =						""""""

     __snake_case			:Optional[int]          =						a == b

     __snake_case			:int          =						name_a
     __snake_case			:Optional[int]          =						name_b

     return res






def   UpperCamelCase  (       snake_case__     :   Union[str, Any]	,snake_case__     :   List[Any]	,snake_case__     :   Tuple  ):




     '''simple docstring'''






     for i, input_name in enumerate(node_proto.input  ):
          if input_name == name:
               node_proto.input.insert(snake_case__	,snake_case__  )
               node_proto.input.pop(i + 1  )

     if node_proto.op_type == "If":
          _graph_replace_input_with(node_proto.attribute[0].g	,snake_case__	,snake_case__  )
          _graph_replace_input_with(node_proto.attribute[1].g	,snake_case__	,snake_case__  )
     if node_proto.op_type == "Loop":
          _graph_replace_input_with(node_proto.attribute[0].g	,snake_case__	,snake_case__  )






def   UpperCamelCase  (       snake_case__     :   Dict	,snake_case__     :   Dict	,snake_case__     :   Dict  ):




     '''simple docstring'''






     for n in graph_proto.node:
          _node_replace_input_with(snake_case__	,snake_case__	,snake_case__  )






def   UpperCamelCase  (       snake_case__     :   List[str]	,snake_case__     :   List[str]	,snake_case__     :   Any  ):




     '''simple docstring'''






     __snake_case			:Optional[int]          =						list(model.graph.initializer  )
     __snake_case			:Dict          =						list(model_without_ext.graph.initializer  )
     for i, ref_i in ind_to_replace:
          assert inits_with_data[i].name == inits[i].name
          assert inits_with_data[ref_i].name == inits[ref_i].name
          assert i > ref_i

          __snake_case			:List[Any]          =						inits[i].name
          __snake_case			:List[Any]          =						inits[ref_i].name

          model_without_ext.graph.initializer.remove(inits[i]  )

          # for n in model.graph.node:
          _graph_replace_input_with(model_without_ext.graph	,snake_case__	,snake_case__  )






def   UpperCamelCase  (       snake_case__     :   Any  ):




     '''simple docstring'''






     __snake_case			:Dict          =						os.path.dirname(snake_case__  )
     __snake_case			:List[str]          =						os.path.basename(snake_case__  )

     __snake_case			:List[str]          =						onnx.load(os.path.join(snake_case__	,snake_case__  )  )

     __snake_case			:Dict          =						list(model.graph.initializer  )

     __snake_case			:str          =						set()
     __snake_case			:Tuple          =						{}
     __snake_case			:Optional[Any]          =						[]

     __snake_case			:List[str]          =						0

     for i in range(len(snake_case__  )  ):
          if i in dup_set:
               continue

          for j in range(i + 1	,len(snake_case__  )  ):
               if j in dup_set:
                    continue
               if _is_equal_tensor_proto(inits[i]	,inits[j]  ):
                    dup_set.add(snake_case__  )
                    dup_set.add(snake_case__  )

                    __snake_case			:Any          =						inits[j].data_type
                    __snake_case			:Any          =						numpy.prod(inits[j].dims  )
                    if dtype == 1:
                         mem_size *= 4
                    elif dtype == 6:
                         mem_size *= 4
                    elif dtype == 7 or dtype == 11:
                         mem_size *= 8
                    else:
                         print("""unexpected data type: """	,snake_case__  )
                    total_reduced_size += mem_size

                    __snake_case			:Tuple          =						inits[i].name
                    __snake_case			:Dict          =						inits[j].name

                    if name_i in dup_map:
                         dup_map[name_i].append(snake_case__  )
                    else:
                         __snake_case			:int          =						[name_j]
                    ind_to_replace.append((j, i)  )

     print("""total reduced size: """	,total_reduced_size / 1024 / 1024 / 1024	,"""GB"""  )

     __snake_case			:Optional[Any]          =						sorted(snake_case__  )
     _remove_dup_initializers_from_model(snake_case__	,snake_case__	,snake_case__  )

     __snake_case			:Union[str, Any]          =						"""optimized_""" + model_file_name
     __snake_case			:str          =						os.path.join(snake_case__	,snake_case__  )
     onnx.save(snake_case__	,snake_case__  )

     return new_model










import math

lowerCamelCase__							=     10
lowerCamelCase__							=     7
lowerCamelCase__							=     BALLS_PER_COLOUR * NUM_COLOURS






def   UpperCamelCase  (       snake_case__     :   int = 20  ):




     '''simple docstring'''






     __snake_case			:Dict          =						math.comb(snake_case__	,snake_case__  )
     __snake_case			:int          =						math.comb(NUM_BALLS - BALLS_PER_COLOUR	,snake_case__  )

     __snake_case			:List[str]          =						NUM_COLOURS * (1 - missing_colour / total)

     return f'''{result:.9f}'''


if __name__ == "__main__":
     print(solution(20))


