Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
#define PI 3.14159265358979323846264338327950L
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
inline ll mod(ll val, ll m) {long long res = val % m;if (res < 0) res += m;return res;}
inline int divisor_count(int n) {int j, c = 1;for (int i = 2; i * i <= n; i++, c *= j)for (j = 1; !(n % i); j++) n /= i;return (1 < n) ? c * 2 : c;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const ll MOD = 1000000007;
/* グラフGの頂点sからDFSして、各頂点の深さを返却 */
vector<int> bfs(int s, Graph G) {
    int n = G.size();
    // 深さ(-1に初期化し未到達を表現)
    vector<int> dp(n,-1);
    // キュー(未訪問の頂点を格納)
    queue<int> que;
    
    // 初期条件(頂点sを初期ノードとする)
    dp[s] = 0;
    que.push(s);
    
    // BFS開始(キューが空になるまで探索を行う)
    while(!que.empty()) {
        // キューから先頭頂点を取り出す
        int v = que.front(); que.pop();
        // v から辿れる頂点をすべて調べる
        for(int nv: G[v]) {
            // 訪問済頂点は探索しない
            if(dp[nv] != -1) continue;
            
            // 新たな頂点nvについて深さを更新してキューに追加
            dp[nv] = dp[v] + 1;
            que.push(nv);
        }
    }
    return dp;
}


int main(){

    INT(n);
  
    ll cnt = 0;
    map<pair<ll,ll>, pair<int,int>> chk;
    ll pw[200200] = {1};
    for(int i = 1; i < 200200; ++i) {
        pw[i] = (pw[i-1]*2) % MOD;
    }

    while(n--){
          LL(a,b);

    if(a == 0 && b == 0) {
        cnt++;
    }
    if(make_pair(a,b) < make_pair(0LL,0LL)) {
        a = -a;
        b = -b;
    }
    ll g = gcd(abs(a),abs(b));

    a /= g; b /= g;

    if(b > 0) {
        chk[{a,b}].first++;
    } else {
        chk[{-b,a}].second++;
    }
    }
    
    ll r = 1LL;
    for(auto& p:chk) {
        r = r * (pw[p.second.first] + pw[p.second.second] - 1) % MOD;
    }

    cout << (cnt+r) % MOD << endl;

    return 0;
}#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
#define SYOU(x) fixed<<setprecision(x) //小数点桁数を指定する
#define PI 3.14159265358979323846264338327950L
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
inline ll mod(ll val, ll m) {long long res = val % m;if (res < 0) res += m;return res;}
inline int divisor_count(int n) {int j, c = 1;for (int i = 2; i * i <= n; i++, c *= j)for (j = 1; !(n % i); j++) n /= i;return (1 < n) ? c * 2 : c;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
const ll MOD = 1000000007;
/* グラフGの頂点sからDFSして、各頂点の深さを返却 */
vector<int> bfs(int s, Graph G) {
    int n = G.size();
    // 深さ(-1に初期化し未到達を表現)
    vector<int> dp(n,-1);
    // キュー(未訪問の頂点を格納)
    queue<int> que;
    
    // 初期条件(頂点sを初期ノードとする)
    dp[s] = 0;
    que.push(s);
    
    // BFS開始(キューが空になるまで探索を行う)
    while(!que.empty()) {
        // キューから先頭頂点を取り出す
        int v = que.front(); que.pop();
        // v から辿れる頂点をすべて調べる
        for(int nv: G[v]) {
            // 訪問済頂点は探索しない
            if(dp[nv] != -1) continue;
            
            // 新たな頂点nvについて深さを更新してキューに追加
            dp[nv] = dp[v] + 1;
            que.push(nv);
        }
    }
    return dp;
}


int main(){

    INT(n);
  
    ll cnt = 0;
    map<pair<ll,ll>, pair<int,int>> chk;
    ll pw[200200] = {1};
    for(int i = 1; i < 200200; ++i) {
        pw[i] = (pw[i-1]*2) % MOD;
    }

    while(n--){
          LL(a,b);

    if(a == 0 && b == 0) {
        cnt++;
    }
    if(make_pair(a,b) < make_pair(0LL,0LL)) {
        a = -a;
        b = -b;
    }
    ll g = gcd(abs(a),abs(b));

    a /= g; b /= g;

    if(b > 0) {
        chk[{a,b}].first++;
    } else {
        chk[{-b,a}].second++;
    }
    }
    
    ll r = 1LL;
    for(auto& p:chk) {
        r = r * (pw[p.second.first] + pw[p.second.second] - 1) % MOD;
    }

    cout << (cnt+r) % MOD << endl;

    return 0;
}

Compiler output:
a.cc:123:2: error: stray '#' in program
  123 | }#include <bits/stdc++.h>
      |  ^
a.cc:123:3: error: 'include' does not name a type
  123 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:139:12: error: redefinition of 'int scan()'
  139 | inline int scan(){ return getchar(); }
      |            ^~~~
a.cc:17:12: note: 'int scan()' previously defined here
   17 | inline int scan(){ return getchar(); }
      |            ^~~~
a.cc:140:13: error: redefinition of 'void scan(int&)'
  140 | inline void scan(int &a){ scanf("%d", &a); }
      |             ^~~~
a.cc:18:13: note: 'void scan(int&)' previously defined here
   18 | inline void scan(int &a){ scanf("%d", &a); }
      |             ^~~~
a.cc:141:13: error: redefinition of 'void scan(unsigned int&)'
  141 | inline void scan(unsigned &a){ scanf("%u", &a); }
      |             ^~~~
a.cc:19:13: note: 'void scan(unsigned int&)' previously defined here
   19 | inline void scan(unsigned &a){ scanf("%u", &a); }
      |             ^~~~
a.cc:142:13: error: redefinition of 'void scan(long int&)'
  142 | inline void scan(long &a){ scanf("%ld", &a); }
      |             ^~~~
a.cc:20:13: note: 'void scan(long int&)' previously defined here
   20 | inline void scan(long &a){ scanf("%ld", &a); }
      |             ^~~~
a.cc:143:13: error: redefinition of 'void scan(long long int&)'
  143 | inline void scan(long long &a){ scanf("%lld", &a); }
      |             ^~~~
a.cc:21:13: note: 'void scan(long long int&)' previously defined here
   21 | inline void scan(long long &a){ scanf("%lld", &a); }
      |             ^~~~
a.cc:144:13: error: redefinition of 'void scan(long long unsigned int&)'
  144 | inline void scan(unsigned long long &a){ scanf("%llu", &a); }
      |             ^~~~
a.cc:22:13: note: 'void scan(long long unsigned int&)' previously defined here
   22 | inline void scan(unsigned long long &a){ scanf("%llu", &a); }
      |             ^~~~
a.cc:145:13: error: redefinition of 'void scan(char&)'
  145 | inline void scan(char &a){ cin >> a; }
      |             ^~~~
a.cc:23:13: note: 'void scan(char&)' previously defined here
   23 | inline void scan(char &a){ cin >> a; }
      |             ^~~~
a.cc:146:13: error: redefinition of 'void scan(float&)'
  146 | inline void scan(float &a){ scanf("%f", &a); }
      |             ^~~~
a.cc:24:13: note: 'void scan(float&)' previously defined here
   24 | inline void scan(float &a){ scanf("%f", &a); }
      |             ^~~~
a.cc:147:13: error: redefinition of 'void scan(double&)'
  147 | inline void scan(double &a){ scanf("%lf", &a); }
      |             ^~~~
a.cc:25:13: note: 'void scan(double&)' previously defined here
   25 | inline void scan(double &a){ scanf("%lf", &a); }
      |             ^~~~
a.cc:148:13: error: redefinition of 'void scan(long double&)'
  148 | inline void scan(long double &a){ scanf("%Lf", &a); }
      |             ^~~~
a.cc:26:13: note: 'void scan(long double&)' previously defined here
   26 | inline void scan(long double &a){ scanf("%Lf", &a); }
      |             ^~~~
a.cc:149:13: error: redefinition of 'void scan(std::vector<bool>&)'
  149 | inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
      |             ^~~~
a.cc:27:13: note: 'void scan(std::vector<bool>&)' previously defined here
   27 | inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
      |             ^~~~
a.cc:150:13: error: redefinition of 'void scan(std::string&)'
  150 | inline void scan(string &a){ cin >> a; }
      |             ^~~~
a.cc:28:13: note: 'void scan(std::string&)' previously defined here
   28 | inline void scan(string &a){ cin >> a; }
      |             ^~~~
a.cc:155:31: error: redefinition of 'template<class T> void scan(std::vector<_Tp>&)'
  155 | template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
      |                               ^~~~
a.cc:33:31: note: 'template<class T> void scan(std::vector<_Tp>&)' previously declared here
   33 | template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
      |                               ^~~~
a.cc:156:44: error: redefinition of 'template<class T, long unsigned int size> void scan(std::array<_Tp, _Nm>&)'
  156 | template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
      |                                            ^~~~
a.cc:34:44: note: 'template<class T, long unsigned int size> void scan(std::array<_Tp, _Nm>&)' previously declared here
   34 | template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
      |                                            ^~~~
a.cc:157:40: error: redefinition of 'template<class T, class L> void scan(std::pair<_T1, _T2>&)'
  157 | template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
      |                                        ^~~~
a.cc:35:40: note: 'template<class T, class L> void scan(std::pair<_T1, _T2>&)' previously declared here
   35 | template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
      |                                        ^~~~
a.cc:158:44: error: redefinition of 'template<class T, long unsigned int size> void scan(T (&)[size])'
  158 | template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
      |                                            ^~~~
a.cc:36:44: note: 'template<class T, long unsigned int size> void scan(T (&)[size])' previously declared here
   36 | template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
      |                                            ^~~~
a.cc:159:31: error: redefinition of 'template<class T> void scan(T&)'
  159 | template<class T> inline void scan(T &a){ cin>>a; }
      |                               ^~~~
a.cc:37:31: note: 'template<class T> void scan(T&)' previously declared here
   37 | template<class T> inline void scan(T &a){ cin>>a; }
      |                               ^~~~
a.cc:160:13: error: redefinition of 'void in()'
  160 | inline void in(){}
      |             ^~
a.cc:38:13: note: 'void in()' previously defined here
   38 | inline void in(){}
      |             ^~
a.cc:161:50: error: redefinition of 'template<class Head, class ... Tail> void in(Head&, Tail& ...)'
  161 | template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
      |                                                  ^~
a.cc:39:50: note: 'template<class Head, class ... Tail> void in(Head&, Tail& ...)' previously declared here
   39 | template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
      |                                                  ^~
a.cc:162:21: error: redefinition of 'constexpr ll gcd(ll, ll)'
  162 | inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
      |                     ^~~
a.cc:40:21: note: 'constexpr ll gcd(ll, ll)' previously defined here
   40 | inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
      |                     ^~~
a.cc:163:21: error: redefinition of 'constexpr ll lcm(ll, ll)'
  163 | inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
      |                     ^~~
a.cc:41:21: note: 'constexpr ll lcm(ll, ll)' previously defined here
   41 | inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
      |                     ^~~
a.cc:164:11: error: redefinition of 'll mod(ll, ll)'
  164 | inline ll mod(ll val, ll m) {long long res = val % m;if (res < 0) res += m;return res;}
      |           ^~~
a.cc:42:11: note: 'll mod(ll, ll)' previously defined here
   42 | inline ll mod(ll val, ll m) {long long res = val % m;if (res < 0) res += m;return res;}
      |           ^~~
a.cc:165:12: error: redefinition of 'int divisor_count(int)'
  165 | inline int divisor_count(int n) {int j, c = 1;for (int i = 2; i * i <= n; i++, c *= j)for (j = 1; !(n % i); j++) n /= i;return (1 < n) ? c * 2 : c;}
      |            ^~~~~~~~~~~~~
a.cc:43:12: note: 'int divisor_count(int)' previously defined here
   43 | inline int divisor_count(int n) {int j, c = 1;for (int i = 2; i * i <= n; i++, c *= j)for (j = 1; !(n % i); j++) n /= i;return (1 < n) ? c * 2 : c;}
      |            ^~~~~~~~~~~~~
a.cc:166:31: error: redefinition of 'template<class T> bool chmax(T&, T)'
  166 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:44:31: note: 'template<class T> bool chmax(T&, T)' previously declared here
   44 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:167:31: error: redefinition of 'template<class T> bool chmin(T&, T)'
  167 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:45:31: note: 'template<class T> bool chmin(T&, T)' previously declared here
   45 | template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:170:11: error: redefinition of 'const int dx [4]'
  170 | const int dx[4] = {1, 0, -1, 0};
      |           ^~
a.cc:48:11: note: 'const int dx [4]' previously defined here
   48 | const int dx[4] = {1, 0, -1, 0};
      |           ^~
a.cc:171:11: error: redefinition of 'const int dy [4]'
  171 | const int dy[4] = {0, 1, 0, -1};
      |           ^~
a.cc:49:11: note: 'const int dy [4]' previously defined here
   49 | const int dy[4] = {0, 1, 0, -1};
      |           ^~
a.cc:173:17: error: redefinition of 'const long long int INF'
  173 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:51:17: note: 'const long long int INF' previously defined here
   51 | const long long INF = 1LL << 60;
      |                 ^~~
a.cc:174:10: error: redefinition of 'const ll MOD'
  174 | con