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 REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
const double eps=1e-10;
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;

signed main(){
  int n;
  cin>>n;
  while(n--){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    cout<<(abs((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1))<eps?"YES":"NO")<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
#include <complex>

using namespace std;

// deq notes ½Êô½É¨¯éxNgZ http://www.deqnotes.net/acmicpc/2d_geometry/
typedef complex<double> P;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

// OÏ (cross product) : a~b = |a||b|sinÆ
double cross(P a, P b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}

// 2¼üÌ½s»è: a//b <=> cross(a, b) = 0
int is_paralell (P a, P b) {
	return EQ ( cross(a, b), 0.0 );
}

int main()
{
	string str = "";
	int n;
	int i,j;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

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

		P p[4];	// A,B,C,D order
		getline (cin, str );
		stringstream ss(str);

		for (j = 0; j < 4; ++j){
			ss >> p[j].real() >> p[j].imag();
		} // end for

		if (is_paralell (p[1] - p[0], p[3] - p[2] ) ) {
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if

	} // end for
		
	return 0;
}

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


int main(){
	int n;
	pair <double, double> a, b, c, d;

	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> a.first >> a.second;
		cin >> b.first >> b.second;
		cin >> c.first >> c.second;
		cin >> d.first >> d.second;

		pair <double, double> v, u;
		v = { b.first - a.first, b.second - a.second };
		u = { d.first - c.first, d.second - c.second };

		if (abs(atan2(v.second, v.first) - atan2(u.second, u.first)) < 0.000001)
			cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


struct P
{
	double x, y;
};

bool operator > (P x, P y)
{ return x.x > y.x || (x.x == y.x && x.y > y.x); }

int main()
{
	vector<P> p(4);

	int n;
	cin >> n;
	
	rep(i, n)
	{
		rep(i, 4)
			cin >> p[i].x >> p[i].y;

		if(p[0] > p[1]) swap(p[0], p[1]);
		if(p[2] > p[3]) swap(p[2], p[3]);
	
		if((p[0].x - p[1].x) * (p[2].y - p[3].y) == (p[0].y - p[1].y) * (p[2].x - p[3].x))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

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

int main(){
   int n,i;
   double x1,y1,x2,y2,x3,y3,x4,y4;
   cin>>n;
   
   for(i=0;i<n;i++){
      cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
      
      if((max(y1,y2)-min(y1,y2))/(max(x1,x2)-min(x1,x2))==(max(y3,y4)-min(y3,y4))/(max(x3,x4)-min(x3,x4)))
         puts("YES");
      else
         puts("NO");
   }
   return 0;
}

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

int main(){

	int n;
	float ax,ay,bx,by,cx,cy,dx,dy;
	float Labx, Laby, Lcdx, Lcdy;
	float cross;

	cin >> n;

	for( int i=0;i<n;i++ ){
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;

		Labx = bx - ax;
		Laby = by - ay;
		Lcdx = dx - cx;
		Lcdy = dy - cy;

		cross = Labx * Lcdy - Laby * Lcdx;

		if( cross == 0.0 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;

	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  while(n--) {
    double a[4][2];

    for(int i=0; i<4; i++) cin >> a[i][0] >> a[i][1];
    if(abs((a[3][0]-a[2][0])*(a[1][1]-a[0][1])-(a[1][0]-a[0][0])*(a[3][1]-a[2][1]))<1e-10) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

C++: #include<iostream>
using namespace std;
int main()
{
    int num;
    double sx1, sy1, sx2, sy2;
    double ex1, ey1, ex2, ey2;
 
    cin >> num;
 
    for(int i = 0; i < num; i++)
    {
        cin >> sx1 >> sy1 >> sx2 >> sy2 >> ex1 >> ey1 >> ex2 >> ey2;
 
        if( (sy2-sy1)/(sx2 - sx1) == (ey2-ey1)/(ex2-ex1))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
}

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

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

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

#define eps 1.0e-7

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( (x1-x2)*(y3-y4)-(y1-y2)*(x3-x4) < eps ) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}