// Assume that x is a pre-parsed input of type "int list list"

// full file: https://github.com/a-red-christmas/aoc2017-fs/blob/master/day2/Program.fs

let part1 x =

List.map (fun y -> List.max y - List.min y) x

|> List.sum

let part2 x =

// iterate over the list twice to find a divisor that isn't self and clean

let findDiv l = List.sumBy (fun y ->

List.sumBy (fun z ->

if y <> z && y % z = 0 then y / z else 0) l) l

List.map findDiv x |> List.sum