Language: C++

#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
template<typename T>
inline void read(T &x)
{
	x=0;
	__int128 f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}	
template<typename T>
void write(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
	return;
}
const __int128 MAXN=200010;
__int128 n;
__int128 a[MAXN],b[MAXN];
__int128 c[MAXN],d[MAXN];
map<pair<__int128,__int128>,__int128> mp;
map<pair<__int128,__int128>,bool> book;
__int128 gcd(register __int128 x,register __int128 y)
{
    return y==0? x:gcd(y,x%y);
}
__int128 ans=1;
__int128 p[MAXN];
inline __int128 abs(register __int128 x)
{
    return x<0? -x:x;
}
int main()
{
    read(n);
    for(register __int128 i=1;i<=n;++i)
    {
        read(a[i]),read(b[i]);
        __int128 x=a[i],y=b[i],p=gcd(abs(a[i]),abs(b[i]));
        if(x==0&&y==0) mp[make_pair(0,0)]++,c[i]=0,d[i]=0;
        else if(x==0) mp[make_pair(0,1)]++,c[i]=0,d[i]=1;
        else if(y==0) mp[make_pair(-1,0)]++,c[i]=-1,d[i]=0;
        else
        {
            if(x*y<0) y=abs(y),x=-abs(x);
            else if(x<0&&y<0) x=-x,y=-y;
            x/=p,y/=p;
            mp[make_pair(x,y)]++;
            c[i]=x,d[i]=y;
        }
    }
    p[0]=1;
    for(register __int128 i=1;i<=n;++i) p[i]=p[i-1]*2,p[i]%=mod;
    for(register __int128 i=0;i<=n;++i) --p[i];
    for(register __int128 i=1;i<=n;++i)
    if(!book[make_pair(c[i],d[i])])
    {
        __int128 x=c[i],y=d[i];
        if(x<0) ans*=p[mp[make_pair(y,-x)]]+p[mp[make_pair(x,y)]]+1,ans%=mod,book[make_pair(x,y)]=book[make_pair(y,-x)]=1;
        else if(x==0&&y==0) book[make_pair(x,y)]=1;
        else ans*=p[mp[make_pair(x,y)]]+p[mp[make_pair(-y,x)]]+1,ans%=mod,book[make_pair(x,y)]=book[make_pair(-y,x)]=1;
    }
    ans+=mp[make_pair(0,0)];
    write(((ans-1)%mod+mod)%mod),putchar('\n');
	return 0;
}


Compiler output:
a.cc:33:32: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   33 | __int128 gcd(register __int128 x,register __int128 y)
      |                                ^
a.cc:33:52: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   33 | __int128 gcd(register __int128 x,register __int128 y)
      |                                                    ^
a.cc:39:39: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   39 | inline __int128 abs(register __int128 x)
      |                                       ^
a.cc: In function 'int main()':
a.cc:46:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   46 |     for(register __int128 i=1;i<=n;++i)
      |                           ^
a.cc:49:41: error: call of overloaded 'abs(__int128&)' is ambiguous
   49 |         __int128 x=a[i],y=b[i],p=gcd(abs(a[i]),abs(b[i]));
      |                                      ~~~^~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:39:17: note: candidate: '__int128 abs(__int128)'
   39 | inline __int128 abs(register __int128 x)
      |                 ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:49:51: error: call of overloaded 'abs(__int128&)' is ambiguous
   49 |         __int128 x=a[i],y=b[i],p=gcd(abs(a[i]),abs(b[i]));
      |                                                ~~~^~~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:39:17: note: candidate: '__int128 abs(__int128)'
   39 | inline __int128 abs(register __int128 x)
      |                 ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:55:28: error: call of overloaded 'abs(__int128&)' is ambiguous
   55 |             if(x*y<0) y=abs(y),x=-abs(x);
      |                         ~~~^~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:39:17: note: candidate: '__int128 abs(__int128)'
   39 | inline __int128 abs(register __int128 x)
      |                 ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:55:38: error: call of overloaded 'abs(__int128&)' is ambiguous
   55 |             if(x*y<0) y=abs(y),x=-abs(x);
      |                                   ~~~^~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
a.cc:39:17: note: candidate: '__int128 abs(__int128)'
   39 | inline __int128 abs(register __int128 x)
      |                 ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
a.cc:63:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   63 |     for(register __int128 i=1;i<=n;++i) p[i]=p[i-1]*2,p[i]%=mod;
      |                           ^
a.cc:64:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   64 |     for(register __int128 i=0;i<=n;++i) --p[i];
      |                           ^
a.cc:65:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   65 |     for(register __int128 i=1;i<=n;++i)
      |                           ^