Language: C++

/*input
10
3 2
3 2
-1 1
2 -1
-3 -9
-8 12
7 7
8 1
8 2
8 4
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}


void init(ll* a,ll n,ll val){
    for(ll i=0;i<n;i++)
        a[i]=val;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll t=1,i,j;
    ll n,a,b;
    cin>>n;
    map<pll,ll> mp;
    ll s=0;
    ll k1=power(2,M-2,M);
    rep(i,0,n){
        cin>>a>>b;
        ll g=__gcd(abs(a),abs(b));
        a/=g,b/=g;
        if(a<0)a=-a,b=-b;
        mp[{a,b}]++;
    }
    ll ans=0;
    for(auto it : mp){
        a=it.F.F,b=it.F.S;
        ll k1=mp[{a,b}],k2=mp[{-b,a}]+mp[{b,-a}];
        ans=ans+(ans*((power(2,k1,M)-1+power(2,k2,M)-1+M)%M))%M;
        ans%=M;
        ans+=(power(2,k1,M)-1+M)%M;
        ans%=M;
        ans+=(power(2,k2,M)-1+M)%M;
        ans%=M;
        mp[{a,b}]=0,mp[{-b,a}]=0,mp[{b,-a}]=0;
    }
    cout<<ans<<endl;
    return 0;
}


/*input
10
3 2
3 2
-1 1
2 -1
-3 -9
-8 12
7 7
8 1
8 2
8 4
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}


void init(ll* a,ll n,ll val){
    for(ll i=0;i<n;i++)
        a[i]=val;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll t=1,i,j;
    ll n,a,b;
    cin>>n;
    map<pll,ll> mp;
    ll s=0;
    ll k1=power(2,M-2,M);
    rep(i,0,n){
        cin>>a>>b;
        ll g=__gcd(abs(a),abs(b));
        a/=g,b/=g;
        if(a<0)a=-a,b=-b;
        mp[{a,b}]++;
    }
    ll ans=0;
    for(auto it : mp){
        a=it.F.F,b=it.F.S;
        ll k1=mp[{a,b}],k2=mp[{-b,a}]+mp[{b,-a}];
        ans=ans+(ans*((power(2,k1,M)-1+power(2,k2,M)-1+M)%M))%M;
        ans%=M;
        ans+=(power(2,k1,M)-1+M)%M;
        ans%=M;
        ans+=(power(2,k2,M)-1+M)%M;
        ans%=M;
        mp[{a,b}]=0,mp[{-b,a}]=0,mp[{b,-a}]=0;
    }
    cout<<ans<<endl;
    return 0;
}




Compiler output:
a.cc:143:4: error: redefinition of 'long long int power(long long int, long long int, long long int)'
  143 | ll power(ll a,ll m,ll mod){
      |    ^~~~~
a.cc:44:4: note: 'long long int power(long long int, long long int, long long int)' previously defined here
   44 | ll power(ll a,ll m,ll mod){
      |    ^~~~~
a.cc:157:6: error: redefinition of 'void init(long long int*, long long int, long long int)'
  157 | void init(ll* a,ll n,ll val){
      |      ^~~~
a.cc:58:6: note: 'void init(long long int*, long long int, long long int)' previously defined here
   58 | void init(ll* a,ll n,ll val){
      |      ^~~~
a.cc:164:5: error: redefinition of 'int main()'
  164 | int main()
      |     ^~~~
a.cc:65:5: note: 'int main()' previously defined here
   65 | int main()
      |     ^~~~