7JITDQMMFU2F7I5YRORAADVZIAFAAFQGUVITWYTH35BQUEVRNJNAC
func solveSecond(crabs []int) int {
var least int
for i := 0; ; i++ {
var fuel int
for _, crab := range crabs {
diff := abs(crab - i)
if diff == 0 {
continue
}
fuel += (diff * (diff + 1)) / 2 // Gauss would be proud :-)
}
if i == 0 {
least = fuel
continue
}
if fuel < least {
least = fuel
} else {
break
}
}
return least
}