{"raw_statement":[{"iden":"statement","content":"%epigraph%%epigraphtext% _Gathering darkness shrouds the woods and the world. The moon sheds its light on the boat and the river.\"To curtain off the moonlight should be hardly possible; the shades present its mellow beauty and restful nature.\" Intonates Mino.\n\n\"See? The clouds are coming.\" Kanno gazes into the distance.\n\n\"That can't be better,\" Mino turns to Kanno._%endepigraphtext%%endepigraph%The sky can be seen as a one-dimensional axis. The moon is at the origin whose coordinate is $0$.\n\nThere are $n$ clouds floating in the sky. Each cloud has the same length $l$. The $i$\\-th initially covers the range of $(x_i, x_i + l)$ (**endpoints excluded**). Initially, it moves at a velocity of $v_i$, which equals either $1$ or $-1$.\n\nFurthermore, no pair of clouds intersect initially, that is, for all $1 \\leq i \\lt j \\leq n$, $\\lvert x_i - x_j \\rvert \\geq l$.\n\nWith a wind velocity of $w$, the velocity of the $i$\\-th cloud becomes $v_i + w$. That is, its coordinate increases by $v_i + w$ during each unit of time. Note that the wind can be strong and clouds can change their direction.\n\nYou are to help Mino count the number of pairs $(i, j)$ ($i &lt; j$), such that with a proper choice of wind velocity $w$ not exceeding $w_\\mathrm{max}$ in absolute value (possibly negative and/or fractional), the $i$\\-th and $j$\\-th clouds both cover the moon at the same future moment. This $w$ doesn't need to be the same across different pairs."},{"iden":"input","content":"The first line contains three space-separated integers $n$, $l$, and $w_\\mathrm{max}$ ($1 \\leq n \\leq 10^5$, $1 \\leq l, w_\\mathrm{max} \\leq 10^8$) — the number of clouds, the length of each cloud and the maximum wind speed, respectively.\n\nThe $i$\\-th of the following $n$ lines contains two space-separated integers $x_i$ and $v_i$ ($-10^8 \\leq x_i \\leq 10^8$, $v_i \\in {-1, 1}$) — the initial position and the velocity of the $i$\\-th cloud, respectively.\n\nThe input guarantees that for all $1 \\leq i \\lt j \\leq n$, $\\lvert x_i - x_j \\rvert \\geq l$."},{"iden":"output","content":"Output one integer — the number of unordered pairs of clouds such that it's possible that clouds from each pair cover the moon at the same future moment with a proper choice of wind velocity $w$."},{"iden":"examples","content":"Input\n\n5 1 2\n-2 1\n2 1\n3 -1\n5 -1\n7 -1\n\nOutput\n\n4\n\nInput\n\n4 10 1\n-20 1\n-10 -1\n0 1\n10 -1\n\nOutput\n\n1"},{"iden":"note","content":"In the first example, the initial positions and velocities of clouds are illustrated below.\n\n<center>![image](https://espresso.codeforces.com/dbf90a43ebbe6d4229a3f771820cebff26cb75e3.png)</center>The pairs are:\n\n*   $(1, 3)$, covering the moon at time $2.5$ with $w = -0.4$;\n*   $(1, 4)$, covering the moon at time $3.5$ with $w = -0.6$;\n*   $(1, 5)$, covering the moon at time $4.5$ with $w = -0.7$;\n*   $(2, 5)$, covering the moon at time $2.5$ with $w = -2$.\n\nBelow is the positions of clouds at time $2.5$ with $w = -0.4$. At this moment, the $1$\\-st and $3$\\-rd clouds both cover the moon.\n\n<center>![image](https://espresso.codeforces.com/17324125ede024cbab6be620a1e81a73e011c7b6.png)</center>In the second example, the only pair is $(1, 4)$, covering the moon at time $15$ with $w = 0$.\n\nNote that all the times and wind velocities given above are just examples among infinitely many choices."}],"translated_statement":[{"iden":"statement","content":"\"遮蔽月光几乎是不可能的；云层呈现出它柔和的美丽与宁静。\" Mino吟诵道。\n\n\"看？云来了。\" Kanno凝视远方。\n\n\"再好不过了，\" Mino转向Kanno。\n\n天空可视为一条一维数轴，月亮位于原点，坐标为 $0$。\n\n天空中有 $n$ 朵云，每朵云长度均为 $l$。第 $i$ 朵云初始时覆盖区间 $(x_i, x_i + l)$（端点不包含）。初始时，它以速度 $v_i$ 移动，$v_i$ 为 $1$ 或 $-1$。\n\n此外，初始时任意两朵云不相交，即对所有 $1 lt.eq i lt j lt.eq n$，有 $lvert x_i -x_j rvert gt.eq l$。\n\n当风速为 $w$ 时，第 $i$ 朵云的速度变为 $v_i + w$，即每单位时间其坐标增加 $v_i + w$。注意风速可能很强，云朵可能改变方向。\n\n你需要帮助 Mino 计算满足条件的无序对 $(i, j)$（$i < j$）的数量，使得存在一个风速 $w$，其绝对值不超过 $w_(upright(m a x))$（可能为负数或分数），使得第 $i$ 朵和第 $j$ 朵云在某个未来的时刻同时覆盖月亮。对于不同对，$w$ 可以不同。\n\n第一行包含三个空格分隔的整数 $n$、$l$ 和 $w_(upright(m a x))$（$1 lt.eq n lt.eq 10^5$，$1 lt.eq l, w_(upright(m a x)) lt.eq 10^8$），分别表示云的数量、每朵云的长度和最大风速。\n\n接下来的 $n$ 行中，第 $i$ 行包含两个空格分隔的整数 $x_i$ 和 $v_i$（$-10^8 lt.eq x_i lt.eq 10^8$，$v_i in {-1, 1}$），分别表示第 $i$ 朵云的初始位置和速度。\n\n输入保证对所有 $1 lt.eq i lt j lt.eq n$，有 $lvert x_i -x_j rvert gt.eq l$。\n\n输出一个整数——满足条件的无序云对数量，即存在一个合适的风速 $w$，使得这对云在某个未来的时刻同时覆盖月亮。"},{"iden":"input","content":"第一行包含三个空格分隔的整数 $n$、$l$ 和 $w_(upright(m a x))$（$1 lt.eq n lt.eq 10^5$，$1 lt.eq l, w_(upright(m a x)) lt.eq 10^8$），分别表示云的数量、每朵云的长度和最大风速。接下来的 $n$ 行中，第 $i$ 行包含两个空格分隔的整数 $x_i$ 和 $v_i$（$-10^8 lt.eq x_i lt.eq 10^8$，$v_i in {-1, 1}$），分别表示第 $i$ 朵云的初始位置和速度。输入保证对所有 $1 lt.eq i lt j lt.eq n$，有 $lvert x_i -x_j rvert gt.eq l$。"},{"iden":"output","content":"输出一个整数——满足条件的无序云对数量，即存在一个合适的风速 $w$，使得这对云在某个未来的时刻同时覆盖月亮。"},{"iden":"examples","content":"输入\n5 1 2\n-2 1\n2 1\n3 -1\n5 -1\n7 -1\n输出\n4\n\n输入\n4 10 1\n-20 1\n-10 -1\n0 1\n10 -1\n输出\n1"},{"iden":"note","content":"在第一个例子中，云的初始位置和速度如下图所示。\n\n满足条件的对为：\n\n$(1, 3)$，在时间 $2.5$ 且 $w = -0.4$ 时覆盖月亮；\n$(1, 4)$，在时间 $3.5$ 且 $w = -0.6$ 时覆盖月亮；\n$(1, 5)$，在时间 $4.5$ 且 $w = -0.7$ 时覆盖月亮；\n$(2, 5)$，在时间 $2.5$ 且 $w = -2$ 时覆盖月亮。\n\n下图展示了在时间 $2.5$ 且 $w = -0.4$ 时云的位置。此时，第 $1$ 朵和第 $3$ 朵云同时覆盖月亮。\n\n在第二个例子中，唯一满足条件的对是 $(1, 4)$，在时间 $15$ 且 $w = 0$ 时覆盖月亮。\n\n请注意，上述所有时间和风速仅是无穷多种可能选择中的示例。"}],"sample_group":[],"show_order":[],"formal_statement":"Let the moon be at position $ 0 $.  \nEach cloud $ i $ has length $ l $, initial position $ x_i $, and initial velocity $ v_i \\in \\{-1, 1\\} $.  \nWith wind velocity $ w \\in \\mathbb{R} $, the velocity of cloud $ i $ becomes $ v_i + w $.  \n\nAt time $ t \\geq 0 $, the position of the left endpoint of cloud $ i $ is:  \n$$\nx_i + (v_i + w)t\n$$  \nand the right endpoint is:  \n$$\nx_i + (v_i + w)t + l\n$$  \n\nThe cloud covers the moon at time $ t $ if:  \n$$\nx_i + (v_i + w)t < 0 < x_i + (v_i + w)t + l\n$$  \nwhich is equivalent to:  \n$$\n- (v_i + w)t - l < x_i < - (v_i + w)t\n$$  \n\nWe are to count the number of unordered pairs $ (i, j) $, $ i < j $, such that there exists some $ w \\in [-w_{\\text{max}}, w_{\\text{max}}] $ and some $ t > 0 $ for which **both** clouds $ i $ and $ j $ simultaneously cover the moon.\n\n---\n\n### Reformulation:\n\nFor cloud $ i $, define the condition for covering the moon at time $ t > 0 $ with wind $ w $:  \n$$\nx_i + (v_i + w)t < 0 < x_i + (v_i + w)t + l\n\\quad \\iff \\quad\n- \\frac{x_i + l}{v_i + w} < t < - \\frac{x_i}{v_i + w}\n$$  \n(Note: We must be cautious with signs — we require $ t > 0 $, so the interval must lie in $ \\mathbb{R}^+ $.)\n\nBut we can eliminate $ t $:  \nWe want **simultaneous coverage** of the moon by clouds $ i $ and $ j $ at the same $ t > 0 $ and same $ w $.  \nSo, for some $ t > 0 $, both:\n\n$$\nx_i + (v_i + w)t < 0 < x_i + (v_i + w)t + l \\tag{1}\n$$\n$$\nx_j + (v_j + w)t < 0 < x_j + (v_j + w)t + l \\tag{2}\n$$\n\nLet $ u = v_i + w $, $ u' = v_j + w $. Then $ u - u' = v_i - v_j $.  \nSo $ u' = u - (v_i - v_j) $.  \n\nFrom (1):  \n$$\n- \\frac{x_i + l}{u} < t < - \\frac{x_i}{u}\n$$  \nFrom (2):  \n$$\n- \\frac{x_j + l}{u'} < t < - \\frac{x_j}{u'}\n$$  \nSubstitute $ u' = u - \\Delta $, where $ \\Delta = v_i - v_j \\in \\{-2, 0, 2\\} $ (since $ v_i, v_j \\in \\{-1,1\\} $).\n\nWe require that the two intervals for $ t $ have non-empty intersection, and that there exists $ u \\in [v_i - w_{\\text{max}}, v_i + w_{\\text{max}}] $ such that the intersection contains a positive $ t $.\n\nBut we can avoid tracking $ t $ by eliminating it.\n\n---\n\n### Key Insight:\n\nFrom (1):  \n$$\nx_i + (v_i + w)t < 0 < x_i + (v_i + w)t + l\n\\Rightarrow\n- x_i - l < (v_i + w)t < -x_i\n$$\n\nSimilarly for $ j $:  \n$$\n- x_j - l < (v_j + w)t < -x_j\n$$\n\nLet $ s = t > 0 $. Then:\n\n$$\n\\frac{-x_i - l}{s} < v_i + w < \\frac{-x_i}{s} \\tag{3}\n$$\n$$\n\\frac{-x_j - l}{s} < v_j + w < \\frac{-x_j}{s} \\tag{4}\n$$\n\nSubtracting (3) and (4):\n\nLet $ A = v_i + w $, $ B = v_j + w $. Then $ A - B = v_i - v_j = \\Delta \\in \\{-2, 0, 2\\} $.\n\nWe can eliminate $ w $: subtract the inequalities.\n\nFrom (3) and (4), subtracting gives:\n\n$$\n\\left( \\frac{-x_i - l}{s} - \\frac{-x_j}{s} \\right) < A - B < \\left( \\frac{-x_i}{s} - \\frac{-x_j - l}{s} \\right)\n\\Rightarrow\n\\frac{ -x_i - l + x_j }{s} < \\Delta < \\frac{ -x_i + x_j + l }{s}\n$$\n\nSo:\n\n$$\n\\frac{ x_j - x_i - l }{s} < \\Delta < \\frac{ x_j - x_i + l }{s}\n$$\n\nMultiply by $ s > 0 $:\n\n$$\nx_j - x_i - l < \\Delta s < x_j - x_i + l\n\\Rightarrow\n|x_j - x_i - \\Delta s| < l\n$$\n\nBut $ \\Delta = v_i - v_j $, so:\n\n$$\n|x_j - x_i - (v_i - v_j)s| < l \\tag{5}\n$$\n\nThis is a necessary condition for simultaneous coverage at time $ s > 0 $.\n\nWe can solve for $ s $:\n\nLet $ d = x_j - x_i $, $ \\Delta = v_i - v_j $. Then:\n\n$$\n|d - \\Delta s| < l\n\\Rightarrow\nd - l < \\Delta s < d + l\n$$\n\nSo:\n\n$$\n\\frac{d - l}{\\Delta} < s < \\frac{d + l}{\\Delta} \\quad \\text{if } \\Delta > 0\n$$\n$$\n\\frac{d + l}{\\Delta} < s < \\frac{d - l}{\\Delta} \\quad \\text{if } \\Delta < 0\n$$\n\nBut since $ s > 0 $, we require the interval to intersect $ (0, \\infty) $.\n\nWe now want to know: **Does there exist $ s > 0 $ such that (5) holds AND there exists $ w \\in [-w_{\\text{max}}, w_{\\text{max}}] $ satisfying both (3) and (4)?**\n\nFrom (3):  \n$$\nw \\in \\left( \\frac{-x_i - l}{s} - v_i, \\frac{-x_i}{s} - v_i \\right)\n$$\n\nFrom (4):  \n$$\nw \\in \\left( \\frac{-x_j - l}{s} - v_j, \\frac{-x_j}{s} - v_j \\right)\n$$\n\nSo the intersection of these two intervals must be non-empty, and must intersect $ [-w_{\\text{max}}, w_{\\text{max}}] $.\n\nBut we can avoid iterating over $ s $.\n\n---\n\n### Final Formalization:\n\nFor a pair $ (i, j) $, $ i < j $, define:\n\n- $ d = x_j - x_i $\n- $ \\Delta = v_i - v_j \\in \\{-2, 0, 2\\} $\n\nDefine the **time window** for simultaneous coverage:\n\n$$\n\\mathcal{S}_{ij} = \\left\\{ s > 0 : |d - \\Delta s| < l \\right\\}\n$$\n\nThis is non-empty iff $ \\Delta \\ne 0 $ and $ |d| < l + |\\Delta| s $ for some $ s > 0 $, which is always true if $ \\Delta \\ne 0 $, but we need to compute the interval:\n\n- If $ \\Delta = 2 $: $ s \\in \\left( \\frac{d - l}{2}, \\frac{d + l}{2} \\right) \\cap \\mathbb{R}^+ $\n- If $ \\Delta = -2 $: $ s \\in \\left( \\frac{d - l}{-2}, \\frac{d + l}{-2} \\right) = \\left( \\frac{l - d}{2}, \\frac{-l - d}{2} \\right) $ — but this is only positive if $ -l - d > 0 \\Rightarrow d < -l $, etc.\n\nActually, let’s write:\n\nFrom $ |d - \\Delta s| < l $, we get:\n\n$$\n\\Delta s \\in (d - l, d + l)\n\\Rightarrow\ns \\in \\left( \\frac{d - l}{\\Delta}, \\frac{d + l}{\\Delta} \\right) \\quad \\text{if } \\Delta > 0\n$$\n$$\ns \\in \\left( \\frac{d + l}{\\Delta}, \\frac{d - l}{\\Delta} \\right) \\quad \\text{if } \\Delta < 0\n$$\n\nSo define:\n\n$$\nI_{ij} = \\left( \\min\\left( \\frac{d - l}{\\Delta}, \\frac{d + l}{\\Delta} \\right), \\max\\left( \\frac{d - l}{\\Delta}, \\frac{d + l}{\\Delta} \\right) \\right) \\cap (0, \\infty)\n$$\n\nThen for each $ s \\in I_{ij} $, define the **allowed wind interval** for cloud $ i $:\n\n$$\nW_i(s) = \\left( \\frac{-x_i - l}{s} - v_i, \\frac{-x_i}{s} - v_i \\right)\n$$\n\nSimilarly for $ j $:\n\n$$\nW_j(s) = \\left( \\frac{-x_j - l}{s} - v_j, \\frac{-x_j}{s} - v_j \\right)\n$$\n\nWe require:\n\n$$\nW_i(s) \\cap W_j(s) \\cap [-w_{\\text{max}}, w_{\\text{max}}] \\ne \\emptyset\n$$\n\nWe want to know: **Does there exist $ s \\in I_{ij} $ such that $ W_i(s) \\cap W_j(s) \\cap [-w_{\\text{max}}, w_{\\text{max}}] \\ne \\emptyset $?**\n\nBut $ W_i(s) \\cap W_j(s) $ is an interval, and we can compute its bounds:\n\nLet $ a_i(s) = \\frac{-x_i - l}{s} - v_i $, $ b_i(s) = \\frac{-x_i}{s} - v_i $\n\nSimilarly $ a_j(s), b_j(s) $\n\nThen:\n\n$$\nW_i(s) \\cap W_j(s) = \\left( \\max(a_i(s), a_j(s)), \\min(b_i(s), b_j(s)) \\right)\n$$\n\nWe require:\n\n$$\n\\max(a_i(s), a_j(s)) < \\min(b_i(s), b_j(s)) \\quad \\text{and} \\quad \\text{this interval overlaps } [-w_{\\text{max}}, w_{\\text{max}}]\n$$\n\nThis is complicated to check for all $ s $, but we can observe:\n\nThe condition that both clouds cover the moon at the same time with wind $ w $ is equivalent to:\n\nThere exists $ w \\in [-w_{\\text{max}}, w_{\\text{max}}] $ and $ t > 0 $ such that:\n\n$$\n\\begin{cases}\nx_i + (v_i + w)t < 0 < x_i + (v_i + w)t + l \\\\\nx_j + (v_j + w)t < 0 < x_j + (v_j + w)t + l\n\\end{cases}\n$$\n\nDefine:\n\nLet $ u = w $. Then we have two linear inequalities in $ t $:\n\n$$\n\\begin{cases}\n- \\frac{x_i + l}{v_i + u} < t < - \\frac{x_i}{v_i + u} \\\\\n- \\frac{x_j + l}{v_j + u} < t < - \\frac{x_j}{v_j + u}\n\\end{cases}\n$$\n\nWe want the intersection of the two $ t $-intervals to be non-empty for some $ u \\in [-w_{\\text{max}}, w_{\\text{max}}] $, and $ v_i + u \\ne 0 $, $ v_j + u \\ne 0 $, and $ t > 0 $.\n\nThis is equivalent to:\n\nThere exists $ u \\in [-w_{\\text{max}}, w_{\\text{max}}] $ such that:\n\n$$\n\\max\\left( - \\frac{x_i + l}{v_i + u}, - \\frac{x_j + l}{v_j + u} \\right) < \\min\\left( - \\frac{x_i}{v_i + u}, - \\frac{x_j}{v_j + u} \\right)\n$$\n\nand the lower bound is positive.\n\nThis is a **semi-algebraic condition** in $ u $, and we need to know if it holds for some $ u $ in a bounded interval.\n\nBut we can transform variables.\n\nLet $ a = v_i + u $, $ b = v_j + u $, so $ a - b = v_i - v_j = \\Delta $, and $ u = a - v_i \\in [-w_{\\text{max}}, w_{\\text{max}}] \\Rightarrow a \\in [v_i - w_{\\text{max}}, v_i + w_{\\text{max}}] $\n\nThen the condition becomes:\n\n$$\n\\max\\left( - \\frac{x_i + l}{a}, - \\frac{x_j + l}{b} \\right) < \\min\\left( - \\frac{x_i}{a}, - \\frac{x_j}{b} \\right)\n\\quad \\text{and} \\quad\n\\max\\left( - \\frac{x_i + l}{a}, - \\frac{x_j + l}{b} \\right) > 0\n$$\n\nSince $ b = a - \\Delta $, substitute:\n\n$$\n\\max\\left( - \\frac{x_i + l}{a}, - \\frac{x_j + l}{a - \\Delta} \\right) < \\min\\left( - \\frac{x_i}{a}, - \\frac{x_j}{a - \\Delta} \\right)\n$$\n\nLet $ f(a) = \\max\\left( - \\frac{x_i + l}{a}, - \\frac{x_j + l}{a - \\Delta} \\right) $,  \n$ g(a) = \\min\\left( - \\frac{x_i}{a}, - \\frac{x_j}{a - \\Delta} \\right) $\n\nWe need $ f(a) < g(a) $ and $ f(a) > 0 $ for some $ a \\in [v_i - w_{\\text{max}}, v_i + w_{\\text{max}}] \\setminus \\{0, \\Delta\\} $\n\nThis is a **one-dimensional feasibility problem** over a union of intervals, with piecewise rational functions.\n\nBut note: the condition $ f(a) < g(a) $ is equivalent to:\n\n$$\n- \\frac{x_i + l}{a} < - \\frac{x_j}{a - \\Delta} \\quad \\text{and} \\quad - \\frac{x_j + l}{a - \\Delta} < - \\frac{x_i}{a}\n$$\n\nand also the other two combinations? Actually, the max < min condition is equivalent to **all four pairwise inequalities**:\n\n1. $ - \\frac{x_i + l}{a} < - \\frac{x_i}{a} $ — always true since $ l > 0 $\n2. $ - \\frac{x_j + l}{a - \\Delta} < - \\frac{x_j}{a - \\Delta} $ — always true\n3. $ - \\frac{x_i + l}{a} < - \\frac{x_j}{a - \\Delta} $\n4. $ - \\frac{x_j + l}{a - \\Delta} < - \\frac{x_i}{a} $\n\nSo only conditions 3 and 4 are nontrivial.\n\nSo we require:\n\n$$\n\\frac{x_i + l}{a} > \\frac{x_j}{a - \\Delta} \\tag{A}\n$$\n$$\n\\frac{x_j + l}{a - \\Delta} > \\frac{x_i}{a} \\tag{B}\n$$\n\nAnd also $ f(a) > 0 \\Rightarrow \\max\\left( - \\frac{x_i + l}{a}, - \\frac{x_j + l}{a - \\Delta} \\right) > 0 \\Rightarrow \\text{at least one of } \\frac{x_i + l}{a} < 0 \\text{ or } \\frac{x_j + l}{a - \\Delta} < 0 $\n\nBut since $ t > 0 $, and $ t < -x_i / a $, we must have $ -x_i / a > 0 \\Rightarrow x_i / a < 0 $, similarly $ x_j / (a - \\Delta) < 0 $. So both $ a $ and $ a - \\Delta $ must have opposite signs to $ x_i $ and $ x_j $ respectively.\n\nBut this is getting too complex for a clean formalization.\n\n---\n\n### Final Clean Formalization (as required):\n\nWe are to count the number of unordered pairs $ (i, j) $, $ i < j $, such that there exists $ w \\in [-w_{\\text{max}}, w_{\\text{max}}] $ and $ t > 0 $ satisfying:\n\n$$\n\\begin{cases}\nx_i + (v_i + w)t < 0 < x_i + (v_i + w)t + l \\\\\nx_j + (v_j + w)t < 0 < x_j + (v_j + w)t + l\n\\end{cases}\n$$\n\nThis is equivalent to:\n\n$$\n\\exists w \\in [-w_{\\text{max}}, w_{\\text{max}}], \\exists t > 0 \\text{ such that }\n\\begin{cases}\n- x_i - l < (v_i + w)t < -x_i \\\\\n- x_j - l < (v_j + w)t < -x_j\n\\end{cases}\n$$\n\nLet $ a = v_i + w $, $ b = v_j + w $. Then $ a - b = v_i - v_j = \\Delta \\in \\{-2, 0, 2\\} $, and $ w = a - v_i \\in [-w_{\\text{max}}, w_{\\text{max}}] \\Rightarrow a \\in [v_i - w_{\\text{max}}, v_i + w_{\\text{max}}] $, $ b = a - \\Delta \\in [v_j - w_{\\text{max}}, v_j + w_{\\text{max}}] $\n\nThen the system becomes:\n\n$$\n\\begin{cases}\n- x_i - l < a t < -x_i \\\\\n- x_j - l < (a - \\Delta) t < -x_j\n\\end{cases}\n\\quad \\text{for some } t > 0, a \\in [v_i - w_{\\text{max}}, v_i + w_{\\text{max}}]\n$$\n\nWe can eliminate $ t $:\n\nFrom the first: $ t \\in \\left( \\frac{-x_i - l}{a}, \\frac{-x_i}{a} \\right) $\n\nFrom the second: $ t \\in \\left( \\frac{-x_j - l}{a - \\Delta}, \\frac{-x_j}{a - \\Delta} \\right) $\n\nSo we require:\n\n$$\n\\left( \\frac{-x_i - l}{a}, \\frac{-x_i}{a} \\right) \\cap \\left( \\frac{-x_j - l}{a - \\Delta}, \\frac{-x_j}{a - \\Delta} \\right) \\cap (0, \\infty) \\ne \\emptyset\n$$\n\nThus, the final formal statement is:\n\n---\n\n**Given:**  \n- $ n $, $ l $, $ w_{\\text{max}} \\in \\mathbb{R}^+ $  \n- For $ i = 1, \\dots, n $: $ x_i \\in \\mathbb{R} $, $ v_i \\in \\{-1, 1\\} $  \n- $ |x_i - x_j| \\geq l $ for all $ i \\ne j $\n\n**Count the number of unordered pairs $ (i, j) $, $ i < j $, such that there exists $ a \\in [v_i - w_{\\text{max}}, v_i + w_{\\text{max}}] $ with $ a \\ne 0 $, $ a - \\Delta \\ne 0 $, where $ \\Delta = v_i - v_j $, and**\n\n$$\n\\left( \\frac{-x_i - l}{a}, \\frac{-x_i}{a} \\right) \\cap \\left( \\frac{-x_j - l}{a - \\Delta}, \\frac{-x_j}{a - \\Delta} \\right) \\cap (0, \\infty) \\ne \\emptyset\n$$\n\n--- \n\nThis is the **mathematical formalization** of the problem.","simple_statement":null,"has_page_source":false}