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 <complex>
using namespace std;

int main()
{
	const double EPS = 1e-10;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		double a = arg((A-B)/(C-D));
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
	}
	return 0;
}

C++: #include<stdio.h>
double x[4],y[4];
double X[2],Y[2];
double s[2];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
         for(int j=0;j<4;j++)
         {
                scanf("%lf%lf",&x[j],&y[j]);
         }
         for(int j=0;j<2;j++)
         {
                (j==0)?X[j]=x[0]-x[1],Y[j]=y[0]-y[1]:X[j]=x[2]-x[3],Y[j]=y[2]-y[3];
         }
         for(int j=0;j<2;j++)
         {
                (Y[j]<0)?Y[j]=Y[j]*-1:Y[j]=Y[j]*1;
                s[j]=X[j]/Y[j];
         }
         (s[0]==s[1])?printf("YES\n"):printf("NO\n");
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>

using namespace std;

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;
		//scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);


#if 0
		// 線じゃなくて点の時
		if (x1 == x2 && y1 == y2) {
			cout << "NO" << endl;
		}
		// 線じゃなくて点の時
		if (x3 == x4 && y3 == y4) {
			cout << "NO" << endl;
		}

		// Y軸に平行な時
		if ( x2 - x1 == 0 && x4 - x3 == 0) {
			cout << "YES" << endl;
		}
		// X軸に平行な時
		if ( y2 - y1 == 0 && y4 - y3 == 0) {
			cout << "YES" << endl;
		}
#endif
		if ( abs((y2 - y1) *  (x4 - x3) - (y4 - y3) *  (x2 - x1)) < 0.0000000001 ) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		float x[4], y[4];
		for(int j = 0; j < 4; j++){
			cin >> x[j] >> y[j];
		}
	//	float ab = 99999999, cd = 99999999;
	//	if(x[0] != x[1]) ab = (y[0]-y[1]) / (x[0]-x[1]);
	//	if(x[2] != x[3]) cd = (y[2]-y[3]) / (x[2]-x[3]);
	//	if(ab == cd) cout << "YES"<< endl;
	//	else cout << "NO" << endl;

		puts((y[1]-y[0])/(x[1]-x[0]) == (y[3]-y[2])/(x[3]-x[2])?"YES":"NO");
	}
	return 0;
}

C++: #include<iostream>
#include<string>

using namespace std;

int N;
double X[4], Y[4];
long long ad, bc;

string parallel_judge(){
	ad = (X[1] * 100000 - X[0] * 100000)*(Y[3] * 100000 - Y[2] * 100000);
	bc = (Y[1] * 100000 - Y[0] * 100000)*(X[3] * 100000 - X[2] * 100000);
	if (ad - bc == 0){
		return "YES";
	}
	else{
		return "NO";
	}
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++){
		for (int j = 0; j < 4; j++){
			cin >> X[j] >> Y[j];
		}
		cout << parallel_judge() << endl;
	}
}

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

using P = complex<long long>;

int cross(P p1, P p2) {
    return (p1.real() * p2.imag() - p1.imag() * p2.real());
}

int main() {
    int n;
    cin >> n;
    while (n--) {
	double x[4], y[4];
	for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
	P pp[4];
	for (int i = 0; i < 4; i++) pp[i] = P(x[i] * 100000, y[i] * 100000);
	if (cross(pp[1] - pp[0], pp[3] - pp[2]) == 0) {
	    cout << "YES" << endl;
	}
	else {
	    cout << "NO" << endl;
	}
    }
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double a[4][2];
		for (int I = 0; I< 4; I++)
		{
			for (int k = 0; k < 2; k++)
			{
				cin >> a[I][k];
			}
		}
		double x, y;
		x = (a[1][1] - a[0][1]) / (a[1][0] - a[0][0]);
		y = (a[3][1] - a[2][1]) / (a[3][0] - a[2][0]);
		if (x == y)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

}

C++: #include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	double x[4],y[4],n;
	cin>>n;
	rep(i,n){
		rep(i,4)cin>>x[i]>>y[i];
		double vx=x[1]-x[0],vy=y[1]-y[0],ux=x[3]-x[2],uy=y[3]-y[2];
		double la=sqrt(vx*vx+vy*vy),lb=sqrt(ux*ux+uy*uy);
		if(abs(vx*ux+vy*uy-la*lb)<1e-6)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-9;
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag();
		P one = a-b;
		P two = c-d;
		bool f = false;
		if( abs(one.real()) < EPS || abs(two.real()) < EPS ){
			f = abs(one.real()) < EPS && abs(two.real()) < EPS;
		}else{
			f = abs(one.imag()/one.real() - two.imag()/two.real()) < EPS;
		}
		cout << (f?"YES":"NO") << endl;
	}
}

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

using namespace std;

int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double x[4],y[4];
		for(int j=0;j<4;j++)
			cin>>x[j]>>y[j];
		if(abs((x[3]-x[2])*(y[1]-y[0])-(x[1]-x[0])*(y[3]-y[2]))<1e-10)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int n;
double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;
int main(){
	int i;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
		ta = xa - xb;
		tb = ya - yb;
		tc = xc - xd;
		td = yc - yd;
		if(tb == td && ta == tc) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <stdio.h>

#define ABS(X) ((X)<0 ? -(X) : (X))
int main(){
    int n;
    double x1, y1, x2, y2;
    double x3, y3, x4, y4;
    double dx1, dy1, dx2, dy2;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        if (ABS(dx1*dy2 - dx2*dy1) < 0.001){
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return 0;
}

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

using namespace std;
typedef complex<double> P;

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n;
  P a,b;
  for(cin>>n;n>0;n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    a = P(x2-x1,y2-y1);
    b = P(x4-x3,y4-y3);
    if (EQV((a/abs(a)),(b/abs(b)))||(EQV((-a/abs(a)),(b/abs(b)))))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

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