func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:66777216 )   using namespace std;   void sIO();   void iIO();   void fIO(string fn);   const long long INF = 1000000003LL;   const long long BI = (long long)1e18;   int n;   long long c, a[1111], b[1111], lg, l, r, m;   long long check(long long x) {     long long ret = 0, cur;     for (int i = 0; i < n; ++i) {       cur = a[i] * x;       if (cur > INF || cur < 0) return INF;       ret += a[i] * x / b[i] + 1;     }     return min(ret, INF);   }   int main() {     sIO();     scanf( %d %I64d , &n, &c);     for (int i = 0; i < n; ++i) scanf( %I64d %I64d , a + i, b + i);     if (check(BI) == c) {       printf( -1 );       ;       return 0;     }     l = 1;     r = BI;     while (r - l > 1) {       m = (l + r) >> 1;       if (check(m) < c)         l = m;       else         r = m;     }     if (check(l) < c) ++l;     if (check(l) != c) {       printf( 0 );       return 0;     }     lg = l;     l = 1;     r = BI;     while (r - l > 1) {       m = (l + r) >> 1;       if (check(m) > c)         r = m;       else         l = m;     }     printf( %I64d , r - lg);     return 0;   }   inline void sIO() {}   inline void iIO() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   inline void fIO(string fn) {     freopen((fn +  .in ).c_str(),  r , stdin);     freopen((fn +  .out ).c_str(),  w , stdout);   }   