



from typing import Dict, Optional, Tuple

import torch





def 				A      (	_UpperCAmelCase							:  torch.Tensor       )							->					torch.Tensor:







			'''simple docstring'''
			_UpperCAmelCase									=  boundaries[1] - boundaries[0]
			_UpperCAmelCase									=  boundaries + step / 2
			_UpperCAmelCase									=  torch.cat([bin_centers, (bin_centers[-1] + step).unsqueeze(-1       )]				,  dim=0       )
			return bin_centers





def 				A      (	_UpperCAmelCase							:  torch.Tensor				,  _UpperCAmelCase							:  torch.Tensor				,  )							->					Tuple[torch.Tensor, torch.Tensor]:







			'''simple docstring'''
			_UpperCAmelCase									=  _calculate_bin_centers(_UpperCAmelCase       )
			return (
			    torch.sum(aligned_distance_error_probs * bin_centers				,  dim=-1       ),
			    bin_centers[-1],
			)





def 				A      (	_UpperCAmelCase							:  torch.Tensor				,  _UpperCAmelCase							:  int = 31				,  _UpperCAmelCase							:  int = 64				,  **_UpperCAmelCase							:  str				,  )							->					Dict[str, torch.Tensor]:







			'''simple docstring'''
			_UpperCAmelCase									=  torch.linspace(0				,  _UpperCAmelCase				,  steps=(no_bins - 1)				,  device=logits.device       )

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

			return {
			    "aligned_confidence_probs": aligned_confidence_probs,
			    "predicted_aligned_error": predicted_aligned_error,
			    "max_predicted_aligned_error": max_predicted_aligned_error,
			}





def 				A      (	_UpperCAmelCase							:  torch.Tensor				,  _UpperCAmelCase							:  Optional[torch.Tensor] = None				,  _UpperCAmelCase							:  int = 31				,  _UpperCAmelCase							:  int = 64				,  _UpperCAmelCase							:  float = 1E-8				,  **_UpperCAmelCase							:  Any				,  )							->					torch.Tensor:







			'''simple docstring'''
			if residue_weights is None:
						_UpperCAmelCase									=  logits.new_ones(logits.shape[-2]       )

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

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

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

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

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

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

			_UpperCAmelCase									=  per_alignment * residue_weights

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





UpperCAmelCase__  =			10**8





def 				A      (	_UpperCAmelCase							:  int       )							->					bool:







			'''simple docstring'''
			if n % 10 == 0:
						return False
			_UpperCAmelCase									=  str(_UpperCAmelCase       )
			return s == s[::-1]





def 				A      (	)							->					int:







			'''simple docstring'''
			_UpperCAmelCase									=  set()
			_UpperCAmelCase									=  1
			_UpperCAmelCase									=  5
			while sum_squares < LIMIT:
						_UpperCAmelCase									=  first_square + 1
						while sum_squares < LIMIT:
									if is_palindrome(_UpperCAmelCase       ):
												answer.add(_UpperCAmelCase       )
									last_square += 1
									sum_squares += last_square**2
						first_square += 1
						_UpperCAmelCase									=  first_square**2 + (first_square + 1) ** 2

			return sum(_UpperCAmelCase       )


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