Language: C++

#include "bits/stdc++.h"

using namespace std;

#define rep(loop, N) for (int loop = 0; loop < N; loop++)

struct Node {
	Node* parent = NULL;
	vector<Node*> child;
	long long value = 0;
};
struct Edge {
	int parent = 0;
	int child = 0;
	bool operator <(const Edge& right) const { return parent < right.parent; }
};
struct Tree {
	vector<Node> node;
	Tree(int, vector<Edge>);
};
Tree::Tree(int nodeNum, vector<Edge> edge) {
	node.resize(nodeNum);
	for (Edge& it : edge) {
		node[it.child].parent = &node[it.parent];
		node[it.parent].child.push_back(&node[it.child]);
	}
}

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
		else {
			break;
		}
	}
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}
long long gcd(long long num1, long long num2) {
	return (num2 == 0 ? num1 : gcd(num2, num1 % num2));
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	long long m_module = 1000000007;
	vector<struct Memo> memo;
public:
	long long calculate(int, int);
	Combination1(int, long long);
};
long long Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, long long module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Therefore(void) {

	int N; cin >> N;

	switch (N % 10) {
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		cout << "hon" << endl; 
		break;
	case 0:
	case 1:
	case 6:
	case 8:
		cout << "pon" << endl;
		break;
	case 3:
		cout << "bon" << endl;
		break;
	}
	return;

}

void B_Triple_Dots(void) {

	int K; cin >> K;
	string S; cin >> S;

	if ((int)S.size() <= K)	cout << S << endl;
	else				cout << S.substr(0, K) << "..." << endl;
	return;
}

void C_Colon(void) {

	double A, B, H, M; cin >> A >> B >> H >> M;

	cout << pow(A * A + B * B - 2 * A * B * cos((H / 6.0 - 11.0 / 360.0 * M) * 3.14159265358979), 0.5) << endl;
	return;
}

void D_Double_Dots(void) {

	struct Room { int sign = -1; vector<int> next; };

	int N, M; cin >> N >> M;
	vector<Room> room(N);
	rep(loop, M) {
		int A, B; cin >> A >> B; A--; B--;
		room[A].next.push_back(B);
		room[B].next.push_back(A);
	}

	vector<int> list, pre_list;
	pre_list.push_back(0);
	
	rep(loop, N) {
		bool changed = false;
		for (int index : pre_list) {
			for (int next_index : room[index].next) {
				if (room[next_index].sign == -1) {
					room[next_index].sign = index;
					list.push_back(next_index);
					changed = true;
				}
			}
		}
		if (changed) {
			pre_list = list;
			list.resize(0);
		}
		else {
			break;
		}
	}

	cout << "Yes" << endl;
	for (int index = 1; index < N; index++) {
		cout << room[index].sign + 1 << endl;
	}
	return;
}

void E_Bullet(void) {

	constexpr int mod = 1000000007;

	struct Fish { 
		long long A; 
		long long B; 
		bool operator < (const Fish& right) {
			return (A == right.A ? B < right.B : A < right.A);
		}
	};

	int N; cin >> N;
	map<Fish, int> fMap;
	rep(loop, N) {
		long long A, B; cin >> A >> B;
		long long GCD = gcd(A, B);
		A /= GCD; B /= GCD;
		if (A < 0LL) {
			A = -A;
			B = -B;
		}
		Fish new_fish = { A,B };
		fMap[new_fish]++;
	}
	vector<long long> com(N + 1);
	com[0] = 1;
	for (int index = 1; index <= N; index++) {
		com[index] = (com[index - 1] * 2) % mod;
	}
	long long sum = 0LL;
	for (auto loop = fMap.begin(); loop != fMap.end(); loop++) {
		Fish fish = loop->first;
		Fish target;
		if (fish.B < 0LL) target = { -fish.B,fish.A };
		else			target = { fish.B,-fish.A };
		sum = (sum + com[fMap[target]] - 1) % mod;
	}

	cout << sum << endl;
	return;
}

int main(void) {

	cout << fixed << setprecision(15);
	//A_Therefore();
	//B_Triple_Dots();
	//C_Colon();
	//D_Double_Dots();
	E_Bullet();
	return 0;
}


Compiler output:
In file included from /usr/include/c++/14/string:49,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = E_Bullet()::Fish]':
/usr/include/c++/14/bits/stl_map.h:511:32:   required from 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = E_Bullet()::Fish; _Tp = int; _Compare = std::less<E_Bullet()::Fish>; _Alloc = std::allocator<std::pair<const E_Bullet()::Fish, int> >; mapped_type = int; key_type = E_Bullet()::Fish]'
  511 |         if (__i == end() || key_comp()(__k, (*__i).first))
      |                             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:229:16:   required from here
  229 |                 fMap[new_fish]++;
      |                              ^
/usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const E_Bullet()::Fish' and 'const E_Bullet()::Fish')
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
a.cc:213:22: note: candidate: 'bool E_Bullet()::Fish::operator<(const E_Bullet()::Fish&)' (near match)
  213 |                 bool operator < (const Fish& right) {
      |                      ^~~~~~~~
a.cc:213:22: note:   passing 'const E_Bullet()::Fish*' as 'this' argument discards qualifiers
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1045 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const E_Bullet()::Fish' is not derived from 'const std::pair<_T1, _T2>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  448 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const E_Bullet()::Fish' is not derived from 'const std::reverse_iterator<_Iterator>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  493 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const E_Bullet()::Fish' is not derived from 'const std::reverse_iterator<_Iterator>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1694 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const E_Bullet()::Fish' is not derived from 'const std::move_iterator<_IteratorL>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1760 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note:   'const E_Bullet()::Fish' is not derived from 'const std::move_iterator<_IteratorL>'
  405 |       { return __x < __y; }
      |                ~~~~^~~~~