Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict as dd
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = dd(int)
a = [tuple(map(int, input().split())) for _ in range(N)]
z = 0
for x, y in a:
  g = gcd(abs(x), abs(y))
  x //= g
  y //= g
  if y < 0:
    x, y = -x, -y
  elif y == 0:
    x = 1
    y = 0
  if (x, y) == (0, 0):
    N -= 1
    z += 1
    continue
  d[(x, y)] += 1
res = 1
u = 0
itr = list(d.keys())
#print(itr, d)
for x, y in itr:
  t = 0
  if (x, y) == (0, 1):
    t = d[(1, 0)]
  elif (x, y) == (1, 0):
    t = d[(0, 1)]
  else:
    t = d[(y * pow(-1, int(x < 0) + 1), abs(x))]
  if t == 0: u += d[(x, y)]
for x, y in itr:
  t = 0
  if (x, y) == (0, 1):
    t = d[(1, 0)]
  elif (x, y) == (1, 0):
    t = d[(0, 1)]
  else:
    t = d[(y * pow(-1, int(x < 0) + 1), abs(x))]
  #print(t, d, (x, y))
  if t:
    v = 0
    v += pow(2, d[(x, y)], mod) - 1
    v %= mod
    v += pow(2, t, mod) - 1
    v %= mod
    v += 1
    v %= mod
    res *= v
    res %= mod
    #print(res, v)
  d[(x, y)] = 0
#print(itr, u, res, z)
print(res * pow(2, u, mod) - 1 + z % mod)

Fixed submission:
import sys
from collections import Counter
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = Counter()
a = [tuple(map(int, input().split())) for _ in range(N)]
z = 0
for x, y in a:
  if (x, y) == (0, 0):
    z += 1
    continue
  if y < 0:
    x *= -1
    y *= -1
  if x == 0:
    x = 0
    y = 1
  elif y == 0:
    x = 1
    y = 0
  g = gcd(x, y)
  x //= g
  y //= g
  d[(x, y)] += 1

res = 1
itr = list(d.keys())
#print(itr, d)
for x, y in itr:
  t = 0
  if x <= 0 and (d[(y, -x)] > 0): continue
  if (x, y) == (1, 0):
    t = d[(0, 1)]
  else:
    t = d[(-y, x)]
  v = 0
  v += pow(2, d[(x, y)], mod) - 1
  v %= mod
  v += pow(2, t, mod) - 1
  v %= mod
  v += 1
  v %= mod
  res *= v
  res %= mod
  #print(res, d, d[(x, y)], t)
#print(itr, u, res, z)
print((res - 1 + z) % mod)

Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict as dd
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = dd(int)
a = [tuple(map(int, input().split())) for _ in range(N)]
for x, y in a:
  g = gcd(abs(x), abs(y))
  d[(x // g, y // g)] += 1
res = 1
u = 0
itr = list(d.keys())
#print(itr)
for x, y in itr:
  t = d[(y, -x)] + d[(-y, x)]
  if t == 0: u += d[(x, y)]
for x, y in itr:
  t = d[(y, -x)] + d[(-y, x)]
  if t:
    v = 0
    v += pow(2, d[(x, y)], mod) - 1
    v %= mod
    v += pow(2, t, mod) - 1
    v %= mod
    v += 1
    v %= mod
    res *= v
    res %= mod
    #print(res, v)
  d[(x, y)] = 0
print(res * pow(2, u, mod) - 1 % mod)

Fixed submission:
import sys
from collections import Counter
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = Counter()
a = [tuple(map(int, input().split())) for _ in range(N)]
z = 0
for x, y in a:
  if (x, y) == (0, 0):
    z += 1
    continue
  if y < 0:
    x *= -1
    y *= -1
  if x == 0:
    x = 0
    y = 1
  elif y == 0:
    x = 1
    y = 0
  g = gcd(x, y)
  x //= g
  y //= g
  d[(x, y)] += 1

res = 1
itr = list(d.keys())
#print(itr, d)
for x, y in itr:
  t = 0
  if x <= 0 and (d[(y, -x)] > 0): continue
  if (x, y) == (1, 0):
    t = d[(0, 1)]
  else:
    t = d[(-y, x)]
  v = 0
  v += pow(2, d[(x, y)], mod) - 1
  v %= mod
  v += pow(2, t, mod) - 1
  v %= mod
  v += 1
  v %= mod
  res *= v
  res %= mod
  #print(res, d, d[(x, y)], t)
#print(itr, u, res, z)
print((res - 1 + z) % mod)

Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict as dd
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = dd(int)
a = [tuple(map(int, input().split())) for _ in range(N)]
table = [0] * N
table[1] = pow(2, N - 2, mod)
for x in range(2, N):
  table[x] = table[x - 1] * 2 % mod - pow(2, N - x - 1, mod)
for x, y in a:
  g = gcd(abs(x), abs(y))
  d[(x // g, y // g)] += 1
res = 1
u = 0
itr = list(d.keys())
#print(itr)
for x, y in itr:
  t = d[(y, -x)] + d[(-y, x)]
  if t == 0: u += d[(x, y)]
for x, y in itr:
  t = d[(y, -x)] + d[(-y, x)]
  if t:
    v = 0
    v += pow(2, d[(x, y)], mod) - 1
    v %= mod
    v += pow(2, t, mod) - 1
    v %= mod
    v += 1
    v %= mod
    res *= v
    res %= mod
    #print(res, v)
  d[(x, y)] = 0
print(res * pow(2, u, mod) - 1 % mod)

Fixed submission:
import sys
from collections import Counter
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = Counter()
a = [tuple(map(int, input().split())) for _ in range(N)]
z = 0
for x, y in a:
  if (x, y) == (0, 0):
    z += 1
    continue
  if y < 0:
    x *= -1
    y *= -1
  if x == 0:
    x = 0
    y = 1
  elif y == 0:
    x = 1
    y = 0
  g = gcd(x, y)
  x //= g
  y //= g
  d[(x, y)] += 1

res = 1
itr = list(d.keys())
#print(itr, d)
for x, y in itr:
  t = 0
  if x <= 0 and (d[(y, -x)] > 0): continue
  if (x, y) == (1, 0):
    t = d[(0, 1)]
  else:
    t = d[(-y, x)]
  v = 0
  v += pow(2, d[(x, y)], mod) - 1
  v %= mod
  v += pow(2, t, mod) - 1
  v %= mod
  v += 1
  v %= mod
  res *= v
  res %= mod
  #print(res, d, d[(x, y)], t)
#print(itr, u, res, z)
print((res - 1 + z) % mod)