






"""simple docstring"""



import torch
from torch import autograd

class 	a					(       autograd.Function     ):







    @staticmethod
    def       UpperCamelCase_				(      _lowerCamelCase							,		_lowerCamelCase							,		_lowerCamelCase							,		_lowerCamelCase	):
      lowercase							   =	inputs.numel()
      lowercase							   =	int(0.0_0_5 * nb_elems	) + 1
      if sigmoid:
        lowercase							   =	(torch.sigmoid(_lowerCamelCase	) > threshold).type(inputs.type()	)
      else:
        lowercase							   =	(inputs > threshold).type(inputs.type()	)
      if mask.sum() < nb_min:
        # We limit the pruning so that at least 0.5% (half a percent) of the weights are remaining
        lowercase							   =	inputs.flatten().kthvalue(max(nb_elems - nb_min							,		1	)	).values
        lowercase							   =	(inputs > k_threshold).type(inputs.type()	)
      return mask







    @staticmethod
    def       UpperCamelCase_				(      _lowerCamelCase							,		_lowerCamelCase	):
      return gradOutput, None, None


class 	a					(       autograd.Function     ):







    @staticmethod
    def       UpperCamelCase_				(      _lowerCamelCase							,		_lowerCamelCase							,		_lowerCamelCase	):
      lowercase							   =	inputs.clone()
      lowercase   ,					lowercase							   =	inputs.flatten().sort(descending=_lowerCamelCase	)
      lowercase							   =	int(threshold * inputs.numel()	)

      # flat_out and mask access the same memory.
      lowercase							   =	mask.flatten()
      lowercase							   =	0
      lowercase							   =	1
      return mask







    @staticmethod
    def       UpperCamelCase_				(      _lowerCamelCase							,		_lowerCamelCase	):
      return gradOutput, None


class 	a					(       a_     ):







    @staticmethod
    def       UpperCamelCase_				(      _lowerCamelCase							,		_lowerCamelCase	):
      lowercase							   =	inputs.clone()
      lowercase   ,					lowercase							   =	inputs.abs().flatten().sort(descending=_lowerCamelCase	)
      lowercase							   =	int(threshold * inputs.numel()	)

      # flat_out and mask access the same memory.
      lowercase							   =	mask.flatten()
      lowercase							   =	0
      lowercase							   =	1
      return mask










"""simple docstring"""



def 						_SCREAMING_SNAKE_CASE			(   ):





  '''simple docstring'''





  for a in range(3_00   ):
    for b in range(a + 1		, 4_00   ):
      for c in range(b + 1		, 5_00   ):
        if (a + b + c) == 10_00 and (a**2) + (b**2) == (c**2):
          return a * b * c

  return -1
def 						_SCREAMING_SNAKE_CASE			(   ):





  '''simple docstring'''





  for a in range(3_00   ):
    for b in range(4_00   ):
      lowercase							   =	10_00 - a - b
      if a < b < c and (a**2) + (b**2) == (c**2):
        return a * b * c

  return -1
def 						_SCREAMING_SNAKE_CASE			(   ):





  '''simple docstring'''





  import timeit

  print(
      timeit.timeit('solution()'		, setup='from __main__ import solution'		, number=10_00   )   )
  print(
      timeit.timeit(
          'solution_fast()'		, setup='from __main__ import solution_fast'		, number=10_00   )   )


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


