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 <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  // ifstream cin("../test.txt");
  int n;
  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; i++) {
      cin >> x[i] >> y[i];
    }

    string res;
    double d = (x[1] - x[0]) * (y[3] - y[2]) - (x[3] - x[2]) * (y[1] - y[0]);
    if (d > -0.00001 && d < 0.00001) {
      res = "YES";
    } else {
      res = "NO";
    }
    cout << res << endl;
  }
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || abs((y1 - y2) / (x1 - x2) - (y3 - y4) / (x3 - x4)) < 1.0e-10;
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}
//#include<iostream>
//int main()
//{
//	int n;
//	std::cin >> n;
//	for (int i = 0; i < n; i++)
//	{
//		double x1, y1, x2, y2, x3, y3, x4, y4;
//		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
//		std::cout << (x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4) ? "YES" : "NO") << std::endl;
//	}
//	return 0;
//}

C++: #include <iostream>

using namespace std;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

double cross_product(Vector& a, Vector& b)
{
  return a.x * b.y - b.x * a.y;
}

int main()
{
  int n;
  Vector A, B, C, D;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if(cross_product(AB, CD) != 0)
      cout << "NO" << endl;
    else 
      cout << "YES" << 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;
		double a = 99999, b = 99999;
		a = (x2 - x1)*(y4 - y3);
		b = (x4 - x3)*(y2 - y1);
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

C++: #include<iostream>
#include<cmath>
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;
		if((int)atan2(y2-y1,x2-x1)*1000000000==(int)atan2(y4-y3,x4-x3)*1000000000){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

int main(){
  int n;
  cin>>n;
  while(n--){
    double x[4];
    double y[4];
    for(int i=0;i<4;i++){
      cin>>x[i]>>y[i];
    }
    x[3]=x[3]-x[2]+x[0];
    y[3]=y[3]-y[2]+y[0];
    double xx=x[3]-x[1];
    double yy=y[3]-y[1];
    if(-1e-10 <= xx && xx <= 1e-10 && -1e-10 <= yy && yy <= 1e-10){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }

  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  int n;
  double x[4],y[4];

  cin >> n;
  while(n--){
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    y[1]-=y[0];
    x[1]-=x[0];
    y[3]-=y[2];
    x[3]-=x[2];
    if(fabs(y[1]*x[3] - y[3]*x[1]) < 10e-12)cout << "YES";
    else cout << "NO";
    cout << endl;
    }
  return 0;
}

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

int main(void)
{
	int i,count=0;
	cin>>i;
	while(count != i)
	{
	float x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

	float ax,ay,bx,by;
	
	if(x2<x1){ax=x1-x2;bx=x3-x4;}
	else{ax=x2-x1;bx=x4-x3;}
	
	if(y2<y1){ay=y1-y2;by=y3-x4;}
	else{ay=y2-y1;by=y4-y3;}

	if(ax==bx&&ay==by)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	count++;
	}
	
	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 <stdio.h>
#include <math.h>

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		
		double x1, y1, x2, y2, x3, y3, x4, y4;
		
		if (sscanf(line, "%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) != 8) {
			return 1;
		}
		
		double ab = INFINITY;
		double cd = INFINITY;

		if (x1 != x2) {
			ab = (y2 - y1)/(x2 - x1);
		}
		if (x3 != x4) {
			cd = (y4 - y3)/(x4 - x3);
		}
		
		printf("%s\n", ((ab == cd) ? "YES" : "NO"));
	}

	return 0;
}

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

#define EPS 1e-10

int main(){
  int n;
  double ax,ay,bx,by,cx,cy,dx,dy;

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
    if( abs(ax-bx)<EPS && abs(cx-dx)<EPS )cout << "YES\n";
    else if( abs(ax-bx)<EPS || abs(cx-dx)<EPS )cout << "NO\n";
    else if( abs( (ay-by)/(ax-bx) - (cy-dy)/(cx-dx) ) < EPS)cout << "YES\n";
    else cout << "NO\n";
  }
}