-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Forked.py
42 lines (37 loc) · 1006 Bytes
/
A_Forked.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import sys,math,os
from collections import defaultdict, deque, Counter, OrderedDict, namedtuple
from bisect import bisect_right, bisect_left
def li(): return list(map(int, sys.stdin.readline().strip().split()))
def intp(): return int(sys.stdin.readline().strip())
def string():
return sys.stdin.readline().strip()
def fast_io():
sys.stdin = open(0)
sys.stdout = open(1, "w")
def solve():
# Start here
a,b = li()
kingx,kingy = li()
queenx,queeny = li()
knightk = set()
knightq = set()
moves = [(a,b),(b,a),(a,-b),(-b,a),(-a,b),(b,-a),(-a,-b),(-b,-a)]
for i in moves:
nx = kingx + i[0]
ny = kingy + i[1]
knightk.add((nx,ny))
for i in moves:
nx = queenx + i[0]
ny = queeny + i[1]
knightq.add((nx,ny))
ans = 0
for i in knightk:
if i in knightq:
ans += 1
print(ans)
return
if __name__ == "__main__":
fast_io()
t = int(input())
for _ in range(t):
solve()