output_description: For each query, print "2", "1" or "0".
input_description: The entire input looks like:
  
      
      
      q (the number of queries)
      1st query
      2nd query
      ...
      qth query
      
  
  Each query consists of integer coordinates of the points p0, p1, p2, p3 in the
  following format:
  
      
      
      xp0 yp0 xp1 yp1 xp2 yp2 xp3 yp3
attempt: #!/usr/bin/env python3
  # CGL_2_A: Segments/Lines - Parallel/Orthogonal
  
  
  def is_parallel(v1, v2):
      return dot(orthogonal(v1), v2) == 0
  
  
  def is_orthogonal(v1, v2):
      return dot(v1, v2) == 0
  
  
  def dot(v1, v2):
      x1, y1 = v1
      x2, y2 = v2
      return x1 * x2 + y1 * y2
  
  
  def orthogonal(v):
      x, y = v
      return -y, x
  
  
  def run():
      q = int(input())
  
      for _ in range(q):
          x0, y0, x1, y1, x2, y2, x3, y3 = [int(i) for i in input().split()]
  
          v1 = (x1 - x0, y1 - y0)
          v2 = (x3 - x2, y3 - y2)
  
          if is_parallel(v1, v2):
              print(2)
          elif is_orthogonal(v1, v2):
              print(1)
          else:
              print(0)
  
  
  if __name__ == "__main__":
      run()
  
problem_description: Parallel/Orthogonal
  
    
  
  For given two lines s1 and s2, print "2" if they are parallel, "1" if they are
  orthogonal, or "0" otherwise.
  
  s1 crosses points p0 and p1, and s2 crosses points p2 and p3.
samples: [{"input": "3\n    0 0 3 0 0 2 3 2\n    0 0 3 0 1 1 1 4\n    0 0 3 0 1 1 2 2", "output": "2\n    1\n    0"}]