Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
constexpr long long BASE = 1000000007;



typedef long long ll;

using namespace std;

template<typename T>

T calc_gcd(T a, T b) {
	if (a < 0)a = -a;
	if (b < 0)b = -b;
	if (b > a) {
		swap(a, b);
		
	}
	if (b == 0)return a;
	while (a % b) {
		a = a % b;
		swap(a, b);
	}
	return b;
}

int modpow(int a, int b, int base) {
	vector<int> vb, va;
	while (b != 0) {
		vb.push_back(b % 2);
		b /= 2;
		va.push_back(a);
		a *= a;
		a %= base;
	}
	int ans = 1;
	for (int i = 0;i < vb.size();i++) {
		if (vb[i] == 1) {
			ans *= va[i];
			ans %= base;
		}
	}
	return ans;
}
 
inline bool operator<=(pair<ll, ll> a, pair<ll, ll> b) {
	if (a.first > b.first)return false;
	if (a.first < b.first)return true;
	return a.second <= b.second;
}

inline bool operator<(pair<ll, ll> a, pair<ll, ll> b) {
	if (a.first > b.first)return false;
	if (a.first < b.first)return true;
	return a.second < b.second;
}
inline bool operator>(pair<ll, ll> a, pair<ll, ll> b) {
	if (a.first < b.first)return false;
	if (a.first > b.first)return true;
	return a.second > b.second;
}
inline bool operator>=(pair<ll, ll> a, pair<ll, ll> b) {
	if (a.first < b.first)return false;
	if (a.first > b.first)return true;
	return a.second >= b.second;
}
inline bool operator==(pair<ll, ll> a, pair<ll, ll> b) {
	return (a.first == b.first && a.second == b.second);
}
inline bool operator!=(pair<ll, ll> a, pair<ll, ll> b) {
	return !(a.first == b.first && a.second == b.second);
}

int bs(int l, int r, pair<long long,ll>);

vector<pair<ll,ll>> v;

int main() {
	int n;
	long long a, b;
	cin >> n;
	long long num_0=0;
	int index = 0;
	for (int i = 0;i < n;i++) {
		cin >> a >> b;
		if (a == 0 && b == 0) {
			num_0++;
		}
		else {
			if (b < 0) {
				a = -a;
				b = -b;
			}
			else if (b == 0 && a < 0) {
				a = -a;
			}
			/*
			long long c = calc_gcd(a, b);
			a /= c;
			b /= c;
			*/
			v.push_back(make_pair(a, b));
		}
	}
	sort(v.begin(),v.end());
	vector<pair<pair<long long,long long>, int>> v2;
	v2.push_back(make_pair(v[0], 1));
	pair<long long,long long> now = v[0];
	for (int i = 1;i < v.size();i++) {
		else {
			v2.push_back(make_pair(v[i], 1));
			now = v[i];
		}
	}
	unique(v.begin(), v.end());
	long long sum = 0;
	long long psum = 0;
	
	for (int i = 0;i < v2.size();i++) {
		psum = sum;
		if (v2[i].first.first<= 0) {
			sum += (1LL + sum);// *((long long)modpow(2, v2[i].second, BASE) - 1LL);
			sum %= BASE;
			if (v2[i].first.first == 0) {
				//int index = bs(0, v.size() - 1, make_pair(1LL, 0LL));
				if (index != -1) {
					sum += (1LL + psum);// *((long long)modpow(2, v2[index].second, BASE) - 1LL);
					sum %= BASE;
				}
			}
			else {

				//int index = bs(0, v.size() - 1,make_pair(v2[i].first.second, -v2[i].first.first));
				if (index != -1) {
					sum += (1LL + psum);// *((long long)modpow(2, v2[index].second, BASE) - 1LL);
					sum %= BASE;
				}
			}
			
		}else {
			if (v2[i].first.second == 0) {
				if (/*bs(0,v.size()-1,make_pair(0,1))!=-1*/1) {

				}
				else {
					sum += (1LL + sum);// *((long long)modpow(2, v2[i].second, BASE) - 1LL);
					sum %= BASE;
				}
			}else if (1/*bs(0,v.size()-1,make_pair(-v2[i].first.second, v2[i].first.first))!=-1*/) {
				
			}
			else {
				sum += (1LL + sum);//*((long long)modpow(2, v2[i].second, BASE) - 1LL);
				sum %= BASE;
			}
		}
	}
	
	
	cout << (sum + num_0) % BASE << endl;
}

int bs(int l, int r, pair<ll, ll> a) {
	if (v[l] > a)return -1;
	if (v[r] < a)return -1;
	if (v[r] == a)return r;
	if (r - l <= 1) {
		if (v[l] == a)return l;
		else return -1;
	}
	else {
		int mid = (l + r) / 2;
		if (v[mid] > a) {
			return bs(l, mid, a);
		}
		else {
			return bs(mid, r, a);
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:112:17: error: 'else' without a previous 'if'
  112 |                 else {
      |                 ^~~~
a.cc:117:15: warning: ignoring return value of '_FIter std::unique(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >]', declared with attribute 'nodiscard' [-Wunused-result]
  117 |         unique(v.begin(), v.end());
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:891:5: note: declared here
  891 |     unique(_ForwardIterator __first, _ForwardIterator __last)
      |     ^~~~~~