Company: IBM
Difficulty: medium
Client-Server Architecture Traffic Management There is a client-server architecture with n clients and one server. Each client starts its interaction with the server at the second start[i] and stops at the second end[i] . The maximum traffic is defined as the maximum number of concurrent interactions with the server. Find the earliest time at which the maximum number of clients are interacting with the server. Note: The endpoint is also included in the interaction. Input Format The first line contains an integer n , the number of clients. The second line contains REQUIREMENT followed by three integers: id , price , and seats . The next n lines contain the data in the format: DATA id price . Output Format For each message, output a single integer: 0 if the message does not fulfill the requirement. The number of seats requested if the requirement is fulfilled. Constraints 1 ≤ n ≤ 100 1 ≤ price ≤ 1000 1 ≤ seats ≤ 10 Examples Input: 10 REQUIREMENT 1 100 3 DATA 1 1 DATA 1 110 DATA 1 3 DATA