func_code_string: #include <bits/stdc++.h>   using std ::vector;   template <typename T>   T max(T x, T y) {     return (x > y) ? x : y;   }   template <typename T>   T min(T x, T y) {     return (x < y) ? x : y;   }   template <typename T>   bool chkmax(T &x, T y) {     return (x >= y) ? 0 : (x = y, 1);   }   template <typename T>   bool chkmin(T &x, T y) {     return (x <= y) ? 0 : (x = y, 1);   }   template <typename T>   T read(T &in) {     in = 0;     char ch;     T f = 1;     while (!isdigit(ch = getchar()))       if (ch ==  - ) f = -1;     while (isdigit(ch)) in = in * 10 + ch -  0 , ch = getchar();     return in *= f;   }   static const int max1 = 100000 + 11;   static const int BIT = 16;   bool vis[max1];   vector<int> fac[max1];   struct Node {     Node *ch[2];     int v;     Node() { ch[0] = ch[1] = NULL, v = 100001; }   };   struct Trie {     Node *root;     Trie() { root = new Node; }     void Insert(int x) {       Node *o = root;       chkmin(o->v, x);       for (int i = (BIT), ir = (0); i >= (ir); --i) {         int c = x >> i & 1;         if (!o->ch[c]) o->ch[c] = new Node;         o = o->ch[c];         chkmin(o->v, x);       }     }   } T[max1];   void Init(int n = 100000) {     for (int i = 1; i <= n; ++i)       for (int j = i; j <= n; j += i) fac[j].push_back(i);   }   void Modify(int x) {     if (vis[x]) return;     vis[x] = 1;     for (vector<int>::iterator i = fac[x].begin(); i != fac[x].end(); ++i)       T[*i].Insert(x);   }   int Query(int x, int k, int s) {     if (x % k) return -1;     s -= x;     int c = 0;     Node *o = T[k].root;     if (o->v > s) return -1;     for (int i = (BIT), ir = (0); i >= (ir); --i) {       int w = x >> i & 1;       if (s < (1 << i) || o->ch[1] && o->ch[1]->v > s)         o = o->ch[0];       else if (!o->ch[0])         o = o->ch[1], c += 1 << i;       else if (!o->ch[1])         o = o->ch[0];       else if (w)         o = o->ch[0];       else         o = o->ch[1], c += 1 << i;     }     return c;   }   int main() {     int q;     read(q);     Init();     while (q--) {       int o, x, k, s;       read(o), read(x);       if (o == 1) {         Modify(x);       } else {         read(k), read(s);         printf( %d n , Query(x, k, s));       }     }     return 0;   }   