{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n \"HTML-CSS\": {\n preferredFont: \"TeX\",\n availableFonts: [\"STIX\",\"TeX\"],\n linebreaks: { automatic:true },\n EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50)\n },\n ShowMathMenu: false,\n TeX: {\n extensions: [\"color.js\"],\n noUndefined: {\n attributes: {\n mathcolor: \"red\",\n mathbackground: \"#FFEEEE\",\n mathsize: \"90%\"\n }\n },\n Macros: { href: \"{}\" }\n },\n tex2jax: {\n inlineMath: [[\u0027$\u0027,\u0027$\u0027], [\u0027\\\\(\u0027,\u0027\\\\)\u0027]],\n displayMath: [ [\"$$\",\"$$\"], [\"\\\\[\", \"\\\\]\"] ],\n multiline: true,\n processEscapes: true\n },\n menuSettings: {\n context: \"Browser\"\n },\n messageStyle: \"none\"\n });\n \u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" src\u003d\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\"\u003e\u003c/script\u003e\n### 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\nDipto is one of the best mathematicians among his friends who likes to solve mathematical problems using mathematical operators. His friend Jakaria is learning bitwise operations and has recently learnt about \"AND operation\" and \"OR operation\". Jakaria came across a problem while learning. The problem states:\n\n\" 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.\nMoreover, there are Q queries. Each query provides 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[**See the example for more clarification.]\n\nJakaria got stuck tring to solve the problem. Then he remembered his friend Dipto and asked him for help. Dipto is not so much experienced with bitwise operations. Help him solve the problem.\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,.....,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 \n1 \u003c\u003d T \u003c\u003d 100\n\n1 \u003c\u003d N, Q \u003c\u003d 10^5\n\n0 \u003c\u003d A_i \u003c\u003d 2^{31}-1\n\n1 \u003c\u003d X \u003c\u003d N\n\n0 \u003c\u003d V \u003c\u003d 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 \n\n###Sample Input:\n\t2\n\t3 2\n\t1 2 3\n\t1 4\n\t3 0\n\t4 1\n\t1 2 3 4\n\t4 0\n\n###Sample Output:\n\t3\n\t7\n\t6\n\t7\n\t3\n\t\n###EXPLANATION:\n**Example case 1:** For the original array, all possible subarrays and their scores are as follows.\n\nAND(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.\n\n\u003caside style\u003d\u0027background: #f8f8f8;padding: 10px 15px;\u0027\u003e\u003cdiv\u003e\u003c/div\u003e\u003c/aside\u003e"}}]}