{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou are playing a game similar to Sokoban on an infinite number line. The game is discrete, so you only consider integer positions on the line.\u003c/p\u003e\u003cp\u003eYou start on a position $$$0$$$. There are $$$n$$$ boxes, the $$$i$$$-th box is on a position $$$a_i$$$. All positions of the boxes are distinct. There are also $$$m$$$ special positions, the $$$j$$$-th position is $$$b_j$$$. All the special positions are also distinct.\u003c/p\u003e\u003cp\u003eIn one move you can go one position to the left or to the right. If there is a box in the direction of your move, then you push the box to the next position in that direction. If the next position is taken by another box, then that box is also pushed to the next position, and so on. \u003cspan class\u003d\"tex-font-style-bf\"\u003eYou can\u0027t go through the boxes\u003c/span\u003e. \u003cspan class\u003d\"tex-font-style-bf\"\u003eYou can\u0027t pull the boxes towards you\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eYou are allowed to perform any number of moves (possibly, zero). Your goal is to place as many boxes on special positions as possible. Note that some boxes can be initially placed on special positions.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 1000$$$)\u0026nbsp;— the number of testcases.\u003c/p\u003e\u003cp\u003eThen descriptions of $$$t$$$ testcases follow.\u003c/p\u003e\u003cp\u003eThe first line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \\le n, m \\le 2 \\cdot 10^5$$$)\u0026nbsp;— the number of boxes and the number of special positions, respectively.\u003c/p\u003e\u003cp\u003eThe second line of each testcase contains $$$n$$$ distinct integers in the increasing order $$$a_1, a_2, \\dots, a_n$$$ ($$$-10^9 \\le a_1 \u0026lt; a_2 \u0026lt; \\dots \u0026lt; a_n \\le 10^9$$$; $$$a_i \\neq 0$$$)\u0026nbsp;— the initial positions of the boxes.\u003c/p\u003e\u003cp\u003eThe third line of each testcase contains $$$m$$$ distinct integers in the increasing order $$$b_1, b_2, \\dots, b_m$$$ ($$$-10^9 \\le b_1 \u0026lt; b_2 \u0026lt; \\dots \u0026lt; b_m \\le 10^9$$$; $$$b_i \\neq 0$$$)\u0026nbsp;— the special positions.\u003c/p\u003e\u003cp\u003eThe sum of $$$n$$$ over all testcases doesn\u0027t exceed $$$2 \\cdot 10^5$$$. The sum of $$$m$$$ over all testcases doesn\u0027t exceed $$$2 \\cdot 10^5$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each testcase print a single integer\u0026nbsp;— the maximum number of boxes that can be placed on special positions.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","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\u003e5\n5 6\n-1 1 5 11 15\n-4 -3 -2 6 7 15\n2 2\n-1 1\n-1000000000 1000000000\n2 2\n-1000000000 1000000000\n-1 1\n3 5\n-1 1 2\n-2 -1 1 2 5\n2 1\n1 2\n10\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n2\n0\n3\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first testcase you can go $$$5$$$ to the right: the box on position $$$1$$$ gets pushed to position $$$6$$$ and the box on position $$$5$$$ gets pushed to position $$$7$$$. Then you can go $$$6$$$ to the left to end up on position $$$-1$$$ and push a box to $$$-2$$$. At the end, the boxes are on positions $$$[-2, 6, 7, 11, 15]$$$, respectively. Among them positions $$$[-2, 6, 7, 15]$$$ are special, thus, the answer is $$$4$$$.\u003c/p\u003e\u003cp\u003eIn the second testcase you can push the box from $$$-1$$$ to $$$-10^9$$$, then the box from $$$1$$$ to $$$10^9$$$ and obtain the answer $$$2$$$.\u003c/p\u003e\u003cp\u003eThe third testcase showcases that you are not allowed to pull the boxes, thus, you can\u0027t bring them closer to special positions.\u003c/p\u003e\u003cp\u003eIn the fourth testcase all the boxes are already on special positions, so you can do nothing and still obtain the answer $$$3$$$.\u003c/p\u003e\u003cp\u003eIn the fifth testcase there are fewer special positions than boxes. You can move either $$$8$$$ or $$$9$$$ to the right to have some box on position $$$10$$$.\u003c/p\u003e"}}]}