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 <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>
#include <iterator>

#include <cmath>

typedef std::pair<double,double> Vec;
typedef std::pair<Vec,Vec> Line;

Vec operator+(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first+rhs.first, lhs.second+rhs.second);
}

Vec operator-(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first-rhs.first, lhs.second-rhs.second);
}

Vec lineToVec(const Line& l) {
	return l.first - l.second;
}

double cross(const Vec& lhs, const Vec& rhs) {
  return lhs.first*rhs.second - lhs.second*rhs.first;
}

int main(void){
	using namespace std;

	int n;
	cin >> n;

	vector< pair<Line,Line> > input;
	input.reserve(n);

	double x1,y1,x2,y2,x3,y3,x4,y4;
	while(cin
		>> x1 >> y1
		>> x2 >> y2
		>> x3 >> y3
		>> x4 >> y4){

		auto AB = make_pair( make_pair(x1,y1), make_pair(x2,y2) );
		auto CD = make_pair( make_pair(x3,y3), make_pair(x4,y4) );

		input.push_back(make_pair(AB,CD));
	}

	for(auto itr=input.begin(); itr!=input.end(); itr++){
		auto AB = itr->first;
		auto CD = itr->second;

		auto cr = cross( lineToVec(AB), lineToVec(CD) );

		if( abs(cr) <10e-10 ){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

C++: #include<iostream>

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

  std::cin >> n;

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

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

int main() {
  int n;
  double x[4];
  double y[4];
  const double eps = 1.0e-12;

  scanf("%d", &n);
  while (n--) {
    for (int i=0; i<4; i++) {
      scanf("%lf %lf", &x[i], &y[i]);
    }
    if (abs((y[1]-y[0])*(x[3]-x[2]) - (x[1]-x[0])*(y[3]-y[2])) < eps) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }

  return 0;
}

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


using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		double x[4], y[4];
		for (int j = 0; j < 4; ++j)
			scanf("%lf %lf", x+j, y+j);

		double x1 = x[1] - x[0];
		double y1 = y[1] - y[0];
		double x2 = x[3] - x[2];
		double y2 = y[3] - y[2];
		if (abs(x1) < 0.001 && abs(x2) < 0.001
			|| abs(y1/x1-y2/x2) < 0.001)
			puts("YES");
		else
			puts("NO");
	}

	return 0;
}

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

int main() {

  int n;
  cin >> n;

  for ( int i = 0; i < n; i++ ) {

    double x[4],y[4];
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

    if ( ( x[0] - x[1] ) * ( x[2] - x[3] ) == 0 ) {

      if ( x[0] == x[1] && x[2] == x[3] ) {
	cout << "YES" << endl;
      }else {
	cout << "NO" << endl;
      }

    }else {

      long long int t1 = ( y[1] - y[0] ) * 1000000 / ( x[1] - x[0] );
      long long int t2 = ( y[3] - y[2] ) * 1000000 / ( x[3] - x[2] );

      if ( t1 == t2 ) {
	cout << "YES" << endl;
      }else {
	cout << "NO" << endl;
      }

    }

  }

  return 0;

}

C++: #include <stdio.h>
#define EPSIRON (1.0e-30)

int main(void){
    int n;
    double x1, x2, x3, x4, dx1, dx2;
    double y1, y2, y3, y4, dy1, dy2;
    double cp; // cross product
    
    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;
        cp = dx1 * dy2 - dy1 * dx2;
        printf("%s\n", cp*cp < EPSIRON ? "YES" : "NO");
    }
    
    return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	while(n > 0){
		double x[4];
		double y[4];

		for(int i = 0; i < 4; ++i){
			cin >> x[i] >> y[i];
		}

		double m1 = (y[0] - y[1]) / (x[0] - x[1]);
		double m2 = (y[2] - y[3]) / (x[2] - x[3]);

		cout << (m1 == m2 ? "YES" : "NO") << endl;

		--n;
	}

	return 0;
}

C++: #include <stdio.h>

int main()
{
	int n;
	double x[4], y[4];

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);

		if((x[1]-x[0])*(y[3]-y[2]) == (y[1]-y[0])*(x[3]-x[2])) puts("YES");
		else puts("NO");
	}

	return 0;
}

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

int main()
{
	int n;
	cin>>n;
	complex<double> a,b,c,d;
	while(n--)
	{
		cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag();
		a=a-b;
		c=c-d;

		cout<<(a.real()*c.imag()-a.imag()*c.real()==0?"YES":"NO")<<endl;
	}
	return 0;
}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 201
#define _MAX 100
#define ABC 26
int main(void)
{
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		if ((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4))
			printf("YES\n");
		else
			printf("NO\n");
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
const double eps = 1e-9;
int main() {
    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;
        x1 *= 100000;
        y1 *= 100000;
        x3 *= 100000;
        y3 *= 100000;
        x1 -= x2 * 100000;
        y1 -= y2 * 100000;
        x3 -= x4 * 100000;
        y3 -= y4 * 100000;
        cout << (abs(x1 * y3 - y1 * x3) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<2;j++) cin >> a[j] >> b[j] >> c[j] >> d[j];
    if(a[0]-b[0]==0&&c[0]-d[0]==0) cout << "YES" << endl;
    else if(a[1]-b[1]==0&&c[1]-d[0]==0) cout << "YES" << endl;
    else if(a[0]*d[0]+a[1]*b[1]==b[0]*d[0]+b[1]*d[1]) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

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

int main() {
	int n;
	double x1, x2, x3, x4, y1, y2, y3, y4;
	vector<double> X1, Y1, X2, Y2;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		X1.push_back(x2 - x1); Y1.push_back(y2 - y1);
		X2.push_back(x4 - x3); Y2.push_back(y4 - y3);
	}
	for (int i = 0; i < n; i++) {
		if (fabs(X1[i]*Y2[i]-X2[i]*Y1[i]<1e-10))cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}