Fixed Length Path I

https://usaco.guide/solutions/cses-2080?lang=cpp

The solutions such as written on this page doesn’t work when I tried to submit exactly the same.
(I have also submitted firstly my own solution. Both solutions get core dump / stack overflow.)

Could you please check if the provided solution is working ?
Furthermore, it seems that the second solution on the same page gets wrong answer.

Thanks a lot !

I just submitted the first one and it’s fine …

The second solution is a solution to fixed-length paths II, not I. Idk why it was added to the module w/o being changed.