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 <complex>
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
using namespace std;
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;
    complex<double> c1(x1, y1);
    complex<double> c2(x2, y2);
    complex<double> c3(x3, y3);
    complex<double> c4(x4, y4);
    double a = arg(c2 - c1) - arg(c4 - c3);
    cout << ((a == 0 || a == M_PI || a == -M_PI) ? "YES" : "NO") << endl;
  }
}

C++: #include <cstdio>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> P;
struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a);
        push_back(b);
    }
};

const double EPS = 1e-10;

double cross(P a, P b)
{
    return imag(conj(a) * b);
}

bool intersectLL(const L &l, const L &m)
{
    return fabs(cross(l[1]-l[0], m[1]-m[0])) > EPS;
}

int main()
{
    int n;

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

        scanf("%lf %lf", &x, &y);
        p[0] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[1] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[2] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[3] = P(x, y);

        puts(intersectLL(L(p[0], p[1]), L(p[2], p[3])) ? "NO" : "YES");
    }

    return 0;
}

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

double EPS = 1e-17;
// BEGIN //////////////////////////////////////////////////////////////
int main() {
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
 		scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
	 	double s = x1 - x2, t = y1 - y2, u = x3 - x4, v = y3 - y4;
	 	if (s * v == t * u) {
		 	printf("YES\n");
	 	} else {
		 	printf("NO\n");
	 }
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

double x[10],y[10];
double g1,g2;
int tc;

int main()
{
	scanf("%d",&tc);
	while(tc--)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3],&x[4],&y[4]);
		g1=(y[2]-y[1])/(x[2]-x[1]);
		g2=(y[4]-y[3])/(x[4]-x[3]);
		if(g1==g2)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		//printf("%.2lf,%.2lf\n",g1,g2);
	}
	return 0;
}

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

#define EPS 0.0000001

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;
      if(abs((y2-y1)/(x4-x3)-(y4-y3)/(x2-x1)) <EPS )cout << "YES" << endl;
      else cout << "NO" << endl;
    }


  return 0;
}

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

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

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

		double abx = fabs(x[0] - x[1]), cdx = fabs(x[2] - x[3]);
		double aby = y[0] - y[1], cdy = y[2] - y[3];

		if (aby / abx == cdy / cdx){
		   cout << "YES" << endl;
		}

		else {
			cout << "NO" << endl;
		}
	}
	return (0);
}

C++: #include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
#include <iomanip>

struct Point
{
    float x;
    float y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    // std::cerr << std::fixed << std::setprecision(100) << GetSlope(l1) << std::endl;
    // std::cerr << std::fixed << std::setprecision(100) << GetSlope(l2) << std::endl;
    // return GetSlope(l1) == GetSlope(l2);
    const double gosa = 0;
    double Slope1 = GetSlope(l1);
    double Slope2 = GetSlope(l2);
    return std::fabs(Slope1 - Slope2) <= gosa;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> p = Input(std::cin);
        std::cout << (IsParallel(p) ? "YES" : "NO") << std::endl; 
        // if((p[1].y-p[0].y)/(p[1].x-p[0].x) == (p[3].y-p[2].y)/(p[3].x-p[2].x)){
        //     std::cout << "YES";
        // }else{
        //     std::cout << "NO";
        // }
        // std::cout << std::endl;
    }
    return 0;
}

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

using namespace std;
#define eps 1e-9

void solve()
{
	int N;
	cin >> N;
	while(N--)
	{
		double x[4], y[4];
		for(int i = 0; i < 4; ++i)
		{
			cin >> x[i] >> y[i];
		}
		if(fabs(x[1] - x[0]) < eps && fabs(x[3] - x[2]) < eps)
		{
			cout << "YES" << endl;
		}
		else if(fabs(x[1] - x[0]) < eps || fabs(x[3] - x[2]) < eps)
		{
			cout << "NO" << endl;
		}
		else if(fabs((y[1] - y[0]) / (x[1] - x[0]) - (y[3] - y[2]) / (x[3] - x[2])) < eps)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

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

C++: #include <iostream>

enum {X1,Y1,X2,Y2,X3,Y3,X4,Y4};

void calcDistance(int x1, int y1, int x2, int y2, int* dx, int* dy) {
	if(x1 < x2) {
		*dx = x2 - x1;
		*dy = y2 - y1;
	} else {
		*dx = x1 - x2;
		*dy = y1 - y2;
	}
}

int main() {
	int n; std::cin >> n;
	double dp[8];
	int ip[8],dx1,dy1,dx2,dy2;
	for(int i=0; i<n; i++) {
		for(int j=0; j<8; j++) std::cin >> dp[j];
		for(int j=0; j<8; j++) ip[j] = (int)(dp[j] * 1000000);
		if(ip[X1] == ip[X2] || ip[X3] == ip[X4]) {
			if(ip[X1] == ip[X2] && ip[X3] == ip[X4]) {
				std::cout << "YES" << std::endl;
			} else {
				std::cout << "NO" << std::endl;
			}
		} else {
			calcDistance(ip[X1],ip[Y1],ip[X2],ip[Y2],&dx1,&dy1);
			calcDistance(ip[X3],ip[Y3],ip[X4],ip[Y4],&dx2,&dy2);
			if(((long long)dy1 * dx2) == ((long long)dx1 * dy2)) {
				std::cout << "YES" << std::endl;
			} else {
				std::cout << "NO" << std::endl;
			}
		}
	}
	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] ) {

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

    }else {

      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;

}