Language: C++

#include<bits/stdc++.h>

#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#define endl        '\n'
#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

namespace InOp{
template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
}
using namespace InOp;

namespace ModOp{
template<class x,class y,class z> z add(x a,y b,z m){return (a+b)%m;}
template<class x,class y,class z> z sub(x a,y b,z m){return (a-b+m)%m;}
template<class x,class y,class z> z mul(x a,y b,z m){return ((ll)a*b)%m;}
template<class y,class z> z expo(ll b,y e,z m){ll a=1;b%=m;while(e!=0){if((e&1)==1){a=a*b;a=a%m;}b=b*b;b%=m;e>>=1;}return a%m;}
template<class x,class z> z inv(x b,z m){return expo(b,m-2,m);}
template<class x,class y> x invGeneral(x a,y b){if(a==0)return b==1?0:-1;x m=invGeneral(b%a,a);return m==-1?-1:((1-(ll)b*m)/a+b)%b;}
template<class x,class y,class z> z div(x a,y b,z m){ll c=inv(b,m);return mul(a,c,m);}
}
using namespace ModOp;

namespace Debug{
template<class x> void deb(x a){cerr<<"a"<<": "<<a<<endl;}
template<class x,class y> void deb(x a,y b){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<endl;}
template<class x,class y,class z> void deb(x a,y b,z c){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<endl;}
template<class x,class y,class z,class xy> void deb(x a,y b,z c,xy d){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<" | "<<"d"<<": "<<d<<endl;}
}
using namespace Debug;

#define N  1000005

ll expo(ll base, ll exponent, ll mod) {                                //return base^exponent modulo modulus
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%mod;
        }
        base = base*base;
        base %= mod;
        exponent>>= 1;
    }
    return ans%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
        ll i,j,k,l,r,x,y,m,n;
        cin>>n;
        map<ll,map<ll,ll>> ma;
        ll tot=0,totl=0,totr=0;
        ll ans=0;   
        ll xxx=0
        for(i=0;i<n;i++)
        {
            // cout<<ans<<endl;
            cin>>l>>r;
            if(l==0&&r==0)
            {
                xxx++;
                continue;
            }
            if(l==0)
            {
                totl++;continue;
            }
            if(r==0)
            {
                totr++;continue;
            }
            ll t=0;
            if((l<0&&r>0)||(l>0&&r<0))t=1;
            l=abs(l);r=abs(r);
            x=__gcd(l,r);
            l=l/x;
            r=r/x;
            if(t==0)
            {
                // cout<<l<<" "<<r<<endl;
                ma[l][r]++;
            }
            else
            {
                // cout<<-l<<" "<<r<<endl;
                ma[-l][r]++;
            }
        }
        x=totl;
        y=totr;
        ans=(expo(2,x+y,hell)-(((expo(2,x,hell)-1+hell)%hell)*((expo(2,y,hell)-1+hell)%hell))%hell+2*hell)%hell;
        // cout<<ans<<endl;
        for(auto i:ma)
        {
            // if(i.F<=0)continue;
            for(auto j:ma[i.F])
            {
                ll a,b;
                ll t=0;
                a=-j.F;
                b=i.F;
                if(a<0&&b<0)
                {
                    a=abs(a);
                    b=abs(b);
                }
                x=ma[a][b];
                if(j.S==0)continue;
                if(x!=0&&i.F<=0)continue;
                y=j.S;
                ans*=(expo(2,x+y,hell)-(((expo(2,x,hell)-1+hell)%hell)*((expo(2,y,hell)-1+hell)%hell))%hell+2*hell)%hell;
                ans%=hell;
                // cout<<i.F<<" "<<j.F<<" "<<x<<" "<<y<<" "<<ans<<endl;
            }
        }
        ans=(ans+xxx)%hell;
        ans=(ans-1+hell)%hell;
        cout<<ans<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:110:9: error: expected ',' or ';' before 'for'
  110 |         for(i=0;i<n;i++)
      |         ^~~
a.cc:110:24: error: expected ';' before ')' token
  110 |         for(i=0;i<n;i++)
      |                        ^
      |                        ;