Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
typedef double dd;
#define pb push_back
#define mp make_pair
#define endl "\n"
ll const M = 1000000007;
dd const pi = acos(-1);
ll const inf = 2e18;
ll const N = 200001;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<ll> a(N),b(N);
ll n;
ll power(ll a,ll b)
{
    ll res = 1;
    while(b > 0)
    {
        if(b & 1)
            res = (res*a)%M;
        a = (a*a)%M;
        b = b >> 1;
    }
    return res;
}
ll modinv(ll a)
{
   return power(a,M - 2); 
}  
void reduce(ll x,ll y,ll index)
{
  if(y == 0)
  {
    a[index] = 1;
    return;
  }
  if(x == 0)
  {
    b[index] = 1;
    return;
  }
  if(x < 0 && y < 0)
    a[index] = abs(x),b[index] = abs(y);
  if(x > 0 && y < 0)
    a[index] = -x,b[index] = -y;
  ll g = __gcd(abs(x),abs(y));
  a[index] /= g,b[index] /= g;
  return;
}
int main()
{
    fast;
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    unsigned long long i,j,t,cnt = 0,ans = 1;
    cin >> n;
    for(i = 1; i <= n; i++)
      cin >> a[i] >> b[i];
    map<pair<ll,ll>,ll> sum;
    for(i = 1; i <= n; i++)
    {
      if(a[i] == 0 && b[i] == 0)
        cnt++;
      else
      {
        reduce(a[i],b[i],i);
        sum[{a[i],b[i]}]++;
      }
    }
    map<pair<ll,ll>,bool> visited;
    for(i = 1; i <= n; i++)
    {
      if((a[i] != 0 && b[i] != 0) && !visited[{a[i],b[i]}])
      {
        ll s1 = 0,s2 = 0;
        s1 = sum[{a[i],b[i]}];
        if(a[i] > 0)
        {
          s2 = sum[{-b[i],a[i]}];
          visited[{-b[i],a[i]}] = true;
        }
        else
        {
          s2 = sum[{b[i],-a[i]}];
          visited[{b[i],-a[i]}] = true;
        }
        ans = (ans*(power(2,s1) + power(2,s2) - 1)%M)%M;
        visited[{a[i],b[i]}] = true;
      }
    }
    cout<<(ans + cnt - 1)%M<<endl;
    return 0;
}    

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 '_Tp std::reduce(_InputIterator, _InputIterator, _Tp, _BinaryOperation) [with _InputIterator = long long int; _Tp = long long unsigned int; _BinaryOperation = plus<void>]':
/usr/include/c++/14/numeric:326:25:   required from '_Tp std::reduce(_InputIterator, _InputIterator, _Tp) [with _InputIterator = long long int; _Tp = long long unsigned int]'
  326 |     { return std::reduce(__first, __last, std::move(__init), plus<>()); }
      |              ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:95:15:   required from here
   95 |         reduce(a[i],b[i],i);
      |         ~~~~~~^~~~~~~~~~~~~
/usr/include/c++/14/numeric:290:13: error: no type named 'reference' in 'struct std::iterator_traits<long long int>'
  290 |       using __ref = typename iterator_traits<_InputIterator>::reference;
      |             ^~~~~
/usr/include/c++/14/numeric:291:21: error: no type named 'reference' in 'struct std::iterator_traits<long long int>'
  291 |       static_assert(is_invocable_r_v<_Tp, _BinaryOperation&, _Tp&, __ref>);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/numeric:292:21: error: no type named 'reference' in 'struct std::iterator_traits<long long int>'
  292 |       static_assert(is_invocable_r_v<_Tp, _BinaryOperation&, __ref, _Tp&>);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/numeric:294:21: error: no type named 'reference' in 'struct std::iterator_traits<long long int>'
  294 |       static_assert(is_invocable_r_v<_Tp, _BinaryOperation&, __ref, __ref>);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/numeric:295:62: error: no type named 'iterator_category' in 'struct std::iterator_traits<long long int>'
  295 |       if constexpr (__is_random_access_iter<_InputIterator>::value)
      |                                                              ^~~~~
/usr/include/c++/14/numeric:299:45: error: subscripted value is neither array nor pointer
  299 |               _Tp __v1 = __binary_op(__first[0], __first[1]);
      |                                      ~~~~~~~^
/usr/include/c++/14/numeric:299:57: error: subscripted value is neither array nor pointer
  299 |               _Tp __v1 = __binary_op(__first[0], __first[1]);
      |                                                  ~~~~~~~^
/usr/include/c++/14/numeric:300:45: error: subscripted value is neither array nor pointer
  300 |               _Tp __v2 = __binary_op(__first[2], __first[3]);
      |                                      ~~~~~~~^
/usr/include/c++/14/numeric:300:57: error: subscripted value is neither array nor pointer
  300 |               _Tp __v2 = __binary_op(__first[2], __first[3]);
      |                                                  ~~~~~~~^
/usr/include/c++/14/numeric:307:38: error: invalid type argument of unary '*' (have 'long long int')
  307 |         __init = __binary_op(__init, *__first);
      |                                      ^~~~~~~~