Time Limit: 5 Seconds
Memory Limit: 65536 KB
Given \(N\) integers \(A_1, A_2, \dots, A_N\). There are 3 types of operations:
For each query, please output the answer.
There are multiple test cases. The first line of the input is an integer \(T\) (\(1 \le T \le 200\)), indicating the number of test cases. For each test case:
The first line contains two integers \(N\) (\(1 \le N \le 10^5\)) and \(Q\) (\(1 \le Q \le 10^5\)), indicating the number of the given integers and the number of operations.
The second line contains \(N\) integers \(A_1, A_2, \dots, A_N\) (\(1 \le A_i \le 10^3\)), indicating the given integers.
The first integer on each of the following \(Q\) lines will be \(op\) (\(1 \le op \le 3\)), indicating the type of operation.
It's guaranteed that neither the sum of \(N\) nor the sum of \(Q\) over all test cases will exceed \(10^6\).