Advent of code 2022. Day 24

Solution