def isqrt(n) return 0_i64 if n<=0_i64 return 1_i64 if n<4_i64 # 1 x,y=0_i64,n while x!=y&&x+1_i64!=y x,y=y,(n/y+y)/2_i64 end x end x,y=gets.not_nil!.split.map &.to_i64 r=isqrt y h=[0]*(r*r*4) (1_i64..r).each{|x|(0_i64..r).each{|y|h[x*x+y*y]+=1}} p (x..y).map{|i|h[i]}.max*4