func_code_string: #include <bits/stdc++.h>   using namespace std;   bool debug = 0;   int n, m, k;   int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};   string direc =  RDLU ;   long long ln, lk, lm;   void etp(bool f = 0) {     puts(f ?  YES  :  NO );     exit(0);   }   void addmod(int& x, int y, int mod = 1000000007) {     x += y;     if (x >= mod) x -= mod;     assert(x >= 0 && x < mod);   }   void et() {     puts( -1 );     exit(0);   }   struct Point {     long double x, y;     Point() {}     Point(long double x, long double y) : x(x), y(y) {}     Point operator*(double o) const { return Point(x * o, y * o); }     Point operator+(const Point& o) const { return Point(x + o.x, y + o.y); }     Point operator-(const Point& o) const { return Point(x - o.x, y - o.y); }     bool operator<(const Point& o) const {       return x < o.x || (x == o.x && y < o.y);     }     friend bool operator==(const Point& r1, const Point& r2) {       return r1.x == r2.x && r1.y == r2.y;     }     long double cross(Point b) const { return x * b.y - b.x * y; }     long double dot(Point b) const { return x * b.x + y * b.y; }   };   set<Point> ss;   void add(long double x, long double y) {     Point p = Point(x, y);     auto it = ss.lower_bound({x, 0});     auto pre = it;     pre--;     if (it != ss.end() && (p - *pre).cross(*it - *pre) <= 0) return;     ss.insert(p);     pre = ss.lower_bound(p);     pre--;     if (pre == ss.begin()) return;     auto pp = pre;     pp--;     while (pre != ss.begin() && (*pre - *pp).cross(p - *pre) <= 0) {       ss.erase(pre);       pre = pp;       if (pp == ss.begin()) return;       pp--;     }   }   inline int dcmp(long double x) {     return fabsl(x) < 1e-9 ? 0 : (x > 0 ? 1 : -1);   }   bool ck(long double dam, long double mana) {     auto cur = ss.lower_bound(Point(dam, 0));     if (cur == ss.end()) return 0;     auto pre = cur;     pre--;     long double x = dam - (*pre).x, y = mana - (*pre).y;     Point z = *cur - *pre;     if (dcmp(x * z.y - y * z.x) <= 0) return 1;     return 0;   }   void fmain(int tid) {     scanf( %d%lld , &n, &lm);     int ans = 0, M = 1e6;     ss.insert(Point(0, 0));     for (int(i) = 1; (i) <= (int)(n); (i)++) {       int t, x, y;       scanf( %d%d%d , &t, &x, &y);       x = (x + ans) % M + 1;       y = (y + ans) % M + 1;       if (t == 1)         add(x, y);       else {         bool ok = ck((long double)y / x, (long double)lm / x);         puts(ok ?  YES  :  NO );         if (ok) ans = i;       }     }   }   int main() {     int t = 1;     for (int(i) = 1; (i) <= (int)(t); (i)++) {       fmain(i);     }     return 0;   }   