func_code_string: #include <bits/stdc++.h>   using namespace std;   char buf[1 << 21], *p1 = buf, *p2 = buf;   inline long long qread() {     register char c =         (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)              ? EOF              : *p1++);     register long long x = 0, f = 1;     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)                ? EOF                : *p1++);     }     while (c >=  0  && c <=  9 ) {       x = (x << 3) + (x << 1) + c - 48;       c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)                ? EOF                : *p1++);     }     return x * f;   }   inline long long Abs(const long long& x) { return (x > 0 ? x : -x); }   inline long long Max(const long long& x, const long long& y) {     return (x > y ? x : y);   }   inline long long Min(const long long& x, const long long& y) {     return (x < y ? x : y);   }   long long n, l, wmax;   vector<long long> ml, mr;   inline long long Div(long long x, long long y) {     if (!y) {       if (x > 0)         return 2147483647;       else         return -2147483647;     }     if (x % y < 0) x -= (y + x % y);     return x / y;   }   inline void Read() {     n = qread();     l = qread();     wmax = qread();     for (register long long i = 1; i <= n; i++) {       register long long x = qread(), v = qread();       if (v == 1)         mr.push_back(x);       else         ml.push_back(x);     }   }   inline void Solve() {     register long long siz = ml.size();     register long long ans = 0;     for (register long long i = 0; i < siz; i++) {       auto lmost = lower_bound(mr.begin(), mr.end(), -ml[i] - l);       ans += upper_bound(                  mr.begin(), lmost,                  Min(Div((ml[i] + l) * (wmax + 1) - 1, wmax - 1), -ml[i] - l)) -              mr.begin();       ans +=           upper_bound(lmost, mr.end(),                       Min(Div((ml[i] + l) * (wmax - 1) - 1, wmax + 1), ml[i])) -           lmost;     }     printf( %lld , ans);   }   signed main() {     Read();     sort(ml.begin(), ml.end());     sort(mr.begin(), mr.end());     Solve();     return 0;   }   