Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))


//???

//???
class Point{
public:
	double x, y;
	//?????????????????????
	Point(int x_=0.0,int y_=0.0):x(x_),y(y_){}
	
	//??????????????????????????????
	Point operator + (Point &p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point &p) { return Point(x - p.x, y - p.y); }
	Point operator * (double k) { return Point(x * k, y * k); }
	Point operator / (double k) { return Point(x / k, y / k); }

	bool operator  < (const Point &p)const {
		return x!=p.x ? x<p.x : y<p.y;
	}
	bool operator == (const Point &p)const {
		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
	}

	//??¢??°
	double norm() { return x*x + y*y; }
	double abs() { return sqrt(norm()); }

};
typedef Point Vector;        //????????????
struct Segment{Point p1,p2;};//??????
typedef Segment Line;        //??´???

//???
class Circle {
public:
	Point center;
	double r;
	//?????????????????????
	Circle(Point c_=Point(),double r_=0.0):center(c_),r(r_){}
};
typedef vector<Point> Polygon;//????§???¢??????????????????



//??¢??°????????????

//?????????????????¢??°??????
namespace VFunc {
	//??????
	double dot(Vector a, Vector b) { return a.x*b.x + a.y*b.y; }
	//??????
	double cross(Vector a, Vector b) { return a.x*b.y - a.y*b.x; }
	//??´?????????????¨????
	bool isOrthogonal(Vector a, Vector b) { return equals(dot(a, b), 0.0); }
	bool isOrthogonal(Point a1,Point  a2, Point b1,Point b2) {return isOrthogonal(a1-a2,b1-b2);}
	bool isOrthogonal(Segment s1, Segment s2) { return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0); }
	//????????????????¨????
	bool isParallel(Vector a, Vector b) { return equals(cross(a, b), 0.0); }
	bool isParallel(Point a1, Point  a2, Point b1, Point b2) {return isParallel(a1 - a2, b1 - b2);}
	bool isParallel(Segment s1, Segment s2) {return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);}

}

//??????????????¨??????
int q;
Point p[4];

int main() {
	cin>>q;
	REP(i,q){
		REP(j, 4)cin >> p[i].x >> p[i].y;
		if      (VFunc::isParallel  (p[0], p[1], p[2], p[3])) cout << "2" << endl;
		else if (VFunc::isOrthogonal(p[0], p[1], p[2], p[3])) cout << "1" << endl;
		else                                                  cout << "0" << endl;
	}
}

Compiler output:
a.cc: In member function 'bool Point::operator==(const Point&) const':
a.cc:30:24: error: 'fabs' was not declared in this scope; did you mean 'abs'?
   30 |                 return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
      |                        ^~~~
      |                        abs
a.cc: In member function 'double Point::abs()':
a.cc:35:31: error: 'sqrt' was not declared in this scope
   35 |         double abs() { return sqrt(norm()); }
      |                               ^~~~
a.cc: In function 'bool VFunc::isOrthogonal(Vector, Vector)':
a.cc:5:22: error: 'fabs' was not declared in this scope; did you mean 'labs'?
    5 | #define equals(a,b) (fabs((a)-(b))<EPS)
      |                      ^~~~
a.cc:63:56: note: in expansion of macro 'equals'
   63 |         bool isOrthogonal(Vector a, Vector b) { return equals(dot(a, b), 0.0); }
      |                                                        ^~~~~~
a.cc: In function 'bool VFunc::isOrthogonal(Segment, Segment)':
a.cc:5:22: error: 'fabs' was not declared in this scope; did you mean 'labs'?
    5 | #define equals(a,b) (fabs((a)-(b))<EPS)
      |                      ^~~~
a.cc:65:60: note: in expansion of macro 'equals'
   65 |         bool isOrthogonal(Segment s1, Segment s2) { return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0); }
      |                                                            ^~~~~~
a.cc: In function 'bool VFunc::isParallel(Vector, Vector)':
a.cc:5:22: error: 'fabs' was not declared in this scope; did you mean 'labs'?
    5 | #define equals(a,b) (fabs((a)-(b))<EPS)
      |                      ^~~~
a.cc:67:54: note: in expansion of macro 'equals'
   67 |         bool isParallel(Vector a, Vector b) { return equals(cross(a, b), 0.0); }
      |                                                      ^~~~~~
a.cc: In function 'bool VFunc::isParallel(Segment, Segment)':
a.cc:5:22: error: 'fabs' was not declared in this scope; did you mean 'labs'?
    5 | #define equals(a,b) (fabs((a)-(b))<EPS)
      |                      ^~~~
a.cc:69:57: note: in expansion of macro 'equals'
   69 |         bool isParallel(Segment s1, Segment s2) {return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);}
      |                                                         ^~~~~~