Harryxun/stf_run huggingface dataset:
n, x = map(int, input().split())
xi = list(map(int, input().split()))

import fraction
import reduce

def gcd(*numbers):
    return functools.reduce(fraction.gcd, numbers)

xi = map(lambda y:y-x, xi)
print(gcd(*xi))

### FIXED CODE ###

n, x = map(int, input().split())
xi = list(map(int, input().split()))

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcd_l(*numbers):
	ret = numbers[0]
	for n in numbers[1:]:
		ret = gcd(ret, n)
	return ret

xi = map(lambda y:abs(y-x), xi)
print(gcd_l(*xi))
# encoding: "utf-8"

class Unreachable(Exception):
    pass

def main():
    [n, q] = [int(x) for x in input().split()]
    setlist = list()
    for i in range(n):
        setlist.append(set(i))

    for _ in range(q):
        run(setlist)


def run(setlist):
    com, x, y = [int(x) for x in input().split()]
    if com == 0:
        # unite
        new_set = setlist[x] | setlist[y]
        for i in new_set:
            setlist[i] = new_set

    elif com == 1:
        # same
        if y in setlist[x]:
            print(1)
        else:
            print(0)
    else:
        raise Unreachable

if __name__ == "__main__":
    main()

### FIXED CODE ###

# encoding: "utf-8"

from enum import Enum

class Unreachable(Exception):
    pass


class Type(Enum):
    VAL = 0
    PTR = 1


class Elem:
    def __init__(self, i, value, _type):
        self.idx = i
        self.value = value
        self.type = _type

    def set(self, value, _type):
        self.value = value
        self.type = _type
        

class SetManager:
    def __init__(self, n):
        self.data = list()
        for i in range(n):
            self.data.append(Elem(i, {i}, Type.VAL))

    def get(self, i):
        return self.data[i]

    def set(self, i, value):
        if isinstance(value, set):
            t = Type.VAL
        elif isinstance(value, int):
            t = Type.PTR
        self.data[i].set(value, t)

    def find_root(self, i):
        elem = self.get(i)
        if elem.type == Type.VAL:
            return (i, elem)
        elif elem.type == Type.PTR:
            j, root_elem = self.find_root(elem.value)
            self.set(i, j)
            return (j, root_elem)
        else:
            raise Unreachable

    def run(self, command):
        com, x, y = command
        if com == 0:
            self.unite(x, y)

        elif com == 1:
            if self.same(x, y):
                print(1)
            else:
                print(0)

        else:
            raise Unreachable

    def unite(self, x, y):
        i, elem_x = self.find_root(x)
        j, elem_y = self.find_root(y)
        if i != j:
            new_set = elem_x.value | elem_y.value
            self.set(i, new_set)
            self.set(j, i)

    def same(self, x, y):
        return y in self.find_root(x)[1].value


class Stdin:
    @staticmethod
    def read_line(converter=str):
        return [converter(x) for x in input().split()]
    
    @staticmethod
    def read_lines(n, converter=str):
        result = list()
        for _ in range(n):
            result.append(Stdin.read_line(converter))
        return result
    
    @staticmethod
    def convert(data, n, converter):
        assert(n == len(converter))
        return tuple(map(lambda x, f: f(x), data, converter))

    @staticmethod
    def convert_lines(datas, n, converter):
        return [converter(data, n, converter) for data in datas]


def main():
    n, q = Stdin.read_line(int)
    manager = SetManager(n)
    commands = Stdin.read_lines(q, int)
    
    for command in commands:
        manager.run(command)


if __name__ == "__main__":
    main()
#D問題
K = int(input())
keta = 1
now = 1
def sunuke(n):
    a = 0
    for i in str(n):
        a+=int(i)
    return(n/a)
count=0
while count < k:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta *= 10



### FIXED CODE ###

#D問題
K=int(input())
keta=1
now=1
count=0

def sunuke(n):
    a=0
    for i in str(n):
        a+=int(i)
    return(n/a)

while count < K:
    if sunuke(now) <= sunuke(now+keta):
        print(now)
        now+=keta
        count+=1
    else:
        now+=9*keta
        keta*=10
a,b,c=map(input().split())
print(a[0]+b[0]+c[0])


### FIXED CODE ###

a,b,c=input().split()
print(a[0]+b[0]+c[0])
n=int(input())
r=[list(map(int, input().split())) for i in range(n)]
b=[list(map(int, input().split())) for i in range(n)]
v=[]
r.sort()
b.sort()
print(r)
print(b)
count=0

for i in range(n):
    for j in range(n):
        if b[i][0]<=r[j][0] or b[i][1]<=r[j][1]:
            break
        else:
            v.append(r[j])    
    if v!=[]:
        v.sort(key=lambda x:x[1])
        print(v)
        r.remove(v[0])
        
            
        v=[]
        count+=1
print(count)
        

### FIXED CODE ###

n=int(input())
r=[list(map(int, input().split())) for i in range(n)]
b=[list(map(int, input().split())) for i in range(n)]
v=[]
r.sort()
b.sort()
count=0
 
for i in range(n):
    for j in range(len(r)):
        if b[i][0]<=r[j][0] or b[i][1]<=r[j][1]:
            pass
        else:
            v.append(r[j])    
    if v!=[]:
        v.sort(key=lambda x:x[1])
        v.reverse()
        r.remove(v[0])
        
            
        v=[]
        count+=1
print(count)
n, w = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(n)]

dp = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(n):
  for j in range(w + 1):
    if j + wv[i][0] <= w:
      dp[i + 1][j + wv[i][0]] = max(dp[i + 1][j + wv[i][0]], dp[i][j] + wv[i][1])
    dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])
print(max(dp[-1]))

### FIXED CODE ###

N, W = [int(i) for i in input().split()]
WV = [[int(i) for i in input().split()] for j in range(N)]

import numpy as np
max_value = np.sum(np.array(WV), axis=0)[1]

# dp[v]: 価値vを達成するのに必要な重さの最小値
dp = np.full(max_value + 1, W + 1, dtype='int64')

dp[0] = 0
for w, v in WV:
    # 価値i(0 <= i <= max_value - v)のときの重さの最小値に対し
    # 次の荷物を入れて、価値i+vのときの重さの最小値を更新
    np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])
print(np.max(np.where(dp <= W)))
#coding:utf-8
s=input()
s=int(s)*int(s)*int(s)
print(s)
input()

### FIXED CODE ###

#coding:utf-8
s=input()
s=int(s)*int(s)*int(s)
print(s)
c=input()
if c == a or i or u or e or o:
    print("vowel")
else:
    print("consonant")

### FIXED CODE ###

c=input()
if c in 'aeiou':
     print("vowel")
else:
     print("consonant")
import math
n,k = map(int,input().split())
ans = 0
mod = 10**9+7
def combinations_count(n, r): #組み合わせ(nCr)
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(1,k+1):
    cnt = combinations_count(n-k+1,i)* combinations_count(k-1, i-1)% mod
    print(cnt)

### FIXED CODE ###

from operator import mul
from functools import reduce
n,k = map(int,input().split())
ans = 0
mod = 10**9+7
def cmb(n, r):
    if r > n:
        return 0
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under
for i in range(1,k+1):
    cnt = cmb(n-k+1,i)* cmb(k-1, i-1)
    print(cnt%mod)
# -*- coding: utf-8 -*-
"""



"""
import sys


def solve(N, W):
    left, right = 0, sum(W)
    ans = [abs(right-left)]
    for w in W:
        left += w
        right -= w
        ans.append(abs(right-left))
    return min(ans)


def main(args):
    N = int(input())
    W = [int(w) for w in input().split()]
    ans = solve(N, W)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
h

### FIXED CODE ###

def solve(N, W):
    left, right = 0, sum(W)
    ans = [abs(right-left)]
    for w in W:
        left += w
        right -= w
        ans.append(abs(right-left))
    return min(ans)


N = int(input())
W = [int(w) for w in input().split()]
ans = solve(N, W)
print(ans)
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
tem=[]
ans=[]

for i in a:
  for j in b:
    tem.append(i+j)
    
tem=tem[:min(3001,x*y*z+1)]

for k in c:
  for l in tem:
    ans.append(k+l)
    
ans.sort()

for m in range(k):
  print(ans[m])

### FIXED CODE ###

x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for num in lisb:
    for nu in lisa:
        an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
#sample code.
import functools
import operator

N = int(input())
v = ((map(int, input().split())))
answer = functools.reduce(mul.v)
answer = answer if answer <= 10 ** 18 else -1
print(answer)

### FIXED CODE ###

N = int(input())
v = list(map(int, input().split()))
limit = 10 ** 18

answer = 1
if 0 in v:
  answer = 0
else:
  for i in v:
    answer = answer * i
    if answer <= limit:
      continue
    else:
      answer = -1
      break
print(answer)
a,b=map(int,input().split())
import math
print(math.gcd(a, b))

### FIXED CODE ###

import fractions
a,b=map(int,input().split())
print((a * b) // fractions.gcd(a, b))
N = int(input())

l_0 = list(map(int , input().split()))

L = [l_0]

m = None

count = 0

while L != []:
	for l in L:
		m = min(l)
		L.remove(l)
		for i in range(len(l)):
			l[i] = l[i] - m
		count += m
		l = " ".join( list(map(str , l)) )
		l = l.split("0")
		for a in l:
			L.append(list(map(int, (a.split()))))
		while [] in L:
			L.remove([])


print(count)

### FIXED CODE ###

c, a, b= list(map(int,input().split()))

print(int(a*c/2))
n, _ = map(int,input().split())
a = list(map(int, input().split()))
dic = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
dp = [0] * (n + 1)


def calc(num, new):
    if num == 0:
        return 0
    num_str = str(num)
    new_str = str(new)
    sstr_list = list(str(num)) + list(str(new))
    sstr_list.sort(reverse=True)
    return int("".join(sstr_list))


for i in a:
    dp[dic[i]] = max(dp[dic[i]], i)

for x in range(n + 1):
    for i in a:
        if x >= dic[i]:
            dp[x] = max(dp[x], calc(dp[x - dic[i]], i))

print(dp[n])

### FIXED CODE ###

n, _ = map(int, input().split())
L = list(map(int, input().split()))
weight = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [-1] * (n+1)
dp[0] = 0

for i in range(n+1):
    for a in L:
        if i+weight[a] < n+1:
            dp[i+weight[a]] = max(dp[i+weight[a]], dp[i]*10+a)

print(dp[n])
import math
import numpy as np 

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X,Y =map(int,input().split())
x,y = np.sum(1/3.0*(np.array([[ 2., -1.],[-1.,  2.]])*np.array([X,Y])),axis=1).astype(np.int32)
#print(x)
##x = int(X-(X+Y)//3)
#y = int(Y-(X+Y)//3)
if (X+Y)%3==0 and x>=0 and y>=0:
    print(cmb(x+y,x,mod))
else:
    print(0)
    


### FIXED CODE ###

import math
#import numpy as np 

#参照
#https://qiita.com/derodero24/items/91b6468e66923a87f39f#%E7%95%AA%E5%A4%96%E7%B7%A8
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 5*10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X,Y =map(int,input().split())
#x,y = np.sum(1/3*(np.array([[ 2., -1.],[-1.,  2.]])*np.array([X,Y])),axis=1).astype(np.int32)
#print(x)
x = int(X-(X+Y)//3)
y = int(Y-(X+Y)//3)
if (X+Y)%3==0 and x>=0 and y>=0:
    print(cmb(x+y,x,mod))
else:
    print(0)
r,c=list(map(int,input().split()))
l=[]
for i in range(r):
	a=list(map(int,input().split()))
	l.append(a.append(sum(a)))
b=[]
for i in range(c+1):
	c=0
	for j in range(r):
		c+=l[j][i]
	b.append(c)
l.append(b)

for i in l:
	print(" ".join(i))

### FIXED CODE ###

r,c=list(map(int,input().split()))
l=[]
for i in range(r):
	a=list(map(int,input().split()))
	a.append(sum(a))
	l.append(a)
b=[]
for i in range(c+1):
	c=0
	for j in range(r):
		c+=l[j][i]
	b.append(c)
l.append(b)

for i in l:
	print(" ".join(list(map(str,i))))
import math

# 入力
N = int(input())

ans = 10**12
square = math.ceil(math.sqrt(N))
for i in range(1, square):
    if N%i == 0:
        ans = min(ans, int(N/i))
b = int(N/ans)
print(ans + b-2)

### FIXED CODE ###

A, B = map(int,input().split())

if A < 10 and B < 10:
    print(A*B)
else:
    print(-1)
n,l=map(int,input().split())

taste = []
teste_zettaichi = []

for i in range(n):
    taste.append(l+i-1)
    teste_zettaichi = abs[taste[i]]

print(sum(taste) - min(teste_zettaichi))

### FIXED CODE ###

num = input()
#num = str(code)

if num[0] == num[1] or num[1] == num[2] or num[2] == num[3]:
    print('Bad')
else:
    print('Good')
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 21:29:28 2020

@author: naoki
"""
import math

N = int(input()) # 時計の個数
T = [int(input()) for i in range(N)] # 時計の針が一周する時間
T.sort() # 小さい順番にソートする
lcm = T[0] 

for i in range(1,N):
    lcm = lcm*T[i]// math.gcd(lcm,T[i])
print(lcm)


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Fri May 29 21:29:28 2020

@author: naoki
"""
import fractions

N = int(input()) # 時計の個数
T = [int(input()) for i in range(N)] # 時計の針が一周する時間
T.sort() # 小さい順番にソートする
lcm = T[0] 

for i in range(1,N):
    lcm = lcm*T[i]// fractions.gcd(lcm,T[i])
print(lcm)
print(''.join([input(),input()][::-1]))

### FIXED CODE ###

print(''.join(input().split()[::-1]))
N, A, B = map(int, input().split())

counter = [0 for _ in range(N)]
ans = 0
for i in range(N):
    string = str(i)
    for j in range(len(str)):
        counter[i] = counter[i] + string[j]
    if(counter[i]>=A and counter[i]<=B):
        ans = ans + i
print(ans)

### FIXED CODE ###

N, A, B = map(int, input().split())
ans = 0

for i in range(1, N+1):
    num_sum = 0
    for j in str(i):
        num_sum += int(j)
    if A<= num_sum <= B:
        ans += i

print(ans)
N, M = list(map(int, input().split()))
list_WA = [0]*N
list_Flag = [0]*N
for i in range(M):
  a, b = list(map(int, input().split()))
  if list_Flag[a-1] == 1:
	pass
  else:
    if b=='WA':
      list_WA[a-1]+=1
    elif b=='AC':
      list_Flag[a-1]=1
    else:
      pass
WA=sum(list_WA)
AC=sum(list_Flag)
ans=[AC,WA]
print(*ans)

### FIXED CODE ###

N, M = list(map(int, input().split()))
list_WA = [0] * N
list_Flag = [0] * N
for i in range(M):
  a, b = list(map(str, input().split()))
  a=int(a)
  if not list_Flag[a-1] == 1:
    if b=='WA':
      list_WA[a-1]=list_WA[a-1]+1
    elif b=='AC':
      list_Flag[a-1]=1
penalty = [0] * N
for p in range(N):
    penalty[p]=list_WA[p]*list_Flag[p]
PE=sum(penalty)
AC=sum(list_Flag)
print(AC,PE)
import sys
rr = lambda: sys.stdin.readline().strip()
ri = lambda: int(rr())
rs = lambda: [int(_) for _ in rr().split()]

S = rr()

if not 1 <= int(S[:1]) <= 12:
    if not 1 <= int(S[2:]) <= 12:
        print('NA')
    else:
        print('YYMM')
elif not 1 <= int(S[2:]) <= 12:
	if not 1 <= int(S[2:]) <= 12:
        print('NA')
    else:
        print('MMYY')
else:
    print('AMBIGUOUS')

### FIXED CODE ###

import sys
rr = lambda: sys.stdin.readline().strip()
ri = lambda: int(rr())
rs = lambda: [int(_) for _ in rr().split()]

S = rr()

if not 1 <= int(S[:2]) <= 12:
    if not 1 <= int(S[2:]) <= 12:
        print('NA')
    else:
        print('YYMM')
elif not 1 <= int(S[2:]) <= 12:
	print('MMYY')
else:
    print('AMBIGUOUS')
max=0
for i in range(1,n+1):
    p=int(input())
    if p>max:
        max=p//2
        print(max)

### FIXED CODE ###

max=0
k=0
N=int(input())
for i in range(1,N+1):
    p=int(input())
    if p>max:max=p
    k=k+p
print((k-max)+(max//2))
import sys
input = lambda: sys.stdin.readline().rstrip()
aint = lambda: int(input())
ints = lambda: list(map(int, input().split()))

n = aint()
get = [[],[],[],[],[],[],[],[],[],[]]
for i in range(n):
    s = input()
    if s not in get[len(s)-1]:
        get[len(s)-1].append(s)

ss = 0
for cont in get:
    ss += sum(cont)
print(ss)

### FIXED CODE ###

import sys
import math
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
Yes = lambda boolean: print('Yes') if boolean else print('No')
YES = lambda boolean: print('YES') if boolean else print('NO')
aint = lambda: int(input())
ints = lambda: list(map(int, input().split()))
is_even = lambda x: True if x%2==0 else False

n = aint()
get = []
for i in range(n):
    s = input()
    get.append(s)
ss = set(get)
print(len(ss))
N = int(input())
A = [int(x) for x in input().split()]

# Common divisor
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)


def gcd_wrapper(x, y):
    if x >= y:
        return gcd(x, y)
    else:
        return gcd(y, x)

if N == 2:
    print(max(A))
    exit()
if N == 3:
    x1 = gcd_wrapper(A[0], A[1])
    x2 = gcd_wrapper(A[1], A[2])
    x3 = gcd_wrapper(A[0], A[2])
    print(max([x1, x2, x3]))
    exit()

init_results = []
for k, g in enumerate(A[0:3]):
    for h in A[k+1:4]:
        init_results.append(gcd_wrapper(g, h))
if max(init_results) == 1:
    print(1)
    exit()
stop_flag = 0
x = max(init_results)
final_result = set()
final_result.add(x)
for i in A:
    tmp = gcd_wrapper(x, i)
    if tmp == 1:
        stop_flag += 1
    else:
        x = tmp
        final_result.add(tmp)
if stop_flag >= 2:
    print(1)
else:
    sorted_final_result = sorted(list(final_result))
    divable = []
    for j in A:
        if j % sorted_final_result[1] != 0:
            divable.append(1)
    if sum(divable) == 1:
        print(sorted_final_result[1])
    else:
        print(sorted_final_result[0])



### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]

# Common divisor
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)


def gcd_wrapper(x, y):
    if x >= y:
        return gcd(x, y)
    else:
        return gcd(y, x)

if N == 2:
    print(max(A))
    exit()
if N == 3:
    x1 = gcd_wrapper(A[0], A[1])
    x2 = gcd_wrapper(A[1], A[2])
    x3 = gcd_wrapper(A[0], A[2])
    print(max([x1, x2, x3]))
    exit()
A = sorted(A)
A.reverse()
init_results = []
for k, g in enumerate(A[0:3]):
    for h in A[k+1:4]:
        init_results.append(gcd_wrapper(g, h))
if max(init_results) == 1:
    print(1)
    exit()
stop_flag = 0
x = max(init_results)
final_result = set()
final_result.add(x)
for i in A:
    tmp = gcd_wrapper(x, i)
    if tmp == 1:
        stop_flag += 1
    else:
        x = tmp
        final_result.add(tmp)
if stop_flag >= 2:
    print(1)
else:
    sorted_final_result = sorted(list(final_result))
    if len(sorted_final_result) == 1:
        print(sorted_final_result[0])
        exit()
    divable = []
    for j in A:
        if j % sorted_final_result[1] != 0:
            divable.append(1)
    if sum(divable) > 1:
        print(sorted_final_result[0])
    else:
        print(sorted_final_result[1])
n = int(input())
pos=[]
for i in range(n):
  x,y,h = map(int, input().split())
  pos.append([x,y,h])

def solve():
  for cx in range(101):
    for cy in range(101):
      H = h+abs(x-cx)+abs(y-cy)
      if all(h == max(H-abs(x-cx)-abs(y-cy), 0) for x,y,h in pos):
        return(cx,cy,H)

cx,cy,H=solve()
print(cx,cy,H)

### FIXED CODE ###

n = int(input())
pos=[]
for i in range(n):
  x,y,h = map(int, input().split())
  pos.append([x,y,h])

pos = sorted(pos, key=lambda x: x[2])
tx,ty,th = pos[-1]
def solve():
  for cx in range(101):
    for cy in range(101):
      H = th+abs(tx-cx)+abs(ty-cy)
      for x,y,h in pos:
        if h != max(H-abs(x-cx)-abs(y-cy), 0):
          break
      else:
        return(cx,cy,H)

cx,cy,H=solve()
print(cx,cy,H)
import functools import reduce
import fractions import gcd

n = int(input())
A = [int(i) for i in input().split()]

print(reduce(gcd, A))

### FIXED CODE ###

from functools import reduce
from fractions import gcd

n = int(input())
A = [int(i) for i in input().split()]

print(reduce(gcd, A))
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



import bisect
from math import gcd
n = int(input())
l = [None] * n
for i in range(n):
    a,b = map(int, input().split())
    g = gcd(a,b)
    l[i] = (a//g, b//g)

l.sort()
M = 1000000007
seen = [False] * n
vals = []

def sub(item):
    item1 = (item[1], -item[0])
    item2 = (-item[1], item[0])
    tmp = None
    count = 0
    li = bisect.bisect_left(l, item1)
    ri = bisect.bisect_right(l, item1)
    count += (ri-li)
    for v in range(li, ri):
        seen[v] = True
    if ri>li:
        tmp = l[li]
        
    li = bisect.bisect_left(l, item2)
    ri = bisect.bisect_right(l, item2)
    count += (ri-li)
    for v in range(li, ri):
        seen[v] = True
    if ri>li:
        tmp = l[li]
    
    return count, tmp

for i,item in enumerate(l):
    if seen[i]:
        continue
    count,tmp = sub(item)
    if count>0:
        count2, tmp = sub(tmp)
        vals.append((pow(2,count,M)+pow(2,count2,M)-1)%M)
    else:
        vals.append(2)
ans = 1
for v in vals:
    ans *= v
    ans %= M
if len(vals)>=2:
    ans -= 1
print(ans%M)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



import bisect
from math import gcd
n = int(input())
l = [None] * n
for i in range(n):
    a,b = map(int, input().split())
    g = gcd(a,b)
    if g==0:
        g = 1
    l[i] = (a//g, b//g)

l.sort()
M = 1000000007
seen = [False] * n
vals = []

def sub(item):
    item1 = (item[1], -item[0])
    item2 = (-item[1], item[0])
    tmp = None
    count = 0
    li = bisect.bisect_left(l, item1)
    ri = bisect.bisect_right(l, item1)
    count += (ri-li)
    for v in range(li, ri):
        seen[v] = True
    if ri>li:
        tmp = l[li]
        
    li = bisect.bisect_left(l, item2)
    ri = bisect.bisect_right(l, item2)
    count += (ri-li)
    for v in range(li, ri):
        seen[v] = True
    if ri>li:
        tmp = l[li]
    
    return count, tmp
zcount = 0
for i,item in enumerate(l):
    if seen[i]:
        continue
    elif item==(0,0):
        zcount += 1
        continue
    count,tmp = sub(item)
    if count>0:
        count2, tmp = sub(tmp)
        vals.append((pow(2,count,M)+pow(2,count2,M)-1)%M)
    else:
        vals.append(2)
ans = 1
for v in vals:
    ans *= v
    ans %= M
ans -= 1
ans = (ans+zcount) % M
print(ans)