eolymp
bolt
Try our new interface for solving problems
Problems

Multiples of 3

Multiples of 3

There are \textbf{n} numbers \textbf{a_0},\textbf{a_1},...,\textbf{a_\{n-1\}}. Initially all are \textbf{0}. You have to perform two types of operations: \begin{enumerate} \item Increase the numbers between indices \textbf{a} and \textbf{b} (inclusive) by \textbf{1}. This is represented by the command "\textbf{0 a b}" \item Answer how many numbers between indices \textbf{a} and \textbf{b} (inclusive) are divisible by \textbf{3}. This is represented by the command "\textbf{1 a b}". \end{enumerate} \InputFile The first line contains two integers \textbf{n} and \textbf{q} (\textbf{1 }≤ \textbf{n}, \textbf{q} ≤ \textbf{100000}). Each of the next \textbf{q} lines are either of the form "\textbf{0 a b}" or "\textbf{1 a b}" as mentioned above. It is known that \textbf{0} ≤ \textbf{a} ≤ \textbf{b} ≤ \textbf{n} - \textbf{1}. \OutputFile Print one line for each query of the form "\textbf{1 a b}" containing the required answer for the corresponding query.
Time limit 1 second
Memory limit 122.17 MiB
Input example #1
4 7
1 0 3
0 1 2
0 1 3
1 0 0
0 0 3
1 3 3
1 0 3
Output example #1
4
1
0
2