code: https://ide.codingblocks.com/s/423228
prob: https://hack.codingblocks.com/app/contests/2022/350/problem
gettng seg fault I’m pretty sure the logic is correct , also the tree is getting built properly so the error must be from the findkDistance or it’s helper funciton