프로그램 명: boi_grow
제한시간: 1 초

Egon takes care of a garden with N apple trees. His responsibilities include two types of tasks: fertilizing the trees and computing some statistics about them.

For fertilizing the trees he has several bottles of MegaBoostFertilizer, which, when treated on trees, causes them to grow one centimeter up instantly. Every bottle has a limited capacity ci , which determines the number of trees it can be applied to. Moreover, for each bottle there is a minimal height hi of trees, which can be treated with it. Since Egon wants to have all his trees as big as possible, he always applies the fertilizer to the ci smallest trees chosen from the trees that are at least hi centimeters high.

When Egon computes statistics about trees he has to determine the number of trees whose height is in some given interval. Egon is quite busy working in the garden, so he asked you to write a program, that given the list of his tasks, computes the statistics for him.

입력

출력

For every task of type C, output one line containing the number of apple trees that have the required height. The order of the results should conform to the order of type C tasks in the input.

Constraints

입출력 예

입력

5 7
1 3 2 5 2
F 2 1
C 3 6
F 2 3
C 6 8
F 2 1
F 2 2
C 3 5

출력

3
0
5
출처:BOI 2011 day1 1/4

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]