Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&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)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    cin >> n;
    rep(j, n)
    {
        double a[8];
        rep(i, 8)
        {
            cin >> a[i];
        }
        double ans = (a[2] - a[0]) * (a[7] - a[5]) - (a[3] - a[1]) * (a[6] - a[4]);
        if (ans < 0.00001)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <complex>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <stdlib.h>

using namespace std;
typedef complex<long> com;

long tri(com a, com b) //triangle size
{
	return(conj(a)*b).imag() / 2;
}

long s_ll(string s) //入力した数字を10*6倍にしてlongとして読み取る
{
	int ssize=s.size();
	int j=6;
	for(int i=0;i<ssize;i++)
	{
		if(s[i]=='.')
		{
			s.erase(i,1);
			j=7-ssize+i;
			break;
		}
	}
	long l;
	l=atoi(s.c_str());
	for(int i=0;i<j;i++)
	{
		l=l*10;
	}
	return l;
}

int n;
string x1, x2, x3, x4, yi, y2, y3, y4;
long  X1, X2, X3, X4, Y1, Y2, Y3, Y4;

int main()
{
	cin >> n;
	while (n--)
	{
		cin >> x1 >> yi >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		X1 = s_ll(x1);
		X2 = s_ll(x2);
		X3 = s_ll(x3);
		X4 = s_ll(x4);
		Y1 = s_ll(yi);
		Y2 = s_ll(y2);
		Y3 = s_ll(y3);
		Y4 = s_ll(y4);
		if (tri(com(X2 - X1, Y2 - Y1), com(X4 - X3, Y4 - Y3)) == 0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
double x[100], y[100];

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

C++: #include <iostream>
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;
		x1 += 100; x2 += 100; x3 += 100; x4 += 100;
		y1 += 100; y2 += 100; y3 += 100; y4 += 100;
		if (x2 - x1 == 0 && x4 - x3 == 0) {
			cout << "YES" << endl;
			continue;
		}
		double m1 = (y2 - y1) / (x2 - x1);
		double m2 = (y4 - y3) / (x4 - x3);
		if (m1 == m2) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
	double N,xx,yy;
	double X[5],Y[5];
	string res[110];
	cin>>N;
	for(int j=1;j<=N;j++){
		for(int i=1;i<=4;i++){
			cin>>X[i]>>Y[i];
		}
		if((X[2]-X[1])*(Y[4]-Y[3])==(X[4]-X[3])*(Y[2]-Y[1])){
			res[j]="YES";
		}
		else{
			res[j]="NO";
		}
	}
	for(int i=1;i<=N;i++){
		cout<<res[i]<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

    ang_ab = (y1 - y2) / (x1 - x2);
    ang_cd = (y3 - y4) / (x3 - x4);

    if (x1 == x2 && x3 == x4) {
      cout << "YES" << endl;
    } else if (ang_ab == ang_cd) {
      cout << "YES" << endl;
    } else {
      cout << "NO"  << endl;
    }
  }

  return 0;
}

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

using namespace std;

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double deg1, deg2;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		deg1 = atan2(y2 - y1, x2 - x1);
		deg2 = atan2(y4 - y3, x4 - x3);
		if (deg1 == deg2)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;



struct pt {

	double x;

	double y;

};



int main() {

	int num;

	cin >> num;

	while(num--) {

		pt p1, p2, p3, p4;

		cin >> p1.x >> p1.y;

		cin >> p2.x >> p2.y;

		cin >> p3.x >> p3.y;

		cin >> p4.x >> p4.y;

		pt v1 = {p1.x-p2.x, p1.y-p2.y};

		pt v2 = {p3.x-p4.x, p3.y-p4.y};

		if (v1.y==0 && v2.y==0) cout << "YES\n";

		else if (v1.x/v1.y == v2.x/v2.y) cout << "YES\n";

		else cout << "NO\n";

	}

	return 0;

}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
typedef struct vec vec;

struct vec {
	double x, y;
};

static vec P(double x, double y){
	vec P = {x, y};
	return P;
}

static vec sub(vec a, vec b){
	return P(a.x - b.x, a.y - b.y);
}

static double cross(vec a, vec b){
	return (a.x * b.y - a.y * b.x);
}

int main(void){
    
    int n = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        double D[8];
        for(int j = 0; j < 8; j++){
            D[j] = 0.0;
        }
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &D[0], &D[1], &D[2], &D[3], &D[4], &D[5], &D[6], &D[7]);
        vec V[4];
    	for(int j = 0; j < 4; j++){
    		V[j] = P(D[2*j], D[2*j+1]);
    	}
    	vec a = sub(V[0], V[1]);
    	vec b = sub(V[2], V[3]);
    	if (cross(a, b) == 0){
    		cout << "YES" << endl;
    	}
    	else{
    		cout << "NO" << endl;
    	}
    }

    return 0;

}

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

C++: #include<iostream>
using namespace std;
 
int main(){
    int n;
    double x[4],y[4];
    cin>>n;
    for(;n--;){
        for(int i=0;i<4;i++){
            cin>>x[i];
            cin>>y[i];
        }
        if((x[0]-x[1])*(y[2]-y[3])==(x[2]-x[3])*(y[0]-y[1])){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

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

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

    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

const double EPS = 1e-11;

int main() {
	complex<double> p[4], a, b;
	double x, y;
	int n;
	cin >> n;
	for(int i = 0;i < n;++i) {
		for(int j = 0;j < 4;++j) {
			cin >> x >> y;
			p[j].real(x);
			p[j].imag(y);
		}
		a = p[1] - p[0];
		b = p[3] - p[2];
		double dot = real(conj(a) * b);
		if(signbit(dot)) dot *= -1.;
		cout << (abs(dot - (abs(a) * abs(b))) < EPS ? "YES" : "NO") << endl;
	}
	return 0;
}