#!/usr/bin/env python3 from math import sqrt b = 10**6 t = 0 for n in range(1, b//4): t += int(sqrt(b + n**2) - n)//2 print(t)