func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int N = 1e6 + 10;   const long long INF = 1e18;   const long double EPS = 1e-12;   long long w[200005];   long long h[200005];   long long c[200005];   long long rgcd[200005];   map<long long, vector<pair<long long, long long> > > ma;   long long gcd(long long a, long long b) {     if (b == 0) return a;     a %= b;     return gcd(b, a);   }   int main() {     int n;     cin >> n;     long long tp = 0;     for (int i = 0; i < (int)n; i++) {       cin >> w[i] >> h[i] >> c[i];       ma[w[i]].push_back(make_pair(h[i], c[i]));       if (i == 0)         tp = c[i];       else         tp = gcd(tp, c[i]);     }     map<long long, vector<pair<long long, long long> > >::iterator it, it_;     for (it = ma.begin(); it != ma.end(); it++) {       sort((it->second).begin(), (it->second).end());     }     it_ = ma.begin();     it_++;     for (it = ma.begin(); it_ != ma.end(); it++) {       int si = (int)(it->second).size();       int si_ = (int)(it_->second).size();       if (si != si_) {         cout <<  0  << endl;         return 0;       }       for (int i = 0; i < (int)si; i++) {         if ((it->second)[i].first != (it_->second)[i].first) {           cout <<  0  << endl;           return 0;         }       }       it_++;     }     long long net;     int fl = 0;     for (it = ma.begin(); it != ma.end(); it++) {       int si = (int)(it->second).size();       int si_ = (int)(it_->second).size();       long long tmp = (it->second)[0].second;       for (int i = (int)1; i < (int)si; i++) {         if (tmp == 1) break;         tmp = gcd(tmp, (it->second)[i].second);       }       for (int i = 0; i < (int)si; i++) {         ((it->second)[i].second) /= tp;       }     }     net = tp;     if (net == 1) {       it_ = ma.begin();       it_++;       for (it = ma.begin(); it_ != ma.end(); it++) {         int si = (int)(it->second).size();         int si_ = (int)(it_->second).size();         long long d1 = 0;         long long d2 = 0;         for (int i = 0; i < (int)si; i++) {           d1 += ((it->second)[i].first) * ((it->second)[i].second);         }         for (int i = 0; i < (int)si; i++) {           d2 += ((it_->second)[i].first) * ((it_->second)[i].second);         }         if (d1 != d2) {           cout <<  0  << endl;           return 0;         }         it_++;       }     }     long long ans = 0;     for (int i = (int)1; i < (int)1e6 + 5; i++) {       long long i_ = (long long)(i);       if (i_ * i_ > net) break;       if (net % i_ == 0) {         ans += 2;       }       if (i_ * i_ == net) {         ans--;       }     }     cout << ans << endl;     return 0;   }   