//PascalABC.NET 3.1 сборка 1200
function Change(condition: boolean; value, default_value: integer): integer;
begin
if condition then
Change := value
else Change := default_value;
end;
const
n = 12;
begin
var a := ArrRandom(n, -10, 10);
a.Println;
if a.Where(x -> x > 0).Count > a.Where(x -> x < 0).Count then begin
var half_max := a.Max / 2;
var mult := 1;
mult := a.Where(x -> x > half_max).Aggregate((mult, x)-> mult * x);
a.Transform(x -> Change((x < 0), mult, x));
end
else
a.Transform(x -> Change((x < 0), 0, x));
a.Println;
end.