Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <numeric>
#include <iomanip>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define rrep(i, n) for (int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for (int i=(int)(n);i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=(int)(r)-1;i>=l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;
using vpii=vector<pii>;
using ll=long long;

constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

const int mod = TEN(9)+7;

ll inv[200010];
ll fac[200010], fac_inv[200010];

ll C(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return ((fac[n] * fac_inv[k] % mod) * fac_inv[n - k]) % mod;
}

void comb_init()
{
	int N = 200005;
	inv[1] = 1;

	for (int i = 2; i <= N; ++i) {
		inv[i] = mod - (mod / i) * inv[mod % i] % mod;
	}

	fac[0] = fac_inv[0] = 1;

	for (int i = 1; i <= N; ++i) {
		fac[i] = (fac[i - 1] * i) % mod;
		fac_inv[i] = (fac_inv[i - 1] * inv[i]) % mod;
	}
}

inline ll mod_pow(ll a, ll x, ll m)
{
	if (x == 0) return 1;

	ll res = mod_pow(a, x / 2, m);

	res *= res;
	res %= m;

	if (x % 2) {
		res *= a;
		res %= m;
	}

	return res;
}


int N;
double A[200010];
double B[200010];
map<double, int> m;
map<double, bool> used;
vpii data;

int dp[200010][3];

signed main()
{
	cin >> N;

	rep(i, N) {
		cin >> A[i] >> B[i];
		m[A[i] / B[i]]++;
	}

	for (auto a : m) {
		if (used[a.fst]) continue;
	
		data.PB(m[a.fst], m[-1/a.fst]);
		//printf("data.PB(%lld, %lld)\n", m[a.fst], m[-1/a.fst]);

		used[a.fst] = used[-1/a.fst] = true;
	}

	int n = data.size();

	dp[0][0] = 1;

	for (int i = 0; i < n; ++i) {
		dp[i + 1][0] =
			(dp[i][0] + dp[i][1] + dp[i][2]) % mod;
		dp[i + 1][1] =
			(dp[i][0] + dp[i][1] + dp[i][2]) * (mod_pow(2, data[i].fst, mod) - 1) % mod;
		dp[i + 1][2] =
			(dp[i][0] + dp[i][1] + dp[i][2]) * (mod_pow(2, data[i].scd, mod) - 1) % mod;

		if (dp[i + 1][1] < 0) dp[i + 1][1] += mod;
		if (dp[i + 1][2] < 0) dp[i + 1][2] += mod;
	}

	int ans = (dp[n][0] + dp[n][1] + dp[n][2] - 1) % mod;

	cout << ans << endl;
}






Compiler output:
a.cc: In function 'int main()':
a.cc:109:17: error: reference to 'data' is ambiguous
  109 |                 data.PB(m[a.fst], m[-1/a.fst]);
      |                 ^~~~
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:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:93:6: note:                 'vpii data'
   93 | vpii data;
      |      ^~~~
a.cc:115:17: error: reference to 'data' is ambiguous
  115 |         int n = data.size();
      |                 ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:93:6: note:                 'vpii data'
   93 | vpii data;
      |      ^~~~
a.cc:123:72: error: reference to 'data' is ambiguous
  123 |                         (dp[i][0] + dp[i][1] + dp[i][2]) * (mod_pow(2, data[i].fst, mod) - 1) % mod;
      |                                                                        ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:93:6: note:                 'vpii data'
   93 | vpii data;
      |      ^~~~
a.cc:125:72: error: reference to 'data' is ambiguous
  125 |                         (dp[i][0] + dp[i][1] + dp[i][2]) * (mod_pow(2, data[i].scd, mod) - 1) % mod;
      |                                                                        ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:93:6: note:                 'vpii data'
   93 | vpii data;
      |      ^~~~