





'''simple docstring'''

from math import sqrt




def    _a    (							lowerCAmelCase_ = 1_000_000	):





      """simple docstring"""



      _snake_case		:	Union[str, Any]					     =     0
      _snake_case		:	List[Any]					     =     0
      _snake_case		:	str					     =     42

      while num_cuboids <= limit:
            max_cuboid_size += 1
            for sum_shortest_sides in range(2			,      2 * max_cuboid_size + 1	):
                  if sqrt(sum_shortest_sides**2 + max_cuboid_size**2	).is_integer():
                        num_cuboids += (
                            min(UpperCAmelCase__			,      sum_shortest_sides // 2	)
                            - max(1			,      sum_shortest_sides - max_cuboid_size	)
                            + 1
                        )

      return max_cuboid_size


if __name__ == "__main__":
   print(F"""{solution() = }""")









'''simple docstring'''

import os

import numpy
import onnx




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	List[Any]					     =     a.name
      _snake_case		:	List[Any]					     =     b.name

      _snake_case		:	Tuple					     =     ''''''
      _snake_case		:	Tuple					     =     ''''''

      _snake_case		:	Optional[Any]					     =     a == b

      _snake_case		:	List[Any]					     =     name_a
      _snake_case		:	str					     =     name_b

      return res




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



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

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




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



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




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Optional[Any]					     =     list(model.graph.initializer	)
      _snake_case		:	List[str]					     =     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[str]					     =     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			,      lowerCAmelCase_			,      lowerCAmelCase_	)




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Tuple					     =     os.path.dirname(lowerCAmelCase_	)
      _snake_case		:	str					     =     os.path.basename(lowerCAmelCase_	)

      _snake_case		:	Tuple					     =     onnx.load(os.path.join(lowerCAmelCase_			,      lowerCAmelCase_	)	)

      _snake_case		:	Union[str, Any]					     =     list(model.graph.initializer	)

      _snake_case		:	Union[str, Any]					     =     set()
      _snake_case		:	Any					     =     {}
      _snake_case		:	str					     =     []

      _snake_case		:	Union[str, Any]					     =     0

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

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

                        _snake_case		:	List[Any]					     =     inits[j].data_type
                        _snake_case		:	Dict					     =     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: '''			,      lowerCAmelCase_	)
                        total_reduced_size += mem_size

                        _snake_case		:	Union[str, Any]					     =     inits[i].name
                        _snake_case		:	Any					     =     inits[j].name

                        if name_i in dup_map:
                              dup_map[name_i].append(lowerCAmelCase_	)
                        else:
                              _snake_case		:	Union[str, Any]					     =     [name_j]
                        ind_to_replace.append((j, i)	)

      print('''total reduced size: '''			,      total_reduced_size / 1_024 / 1_024 / 1_024			,      '''GB'''	)

      _snake_case		:	List[str]					     =     sorted(lowerCAmelCase_	)
      _remove_dup_initializers_from_model(lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_	)

      _snake_case		:	List[str]					     =     '''optimized_''' + model_file_name
      _snake_case		:	List[Any]					     =     os.path.join(lowerCAmelCase_			,      lowerCAmelCase_	)
      onnx.save(lowerCAmelCase_			,      lowerCAmelCase_	)

      return new_model


