func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   inline void maxi(T &x, T y) {     if (y > x) x = y;   }   template <class T>   inline void mini(T &x, T y) {     if (y < x) x = y;   }   const int N = 2e5, B = 0x7fffffff;   int t;   int main() {     scanf( %d , &t);     for (int tt = 1; tt <= t; tt++) {       long long x, y, p, q;       scanf( %lld %lld %lld %lld , &x, &y, &p, &q);       long long l = 0, r = 1000000000;       long long ans = -1;       while (l <= r) {         long long mid = (l + r) >> 1;         if (mid * p >= x && mid * q >= y) {           if ((mid * q) - y >= (mid * p) - x)             ans = mid, r = mid - 1;           else             l = mid + 1;         } else           l = mid + 1;       }       if (ans == -1)         puts( -1 );       else         printf( %lld n , (ans * q) - y);     }     return !!0;   }   