Language: C++

#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
typedef int128_t lint;
typedef std::pair<lint, lint> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = 1e-9;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
lint mypow(lint a, lint b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	lint memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
std::string to_string(std::vector<int>& vec) {
	std::string res = "[";
	rep(i, vec.size() - 1)res += std::to_string(vec[i]) + ", ";
	res += std::to_string(vec.back()) + "]";
	return res;
}
class Rational {
public:
	lint num, den;
	Rational() :num(0), den(1) {}
	Rational(lint p) :num(p), den(1) {}
	Rational(lint p, lint q) :num(p), den(q) {
		reduce();
	}
	void reduce() {
		if (den < 0) {
			num = -num; den = -den;
		}
		if (num == 0)den = 1;
		else {
			lint r = gcd(abs(num), abs(den));
			num /= r; den /= r;
		}
	}
	inline bool operator<(const Rational& rhs)const {
		return num * rhs.den < rhs.num * den;
	}
	inline bool operator==(const Rational& rhs)const {
		return num * rhs.den == rhs.num * den;
	}
	inline bool operator>(const Rational& rhs)const {
		return num * rhs.den > rhs.num * den;
	}
	inline Rational& operator+=(Rational rhs) {
		lint r = lcm(this->den, rhs.den);
		num *= r / this->den;
		rhs.num *= r / rhs.den;
		den = rhs.den = r;
		num += rhs.num;
		reduce();
		return *this;
	}
	inline Rational operator-() {
		return Rational(-num, den);
	}
	inline Rational& operator-=(Rational rhs) {
		lint r = lcm(this->den, rhs.den);
		num *= r / this->den;
		rhs.num *= r / rhs.den;
		den = rhs.den = r;
		num -= rhs.num;
		reduce();
		return *this;
	}
	inline Rational& operator*=(const Rational& rhs) {
		num *= rhs.num;
		den *= rhs.den;
		reduce();
		return *this;
	}
	inline Rational& operator/=(const Rational& rhs) {
		num *= rhs.den;
		den *= rhs.num;
		reduce();
		return *this;
	}
	template<typename T> Rational operator+(const T& rhs)const { return Rational(*this) += rhs; }
	template<typename T> Rational& operator+=(const T& rhs) { return operator+=(Rational(rhs)); }
	template<typename T> Rational operator-(const T& rhs)const { return Rational(*this) -= rhs; }
	template<typename T> Rational& operator-=(const T& rhs) { return operator-=(Rational(rhs)); }
	template<typename T> Rational operator*(const T& rhs)const { return Rational(*this) *= rhs; }
	template<typename T> Rational& operator*=(const T& rhs) { return operator*=(Rational(rhs)); }
	template<typename T> Rational operator/(const T& rhs)const { return Rational(*this) /= rhs; }
	template<typename T> Rational& operator/=(const T& rhs) { return operator/=(Rational(rhs)); }

	Rational inv() const{
		return Rational(den,num);
	}
};
std::ostream& operator<<(std::ostream& ofs, const Rational& x) {
	ofs << x.num << "/" << x.den;
	return ofs;
}
template<unsigned int modulo = 1000000007>
class ModInt {
	lint value;
public:
	ModInt() : value(0) {}
	template<typename T>
	ModInt(T value = 0) : value(value) {
		if (value < 0)value = -(lint)(-value % modulo) + modulo;
		this->value = value % modulo;
	}
	inline operator int()const { return value; }
	inline ModInt& operator+=(const ModInt& x) {
		value += x.value;
		if (value >= modulo)value -= modulo;
		return *this;
	}
	inline ModInt& operator++() {
		if (value == modulo - 1)value = 0;
		else value++;
		return *this;
	}
	inline ModInt operator-()const {
		return ModInt(0) -= *this;
	}
	inline ModInt& operator-=(const ModInt& x) {
		value -= x.value;
		if (value < 0)value += modulo;
		return *this;
	}
	inline ModInt& operator--() {
		if (value == 0)value = modulo - 1;
		else value--;
		return *this;
	}
	inline ModInt& operator*=(const ModInt& x) {
		value = value * x.value % modulo;
		return *this;
	}
	inline ModInt& operator/=(ModInt rhs) {
		int exp = modulo - 2;
		while (exp) {
			if (exp & 1)*this *= rhs;
			rhs *= rhs;
			exp >>= 1;
		}
		return *this;
	}
	template<typename T> ModInt operator+(const T& rhs)const { return ModInt(*this) += rhs; }
	template<typename T> ModInt& operator+=(const T& rhs) { return operator+=(ModInt(rhs)); }
	template<typename T> ModInt operator-(const T& rhs)const { return ModInt(*this) -= rhs; }
	template<typename T> ModInt& operator-=(const T& rhs) { return operator-=(ModInt(rhs)); }
	template<typename T> ModInt operator*(const T& rhs)const { return ModInt(*this) *= rhs; }
	template<typename T> ModInt& operator*=(const T& rhs) { return operator*=(ModInt(rhs)); }
	template<typename T> ModInt operator/(const T& rhs)const { return ModInt(*this) /= rhs; }
	template<typename T> ModInt& operator/=(const T& rhs) { return operator/=(ModInt(rhs)); }
};
template<unsigned int T>
std::istream& operator>>(std::istream& ist, ModInt<T>& x) {
	lint a;
	ist >> a;
	x = a;
	return ist;
}
int n;
int a0,b0,both0;
std::map<Rational,int> mp;
std::set<Rational> d;
int main(){
	std::cin>>n;
	rep(i,n){
		lint a,b;
		std::cin>>a>>b;
		if(a==0&&b==0)both0++;
		else if(a==0)a0++;
		else if(b==0)b0++;
		else mp[Rational(a,b)]++;
	}
	ModInt<> ans=1;
	for(auto ite=mp.begin();ite!=mp.end();ite++){
		if(!(*ite).second)continue;
		if(d.find((*ite).first)!=d.end())continue;
		ans*=modpow(2,(*ite).second,1000000007)+modpow(2,mp[-(*ite).first.inv()],1000000007)-1;
		d.insert(-(*ite).first.inv());
	}
	ans*=modpow(2,a0,1000000007)+modpow(2,b0,1000000007)-1;
	ans+=both0;
	ans-=1;
	std::cout<<ans<<std::endl;
	return 0;
}

Compiler output:
a.cc:34:9: error: 'int128_t' does not name a type; did you mean 'int8_t'?
   34 | typedef int128_t lint;
      |         ^~~~~~~~
      |         int8_t
a.cc:35:19: error: 'lint' was not declared in this scope; did you mean 'uint'?
   35 | typedef std::pair<lint, lint> P;
      |                   ^~~~
      |                   uint
a.cc:35:25: error: 'lint' was not declared in this scope; did you mean 'uint'?
   35 | typedef std::pair<lint, lint> P;
      |                         ^~~~
      |                         uint
a.cc:35:29: error: template argument 1 is invalid
   35 | typedef std::pair<lint, lint> P;
      |                             ^
a.cc:35:29: error: template argument 2 is invalid
a.cc:37:11: error: 'lint' does not name a type; did you mean 'uint'?
   37 | constexpr lint LINF = LLONG_MAX/2;
      |           ^~~~
      |           uint
a.cc:57:8: error: 'lint' does not name a type; did you mean 'uint'?
   57 | inline lint gcd(lint a, lint b) {
      |        ^~~~
      |        uint
a.cc:64:8: error: 'lint' does not name a type; did you mean 'uint'?
   64 | inline lint lcm(lint a, lint b) {
      |        ^~~~
      |        uint
a.cc:67:14: error: 'lint' was not declared in this scope; did you mean 'uint'?
   67 | bool isprime(lint n) {
      |              ^~~~
      |              uint
a.cc:74:1: error: 'lint' does not name a type; did you mean 'uint'?
   74 | lint mypow(lint a, lint b) {
      | ^~~~
      | uint
a.cc:80:1: error: 'lint' does not name a type; did you mean 'uint'?
   80 | lint modpow(lint a, lint b, lint m) {
      | ^~~~
      | uint
a.cc: In function 'void printArray(std::vector<_Tp>&)':
a.cc:31:33: error: 'lint' was not declared in this scope; did you mean 'uint'?
   31 | #define rep(i,n) for(int i=0;i<(lint)(n);i++)
      |                                 ^~~~
a.cc:88:9: note: in expansion of macro 'rep'
   88 |         rep(i, vec.size() - 1)std::cout << vec[i] << " ";
      |         ^~~
a.cc: In function 'std::string to_string(std::vector<int>&)':
a.cc:31:33: error: 'lint' was not declared in this scope; did you mean 'uint'?
   31 | #define rep(i,n) for(int i=0;i<(lint)(n);i++)
      |                                 ^~~~
a.cc:102:9: note: in expansion of macro 'rep'
  102 |         rep(i, vec.size() - 1)res += std::to_string(vec[i]) + ", ";
      |         ^~~
a.cc: At global scope:
a.cc:108:9: error: 'lint' does not name a type; did you mean 'uint'?
  108 |         lint num, den;
      |         ^~~~
      |         uint
a.cc:110:22: error: expected ')' before 'p'
  110 |         Rational(lint p) :num(p), den(1) {}
      |                 ~    ^~
      |                      )
a.cc:111:22: error: expected ')' before 'p'
  111 |         Rational(lint p, lint q) :num(p), den(q) {
      |                 ~    ^~
      |                      )
a.cc: In constructor 'Rational::Rational()':
a.cc:109:21: error: class 'Rational' does not have any field named 'num'
  109 |         Rational() :num(0), den(1) {}
      |                     ^~~
a.cc:109:29: error: class 'Rational' does not have any field named 'den'
  109 |         Rational() :num(0), den(1) {}
      |                             ^~~
a.cc: In member function 'void Rational::reduce()':
a.cc:115:21: error: 'den' was not declared in this scope
  115 |                 if (den < 0) {
      |                     ^~~
a.cc:116:25: error: 'num' was not declared in this scope; did you mean 'enum'?
  116 |                         num = -num; den = -den;
      |                         ^~~
      |                         enum
a.cc:118:21: error: 'num' was not declared in this scope; did you mean 'enum'?
  118 |                 if (num == 0)den = 1;
      |                     ^~~
      |                     enum
a.cc:118:30: error: 'den' was not declared in this scope
  118 |                 if (num == 0)den = 1;
      |                              ^~~
a.cc:120:25: error: 'lint' was not declared in this scope; did you mean 'uint'?
  120 |                         lint r = gcd(abs(num), abs(den));
      |                         ^~~~
      |                         uint
a.cc:121:32: error: 'r' was not declared in this scope
  121 |                         num /= r; den /= r;
      |                                ^
a.cc:121:35: error: 'den' was not declared in this scope
  121 |                         num /= r; den /= r;
      |                                   ^~~
a.cc: In member function 'bool Rational::operator<(const Rational&) const':
a.cc:125:24: error: 'num' was not declared in this scope; did you mean 'enum'?
  125 |                 return num * rhs.den < rhs.num * den;
      |                        ^~~
      |                        enum
a.cc:125:34: error: 'const class Rational' has no member named 'den'
  125 |                 return num * rhs.den < rhs.num * den;
      |                                  ^~~
a.cc:125:44: error: 'const class Rational' has no member named 'num'
  125 |                 return num * rhs.den < rhs.num * den;
      |                                            ^~~
a.cc:125:50: error: 'den' was not declared in this scope
  125 |                 return num * rhs.den < rhs.num * den;
      |                                                  ^~~
a.cc: In member function 'bool Rational::operator==(const Rational&) const':
a.cc:128:24: error: 'num' was not declared in this scope; did you mean 'enum'?
  128 |                 return num * rhs.den == rhs.num * den;
      |                        ^~~
      |                        enum
a.cc:128:34: error: 'const class Rational' has no member named 'den'
  128 |                 return num * rhs.den == rhs.num * den;
      |                                  ^~~
a.cc:128:45: error: 'const class Rational' has no member named 'num'
  128 |                 return num * rhs.den == rhs.num * den;
      |                                             ^~~
a.cc:128:51: error: 'den' was not declared in this scope
  128 |                 return num * rhs.den == rhs.num * den;
      |                                                   ^~~
a.cc: In member function 'bool Rational::operator>(const Rational&) const':
a.cc:131:24: error: 'num' was not declared in this scope; did you mean 'enum'?
  131 |                 return num * rhs.den > rhs.num * den;
      |                        ^~~
      |                        enum
a.cc:131:34: error: 'const class Rational' has no member named 'den'
  131 |                 return num * rhs.den > rhs.num * den;
      |                                  ^~~
a.cc:131:44: error: 'const class Rational' has no member named 'num'
  131 |                 return num * rhs.den > rhs.num * den;
      |                                            ^~~
a.cc:131:50: error: 'den' was not declared in this scope
  131 |                 return num * rhs.den > rhs.num * den;
      |                                                  ^~~
a.cc: In member function 'Rational& Rational::operator+=(Rational)':
a.cc:134:17: error: 'lint' was not declared in this scope; did you mean 'uint'?
  134 |                 lint r = lcm(this->den, rhs.den);
      |                 ^~~~
      |                 uint
a.cc:135:17: error: 'num' was not declared in this scope; did you mean 'enum'?
  135 |                 num *= r / this->den;
      |                 ^~~
      |                 enum
a.cc:135:24: error: 'r' was not declared in this scope
  135 |                 num *= r / this->den;
      |                        ^
a.cc:135:34: error: 'class Rational' has no member named 'den'
  135 |                 num *= r / this->den;
      |                                  ^~~
a.cc:136:21: error: 'class Rational' has no member named 'num'
  136 |                 rhs.num *= r / rhs.den;
      |                     ^~~
a.cc:136:36: error: 'class Rational' has no member named 'den'
  136 |                 rhs.num *= r / rhs.den;
      |                                    ^~~
a.cc:137:17: error: 'den' was not declared in this scope
  137 |                 den = rhs.den = r;
      |                 ^~~
a.cc:137:27: error: 'class Rational' has no member named 'den'
  137 |                 den = rhs.den = r;
      |                           ^~~
a.cc:138:28: error: 'class Rational' has no member named 'num'
  138 |                 num += rhs.num;
      |                            ^~~
a.cc: In member function 'Rational Rational::operator-()':
a.cc:143:34: error: 'num' was not declared in this scope; did you mean 'enum'?
  143 |                 return Rational(-num, den);
      |                                  ^~~
      |                                  enum
a.cc:143:39: error: 'den' was not declared in this scope
  143 |                 return Rational(-num, den);
      |                                       ^~~
a.cc: In member function 'Rational& Rational::operator-=(Rational)':
a.cc:146:17: error: 'lint' was not declared in this scope; did you mean 'uint'?
  146 |                 lint r = lcm(this->den, rhs.den);
      |                 ^~~~
      |                 uint
a.cc:147:17: error: 'num' was not declared in this scope; did you mean 'enum'?
  147 |                 num *= r / this->den;
      |                 ^~~
      |                 enum
a.cc:147:24: error: 'r' was not declared in this scope
  147 |                 num *= r / this->den;
      |                        ^
a.cc:147:34: error: 'class Rational' has no member named 'den'
  147 |                 num *= r / this->den;
      |                                  ^~~
a.cc:148:21: error: 'class Rational' has no member named 'num'
  148 |                 rhs.num *= r / rhs.den;
      |                     ^~~
a.cc:148:36: error: 'class Rational' has no member named 'den'
  148 |                 rhs.num *= r / rhs.den;
      |                                    ^~~
a.cc:149:17: error: 'den' was not declared in this scope
  149 |                 den = rhs.den = r;
      |                 ^~~
a.cc:149:27: error: 'class Rational' has no member named 'den'
  149 |                 den = rhs.den = r;
      |                           ^~~
a.cc:150:28: error: 'class Rational' has no member named 'num'
  150 |                 num -= rhs.num;
      |