Problem F
Tónlistarlisti
Languages
en
is

Atli is very disorganized and only has one playlist of songs to listen to. All songs he likes go into the top of the list, and when he listens to music he starts with the top song and listens to them in order. If he has listened to them all, he starts anew from the top.
For some reason the program he uses to listen to music cannot show him how often he has listened to each song. Thus he asks you to make a program that can maintain such statistics. He only counts times when he listens to a song from start to end without interruption.
Input
The first line in the input contains one integer
Next there are
Output
For each query that starts with a
Scoring
Group |
Points |
Constraints |
1 |
20 |
|
2 |
20 |
|
3 |
30 |
|
4 |
30 |
|
Sample Input 1 | Sample Output 1 |
---|---|
3 L roundabout 509 P 7200 Q roundabout |
14 |
Sample Input 2 | Sample Output 2 |
---|---|
8 L uufo 239 L ghoul 271 L ghost 349 P 858 P 619 P 9139 L mystery_circles_ultra 239 Q ghoul |
11 |
Sample Input 3 | Sample Output 3 |
---|---|
13 Q nymphis_fae L spider_dance 106 L crab_rave 256 P 824 L alchemy 300 L crab_rave 256 P 1000 Q crab_rave L infestation 274 L sea_shanty_two 128 L crab_rave 256 P 1577 Q crab_rave |
0 2 4 |