############################################## # The goal for this exercise is to implement # a Terrace class that allows the main program # below to successfully solve the # Hanging Out on the Terrace contest problem # (see open.kattis.com/problems/hangingout) ############################################## ############################################## # implement a Terrace class here that supports: # - constructor that accepts terrace capacity as parameter # - processEnter(n) function to model arrival of n people # - processLeave(n) function to model departure of n people # - getNumDenied() function that returns total number of GROUPS # thus far denied during the simulation ############################################## class Terrace: pass ############################################## # Do not change anything below this line ############################################## limit,n = [int(k) for k in input().split()] terrace = Terrace(limit) for _ in range(n): pieces = input().split() j = int(pieces[1]) if pieces[0] == 'enter': terrace.processEnter(j) else: terrace.processLeave(j) print(terrace.getNumDenied())