牛客-金币
https://www.nowcoder.com/acm/contest/170/A
var
l,r,tot,pre,i:qword;
function max(a,b:int64):int64;
begin
if a>b then exit(a) else exit(b);
end;
function o(a:int64):int64;
begin
if a<0 then exit(0) else exit(a);
end;
begin
readln(l,r);
tot:=0;i:=1;pre:=0;
while i*i+pre<=r do
begin
tot:=tot+o(pre+i*i-max(l-1,pre))*i;
pre:=pre+i*i;
inc(i);
end;
tot:=tot+(r-pre)*i;
writeln(tot);
end.