You are given an array $$$A$$$ of size $$$N$$$. You need to process $$$Q$$$ queries of two types:
Query: Given an integer $$$x$$$, return the number of elements in the array that are equal to $$$x$$$.
Update query: Given an integer $$$x$$$, for every index $$$i$$$ such that $$$A_i \gt x$$$, update the value as: $$$A_i = A_i - x$$$
Input
The first line contains two integers $$$N$$$ , $$$Q$$$ $$$(1 \le N \le 10^5)$$$ $$$(1 \le Q \le 10^5)$$$, the size of the array, the number of queries.
The second line contains $$$N$$$ integers $$$A_1, A_2, \dots, A_N$$$ $$$(1 \le A_i \le 10^6)$$$.
The next $$$Q$$$ lines each contain a query of one of the following types:
Type 1:1 x $$$(1 \le x \le 10^6)$$$ — print the number of elements in the array equal to $$$x$$$.
Type 2:2 x $$$(1 \le x \le 10^6)$$$ — for every index $$$i$$$ such that $$$A_i \gt x$$$, update the value as $$$A_i = A_i - x$$$.
Output
For each query of type 1, output a single integer representing the number of elements equal to $$$x$$$.
Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.
→ Practice?
Want to solve the contest problems after the official contest ends? Just register for practice and you will be able to submit solutions.