Company: Visa_21_feb
Difficulty: easy
Count Server Faults A data centre runs n servers with the IDs s1 , s2 , ..., sn . A monitoring system emits a chronological stream of log entries; every entry names one server and the outcome of one request on it, either error or success . Each server keeps a consecutive error streak — how many error entries it has produced since its last success entry and since its last replacement. Only that server's own entries matter: entries belonging to other servers sit between them in the stream but do not interrupt the streak. When a server's streak reaches 3 , the server is declared faulty and is replaced on the spot. The replacement carries the same ID, and its streak starts again from 0 . A success entry sets that server's streak back to 0 . Report how many replacements happen in total while the whole stream is processed. Input Format The first line contains two space-separated integers n and m — the number of servers and the number of log entries. Each of the next m lines holds one log ent