Codeforces Round 538 (Div. 2) |
---|
Finished |
You are given an array $$$a_1, a_2, \ldots, a_n$$$.
You need to perform $$$q$$$ queries of the following two types:
The Euler's totient function of a positive integer $$$n$$$ (denoted as $$$\varphi(n)$$$) is the number of integers $$$x$$$ ($$$1 \le x \le n$$$) such that $$$\gcd(n,x) = 1$$$.
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 4 \cdot 10^5$$$, $$$1 \le q \le 2 \cdot 10^5$$$) — the number of elements in array $$$a$$$ and the number of queries.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300$$$) — the elements of array $$$a$$$.
Then $$$q$$$ lines follow, describing queries in the format given in the statement.
It is guaranteed that there is at least one "TOTIENT" query.
For each "TOTIENT" query, print the answer to it.
4 4
5 9 1 2
TOTIENT 3 3
TOTIENT 3 4
MULTIPLY 4 4 3
TOTIENT 4 4
1
1
2
In the first example, $$$\varphi(1) = 1$$$ for the first query, $$$\varphi(2) = 1$$$ for the second query and $$$\varphi(6) = 2$$$ for the third one.
Name |
---|