Company: Walmart_12march
Difficulty: medium
Train Station Waiting Time Problem Description In a busy city, the train station is a hub of constant activity, with trains arriving and departing to connect people across the region. However, the station has only a limited number of platforms, which means that when several trains arrive close together, some must wait for a platform to become free. Your task is to help the station manager determine the overall delay experienced by all the trains. Each train has a specific arrival and departure time, and the rules are as follows: When a train arrives, if there is an available platform, it is assigned immediately. If all platforms are occupied, the arriving train must wait until a platform becomes free. The waiting time for a train is the interval between its scheduled arrival and the time it is finally accommodated on a platform. Write a program that calculates the total waiting time for all trains based on these constraints. Input Format The first line contains two integers N and P whi