func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     char ch = getchar();     int ret = 0, f = 1;     while (ch >  9  || ch <  0 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) ret = ret * 10 + ch -  0 , ch = getchar();     return ret * f;   }   const double inf = 1e30, eps = 1e-10;   const int mx = 100005, md = 1e6;   struct P {     double x, y;     bool operator<(const P& a) const { return x == a.x ? y < a.y : x < a.x; }     bool operator==(const P& a) const {       return fabs(x - a.x) < eps && fabs(y - a.y) < eps;     }     bool operator!=(const P& a) const {       return fabs(x - a.x) > eps || fabs(y - a.y) > eps;     }     double operator*(const P& a) const { return x * a.y - y * a.x; }     P operator-(const P& a) const { return (P){x - a.x, y - a.y}; }   } t[mx], st, ed;   int f[mx], s[mx][2], rt, tot;   inline void rot(int x) {     int y = f[x], z = f[y], p = y[s][0] == x;     if (z)       z[s][z[s][1] == y] = x;     else       rt = x;     f[x] = z, f[y] = x, s[x][p][f] = y;     s[y][p ^ 1] = s[x][p], s[x][p] = y;   }   inline void spl(int x, int o = 0) {     for (int y = 0; f[x] ^ o; rot(x))       if (f[y = f[x]] ^ o) rot((s[y][0] == x) == (s[f[y]][0] == y) ? y : x);   }   inline int ins(P x) {     int cu = rt, ls = 0;     while (cu) {       if (t[cu] == x) {         spl(cu);         return cu;       }       ls = cu, cu = s[cu][t[cu] < x];     }     f[++tot] = ls, s[ls][t[ls] < x] = tot, t[tot] = x;     spl(tot);     return tot;   }   inline int fnd(P x) {     int cu = rt;     while (cu) {       if (t[cu] == x) return cu;       cu = s[cu][t[cu] < x];     }     return -1;   }   inline int pre(int id) {     spl(id);     int cu = s[rt][0];     while (s[cu][1]) cu = s[cu][1];     return cu;   }   inline int nxt(int id) {     spl(id);     int cu = s[rt][1];     while (s[cu][0]) cu = s[cu][0];     return cu;   }   inline void del(int id) {     int pr = pre(id), nx = nxt(id);     spl(pr), spl(nx, rt), s[s[rt][1]][0] = 0;   }   inline void add(P a) {     int id = ins(a);     int pr = pre(id), nx = nxt(id), ppr, nnx;     if (pr && nx && t[nx] != ed && ((t[pr] - a) * (t[nx] - a)) > 0) {       del(fnd(a));       return;     }     while (1) {       pr = pre(id);       ppr = pre(pr);       if (ppr && ((t[pr] - t[ppr]) * (a - t[ppr])) <= 0)         del(pr);       else         break;     }     while (1) {       nx = nxt(id);       nnx = nxt(nx);       if (t[nx] != ed && nnx && t[nnx] != ed && ((t[nx] - a) * (t[nnx] - a)) <= 0)         del(nx);       else         break;     }   }   inline int qry(double a) {     int cu = rt, re = 0;     t[0].x = -1;     while (cu) {       if (t[cu].x <= a + eps && t[re].x < t[cu].x) re = cu;       cu = s[cu][t[cu].x <= a + eps];     }     return re;   }   int n, ls;   double m;   int main() {     cin >> n >> m;     st = (P){0, 0}, ed = (P){inf, inf};     t[rt = tot = 1] = st;     ins(ed);     for (int i = 1; i <= n; i++) {       int op = read(), a = (ls + read()) % md + 1, b = (ls + read()) % md + 1;       if (op == 1) {         add((P){(double)a, (double)b});       } else {         double x = (double)b / a, y = (double)m / a;         int po = qry(x), nx = nxt(po);         if (fabs(t[po].x - x) < eps && t[po].y < y + eps)           ls = i, printf( YES n );         else if (t[nx] == ed)           printf( NO n );         else {           double inc =               t[po].y + (t[nx].y - t[po].y) / (t[nx].x - t[po].x) * (x - t[po].x);           if (inc <= y + eps)             ls = i, printf( YES n );           else             printf( NO n );         }       }     }     return 0;   }   