func_code_string: #include <bits/stdc++.h>   using namespace std;   int32_t main() {     long long t;     cin >> t;     for (long long q = 0; q < t; q++) {       long long a, b, k;       cin >> a >> b >> k;       vector<long long> x(a * b);       for (long long i = 0; i < a * b; i++) {         x[i] = (i % a % b != i % b % a);       }       long long all = 0;       for (long long i = 0; i < a * b; i++) {         all += x[i];       }       vector<long long> sum_pref(a * b + 1, 0);       for (long long i = 0; i < a * b; i++) {         sum_pref[i + 1] = sum_pref[i] + x[i];       }       for (long long i = 0; i < k; i++) {         long long l, r;         cin >> l >> r;         r++;         long long ans = (r / (a * b) - l / (a * b)) * all;         ans += sum_pref[r % (a * b)];         ans -= sum_pref[l % (a * b)];         cout << ans <<    ;       }       cout << endl;     }     return 0;   }   