



"""simple docstring"""
import torch

from transformers import AutoModel



class       SCREAMING_SNAKE_CASE__  (					torch.nn.Module ):

   def __init__(   self      ,     _SCREAMING_SNAKE_CASE="sayef/fsner-bert-base-uncased"						)  ->      Tuple:





    '''simple docstring'''




    super(_SCREAMING_SNAKE_CASE      ,     self						).__init__()

    UpperCAmelCase	:					Any	=	AutoModel.from_pretrained(_SCREAMING_SNAKE_CASE      ,     return_dict=_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Tuple	=	torch.nn.CosineSimilarity(3      ,     1E-08						)
    UpperCAmelCase	:					List[str]	=	torch.nn.Softmax(dim=1						)

   def 	SCREAMING_SNAKE_CASE     (   self      ,     **_SCREAMING_SNAKE_CASE						)  ->      Dict:





    '''simple docstring'''




    return self.bert(**_SCREAMING_SNAKE_CASE						).last_hidden_state

   def 	SCREAMING_SNAKE_CASE     (   self      ,     _SCREAMING_SNAKE_CASE						)  ->      Union[str, Any]:





    '''simple docstring'''




    return token_embeddings.sum(2      ,     keepdim=_SCREAMING_SNAKE_CASE						)

   def 	SCREAMING_SNAKE_CASE     (   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE=1						)  ->      Union[str, Any]:





    '''simple docstring'''




    return self.softmax(T * self.cos(_SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)						)




   def 	SCREAMING_SNAKE_CASE     (   self      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)  ->      List[Any]:





    '''simple docstring'''




    UpperCAmelCase	:					Dict	=	W_supports["""sizes"""].tolist()
    UpperCAmelCase	:					Optional[Any]	=	W_supports["""start_token_id"""].item()
    UpperCAmelCase	:					Any	=	W_supports["""end_token_id"""].item()

    del W_supports["sizes"]
    del W_supports["start_token_id"]
    del W_supports["end_token_id"]

    UpperCAmelCase	:					str	=	self.BERT(**_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Union[str, Any]	=	self.BERT(**_SCREAMING_SNAKE_CASE						)

    UpperCAmelCase	:					Dict	=	None
    UpperCAmelCase	:					Dict	=	None

    UpperCAmelCase	:					Optional[int]	=	W_supports["""input_ids"""] == start_token_id
    UpperCAmelCase	:					List[str]	=	W_supports["""input_ids"""] == end_token_id

    for i, size in enumerate(_SCREAMING_SNAKE_CASE						):
     if i == 0:
      UpperCAmelCase	:					List[str]	=	0
     else:
      UpperCAmelCase	:					Optional[Any]	=	support_sizes[i - 1]

     UpperCAmelCase	:					List[str]	=	S[s : s + size][start_token_masks[s : s + size]]
     UpperCAmelCase	:					Optional[Any]	=	S[s : s + size][end_token_masks[s : s + size]]

     UpperCAmelCase	:					Dict	=	torch.matmul(q[i]      ,     s_start.T						).sum(1						).softmax(0						)
     UpperCAmelCase	:					Optional[int]	=	torch.matmul(q[i]      ,     s_end.T						).sum(1						).softmax(0						)

     if p_starts is not None:
      UpperCAmelCase	:					List[Any]	=	torch.vstack((p_starts, p_start)						)
      UpperCAmelCase	:					Any	=	torch.vstack((p_ends, p_end)						)
     else:
      UpperCAmelCase	:					str	=	p_start
      UpperCAmelCase	:					Optional[int]	=	p_end

    return p_starts, p_ends





"""simple docstring"""
from collections import defaultdict
from math import ceil, sqrt

def       _snake_case						(						UpperCamelCase						:		int = 1000000			,		UpperCamelCase						:		int = 10						):
 UpperCAmelCase	:					defaultdict	=	defaultdict(UpperCamelCase						)

 for outer_width in range(3			,		(t_limit // 4) + 2						):
  if outer_width * outer_width > t_limit:
   UpperCAmelCase	:					str	=	max(
       ceil(sqrt(outer_width * outer_width - t_limit						)						)			,		1						)
  else:
   UpperCAmelCase	:					Optional[Any]	=	1

  hole_width_lower_bound += (outer_width - hole_width_lower_bound) % 2

  for hole_width in range(UpperCamelCase			,		outer_width - 1			,		2						):
   count[outer_width * outer_width - hole_width * hole_width] += 1

 return sum(1 for n in count.values() if 1 <= n <= 10						)


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