Language: C++

#include <iostream>
#include <map>
#include <vector>

__int64 gcd(__int64 a,__int64 b){
  __int64 r=a%b;
  while(r!=0){
   //std::cout<<a<<" "<<b<<" "<<r<<std::endl;
   a=b;
   b=r;
   r=a%b;
  }
  return b;
}

 __int64 pow(__int64 a,__int64 b, __int64 d){
  if(b==1){
   return a%d;
  }else if(b==0){
   return 1;
  }else{
   a=a%d;
   a=(a*a)%d;
   if(b%2==0){
    return pow(a,b/2,d);
   }else{
    return (pow(a,b/2,d)*a)%d;
   }
  }
 }

int main(){
///*
 int N;
 std::cin>>N;
 std::map<std::pair<__int64,__int64>,int> mp;
 //std::vector<__int64> A(N);
 //std::vector<__int64> B(N);
 __int64 a,b;
 __int64 zero=0;
 for(int i=0;i<N;i++){
  std::cin>>a>>b;
  //A[i]=a;
  //B[i]=b;
  if(a==0&&b==0){
   zero++;
  }else if(a==0){
   mp[{0,1}]++;
  }else if(b==0){
   mp[{1,0}]++;
  }else{
   if(a<0&&b<0){
    __int64 g=gcd(-a,-b);
    mp[{(-a/g),(-b/g)}]++;
   }else if(a<0){
    __int64 g=gcd(-a,b);
    mp[{(a/g),(b/g)}]++;
   }else if(b<0){
    __int64 g=gcd(a,-b);
    mp[{(-a/g),(-b/g)}]++;
   }else{
    __int64 g=gcd(a,b);
    mp[{(a/g),(b/g)}]++;
   }
  }
 }

/*
 for (auto const& p : mp){
    std::cout<<"(<"<<p.first.first<<","<<p.first.second<<">"<<","<<p.second<<")"<<std::endl; 
 }
*/
 __int64 d=1000000007;
//*/
 __int64 ans=1;
 __int64 al=0;
 __int64 be=0;
 __int64 ga=0;
 for(auto p:mp){
  //std::cout<<"(<"<<p.first.first<<","<<p.first.second<<">"<<","<<p.second<<")"<<std::endl;
  al=p.first.first;
  be=p.first.second;
  ga=1;
  ga+=pow(2,mp[{al,be}],d)-1;
  //mp.erase({al,be});
  mp[{al,be}]=0;
  if(al>=0){
   if(mp[{-be,al}]!=0){
    ga+=pow(2,mp[{-be,al}],d)-1;
    //mp.erase({-be,al});
    mp[{-be,al}]=0;
   }
  }else{
   if(mp[{be,-al}]!=0){
    ga+=pow(2,mp[{be,-al}],d)-1;
    //mp.erase({be,-al});
    mp[{be,-al}]=0;
   }
  }
  //std::cout<<ga<<std::endl;
  ans*=ga;
  ans=ans%d;
 }
 
 ans+=zero;
 ans=ans%d;
 ans--;
 if(ans<0){
  ans+=d;
 }
 std::cout<<ans<<std::endl;
}

Compiler output:
a.cc:5:1: error: '__int64' does not name a type; did you mean '__int64_t'?
    5 | __int64 gcd(__int64 a,__int64 b){
      | ^~~~~~~
      | __int64_t
a.cc:16:2: error: '__int64' does not name a type; did you mean '__int64_t'?
   16 |  __int64 pow(__int64 a,__int64 b, __int64 d){
      |  ^~~~~~~
      |  __int64_t
a.cc: In function 'int main()':
a.cc:36:21: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
   36 |  std::map<std::pair<__int64,__int64>,int> mp;
      |                     ^~~~~~~
      |                     __int64_t
a.cc:36:36: error: template argument 1 is invalid
   36 |  std::map<std::pair<__int64,__int64>,int> mp;
      |                                    ^
a.cc:36:41: error: template argument 1 is invalid
   36 |  std::map<std::pair<__int64,__int64>,int> mp;
      |                                         ^
a.cc:36:41: error: template argument 3 is invalid
a.cc:36:41: error: template argument 4 is invalid
a.cc:39:9: error: expected ';' before 'a'
   39 |  __int64 a,b;
      |         ^~
      |         ;
a.cc:40:9: error: expected ';' before 'zero'
   40 |  __int64 zero=0;
      |         ^~~~~
      |         ;
a.cc:42:13: error: 'a' was not declared in this scope
   42 |   std::cin>>a>>b;
      |             ^
a.cc:42:16: error: 'b' was not declared in this scope
   42 |   std::cin>>a>>b;
      |                ^
a.cc:46:4: error: 'zero' was not declared in this scope
   46 |    zero++;
      |    ^~~~
a.cc:48:6: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   48 |    mp[{0,1}]++;
      |      ^
a.cc:50:6: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   50 |    mp[{1,0}]++;
      |      ^
a.cc:53:12: error: expected ';' before 'g'
   53 |     __int64 g=gcd(-a,-b);
      |            ^~
      |            ;
a.cc:54:13: error: 'g' was not declared in this scope
   54 |     mp[{(-a/g),(-b/g)}]++;
      |             ^
a.cc:54:7: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   54 |     mp[{(-a/g),(-b/g)}]++;
      |       ^
a.cc:56:12: error: expected ';' before 'g'
   56 |     __int64 g=gcd(-a,b);
      |            ^~
      |            ;
a.cc:57:12: error: 'g' was not declared in this scope
   57 |     mp[{(a/g),(b/g)}]++;
      |            ^
a.cc:57:7: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   57 |     mp[{(a/g),(b/g)}]++;
      |       ^
a.cc:59:12: error: expected ';' before 'g'
   59 |     __int64 g=gcd(a,-b);
      |            ^~
      |            ;
a.cc:60:13: error: 'g' was not declared in this scope
   60 |     mp[{(-a/g),(-b/g)}]++;
      |             ^
a.cc:60:7: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   60 |     mp[{(-a/g),(-b/g)}]++;
      |       ^
a.cc:62:12: error: expected ';' before 'g'
   62 |     __int64 g=gcd(a,b);
      |            ^~
      |            ;
a.cc:63:12: error: 'g' was not declared in this scope
   63 |     mp[{(a/g),(b/g)}]++;
      |            ^
a.cc:63:7: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   63 |     mp[{(a/g),(b/g)}]++;
      |       ^
a.cc:73:9: error: expected ';' before 'd'
   73 |  __int64 d=1000000007;
      |         ^~
      |         ;
a.cc:75:9: error: expected ';' before 'ans'
   75 |  __int64 ans=1;
      |         ^~~~
      |         ;
a.cc:76:9: error: expected ';' before 'al'
   76 |  __int64 al=0;
      |         ^~~
      |         ;
a.cc:77:9: error: expected ';' before 'be'
   77 |  __int64 be=0;
      |         ^~~
      |         ;
a.cc:78:9: error: expected ';' before 'ga'
   78 |  __int64 ga=0;
      |         ^~~
      |         ;
a.cc:79:13: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   79 |  for(auto p:mp){
      |             ^~
      |             std::begin
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:79:13: error: 'end' was not declared in this scope; did you mean 'std::end'?
   79 |  for(auto p:mp){
      |             ^~
      |             std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc:81:3: error: 'al' was not declared in this scope
   81 |   al=p.first.first;
      |   ^~
a.cc:82:3: error: 'be' was not declared in this scope
   82 |   be=p.first.second;
      |   ^~
a.cc:83:3: error: 'ga' was not declared in this scope
   83 |   ga=1;
      |   ^~
a.cc:84:15: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   84 |   ga+=pow(2,mp[{al,be}],d)-1;
      |               ^
a.cc:84:25: error: 'd' was not declared in this scope
   84 |   ga+=pow(2,mp[{al,be}],d)-1;
      |                         ^
a.cc:84:7: error: 'pow' was not declared in this scope
   84 |   ga+=pow(2,mp[{al,be}],d)-1;
      |       ^~~
a.cc:86:5: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   86 |   mp[{al,be}]=0;
      |     ^
a.cc:88:9: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   88 |    if(mp[{-be,al}]!=0){
      |         ^
a.cc:89:17: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   89 |     ga+=pow(2,mp[{-be,al}],d)-1;
      |                 ^
a.cc:91:7: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   91 |     mp[{-be,al}]=0;
      |       ^
a.cc:94:9: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   94 |    if(mp[{be,-al}]!=0){
      |         ^
a.cc:95:17: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   95 |     ga+=pow(2,mp[{be,-al}],d)-1;
      |                 ^
a.cc:97:7: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
   97 |     mp[{be,-al}]=0;
      |       ^
a.cc:101:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
  101 |   ans*=ga;
      |   ^~~
      |   abs
a.cc:105:2: error: 'ans' was not declared in this scope; did you mean 'abs'?
  105 |  ans+=zero;
      |  ^~~
      |  abs
a.cc:105:7: error: 'zero' was not declared in this scope
  105 |  ans+=zero;
      |       ^~~~
a.cc:106:10: error: 'd' was not declared in this scope
  106 |  ans=ans%d;
      |          ^