func_code_string: #include <bits/stdc++.h>   using namespace std;   map<pair<long long, long long>, long long> cost;   map<long long, int> vis;   map<long long, int> freq;   int main() {     int q;     cin >> q;     while (q--) {       int e;       long long v, u;       cin >> e >> v >> u;       long long tv = v;       long long tu = u;       if (e == 1) {         long long w;         cin >> w;         if (u == v) continue;         while (tv > 0) {           freq[tv]++;           tv /= 2;         }         while (tu > 0) {           ++freq[tu];           tu /= 2;         }         tv = v;         tu = u;         while (freq[tv] == 1 && tv > 1) {           cost[make_pair(tv, tv / 2)] += w;           tv /= 2;         }         while (freq[tu] == 1 && tu > 1) {           cost[make_pair(tu, tu / 2)] += w;           tu /= 2;         }       } else {         long long ans = 0;         while (tv > 0) {           freq[tv]++;           tv /= 2;         }         while (tu > 0) {           ++freq[tu];           tu /= 2;         }         tv = v;         tu = u;         while (freq[tv] == 1 && tv > 1) {           ans += cost[make_pair(tv, tv / 2)];           tv /= 2;         }         while (freq[tu] == 1 && tu > 1) {           ans += cost[make_pair(tu, tu / 2)];           tu /= 2;         }         cout << ans << endl;       }       freq.clear();     }   }   