Skip to content

Instantly share code, notes, and snippets.

@Wendly
Last active June 25, 2017 20:50
Show Gist options
  • Save Wendly/08dd34ad65e04eb1ef90f2e704d13526 to your computer and use it in GitHub Desktop.
Save Wendly/08dd34ad65e04eb1ef90f2e704d13526 to your computer and use it in GitHub Desktop.
n = int(input())
num = 0
changed = False
changedNum = 0
for i in range(0, 2 * n):
command = input()
if command == 'remove':
num -= 1
if changed:
changedNum += 1
changed = False
else:
boxNum = int(command.split(' ')[1])
if num == 0:
minNum = boxNum
if boxNum > minNum:
changed = True
else:
minNum = boxNum
num += 1
print(changedNum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment