func_code_string: #include <bits/stdc++.h>   using namespace std;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   inline int rand(int x, int y) {     ++y;     return (rng() % (y - x)) + x;   }   string to_string(char c) {     string second(1, c);     return second;   }   string to_string(bool b) { return (b ?  true  :  false ); }   template <typename A, typename B>   string to_string(pair<A, B> p) {     return  (  + to_string(p.first) +  ,   + to_string(p.second) +  ) ;   }   template <typename A>   string to_string(A v) {     bool first = true;     string res =  { ;     for (const auto &x : v) {       if (!first) {         res +=  ,  ;       }       first = false;       res += to_string(x);     }     res +=  } ;     return res;   }   void degug_out() { cerr << endl; }   template <typename Head, typename... Tail>   void degug_out(Head H, Tail... T) {     cerr <<     << to_string(H);     degug_out(T...);   }   inline int gcd(int a, int b) {     if (a > b) swap(a, b);     if (a == 0) return b;     return gcd(b % a, a);   }   int n;   int read() {     bool neg = false;     int res = 0;     char c = getchar();     while (true) {       if (c ==  - ) break;       if ( 0  <= c && c <=  9 ) break;       c = getchar();     }     if (c ==  - )       neg = true;     else       res = c -  0 ;     while (true) {       c = getchar();       if (c <  0  || c >  9 ) break;       res = (res << 1) + (res << 3) + (c -  0 );     }     if (neg) return -res;     return res;   }   const int sz = 670;   int store[sz + 2][sz + 2];   int A[(500006)];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     n = read();     for (int i = (0); i <= (int)(n - 1); ++i) {       int op, x, y;       op = read(), x = read(), y = read();       if (op == 1) {         for (int i = (1); i <= (int)(sz); ++i) {           store[i][x % i] += y;         }         A[x] += y;       } else {         if (x > sz) {           int ans = 0;           for (int i = y; i <= 500000; i += x) ans += A[i];           cout << ans <<   n ;         } else {           cout << store[x][y] <<   n ;         }       }     }   }   