Little Andrew has a dream: to be a top coder
. A top coder must have a number of skills, like algorithm design, time complexity analysis, logic thinking, coding and debugging, etc.
Andrew designed a model for how to become a top coder. In his model, a top coder needs to master
Given Andrew's initial skills and the skills required by each question, can you help Andrew find out the most number of questions he can solve?
Input Specification
The first line contains two integers,
The second line contains
Each of the following
Output Specification
Print one integer, the most number of questions Andrew can solve.
Sample Input
4 3
5 3 1
4 2 1
2 3 7
9 4 2
3 9 2
Sample Output
3
Explanation for Sample Output
Andrew's initial skills are
- Andrew can solve question
which requires skills , and after that, Andrew's skills are . - Andrew can solve question
which requires skills , and after that, Andrew's skills are . - Andrew can solve question
which requires skills , and after that, Andrew's skills are .
However, Andrew cannot solve question
Constraints
Subtask | Points | Additional constraints |
---|---|---|
No additional constraints. |
Comments