{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"### Read problems statements in [Mandarin Chinese](https://www.codechef.com/download/translated/COOK128/mandarin/OROFAND.pdf), [Russian](https://www.codechef.com/download/translated/COOK128/russian/OROFAND.pdf), and [Bengali](https://www.codechef.com/download/translated/COOK128/bengali/OROFAND.pdf) as well.\n\nYou are given an array $A$ with $N$ integers. An array\u0027s score is defined as the bitwise AND of all its elements. You need to find the bitwise OR of the scores of all possible non-empty subarrays of $A$.\n\nFurthermore, there are $Q$ queries. Each query consists of two integers $X$ and $V$. You need to change the value of the element at index $X$ to $V$. After each query, you again need to find the bitwise OR of the scores of all possible non-empty subarrays.\n\nSee the example for more clarification.\n\n### Input:\nThe first line of the input contains a single integer $T$ - the number of test cases. The description of $T$ test cases follows.\n\nThe first line of each test case contains two space-separated integers $N$ and $Q$ - the size of the array and the number of queries, respectively.\n\nThe second line contains $N$ space-separated integers $A_1,\\ldots,A_N$.\n\nEach of the next $Q$ lines contains two space-separated integers $X$ and $V$ - the position and the new value of the query, respectively.\n\n### Output:\nFor each test case print $Q+1$ lines. In the first line print the answer for the original array and in the next $Q$ lines print the answer after every query.\n\n### Constraints \n$1 \\le T \\le 100$\n\n$1 \\le N, Q \\le 10^5$\n\n$0 \\le A_i \\le 2^{31}-1$\n\n$1 \\le X \\le N$\n\n$0 \\le V \\le 2^{31}-1$\n\nThe sum of $N$ over all test cases does not exceed $10^5$\n\nThe sum of $Q$ over all test cases does not exceed $10^5$"}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n3 2\n1 2 3\n1 4\n3 0\n4 1\n1 2 3 4\n4 0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n7\n6\n7\n3\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n**Example case 1:** For the original array, all possible subarrays and their scores are as follows.\n\n$AND(1) \u003d 1$, $AND(2) \u003d 2$, $AND(3) \u003d 3$, $AND(1,2) \u003d 0$, $AND(2,3) \u003d 2$, $AND(1,2,3) \u003d 0$.\n\nThe bitwise OR of all possible subarray\u0027s score is $OR(1,2,3,0,2,0) \u003d 3$.\n\nAfter the first query new array will be $[4,2,3]$ and the answer will be $7$.\n\nAfter the second query new array will be $[4,2,0]$ and the answer will be $6$."}}]}