Language: C++

/*
* Welcome to my code!
*---------------------------------------------*
* author : lynmisakura(twitter : @andoreiji11)
*/
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size()) 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;
using pl = pair<ll,ll>;
using vpl = vector<pl>;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){ int sz = a.size();
for(int i=0;i<a.size();i++)cout << a[i] << (i < sz-1 ? ' ' : '\n'); }
void ioboost(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}
///////////////////////////////////////////////////////////
/*
 * Modint struct
 * library author : @snuke
 * */
const int mod = 1e9 + 7;
struct mint {
  long long x; // typedef long long ll;
  mint(long long x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) { if((x+=a.x)>=mod)x-=mod;return *this;}
  mint& operator-=(const mint a) { if((x+=mod-a.x)>=mod)x-=mod; return *this;}
  mint& operator*=(const mint a) { (x *=a.x)%=mod; return *this;}
  mint operator+(const mint a) const { mint res(*this);return res+=a;}
  mint operator-(const mint a) const { mint res(*this);return res-=a;}
  mint operator*(const mint a) const { mint res(*this);return res*=a;}
  mint pow(ll t) const {
    if (!t) return 1;mint a = pow(t>>1);a*=a;
    if (t&1) a *= *this;return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return (*this) *= a.inv();}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


#define F first
#define S second


map<pair<ll,ll>,pair<int,int>> M;

ll a[200020],b[200020];



int main(void){
  ioboost();

  int n;cin >> n;
  rep(i,n)cin >> a[i] >> b[i];  
  
  rep(i,n){
    if(gcd(abs(a[i]),abs(b[i])) == 0){
      cout << "WA" << '\n';
      return 0;
    }
    ll p = a[i] / max(1,gcd(abs(a[i]),abs(b[i])));
    ll q = b[i] / max(1,gcd(abs(a[i]),abs(b[i])));
    
    if(q < 0){
      ll wq = q,wp = p;
      p = -wp;
      q = -wq;
    }
    if(M[mp(p,q)].F == 0)M[mp(p,q)].F = 1;
    else M[mp(p,q)].first++;

    M[mp(p,q)].second = 0;
  }
 // for(auto i : M)cout << i.F.F << ' ' << i.F.S << '\n';

  vector<pair<int,int> > P;
  
  for(auto i : M){
    if(i.second.second++ == 0){
      ll p = i.F.F;
      ll q = i.F.S;
      pair<ll,ll> r = mp(q,-p);
      if(M[r].F == 0)P.eb(i.second.first,0);
      else P.eb(i.second.first,M[r].first);
      M[r].second++;
    }
  }
//  for(auto i : P)cout << i.F << ' ' << i.S << '\n';
  int m = P.size();
  mint ans = 1;
  rep(i,m){
    if(P[i].S == 0 || P[i].F == 0){
      ans *= mint(2).pow(P[i].S + P[i].F);
      continue;
    }
    ans *= mint(2).pow(P[i].S + P[i].F) - (mint)(mint(2).pow(P[i].S) - 1) *(mint)(mint(2).pow(P[i].F) - 1);
  }
  ans -= 1;
  cout << ans << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:108:22: error: no matching function for call to 'max(int, std::common_type_t<long long int, long long int>)'
  108 |     ll p = a[i] / max(1,gcd(abs(a[i]),abs(b[i])));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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:6:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:108:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::common_type_t<long long int, long long int>' {aka 'long long int'})
  108 |     ll p = a[i] / max(1,gcd(abs(a[i]),abs(b[i])));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:108:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  108 |     ll p = a[i] / max(1,gcd(abs(a[i]),abs(b[i])));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:109:22: error: no matching function for call to 'max(int, std::common_type_t<long long int, long long int>)'
  109 |     ll q = b[i] / max(1,gcd(abs(a[i]),abs(b[i])));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:109:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::common_type_t<long long int, long long int>' {aka 'long long int'})
  109 |     ll q = b[i] / max(1,gcd(abs(a[i]),abs(b[i])));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:109:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  109 |     ll q = b[i] / max(1,gcd(abs(a[i]),abs(b[i])));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~