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<bits/stdc++.h>

#define EPS 1.0e-10

using namespace std;

bool is_parallel(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy){
    double cp = (bx-ax)*(dy-cy) - (by-ay)*(dx-cx);
    return fabs(cp) < EPS;
}

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

    return 0;
}

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

struct Point
{
  double x;
  double y;
};

//              --class Line
class Line
{
  public:
    Line(Point p1, Point p2);

  public:
    bool parallel(Line other); // 平行か

  private:
    Point m_p1;
    Point m_p2;
    double m_slope;     //  傾き
};

Line::Line(Point p1, Point p2)
{
  m_p1 = p1;
  m_p2 = p2;
  m_slope = ( p2.y - p1.y ) / ( p2.x - p1.x );
}

bool Line::parallel(Line other)
{
  return m_slope == other.m_slope;
}

int main(void)
{
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i)
  {
    Point p1, p2, p3, p4;
    cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
    Line line1(p1, p2);
    Line line2(p3, p4);
    cout << (line1.parallel(line2) ? "YES" : "NO") << endl;
  }
  return 0;
}

C++: #include <stdio.h>

int main(void)
{
    int i;

    int datesets;
    scanf("%d", &datesets);

    while (datesets--) {
        double x[4], y[4];
        for (i = 0; i < 4; i++) {
            scanf(" %lf %lf", &x[i], &y[i]);
        }

        double judge = (x[0] - x[1]) * (y[2] - y[3])
                        - (x[2] - x[3]) * (y[0] - y[1]);
        if (judge == 0) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return 0;
}

C++: #include<iostream>
#define rep(i,x) for(int i=0;i<x;i++)
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        double a[4][2];
        rep(i,4)rep(j,2)cin>>a[i][j];
        double line1=(a[1][1]-a[0][1])/(a[1][0]-a[0][0]);
        double line2=(a[3][1]-a[2][1])/(a[3][0]-a[2][0]);
        if(line1==line2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)

int n;
double xa, ya, xb, yb, xc, yc, xd, yd, d1, d2;

int main() {
	scanf("%d",&n);
	rep(i,n) {
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd);
		if (xa==xb) d1 = 1e200;
		else d1 = (yb-ya)/(xb-xa);
		if (xc==xd) d2 = 1e200;
		else d2 = (yd-yc)/(xd-xc);
		if (abs(d1-d2)<1e-10) printf("YES\n");
		else printf("NO\n");
	}
}

C++: a#include <iostream>

using namespace std;



struct pt {

	double x;

	double y;

};



int main() {

	int num;

	cin >> num;

	while(num--) {

		pt p1, p2, p3, p4;

		cin >> p1.x >> p1.y;

		cin >> p2.x >> p2.y;

		cin >> p3.x >> p3.y;

		cin >> p4.x >> p4.y;

		pt v1 = {p1.x-p2.x, p1.y-p2.y};

		pt v2 = {p3.x-p4.x, p3.y-p4.y};

		if (v1.y==0 && v2.y==0) cout << "YES\n";

		else if (v1.x/v1.y == v2.x/v2.y) cout << "YES\n";

		else cout << "NO\n";

	}

	return 0;

}

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

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

    cin >> num;

    for(i = 0; i < num; i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        cross = abs((x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3));
        if(cross < 1e-11){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

using namespace std;

void swap(double &x, double &y, double &xx, double &yy) 
{
  double tmp_x = x;
  double tmp_y = y;
  x = xx;
  y = yy;
  xx = tmp_x;
  yy = tmp_y;
}

bool isZero(double x) 
{
  return x < 0.000001;
}

void compute(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) 
{
  if (x1 > x2) swap(x1, y1, x2, y2);
  if (x3 > x4) swap(x3, y3, x4, y4);

  double diff_x12 = x2 - x1;
  double diff_y12 = y2 - y1;
  double diff_x34 = x4 - x3;
  double diff_y34 = y4 - y3;

  if (isZero(diff_x12) && isZero(diff_y12))
    cout << "NO" << endl;
  else if (isZero(diff_x34) && isZero(diff_y34))
    cout << "NO" << endl;  
  else if (!isZero(diff_x12) && !isZero(diff_x34)) {
    if (isZero(diff_y12) && isZero(diff_y34))
      cout << "YES" << endl;
    else {
      double ab = diff_y12 / diff_x12;
      double cd = diff_y34 / diff_x34;
      if (isZero(abs(ab - cd)))
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  else if (isZero(diff_x12) && isZero(diff_x34)) 
    cout << "YES" << endl;  
  else
    cout << "NO" << endl;  
}

int main(void) 
{
  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;
    compute(x1, y1, x2, y2, x3, y3, x4, y4);
  }
  
  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-5) cout << "YES" << endl;
        else cout << "NO" << endl;
        */
        if(abs(arg(v1)-arg(v2)) < 1e-8) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>

struct Point2D {
	double x, y;
	Point2D operator-(Point2D &inp) {
		Point2D ans;
		ans.x = this->x - inp.x;
		ans.y = this->y - inp.y;
		return ans;
	}
	static double crossZ(Point2D &a, Point2D &b) {
		return a.x * b.y - a.y * b.x;
	}
};

int main() {
	int dataSet;
	Point2D p[4], v[2];
	for (std::cin >> dataSet; dataSet > 0; --dataSet) {
		std::cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y >> p[3].x >> p[3].y;
		v[0] = p[1] - p[0];
		v[1] = p[3] - p[2];
		std::cout << ((Point2D::crossZ(v[0], v[1]) == 0.) ? "YES" : "NO") << '\n';
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef complex<double> xy_t; 
xy_t a[100], b[100], c[100], d[100];
double x, y;
int n;
int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> x >> y;
		a[i]=xy_t(x, y);
		cin >> x >> y;
		b[i]=xy_t(x, y);
		cin >> x >> y;
		c[i]=xy_t(x, y);
		cin >> x >> y;
		d[i]=xy_t(x, y);
	}
	for(int i=0; i<n; i++)
	{
		if(abs((conj(b[i]-a[i])*(d[i]-c[i])).imag())<1e-10)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}