Company: Juspay_29aug
Difficulty: medium
Traffic Control Hubs Problem Description In a smart city, there are an infinite number of traffic control hubs numbered with positive integers starting from 1. Each hub is connected by smart roads in a unique tree-like structure: There is a direct, bidirectional road between hub 1 and 2i. Another direct road exists between hub i and 2i + 1. Given this structure, there is always a unique shortest path between any two traffic control hubs. Initially, passing through any road is toll-free. However, to optimize traffic flow and manage congestion, the city traffic authority occasionally imposes toll fees on certain roads along specific paths. The traffic authority will introduce a series of changes: Toll Fee Update: An update described by integers x, y, and t imposes a toll of t units on all roads along the shortest path from hub y to hub x. Travel Cost Calculation: A commuter travels from hub x to hub y using the shortest path, and you need to calculate the total toll fees they incur. Inpu