'''simple docstring'''




from typing import Dict, Optional, Tuple

import torch





def 	_UpperCAmelCase       (				_UpperCamelCase       :      torch.Tensor  )      -> torch.Tensor:
    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 	_UpperCAmelCase       (				_UpperCamelCase       :      torch.Tensor,  _UpperCamelCase       :      torch.Tensor,  )      -> Tuple[torch.Tensor, torch.Tensor]:
    A_      =  _calculate_bin_centers(_UpperCamelCase  )
    return (
        torch.sum(aligned_distance_error_probs * bin_centers,  dim=-1  ),
        bin_centers[-1],
    )





def 	_UpperCAmelCase       (				_UpperCamelCase       :      torch.Tensor,  _UpperCamelCase       :      int = 31,  _UpperCamelCase       :      int = 64,  **_UpperCamelCase       :      int,  )      -> Dict[str, torch.Tensor]:
    A_      =  torch.linspace(0,  _UpperCamelCase,  steps=(no_bins - 1),  device=logits.device  )

    A_      =  torch.nn.functional.softmax(_UpperCamelCase,  dim=-1  )
    A_  ,A_      =  _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 	_UpperCAmelCase       (				_UpperCamelCase       :      torch.Tensor,  _UpperCamelCase       :      Optional[torch.Tensor] = None,  _UpperCamelCase       :      int = 31,  _UpperCamelCase       :      int = 64,  _UpperCamelCase       :      float = 1E-8,  **_UpperCamelCase       :      Dict,  )      -> torch.Tensor:
    if residue_weights is None:
        A_      =  logits.new_ones(logits.shape[-2]  )

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

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

    A_      =  1.2_4 * (clipped_n - 15) ** (1.0 / 3) - 1.8

    A_      =  torch.nn.functional.softmax(_UpperCamelCase,  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(_UpperCamelCase  )).nonzero()[0]
    return per_alignment[tuple(_UpperCamelCase  )]







'''simple docstring'''




__snake_case  : str		       =    10**8





def 	_UpperCAmelCase       (				_UpperCamelCase       :      int  )      -> bool:
    if n % 10 == 0:
        return False
    A_      =  str(_UpperCamelCase  )
    return s == s[::-1]





def 	_UpperCAmelCase       (				)      -> int:
    A_      =  set()
    A_      =  1
    A_      =  5
    while sum_squares < LIMIT:
        A_      =  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
        A_      =  first_square**2 + (first_square + 1) ** 2

    return sum(_UpperCamelCase  )


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






