Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from math import gcd

def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    quad1 = defaultdict(int)
    quad2 = defaultdict(int)
    for _ in range(n):
        a, b = map(int, input().split())
        g = gcd(a, b)
        a, b = a//g, b//g

        if a == b == 0:
            zeroes += 1
            continue
        
        if b < 0:
            a, b = -a ,-b
        
        if a <= 0:
            a, b = b, -a
            quad1[(a,b)] += 0
            quad2[(a,b)] += 1
        else:
            quad1[(a,b)] += 1
            quad2[(a,b)] += 0

    ans = 1
    for k, v in quad1.items():
        now = 1
        now += pow(2, v, mod) -1
        now += pow(2, quad2[k], mod) -1
        ans = ans * now % mod
    
    ans += (zeroes - 1)
    print (ans % mod)


if __name__ == '__main__':
    main()

Fixed submission:
from collections import defaultdict
import math


def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    counter1 = defaultdict(int)
    counter2 = defaultdict(int)
    for _ in range(n):
        x, y = [int(x) for x in input().split()]

        if x == y == 0:
            zeroes += 1
            continue

        denominator = math.gcd(x, y)
        x, y = x // denominator, y // denominator

        if y < 0:
            # quadrant III, IV -> I, II
            x, y = -x, -y

        if x <= 0:
            # round 90° from quadrant II to I
            x, y = y, -x
            counter2[(x, y)] += 1
            counter1[(x, y)] += 0
        else:
            counter1[(x, y)] += 1
            counter2[(x, y)] += 0

    ans = 1
    for k, v in counter1.items():
        now = 1
        now += pow(2, v, mod) - 1
        now += pow(2, counter2[k], mod) - 1
        ans = ans * now % mod
    ans += zeroes
    ans -= 1  # choose no fish
    return ans % mod


if __name__ == '__main__':
    print(main())

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from math import gcd

def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    quad1 = defaultdict(int)
    quad2 = defaultdict(int)
    for _ in range(n):
        if a == b == 0:
            zeroes += 1
            continue

        a, b = map(int, input().split())
        g = gcd(a, b)
        a //= g; b//= g
        
        if b < 0:
            a, b = -a ,-b
        
        if a <= 0:
            a, b = b, -a
            quad1[(a,b)] += 0
            quad2[(a,b)] += 1
        else:
            quad1[(a,b)] += 1
            quad2[(a,b)] += 0

    ans = 1
    for k, v in quad1.items():
        now = 1
        now += pow(2, v, mod) -1
        now += pow(2, quad2[k], mod) -1
        ans = ans * now % mod
    
    ans += (zeroes - 1)
    print (ans % mod)


if __name__ == '__main__':
    main()

Fixed submission:
from collections import defaultdict
import math


def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    counter1 = defaultdict(int)
    counter2 = defaultdict(int)
    for _ in range(n):
        x, y = [int(x) for x in input().split()]

        if x == y == 0:
            zeroes += 1
            continue

        denominator = math.gcd(x, y)
        x, y = x // denominator, y // denominator

        if y < 0:
            # quadrant III, IV -> I, II
            x, y = -x, -y

        if x <= 0:
            # round 90° from quadrant II to I
            x, y = y, -x
            counter2[(x, y)] += 1
            counter1[(x, y)] += 0
        else:
            counter1[(x, y)] += 1
            counter2[(x, y)] += 0

    ans = 1
    for k, v in counter1.items():
        now = 1
        now += pow(2, v, mod) - 1
        now += pow(2, counter2[k], mod) - 1
        ans = ans * now % mod
    ans += zeroes
    ans -= 1  # choose no fish
    return ans % mod


if __name__ == '__main__':
    print(main())

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from math import gcd

def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    quad1 = defaultdict(int)
    quad2 = defaultdict(int)
    for _ in range(n):
        a, b = map(int, input().split())
        g = gcd(a, b)
        a //= g; b//= g

        if a == b == 0:
            zeroes += 1
            continue
        
        if b < 0:
            a, b = -a ,-b
        
        if a <= 0:
            a, b = b, -a
            quad1[(a,b)] += 0
            quad2[(a,b)] += 1
        else:
            quad1[(a,b)] += 1
            quad2[(a,b)] += 0

    ans = 1
    for k, v in quad1.items():
        now = 1
        now += pow(2, v, mod) -1
        now += pow(2, quad2[k], mod) -1
        ans = ans * now % mod
    
    ans += (zeroes - 1)
    print (ans % mod)


if __name__ == '__main__':
    main()

Fixed submission:
from collections import defaultdict
import math


def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    counter1 = defaultdict(int)
    counter2 = defaultdict(int)
    for _ in range(n):
        x, y = [int(x) for x in input().split()]

        if x == y == 0:
            zeroes += 1
            continue

        denominator = math.gcd(x, y)
        x, y = x // denominator, y // denominator

        if y < 0:
            # quadrant III, IV -> I, II
            x, y = -x, -y

        if x <= 0:
            # round 90° from quadrant II to I
            x, y = y, -x
            counter2[(x, y)] += 1
            counter1[(x, y)] += 0
        else:
            counter1[(x, y)] += 1
            counter2[(x, y)] += 0

    ans = 1
    for k, v in counter1.items():
        now = 1
        now += pow(2, v, mod) - 1
        now += pow(2, counter2[k], mod) - 1
        ans = ans * now % mod
    ans += zeroes
    ans -= 1  # choose no fish
    return ans % mod


if __name__ == '__main__':
    print(main())

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from math import gcd

def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    quad1 = defaultdict(int)
    quad2 = defaultdict(int)
    for _ in range(n):
        a, b = map(int, input().split())
        g = gcd(a, b)
        a //= g; b//= g

        if a == b == 0:
            zeroes += 1
            continue
        
        if b < 0:
            a, b = -a ,-b
        
        if a <= 0:
            a, b = b, -a
            quad1[(a,b)] += 0
            quad2[(a,b)] += 1
        else:
            quad1[(a,b)] += 1
            quad2[(a,b)] += 0

    ans = 1
    for k, v in quad1.items():
        now = pow(2, v, mod)
        now += pow(2, quad2[k], mod)
        now -= 1
        ans = ans * now % mod
    
    ans += (zeroes - 1)
    print (ans)


if __name__ == '__main__':
    main()

Fixed submission:
from collections import defaultdict
import math


def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    counter1 = defaultdict(int)
    counter2 = defaultdict(int)
    for _ in range(n):
        x, y = [int(x) for x in input().split()]

        if x == y == 0:
            zeroes += 1
            continue

        denominator = math.gcd(x, y)
        x, y = x // denominator, y // denominator

        if y < 0:
            # quadrant III, IV -> I, II
            x, y = -x, -y

        if x <= 0:
            # round 90° from quadrant II to I
            x, y = y, -x
            counter2[(x, y)] += 1
            counter1[(x, y)] += 0
        else:
            counter1[(x, y)] += 1
            counter2[(x, y)] += 0

    ans = 1
    for k, v in counter1.items():
        now = 1
        now += pow(2, v, mod) - 1
        now += pow(2, counter2[k], mod) - 1
        ans = ans * now % mod
    ans += zeroes
    ans -= 1  # choose no fish
    return ans % mod


if __name__ == '__main__':
    print(main())

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
import math

def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    quadrant1 = defaultdict(int)
    quadrant2 = defaultdict(int)

    for _ in range(n):
        a, b = map(int, input().split())
        if a == b == 0:
            zeroes += 1

        g = math.gcd(a, b)
        a, b = a//g, b//g 
        
        if b < 0:
            a, b = -a, -b
        
        if a <= 0:
            a, b = b, -a
            quadrant1[(a, b)] += 0
            quadrant2[(a, b)] += 1
        else:
            quadrant1[(a, b)] += 1
            quadrant2[(a, b)] += 0
    
    ans = 1
    for key, value in quadrant1.items():
        now = 1
        now += pow(2, value, mod) - 1
        now += pow(2, quadrant2[key], mod) - 1
        ans = (ans * now) % mod
    
    ans += (zeroes - 1)
    return ans % mod

if __name__ == '__main__':
    print (main())

Fixed submission:
from collections import defaultdict
import math


def main():
    n = int(input())
    mod = 1000000007
    zeroes = 0
    counter1 = defaultdict(int)
    counter2 = defaultdict(int)
    for _ in range(n):
        x, y = [int(x) for x in input().split()]

        if x == y == 0:
            zeroes += 1
            continue

        denominator = math.gcd(x, y)
        x, y = x // denominator, y // denominator

        if y < 0:
            # quadrant III, IV -> I, II
            x, y = -x, -y

        if x <= 0:
            # round 90° from quadrant II to I
            x, y = y, -x
            counter2[(x, y)] += 1
            counter1[(x, y)] += 0
        else:
            counter1[(x, y)] += 1
            counter2[(x, y)] += 0

    ans = 1
    for k, v in counter1.items():
        now = 1
        now += pow(2, v, mod) - 1
        now += pow(2, counter2[k], mod) - 1
        ans = ans * now % mod
    ans += zeroes
    ans -= 1  # choose no fish
    return ans % mod


if __name__ == '__main__':
    print(main())