Here's your approach:
Read (number of rooms).
For each room, read a pair (occupancy, capacity).
Initialize a counter to .
Loop through each room.
Check if
This solution uses a simple loop with a condition. You process each pair independently. The order doesn't matter because you're just counting rooms that meet the criteria. Each step should be clear and testable. Before coding, trace through with a small example to verify the logic. Think about edge cases: empty input, single element, maximum values. Make sure your algorithm handles them correctly.