program CapSoChinhPhuong;
uses crt;
var
n, a, b, count: integer;
begin
clrscr;
write('Nhap vao so nguyen n: ');
readln(n);
count := 0;
writeln('Cac cap so a, b sao cho a^2 + b^2 la so chinh phuong la:');
for a := 1 to n do begin
for b := 1 to n do begin
if (sqr(a) + sqr(b)) mod round(sqrt(sqr(a) + sqr(b))) = 0 then begin
writeln('a = ', a, ', b = ', b);
count := count + 1;
end;
end;
end;
writeln('Tong so cap so la: ', count);
readln;
end.