





'''simple docstring'''







from __future__ import annotations





def    _lowerCAmelCase						(						lowercase	)					->					set[int]:
			__lowerCAmelCase											=				{1}
			__lowerCAmelCase											=				[1]
			for _ in range(2					,	depth + 1	):
						__lowerCAmelCase											=				[*previous_coefficients, 0]
						__lowerCAmelCase											=				[0, *previous_coefficients]
						__lowerCAmelCase											=				[]
						for x, y in zip(lowercase					,	lowercase	):
									coefficients.add(x + y	)
									previous_coefficients.append(x + y	)
			return coefficients





def    _lowerCAmelCase						(						lowercase	)					->					set[int]:
			__lowerCAmelCase											=				set()
			for number in unique_coefficients:
						__lowerCAmelCase											=				2
						__lowerCAmelCase											=				number
						while divisor**2 <= copy_number:
									__lowerCAmelCase											=				0
									while copy_number % divisor == 0:
												copy_number //= divisor
												multiplicity += 1
									if multiplicity >= 2:
												non_squarefrees.add(lowercase	)
												break
									divisor += 1

			return unique_coefficients.difference(lowercase	)





def    _lowerCAmelCase						(						lowercase = 51	)					->					int:
			__lowerCAmelCase											=				get_pascal_triangle_unique_coefficients(lowercase	)
			__lowerCAmelCase											=				get_squarefrees(lowercase	)
			return sum(lowercase	)


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








'''simple docstring'''







import torch
from torch import autograd





class     _UpperCAmelCase							(						autograd.Function   ):
		@staticmethod
		def   lowerCamelCase__			(  __SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE			):



					'''simple docstring'''

					__lowerCAmelCase											=				inputs.numel()
					__lowerCAmelCase											=				int(0.005 * nb_elems			) + 1
					if sigmoid:
								__lowerCAmelCase											=				(torch.sigmoid(__SCREAMING_SNAKE_CASE			) > threshold).type(inputs.type()			)
					else:
								__lowerCAmelCase											=				(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
								__lowerCAmelCase											=				inputs.flatten().kthvalue(max(nb_elems - nb_min,1			)			).values
								__lowerCAmelCase											=				(inputs > k_threshold).type(inputs.type()			)
					return mask







		@staticmethod
		def   lowerCamelCase__			(  __SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE			):



					'''simple docstring'''

					return gradOutput, None, None





class     _UpperCAmelCase							(						autograd.Function   ):
		@staticmethod
		def   lowerCamelCase__			(  __SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE			):



					'''simple docstring'''

					__lowerCAmelCase											=				inputs.clone()
					__lowerCAmelCase						,       __lowerCAmelCase											=				inputs.flatten().sort(descending=__SCREAMING_SNAKE_CASE			)
					__lowerCAmelCase											=				int(threshold * inputs.numel()			)

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







		@staticmethod
		def   lowerCamelCase__			(  __SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE			):



					'''simple docstring'''

					return gradOutput, None





class     _UpperCAmelCase							(						lowerCAmelCase_   ):
		@staticmethod
		def   lowerCamelCase__			(  __SCREAMING_SNAKE_CASE,__SCREAMING_SNAKE_CASE			):



					'''simple docstring'''

					__lowerCAmelCase											=				inputs.clone()
					__lowerCAmelCase						,       __lowerCAmelCase											=				inputs.abs().flatten().sort(descending=__SCREAMING_SNAKE_CASE			)
					__lowerCAmelCase											=				int(threshold * inputs.numel()			)

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

