Rosetta Problems

ICPC Practice Contest 2021 - F: Fast and Hairy

https://oj.vnoi.info/problem/icpc21_beta_f