27 lines
678 B
Odin
27 lines
678 B
Odin
package main
|
|
|
|
import "core:strconv"
|
|
import "core:slice"
|
|
import "core:fmt"
|
|
import "../../utils"
|
|
|
|
main :: proc() {
|
|
lines := utils.read_input_lines()
|
|
|
|
count := make(map[int]int)
|
|
for line in lines {
|
|
line_n, ok := strconv.parse_int(line, 10)
|
|
assert(ok, "Invalid input data: not a number")
|
|
count[line_n] += 1
|
|
}
|
|
|
|
entries, _ := slice.map_entries(count)
|
|
slice.sort_by(entries, proc(a, b: slice.Map_Entry(int, int)) -> bool {
|
|
return a.value > b.value
|
|
})
|
|
|
|
assert(len(entries) >= 3, "Invalid input data: not enough data")
|
|
|
|
result := entries[0].key * entries[1].key * entries[2].key
|
|
fmt.printfln("ANSWER: %v", result)
|
|
} |