

"""simple docstring"""




from typing import Dict, Optional, Tuple

import torch
def    __SCREAMING_SNAKE_CASE						(						lowercase__      ):
					"""simple docstring"""
					A			=					boundaries[1] - boundaries[0]
					A			=					boundaries + step / 2
					A			=					torch.cat([bin_centers, (bin_centers[-1] + step).unsqueeze(-1      )]			,							dim=0      )
					return bin_centers
def    __SCREAMING_SNAKE_CASE						(						lowercase__			,							lowercase__			,							):
					"""simple docstring"""
					A			=					_calculate_bin_centers(lowercase__      )
					return (
					    torch.sum(aligned_distance_error_probs * bin_centers			,							dim=-1      ),
					    bin_centers[-1],
					)
def    __SCREAMING_SNAKE_CASE						(						lowercase__			,							lowercase__ = 31			,							lowercase__ = 64			,							**lowercase__			,							):
					"""simple docstring"""
					A			=					torch.linspace(0			,							lowercase__			,							steps=(no_bins - 1)			,							device=logits.device      )

					A			=					torch.nn.functional.softmax(lowercase__			,							dim=-1      )
					A			,    A			=					_calculate_expected_aligned_error(
					    alignment_confidence_breaks=lowercase__			,							aligned_distance_error_probs=lowercase__			,							)

					return {
					    "aligned_confidence_probs": aligned_confidence_probs,
					    "predicted_aligned_error": predicted_aligned_error,
					    "max_predicted_aligned_error": max_predicted_aligned_error,
					}
def    __SCREAMING_SNAKE_CASE						(						lowercase__			,							lowercase__ = None			,							lowercase__ = 31			,							lowercase__ = 64			,							lowercase__ = 1e-8			,							**lowercase__			,							):
					"""simple docstring"""




					if residue_weights is None:
										A			=					logits.new_ones(logits.shape[-2]      )

					A			=					torch.linspace(0			,							lowercase__			,							steps=(no_bins - 1)			,							device=logits.device      )

					A			=					_calculate_bin_centers(lowercase__      )
					torch.sum(lowercase__      )
					A			=					logits.shape[-2]
					A			=					max(lowercase__			,							19      )

					A			=					1.24 * (clipped_n - 15) ** (1.0 / 3) - 1.8

					A			=					torch.nn.functional.softmax(lowercase__			,							dim=-1      )

					A			=					1.0 / (1 + (bin_centers**2) / (da**2))
					A			=					torch.sum(probs * tm_per_bin			,							dim=-1      )

					A			=					residue_weights / (eps + residue_weights.sum())
					A			=					torch.sum(predicted_tm_term * normed_residue_mask			,							dim=-1      )

					A			=					per_alignment * residue_weights

					A			=					(weighted == torch.max(lowercase__      )).nonzero()[0]
					return per_alignment[tuple(lowercase__      )]











def 	lowerCAmelCase_	(     lowerCamelCase:				int  )    ->	int:


      '''simple docstring'''




      return n * (2 * n - 1)

def 	lowerCAmelCase_	(     lowerCamelCase:				int  )    ->	bool:


      '''simple docstring'''




      lowerCamelCase__					     = (1 + 24 * n) ** 0.5
      return ((1 + root) / 6) % 1 == 0

def 	lowerCAmelCase_	(     lowerCamelCase:				int = 1_44  )    ->	int:


      '''simple docstring'''




      lowerCamelCase__					     = start
      lowerCamelCase__					     = hexagonal_num(lowerCamelCase  )
      while not is_pentagonal(lowerCamelCase  ):
            n += 1
            lowerCamelCase__					     = hexagonal_num(lowerCamelCase  )
      return num


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