var
k,n,i:integer;
begin
readln(k,n);
i:=n mod k;
if i<=k div 2 then writeln(i)
else writeln(abs(i-k));
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var
k,n,i:integer;
begin
readln(k,n);
i:=n mod k;
if i<=k div 2 then writeln(i)
else writeln(abs(i-k));
end.