func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> di[100003];   struct trie {     trie *zero, *one;     int val;     trie() {       zero = one = NULL;       val = 100003;     }   } * root[100003];   void add(trie *cur, int a) {     int i, ck;     for (i = 20; i >= 0; i--) {       ck = (1 << i & a);       if (ck == 0) {         cur->val = min(cur->val, a);         if (cur->zero == NULL) cur->zero = new trie();         cur = cur->zero;         cur->val = min(cur->val, a);       } else {         cur->val = min(cur->val, a);         if (cur->one == NULL) cur->one = new trie();         cur = cur->one;         cur->val = min(cur->val, a);       }     }   }   int query(trie *cur, int a, int lim) {     int i, ck, ans;     for (i = 20; i >= 0; i--) {       ck = (1 << i & a);       if (ck == 0) {         if (cur->one != NULL && cur->one->val + a <= lim)           cur = cur->one;         else if (cur->zero != NULL)           cur = cur->zero;         ans = cur->val;       } else {         if (cur->zero != NULL && cur->zero->val + a <= lim)           cur = cur->zero;         else if (cur->one != NULL)           cur = cur->one;         ans = cur->val;       }     }     return ans;   }   void pre() {     for (int i = 1; i < 100003; i++) {       for (int j = i; j < 100003; j += i) di[j].push_back(i);       root[i] = new trie();     }   }   int main() {     pre();     int q, a, k, s, v, ty;     scanf( %d , &q);     while (q--) {       scanf( %d , &ty);       if (ty == 1) {         scanf( %d , &a);         for (int x : di[a]) {           add(root[x], a);         }       } else {         scanf( %d %d %d , &v, &k, &s);         if (root[k]->val + v > s || root[k]->val == 0 || v % k)           printf( -1 n );         else           printf( %d n , query(root[k], v, s));       }     }     return 0;   }   