Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;
double pi = 3.14159265358979;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}

ll gcd(ll x, ll y) {
  ll M = max(x, y);
  ll m = min(x, y);
  while (M%m!=0) {
    ll l = m;
    m = M%m;
    M = l;
  }
  return m;
}

int main() {
  ll n;
  cin >> n;
  queue<pair<int, int>> q;
  map<pair<int, int>, ll> ma1;
  map<pair<int, int>, ll> ma2;
  int a0 = 0;
  int b0 = 0;
  int ab0 = 0;
  
  ll N = 0;
  for (int i = 0; i < n; i++) {
    double a,b;
    cin >> a >> b;
    if (a == 0) {
      if (b != 0) a0++;
      else ab0++;
    }
    else if (b == 0) b0++;
    else {
      ll g = gcd(a,b);
      a /= g;
      b /= g;
      if (a<0) {
        a = 0-a;
        b = 0-b;
      }
      ll A = a;
      ll B = b;
      if (B < 0) {
        B = 0-B;
        A = 0-A;
      }
      if (ma2[make_pair(a, b)] == 0 && ma2[make_pair(B, -A)] == 0) q.push(make_pair(a, b));
      ma1[make_pair(B, -A)]++;
      ma2[make_pair(a, b)]++;
      if (ma2[make_pair(B, -A)] >= 1 && ma2[make_pair(a, b)] == 1) N++;
    }
  }
  
  ll count = 0;
  
  
  vector<vector<ll>> v(N, vector<ll>(0));
  ll i = 0;
  ll NN = 0;
  while (!q.empty()) {
    ll cA = ma2[q.front()];
    ll a, b;
    tie(a, b) = q.front();
    ll A = a;
    ll B = b;
    if (B < 0) {
      B = 0-B;
      A = 0-A;
    }
    ll cB = ma2[make_pair(B, -A)];
    if (cB != 0) {
      ll ccA = r(2,cA)-1;
      ll ccB = r(2,cB)-1;
      v[i].push_back(ccA);
      v[i].push_back(ccB);
      v[i].push_back(1);
    }
    else NN++;
    q.pop();
    i++;
  }
  queue<ll> p;
  p.push(1);
  for (int i = 0; i < N; i++) {
    ll J = p.size();
    for (int j = 0; j < J; j++) {
      for (int x : v[i]) {
        ll P = p.front() * x % mod;
        p.push(P);
      }
      p.pop();
    }
  }
  ll sum = 0;
  while (!p.empty()) {
    sum += p.front();
    sum %= mod;
    p.pop();
  }

  ll NNN = r(2, NN);
  sum = sum * NNN % mod;
  sum--;
  count += sum;
  count %= mod;
  
  //以下0を含むものが存在するとき
  n -= ab0;
  ll a0n = n - a0;
  ll b0n = n - b0;
  
  if (a0 > 0) {
  ll A0 = r(2, a0)-1;
  ll A0n = r(2, a0n - b0)-1;
  ll A00 = A0 * A0n % mod;
  count += A00;
  count %= mod;
  }
  
  if (b0 > 0) {
  ll B0 = r(2, b0)-1;
  ll B0n = r(2, b0n - a0)-1;
  ll B00 = B0 * B0n % mod;
  count += B00;
  count %= mod;
  }
  
  printf("%lld\n", count);
}

Compiler output:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric: In instantiation of 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = double; _Nn = double; common_type_t<_Mn, _Nn> = double]':
a.cc:44:17:   required from here
   44 |       ll g = gcd(a,b);
      |              ~~~^~~~~
/usr/include/c++/14/numeric:175:21: error: static assertion failed: std::gcd arguments must be integers
  175 |       static_assert(is_integral_v<_Mn> && is_integral_v<_Nn>,
      |                     ^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/numeric:175:21: note: 'std::is_integral_v<double>' evaluates to false
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/type_traits: In instantiation of 'struct std::make_unsigned<double>':
/usr/include/c++/14/type_traits:2076:11:   required by substitution of 'template<class _Tp> using std::make_unsigned_t = typename std::make_unsigned::type [with _Tp = double]'
 2076 |     using make_unsigned_t = typename make_unsigned<_Tp>::type;
      |           ^~~~~~~~~~~~~~~
/usr/include/c++/14/numeric:182:24:   required from 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = double; _Nn = double; common_type_t<_Mn, _Nn> = double]'
  182 |       return __detail::__gcd<make_unsigned_t<_Ct>>(__m2, __n2);
      |              ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:44:17:   required from here
   44 |       ll g = gcd(a,b);
      |              ~~~^~~~~
/usr/include/c++/14/type_traits:1929:13: error: invalid use of incomplete type 'class std::__make_unsigned_selector<double, false, false>'
 1929 |     { using type = typename __make_unsigned_selector<_Tp>::__type; };
      |             ^~~~
/usr/include/c++/14/type_traits:1837:11: note: declaration of 'class std::__make_unsigned_selector<double, false, false>'
 1837 |     class __make_unsigned_selector;
      |           ^~~~~~~~~~~~~~~~~~~~~~~~