func_code_string: //   // Created by Abhishek Bansal on 3/18/2021   //   //#pragma GCC optimize ( O3 )   //#pragma GCC optimize( Ofast,no-stack-protector )   //#pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,mmx,tune=native )   #include <bits/stdc++.h>   #define ll long long   #define ld long double   using namespace std;   clock_t startTime;   double getCurrentTime() {       return (double)(clock() - startTime) / CLOCKS_PER_SEC;   }   /*------------------------------------------------IO_OPERATORS---------------------------------------------*/   template<typename T, typename U> inline ostream &operator << (ostream &_out, const pair<T, U> &_p) { _out << _p.first <<     << _p.second; return _out; }   template<typename T, typename U> inline istream &operator >> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }   template<typename T> inline ostream &operator << (ostream &_out, const vector<T> &_v) { if (_v.empty()) return _out; _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) _out <<     << *_it; return _out; }   template<typename T> inline istream &operator >> (istream &_in, vector<T> &_v) { for (auto &_i : _v) _in >> _i; return _in; }   template<typename T> inline ostream &operator << (ostream &_out, const set<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out <<     << *_it; return _out; }   template<typename T> inline ostream &operator << (ostream &_out, const multiset<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out <<     << *_it; return _out; }   template<typename T> inline ostream &operator << (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out <<     << *_it; return _out; }   template<typename T> inline ostream &operator << (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out <<     << *_it; return _out; }   template<typename T, typename U> inline ostream &operator << (ostream &_out, const map<T, U> &_m) { if (_m.empty()) return _out; _out <<  {   << _m.begin()->first <<   ,    << _m.begin()->second <<   } ; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) _out <<  , {    << _it->first <<   ,    << _it->second <<   } ; return _out; }   template<typename T, typename U> inline ostream &operator << (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) return _out; _out <<  (  << _m.begin()->first <<  :   << _m.begin()->second <<  ) ; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) _out <<  , (  << _it->first <<  :   << _it->second <<  ) ; return _out; }   //For 1 based indexing   template<typename T>   void out(const vector<T> &a, int n) {       for (int i = 1; i <= n; ++i) {cout << a[i] <<    ;} cout <<   n ;   }   template<typename T>   void out(const vector<vector<T>> &a, int n, int m) {       for (int i = 1; i <= n; ++i) {for (int j = 1; j <= m; ++j) {cout << a[i][j] <<    ;}cout <<   n ;}   }      const int N = 20000005;   int lp[N+1];   vector<int> pr;      void Precompute() {       for (int i=2; i<=N; ++i) {           if (lp[i] == 0) {               lp[i] = i;               pr.push_back (i);           }           for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)               lp[i * pr[j]] = pr[j];       }   }      void solve() {       int c, d, x;cin >> c >> d >> x;       ll ans = 0;       auto calc = [&](int i) {           if ((d + x / i) % c) return;           int prod = (d + x / i) / c;           int cnt = 0;           while (prod != 1) {               int  u= lp[prod];               cnt++;               while (prod % u == 0) prod /= u;           }           ans += (1 << cnt);       };          for (int i = 1; i * i <= x; ++i) {           if (x % i != 0) continue;           calc(i);           if (i * i != x) calc(x / i);       }       cout << ans <<   n ;   }      int main() {       ios_base::sync_with_stdio(false);cin.tie(nullptr);          startTime = clock();   // freopen( input.txt ,  r , stdin);   // freopen( output.txt ,  w , stdout);   //    cout << fixed << setprecision(20);       int T = 1;       Precompute();       cin >> T;       while (T--) {           solve();       }       return 0;   }