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")
			continue
		}
		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>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

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

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>

#define abs(a) (a > 0 ? a:-a)
using namespace std;

void q21() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		double ax, ay, bx, by, cx, cy, dx, dy;
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
		if (bx - ax == 0 || dx - cx == 0) {
			if (bx - ax == dx - cx) {
				cout << "YES" << endl;
				continue;
			}
		}
		else if (abs((by - ay) / (bx - ax) - (dy - cy) / (dx - cx)) <= 0.000001 ){
			cout << "YES" << endl;
			continue;
		}
		cout << "NO" << endl;
	}
}

int main() {
	q21();
	return 0;
}

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


class vec{
public:
	double x;
	double y;

	vec(){}
	vec(double x1, double y1, double x2, double y2) : x(x2 - x1), y(y2 - y1){}

	double sarrus(const vec v){
		return x*v.y - y*v.x;
	}
};


int main(){
	int n;
	double x1, y1, x2, y2;
	vec v1, v2;
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> x1 >> y1 >> x2 >> y2;
		v1 = vec(x1, y1, x2, y2);
		cin >> x1 >> y1 >> x2 >> y2;
		v2 = vec(x1, y1, x2, y2);

		if(v1.sarrus(v2) == 0) 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 = b-a;
		P two = d-c;
		cout << (one.imag()/one.real() == two.imag()/two.real()?"YES":"NO") << endl;	
	}
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(((x2 - x1)*(y4 - y3))-((x4 - x3)*(y2 - y1))==0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

using namespace std;

int N;
double X[4], Y[4];

string parallel_judge(){
	if ((X[1] * 100000 - X[0] * 100000)*(Y[3] * 100000 - Y[2] * 100000) == (Y[1] * 100000 - Y[0] * 100000)*(X[3] * 100000 - X[2] * 100000)){
		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 <cstdint>

int main()
{
	std::uint32_t n;
	std::cin >> n;
	for (std::uint32_t i = 0; i < n; ++i) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (x1 - x2 == 0) {
			if (x3 - x4 == 0 && y1 - y2 == y3 - y4) {
				std::cout << "NO" << std::endl;
			}
			else {
				std::cout << "YES" << std::endl;
			}
		}
		else {
			if ((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4)) {
				std::cout << "NO" << std::endl;
			}
			else {
				std::cout << "YES" << std::endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int n;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	cin>>n;
	for(int i=0;i<n;i++){
	    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;


    double a,b;
    a=(y2-y1)/(x2-x1);
    b=(y4-y3)/(x4-x3);
    (a==b)? cout<<"YES"<<endl : cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main() {

	int n;
	double x[4] = { 0 }, y[4] = { 0 }, ans[2] = { 0 };

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		ans[0] = (y[1] - y[0]) / (x[1] - x[0]);
		ans[1] = (y[3] - y[2]) / (x[3] - x[2]);

		if (ans[0] == ans[1])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
		ans[0] = ans[1] = 0;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
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;

		double a1,a2;
		a1 = (y2-y1)/(x2-x1);
		a2 = (y4-y3)/(x4-x3);

		if(a1 == a2){
			cout << "YES" << endl;
		}
		else cout << "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;
}