Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                fmt.Scanf("%f %f %f %f %f %f %f %f",
                        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

C++: #include <iostream>
#include <cmath>
using namespace std;

const double EPS = 1e-10;

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b)))
		return 0;
	return a + b;
}

struct P {
	double x, y;
	P() {};
	P(double x, double y) : x(x), y(y) {
	}

	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}

	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}

	P operator * (double d) {
		return P(x * d, y * d);
	}

	P operator / (double d) {
		return P(x / d, y / d);
	}

	// 内積
	double dot(P p) {
		return add(x * p.x, y * p.y);
	}

	// 外積
	double det(P p) {
		return add(x * p.y, -y * p.x);
	}
};

// 線分上に点があるか
bool on_seg(P p1, P p2, P q) {
	return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}

// 直線と直線の交点
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}

// 2直線の直行判定
bool line_orth(P a1, P a2, P b1, P b2) {
	return fabs((a1 - a2).dot(b1 - b2)) < EPS;
}

// 2直線の平行判定
bool line_paral(P a1, P a2, P b1, P b2) {
	return fabs((a1 - a2).det(b1 - b2)) < EPS;
}

int main(void) {
	int N;
	P p[4];
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> p[j].x >> p[j].y;
		}
		cout << (line_paral(p[0], p[1], p[2], p[3]) ? "YES" : "NO") << endl;
	}
}

C++: #include<iostream>
using namespace std;

int main(){
  int n;
  cin>>n;
  while(n--){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    long long int xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4;
    xx1 = x1*100000;
    yy1 = y1*100000;
    xx2 = x2*100000;
    yy2 = y2*100000;
    xx3 = x3*100000;
    yy3 = y3*100000;
    xx4 = x4*100000;
    yy4 = y4*100000;
    
    xx4 = xx4 - xx3 + xx1;
    yy4 = yy4 - yy3 + yy1;

    if(xx2 == xx4 && yy2 == yy4){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }


  }
  return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main() {
  int n;
  cin>>n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  for(int i=0;i<n;i++){ 
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ) 
      cout<<"YES\n";
    else
      cout<<"NO\n";
  }
  return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
    int n;
    cin >> n;
    while(n--){
        double x1,y1,x2,y2,x3,y3,x4,y4,ll,lll;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        ll = (y1-y2)/(x1-x2);
        lll = (y4-y3)/(x4-x3);
        cout << ((ll == lll)? "YES" : "NO") << endl;
    }
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	double veku1[2];
	double veku2[2];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;
		if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
			veku1[0] = x3 - x1;
			veku1[1] = y3 - y1;
			veku2[0] = x4 - x1;
			veku2[1] = y4 - y1;
			if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
				cout << "NO" << endl;
			} else {
				cout << "YES" << endl;
			}
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
 
int main(){
  double a,b,c,d,e,f,g,h;
  int t;
  
  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    cout << ((d-b)/(c-a) == (h-f)/(g-e) ? "YES" : "NO") << endl;
  }
 
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
// const double eps = 1e-9;
int main() {
    int n; cin >> n;
    for (int i = 0; i < n; ++i) {
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        x1 -= x2;
        y1 -= y2;
        x3 -= x4;
        y3 -= y4;
        cout << (x1 * y3 - y1 * x3 == 0 ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if((a[1].first-a[0].first)==0&&(a[3].first-a[2].first)==0)
            cout<<"NO"<<endl;
        else if((a[1].second-a[0].second)/(a[1].first-a[0].first)!=(a[3].second-a[2].second)/(a[3].first-a[2].first))
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

class vec2d {
public:
  double x,y;
  void set(double x=0,double y=0) {
    this->x = x;
    this->y = y;
  }
};
double cross(vec2d A,vec2d B) {
  return (A.x*B.y - B.x*A.y);
}
bool is_paralles(vec2d A,vec2d B) {
  if(cross(A,B) < 1e-9) return true;
  return false;
}

int main() {
  int n;
  cin >> n;
  while(n--) {
    double x1,y1,x2,y2;
    vec2d p[2];
    for(int i=0;i<2;i++) {
      cin >> x1 >> y1 >> x2 >> y2;
      p[i].set(x2 - x1,y2 - y1);
    }
    if(is_paralles(p[0],p[1])) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <iostream>
using namespace std;
void judge(double,double,double,double,double,double,double,double);

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;

	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		judge(x1, y1, x2, y2, x3, y3, x4, y4);
	}
	
	return 0;
}

void judge(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
	double abx = x2 - x1;
	double aby = y2 - y1;
	double cdx = x4 - x3;
	double cdy = y4 - y3;
	if (aby / abx == cdy / cdx) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return;

}

C++: 
#include <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> Point;

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];

        double dot = v1.real()*v2.real() + v1.imag()*v2.imag();
        double n = norm(v1) * norm(v2);
        if(abs(dot*dot - n) < 1e-9) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}