





"""simple docstring"""


from __future__ import annotations

import csv

import requests
from bsa import BeautifulSoup




def 					lowercase__    (					lowercase_ = ""			)					->		dict[str, float]:




      """simple docstring"""

      _UpperCamelCase      :	int						=       url or "https://www.imdb.com/chart/top/?ref_=nv_mv_250"
      _UpperCamelCase      :	Optional[int]						=       BeautifulSoup(requests.get(lowercase_			).text		,"html.parser"			)
      _UpperCamelCase      :	Tuple						=       soup.find_all("td"		,attrs="titleColumn"			)
      _UpperCamelCase      :	List[str]						=       soup.find_all("td"		,class_="ratingColumn imdbRating"			)
      return {
          title.a.text: float(rating.strong.text			)
          for title, rating in zip(lowercase_		,lowercase_			)
      }




def 					lowercase__    (					lowercase_ = "IMDb_Top_250_Movies.csv"			)					->		None:




      """simple docstring"""

      _UpperCamelCase      :	int						=       get_imdb_top_aaa_movies()
      with open(lowercase_		,"w"		,newline=""			) as out_file:
            _UpperCamelCase      :	Union[str, Any]						=       csv.writer(lowercase_			)
            writer.writerow(["Movie title", "IMDb rating"]			)
            for title, rating in movies.items():
                  writer.writerow([title, rating]			)


if __name__ == "__main__":
  write_movies()







"""simple docstring"""


from collections import defaultdict
from math import ceil, sqrt




def 					lowercase__    (					lowercase_ = 1_000_000		,lowercase_ = 10			)					->		int:




      """simple docstring"""

      _UpperCamelCase      :	defaultdict						=       defaultdict(lowercase_			)

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

            hole_width_lower_bound += (outer_width - hole_width_lower_bound) % 2

            for hole_width in range(lowercase_		,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() = }""")
