Mitch Jones is fighting in the WoW 3v3 Arena! There are
Given all of the abilities Mitch casts, determine the number of abilities on each target that he will be able to cast successfully.
Input Specification
The first line will contain the integer
The second line will contain the integer
The third line will contain the integer
The next
These integers will be in the order:
Output Specification
Output
Sample Input
5
3
6
3 4 4 3
1 5 3 1
1 1 9 3
1 3 4 3
3 5 8 1
1 4 3 3
Sample Output
0
5
1
Sample Explanation
There are 5 different types of abilities, and each ability has a maximum counter value of 3. There are 6 abilities that are cast. The first one is used on target 3, adding 4 to the counter of spells 3 and 4 on that target. The second spell is used on target 1, adding 3 to the counter of spells 1 to 5, and so on. In the end, out of the 5 spells, for target 1, all spells have a counter greater than 3 and therefore, 0 spells can be cast, for target two, since no spells were cast, all 5 spells can be cast successfully, and for target 3, 1 spell has a counter less than 6.
Comments