I was solving this interesting number-theory + trees problem. And I came up with an solution where n ≤ 200000.
My idea is that the answer for every node will either be a factor of the root or be a factor of the number itself, and only these about values need to be tested.
The solution in the e