## Appleby Contest '20 P2 - Playful Playdoughs

View as PDF

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 512M

Author:
Problem type

Plasmatic loves playing with playdoughs in his spare times. Currently, he has a collection of playdoughs, and the playdough weighs grams for each from to . However, he is too busy practicing for IOI. As a result, he doesn't have much time to play with the playdoughs. Instead, he gives you operations that he wants you to do with his collection of playdoughs, and each operation can be one of the two:

1. 1 x: Find all playdoughs that weighs exactly grams then split the playdough into and .

2. 2 y: Find the number of playdoughs that weighs exactly grams.

As a good friend of him, you want to print the answers for all of the queries in the form of 2 y. Do not disappoint him!

#### Constraints

Note that a 64-bit integer be needed to get full points. In C++, this can be done with long long. In Java, this can be done with long. In Python, the standard int will suffice.

#### Input Specification

First line contains two integers and separated by a space.

The next line contains integers , the weight of each of his playdough originally.

The following lines each contains two space-separated integers, indicating a valid query.

#### Output Specification

Print the answer to each of the query of the second type, followed by a newline.

#### Sample Input

5 4
1 2 3 4 5
1 5
1 4
2 2
2 3

#### Sample Output

4
2