Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			a := (fpoints[1] - fpoints[3]) / (fpoints[0] - fpoints[2])
			b := (fpoints[5] - fpoints[7]) / (fpoints[4] - fpoints[6])
			if a == b {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

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

int main(){
	int n;
	long double t[100][8];
	long double ab, cd;
	cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 8; j++){
			cin >> t[i][j];
		}
	}
	for(int i = 0; i < n; i++){
		ab = (t[i][1]-t[i][3])*(t[i][4]-t[i][6]);
		cd = (t[i][5]-t[i][7])*(t[i][0]-t[i][2]);
		if(t[i][0] == t[i][2]){
			if(t[i][4] == t[i][6]){
				cout << "YES" << endl;
			}
			else{
				cout << "NO" << endl;
			}
		}
		else if(t[i][1] == t[i][3]){
			if(t[i][5] == t[i][7]){
				cout << "YES" << endl;
			}
			else{
				cout << "NO" << endl;
			}
		}
		else if(ab == cd){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

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

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

int main() {
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		long double x1, y1, x2, y2, x3, y3, x4, y4, ax, ay, bx, by;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		ax = x1 - x2; ay = y1 - y2;
		bx = x3 - x4; by = y3 - y4;
		if (std::abs(ax*by - ay*bx) < 0.00000000000000000000000000000001) {
			std::cout << "YES" << std::endl;
		}
		else {
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

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

int main() {
	double x[4], y[4], m[2];
	int i, n;
	cin >> n;
	while (n--) {
		for (i = 0; i < 4; i++)
			scanf("%lf %lf", &x[i], &y[i]);
		if (x[0] == x[1] && x[2] == x[3])
			cout << "YES" << endl;
		else if (x[0] != x[1] && x[2] != x[3]) {
			m[0] = (y[1]-y[0]) / (x[1]-x[0]);
			m[1] = (y[3]-y[2]) / (x[3]-x[2]);
			if (m[0] - m[1] == 0)
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		} else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
#define EPS (pow(10, -10))
#define EQ(a,b) (abs((a)-(b)) < EPS)


typedef complex<double> P;

double cross(P a, P b) {
    return(a.real() * b.imag() - a.imag() * b.real());
}

int is_parallel(P a1, P a2, P b1, P b2) {
    return(EQ(cross(a1 - a2, b1 - b2), 0.0));
}

int main(void) {
    int n;
	double x1,x2,x3,x4,y1,y2,y3,y4;
    
    cin >> n;
    for(int r = 0; r < n; r++) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        P a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
        if(is_parallel(a, b, c, d)) cout << "YES" << endl;
        else                        cout << "NO" << endl;
    }
    return(0);
}

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

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

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-2) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
	int k;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double veku1[2];
	double veku2[2];
	double veku3[2];
	double t;
	double m;
	cin >> k;

	for (int i = 0; i < k; 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;

		t = veku1[0] * veku2[0] + veku1[1] * veku2[1];

		if (t * t != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku2[0] * veku2[0] + veku2[1] * veku2[1])) {
			cout << "NO" << endl;
		} else {
			veku3[0] = x3 - x1;
			veku3[1] = y3 - y1;
			m = veku1[0] * veku3[0] + veku1[1] * veku3[1];
			if (m * m != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku3[0] * veku3[0] + veku3[1] * veku3[1])) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;

int main() {
    int n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> n;
    while(n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        cout << (abs((x2-x1)*(y4-y3) - (x4-x3)*(y2-y1)) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
struct Coordinate {
	long double x;
	long double y;
};
int main() {
	short int n;
	cin >> n;
	vector<bool>l;
	for (int i = 0; i < n; i++){
		Coordinate A, B, C, D;
		cin >> A.x >> A.y >> B.x >> B.y;
		long double Inclination_of_AB = (B.y - A.y) / (B.x - A.x);
		cin >> C.x >> C.y >> D.x >> D.y;
		long double Inclination_of_CD = (D.y - C.y) / (D.x - C.x);
		l.push_back(Inclination_of_AB == Inclination_of_CD);
	}
	for (bool i : l) {
		if (i) cout << "YES";
		else cout << "NO";
		cout << endl;
	}
	return 0;
}

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

using namespace std;

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

	cin >> n;

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

	for (int i = 0; i < n; i++)
	{
		if ((x2[i] - x1[i]) / (y2[i] - y1[i]) == (x4[i] - x3[i]) / (y4[i] - y3[i]))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	double zhyoxy[4], line1, line2;
	char hantei[2];
	int time;
	cin >> time;
	for (int i = 0; i < time; ++i) {
		for (int i = 0; i < 4; ++i) {
			cin >> zhyoxy[i];
		}
		if (zhyoxy[3] == zhyoxy[1]) {
			hantei[0] = 'y';
		}
		else if (zhyoxy[2] == zhyoxy[0]) {
			hantei[0] = 'x';
		}
		line1 = (zhyoxy[3] - zhyoxy[1]) / (zhyoxy[2] - zhyoxy[0]);
		for (int i = 0; i < 4; ++i) {
			cin >> zhyoxy[i];
		}
		if (zhyoxy[3] == zhyoxy[1]) {
			hantei[1] = 'y';
		}
		else if (zhyoxy[2] == zhyoxy[0]) {
			hantei[1] = 'x';
		}
		line2 = (zhyoxy[3] - zhyoxy[1]) / (zhyoxy[2] - zhyoxy[0]);
		if ((line1 == line2||zhyoxy[0]==zhyoxy[1])&&line1!=0&&line2!=0) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}