Buggy python submission (verdict: Runtime Error):
_, *e = [[*map(int, t.split())] for t in open(0)]
ans = 1
mod = 10 ** 9 + 7
slope_dict = {}
zeros = 0
vect_x = 0
for x, y in e:
    if x == y == 0:
        zeros += 1
    elif y == 0:
        vect_x += 1
    else:
        slope_dict[x/y] = slope_dict.get(x/y, 0) + 1
ans = ans * (pow(2, vect_x, mod) + pow(2, slope_dict.get(0, 0), mod) - 1) % mod
slope_dict.pop(0)
for k in slope_dict:
    if -1/k in slope_dict:
        if k >= 1:
            ans = ans * (pow(2, slope_dict[k], mod) +
                         pow(2, slope_dict[-1/k], mod) - 1) % mod
    else:
        ans = ans * (pow(2, slope_dict[k], mod)) % mod
print(ans + zeros - 1 % mod)


Fixed submission:
from math import gcd
from collections import defaultdict
mod = 10**9+7
_, *S = open(0)
mp = defaultdict(lambda: [0, 0])
O = 0
for s in S:
    a, b = map(int, s.split())
    if a == b == 0:
        O += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0 or a == 0 < b:
            a, b = -a, -b
        f = 0
        if b < 0:
            a, b, f = -b, a, 1
        mp[(a, b)][f] += 1
ans = 1
for k in mp:
    x, y = mp[k]
    ans = ans*(pow(2, x, mod)+pow(2, y, mod)-1) % mod
print((ans+O-1) % mod)

Buggy python submission (verdict: Runtime Error):
_, *e = [[*map(int, t.split())] for t in open(0)]
ans = 1
mod = 10 ** 9 + 7
slope_dict = {}
zeros = 0
vect_x = 0
for x, y in e:
    if x == y == 0:
        zeros += 1
    elif y == 0:
        vect_x += 1
    else:
        slope_dict[x/y] = slope_dict.get(x/y, 0) + 1
ans = ans * (pow(2, vect_x, mod) + pow(2, slope_dict.get(0, 0), mod) - 1) % mod
slope_dict.popitem(0)
for k in slope_dict:
    if -1/k in slope_dict:
        if k >= 1:
            ans = ans * (pow(2, slope_dict[k], mod) +
                         pow(2, slope_dict[-1/k], mod) - 1) % mod
    else:
        ans = ans * (pow(2, slope_dict[k], mod)) % mod
print(ans + zeros - 1 % mod)


Fixed submission:
from math import gcd
from collections import defaultdict
mod = 10**9+7
_, *S = open(0)
mp = defaultdict(lambda: [0, 0])
O = 0
for s in S:
    a, b = map(int, s.split())
    if a == b == 0:
        O += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0 or a == 0 < b:
            a, b = -a, -b
        f = 0
        if b < 0:
            a, b, f = -b, a, 1
        mp[(a, b)][f] += 1
ans = 1
for k in mp:
    x, y = mp[k]
    ans = ans*(pow(2, x, mod)+pow(2, y, mod)-1) % mod
print((ans+O-1) % mod)

Buggy python submission (verdict: Runtime Error):
[n], *e = [[*map(int, t.split())] for t in open(0)]
ans = 0
mod = 10 ** 9 + 7
slope_dict = {}
for x, y in e:
    a = 2**slope_dict.get(x/y, 0)
    b = 2**slope_dict.get(-y/x, 0)
    ans = ((ans * (2 * a + b - 1) + a)/(a + b - 1))  # % mod
    slope_dict[x/y] = slope_dict.get(x/y, 0) + 1

print(int(ans % mod))


Fixed submission:
from math import gcd
from collections import defaultdict
mod = 10**9+7
_, *S = open(0)
mp = defaultdict(lambda: [0, 0])
O = 0
for s in S:
    a, b = map(int, s.split())
    if a == b == 0:
        O += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0 or a == 0 < b:
            a, b = -a, -b
        f = 0
        if b < 0:
            a, b, f = -b, a, 1
        mp[(a, b)][f] += 1
ans = 1
for k in mp:
    x, y = mp[k]
    ans = ans*(pow(2, x, mod)+pow(2, y, mod)-1) % mod
print((ans+O-1) % mod)

Buggy python submission (verdict: Runtime Error):
[n], *e = [[*map(int, t.split())] for t in open(0)]
ans = 0
mod = 10 ** 9 + 7
slope_dict = {}
for x, y in e:
    a = 2**slope_dict.get(x/y, 0)
    b = 2**slope_dict.get(-y/x, 0)
    ans = ((ans * (2 * a + b - 1) + a)/(a + b - 1)) % mod
    slope_dict[x/y] = slope_dict.get(x/y, 0) + 1

print(int(ans))

Fixed submission:
from math import gcd
from collections import defaultdict
mod = 10**9+7
_, *S = open(0)
mp = defaultdict(lambda: [0, 0])
O = 0
for s in S:
    a, b = map(int, s.split())
    if a == b == 0:
        O += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0 or a == 0 < b:
            a, b = -a, -b
        f = 0
        if b < 0:
            a, b, f = -b, a, 1
        mp[(a, b)][f] += 1
ans = 1
for k in mp:
    x, y = mp[k]
    ans = ans*(pow(2, x, mod)+pow(2, y, mod)-1) % mod
print((ans+O-1) % mod)

Buggy python submission (verdict: Runtime Error):
[n], *e = [[*map(int, t.split())] for t in open(0)]
ans = 0
count = 0
slope_dict = {}
for x, y in e:
    count += 1
    if x/y in slope_dict:
        slope_dict[x/y] += 1
    else:
        slope_dict[x/y] = 1
    ans = ans + \
        2**(count - 1 - (0 if -y/x not in slope_dict else slope_dict[-y/x]))
print(ans)


Fixed submission:
from math import gcd
from collections import defaultdict
mod = 10**9+7
_, *S = open(0)
mp = defaultdict(lambda: [0, 0])
O = 0
for s in S:
    a, b = map(int, s.split())
    if a == b == 0:
        O += 1
    else:
        g = gcd(a, b)
        a //= g
        b //= g
        if a < 0 or a == 0 < b:
            a, b = -a, -b
        f = 0
        if b < 0:
            a, b, f = -b, a, 1
        mp[(a, b)][f] += 1
ans = 1
for k in mp:
    x, y = mp[k]
    ans = ans*(pow(2, x, mod)+pow(2, y, mod)-1) % mod
print((ans+O-1) % mod)