func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 1e10;   void solve() {     long long n, c;     cin >> n >> c;     long long a[n], b[n];     for (long long i = 0; i < n; i++) {       cin >> a[i] >> b[i];     }     long long low = -1, high = -1;     for (long long i = 1; i <= 100000; i++) {       long long cnt = 0;       for (long long j = 0; j < n; j++) {         cnt++;         cnt += (a[j] * i) / b[j];       }       if (cnt > c) break;       if (cnt < c) continue;       if (cnt == c) {         if (low == -1) low = i;         high = i;       }     }     if (high == -1)       cout << 0;     else       cout << high - low + 1;   }   int32_t main() {     long long t = 1;     while (t--) {       solve();     }     return 0;   }   