{"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\u003eThere are $$$n$$$ lines $$$l_1,l_2,\\dots,l_n$$$ on the 2D-plane.\u003c/p\u003e\u003cp\u003eStaring at these lines, Calabash is wondering how many pairs of $$$(i,j)$$$ that $$$1\\leq i\u0026lt;j\\leq n$$$ and $$$l_i,l_j$$$ share at least one common point. Note that two overlapping lines also share common points.\u003c/p\u003e\u003cp\u003ePlease write a program to solve Calabash\u0027s problem.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains an integer $$$T(1\\leq T\\leq 1000)$$$, denoting the number of test cases.\u003c/p\u003e\u003cp\u003eIn each test case, there is one integer $$$n(1\\leq n\\leq 100000)$$$ in the first line, denoting the number of lines.\u003c/p\u003e\u003cp\u003eFor the next $$$n$$$ lines, each line contains four integers $$$xa_i,ya_i,xb_i,yb_i(|xa_i|,|ya_i|,|xb_i|,|yb_i|\\leq 10^9)$$$. It means $$$l_i$$$ passes both $$$(xa_i,ya_i)$$$ and $$$(xb_i,yb_i)$$$. $$$(xa_i,ya_i)$$$ will never be coincided with $$$(xb_i,yb_i)$$$.\u003c/p\u003e\u003cp\u003eIt is guaranteed that $$$\\sum n\\leq 10^6$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print a single line containing an integer, denoting the answer.\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\u003e3\n2\n0 0 1 1\n0 1 1 0\n2\n0 0 0 1\n1 0 1 1\n2\n0 0 1 1\n0 0 1 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n0\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}