{"problem":{"name":"Rectangles","description":{"content":"We have $N$ distinct points on a two-dimensional plane, numbered $1,2,\\ldots,N$. Point $i$ $(1 \\leq i \\leq N)$ has the coordinates $(x_i,y_i)$. How many rectangles are there whose vertices are among t","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":4000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc218_d"},"statements":[{"statement_type":"Markdown","content":"We have $N$ distinct points on a two-dimensional plane, numbered $1,2,\\ldots,N$. Point $i$ $(1 \\leq i \\leq N)$ has the coordinates $(x_i,y_i)$.\nHow many rectangles are there whose vertices are among the given points and whose edges are parallel to the $x$\\- or $y$\\-axis?\n\n## Constraints\n\n*   $4 \\leq N \\leq 2000$\n*   $0 \\leq x_i, y_i \\leq 10^9$\n*   $(x_i,y_i) \\neq (x_j,y_j)$ $(i \\neq j)$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$x_1$ $y_1$\n$x_2$ $y_2$\n $ \\vdots $ \n$x_N$ $y_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc218_d","tags":[],"sample_group":[["6\n0 0\n0 1\n1 0\n1 1\n2 0\n2 1","3\n\nThere are three such rectangles:\nthe rectangle whose vertices are Points $1$, $2$, $3$, $4$,\nthe rectangle whose vertices are Points $1$, $2$, $5$, $6$,\nand the rectangle whose vertices are Points $3$, $4$, $5$, $6$."],["4\n0 1\n1 2\n2 3\n3 4","0"],["7\n0 1\n1 0\n2 0\n2 1\n2 2\n3 0\n3 2","1"]],"created_at":"2026-03-03 11:01:14"}}