"input.txt" ascii file-lines first "," split [ dec> ] map dup [ median ] keep n-v vabs sum . dup dup minmax [a,b] [ [ - abs [1,b] sum ] curry map-sum ] [ with infimum-by ] keep call .
Done