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 <complex.h>
#include <math.h>
using namespace std;

const double eps = pow(10, -11);
double x[4], y[4];
int N;
typedef complex<double> xy_t;

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag();}
int main() {
  cin >> N; //問題数
  for (int t=0; t<N; ++t) {
    for (int i=0; i<4; ++i)
	  cin >> x[i] >> y[i]; //x0,y0..x3,y3
	xy_t a[2] = {
	  xy_t(x[0], y[0]) - xy_t(x[1],y[1]),
	  xy_t(x[2], y[2]) - xy_t(x[3],y[3])
	  };
	  double s = cross_product(a[0] , a[1])/2;
	  bool p = abs(s) < eps;
	  cout << (p ? "YES" : "NO") << endl;
	  }
	 }

C++: #include <stdio.h>
#include <conio.h>

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

	scanf("%d",&num) ;
	for( int i = 0 ; i < num ; i ++ )
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ax , &ay , &bx , &by , &cx , &cy , &dx , &dy ) ;

		if( ((by-ay)/(bx-ax)) == ((dy-cy)/(dx-cx)) ) printf("YES\n") ;
		else printf("NO\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++){
		for(int j = 0; j < 4; j++){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		if((y[1] - y[0]) * (x[3] - x[2]) == (x[1] - x[0]) * (y[3] - y[2])){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <stdio.h>

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

	fgets(line, sizeof line, stdin);
	sscanf(line, "%d", &n);

	double x1, y1, x2, y2, x3, y3, x4, y4;
	
	while (n--) {
		fgets(line, sizeof line, stdin);
		sscanf(line, "%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

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

	return 0;
}

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

struct Point2D {
    double x, y;

    Point2D() {}
    Point2D(double ax, double ay) {
        x = ax;
        y = ay;
    }
    Point2D operator -(Point2D &p) {
        return Point2D(x - p.x, y - p.y);
    }
    double slope(Point2D &p) {
        return (p.x != x) ? (p.y - y) / (p.x - x) : numeric_limits<double>::infinity();
    }
    double cross(Point2D &p) { // only z
        return x * p.y - y * p.x;
    }
};

namespace std {
    istream &operator>>(istream &is, Point2D &p) {
        is >> p.x >> p.y;
        return is;
    }

    ostream &operator<<(ostream &os, Point2D &p) {
        os << fixed << p.x << " " << p.y;
        return os;
    }
}

int main()
{
    int n;
    cin >> n;
    for (Point2D a, b, c, d; n-- && cin >> a >> b >> c >> d;)
        cout << ((a.slope(b) == c.slope(d)) ? "YES" : "NO") << endl;

    return 0;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int n;
	cin >> n;

	for( int i = 0; i < n; ++i ) {
		double x[4], y[4];
		cin >> x[0] >> y[0];
		cin >> x[1] >> y[1];
		cin >> x[2] >> y[2];
		cin >> x[3] >> y[3];

		double vx0 = x[1] - x[0];
		double vy0 = y[1] - y[0];
		double vx1 = x[3] - x[2];
		double vy1 = y[3] - y[2];

		double result = vx0 * vy1 - vy0 * vx1;
		if( abs( result ) < 1e-10 ) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

int main()
{
	int n,d1,d2;
	double x[4], y[4];
	int ans[100];
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (x[0] > x[2])
			d1 = x[0] - x[2];
		else
			d1 = x[2] - x[0];
		if (x[1] > x[3])
			d2 = x[1] - x[3];
		else
			d2 = x[3] - x[1];
		if (d1 == d2)
			ans[a] = 0;
		else
			ans[a] = 1;
	}
	for (int b = 0; b < n; b++) {
		if (ans[b] == 0)
			cout << "YES" << endl;
		else if (ans[b] == 1)
			cout << "NO" << endl;

	}
}

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

C++: #include<cstdio>
#include<cmath>
struct Point
{
	double x,y;
};
int main(void)
{
	int num;
	Point a,b,c,d;
	scanf("%d",&num);
	for(int f1=0;f1<num;f1++)
	{
		scanf("%lf %lf",&a.x,&a.y);
		scanf("%lf %lf",&b.x,&b.y);
		scanf("%lf %lf",&c.x,&c.y);
		scanf("%lf %lf",&d.x,&d.y);
		Point vec1,vec2;
		vec1.x=b.x-a.x;vec1.y=b.y-a.y;
		vec2.x=d.x-c.x;vec2.y=d.y-c.y;
		if((float)atan2(vec1.y,vec1.x)==(float)atan2(vec2.y,vec2.x))
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;

	double x1, y1, x2, y2, x3, y3, x4, y4;

	while (n--){
		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>
using namespace std;
#define INF 1e+15

int main(){
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n;
	cin >> n;
	while( n-- ){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double tan1, tan2;
		if( x1 - x2 == 0 ){
			tan1 = INF;
		}else{
			tan1 = (x1-x2)*(y3-y4);
		}
		if( x3 - x4 == 0 ){
			tan2 = INF;
		}else{
			tan2 = (x3-x4)*(y1-y2);
		}
		if( tan1 == tan2 ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  int n; cin >> n;

  while (n--) {

    Real x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    x1 -= x2;
    y1 -= y2;
    x3 -= x4;
    y3 -= y4;

    if (x1 * y3 == y1 * x3) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }

  }

  return 0;
}