#P6013. [CSGRound3] 压岁钱
[CSGRound3] 压岁钱
Background
Wishing everyone a happy Year of the Rat in the Gengzi year! Best wishes!
May the pneumonia outbreak be brought under control as soon as possible. Stay strong, China!
When the New Year comes, Xiao Z can always receive a lot of lucky money.
Xiao Z is a player who really likes spending money in games, so from time to time he will spend part of his lucky money to buy skins and gems.
But Xiao Z is also very worried that he will spend all his lucky money in just a few days. To deal with this, Xiao Z has a sealing technique that can temporarily seal away part of his money (meaning it cannot be spent). It can only be used after the seal is lifted on some day.
Problem Description
There are events in total, and the events are divided into the following types.
- Xiao Z receives yuan of lucky money.
- Xiao Z spends yuan of lucky money to buy skins.
- Xiao Z seals yuan of his money. The seal will be lifted second before event happens. It is guaranteed that each time, the money Xiao Z currently has is greater than or equal to the amount being sealed.
If Xiao Z does not have enough money to spend on some event, Xiao Z will feel unhappy. At the same time, when he does not have enough money, Xiao Z will not spend the money.
Please tell Xiao Z in how many events he will not have enough money to spend.
Input Format
The first line contains an integer , which indicates the total number of events.
The next lines each start with an integer , indicating the type of the event.
If or , then it is followed by an integer .
If , then it is followed by two integers .
Output Format
Output one line with one integer, indicating the number of events in which there is not enough money to spend.
3
1 10
2 20
2 10
1
5
1 10
3 5 5
2 10
1 10
2 20
1
Hint
[Sample 1 Explanation]
Day 1: Income yuan, balance yuan.
Day 2: Not enough to spend yuan, balance yuan.
Day 3: Spend yuan, balance yuan.
Total: day.
[Sample 2 Explanation]
Day 1: Income yuan, balance yuan.
Day 2: Seal yuan, balance yuan.
Day 3: Not enough to spend yuan, balance yuan.
Day 4: Income yuan, balance yuan.
Day 5: The seal is lifted, spend yuan, balance yuan.
Total: day.
[Constraints]
For of the testdata, .
For of the testdata, .
For of the testdata, , , .
Translated by ChatGPT 5