Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[4] == fpoints[6] {
			fmt.Println("YES")
			continue
		}
		a := (fpoints[1]-fpoints[3])/(fpoints[0]-fpoints[2])
		b := (fpoints[5]-fpoints[7])/(fpoints[4]-fpoints[6])
		if a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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].x - p[3].x && p[0].y - p[1].y == p[2].y - p[3].y)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

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

using namespace std;

int n;

double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;

int main(){

	int i;

	cin >> n;

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

		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;

		ta = xa - xb;

		tb = ya - yb;

		tc = xc - xd;

		td = yc - yd;

		if(tc/td == ta/tb) cout << "YES" << endl;

		else if(ta == -tc && tb == -td) cout << "YES" << endl;
		else cout << "NO" << endl;

	}

	return 0;

}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
	long double ax, ay, bx, by, cx, cy, dx, dy;
	int num;
	cin >> num;
	while (cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy) {
		/**
		double inner = (by - ay)*(dy - cy) + (bx - ax)*(dx - cx);
		double length = sqrt((by - ay)*(by - ay) + (bx - ax)*(bx - ax))
			* sqrt((dy - cy)*(dy - cy) + (dx - cx)*(dx - cx));
		*/
		//if(max(inner - length, length - inner) < 1e-5) {
		if((bx - ax) * (dy - cy) - (by - ay) * (dx - cx) == 0){
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
		//cout << (bx - ax) * (dy - cy) - (by - ay) * (dx - cy) << endl;
	}
	return 0;
}

C++: #include <cmath>
#include <complex>
#include <vector>
#include <cfloat>
#include <algorithm>
using namespace std;


//二次元幾何テンプレート
//点クラス point->x,y
//直線クラス line->s,v
//
class point;
class line;
point vec_add(point vec1,point vec2);//ベクトルの足し算
point vec_sub(point vec1,point vec2);//ベクトルの引き算
double inner_product(point a,point b);//内積
double outer_product(point a,point b);//外積
bool vec_parallel(point vec1,point vec2);//ベクトルの並行判定(交差判定falseとしても使える)
bool vec_angle_right(point vec1,point vec2);//ベクトルの直行判定
bool cross_line_segment(line a,point p1,point p2);//直線と線分の交差判定
//


class point{
public:
	double x,y;
	point(){
		x=0;
		y=0;
	}
	point(double a,double b){
		x=a;
		y=b;
	}
};

//直線クラス
class line{
public:
	point s,v;
public:
	line(point a,point b){
		s=a;
		v=vec_sub(a,b);
	}
};

//多角形(頂点を保持する)
typedef vector<point> polygon;

//ベクトルの足し算
point vec_add(point vec1,point vec2){
	point res(vec1.x+vec2.x,vec1.y+vec2.y);
	return res;
}
//ベクトルの引き算
point vec_sub(point vec1,point vec2){
	point res(vec1.x-vec2.x,vec1.y-vec2.y);
	return res;
}
//内積
double inner_product(point a,point b){
	return a.x * b.x + a.y * b.y;
}
//外積
double outer_product(point a,point b){
	return a.x * b.y - a.y * b.x;
}


//ベクトルの並行判定
bool vec_parallel(point vec1,point vec2){
	if(outer_product(vec1,vec2)==0){
		return true;
	}else{
		return false;
	}
}
//ベクトルの直交判定
bool vec_angle_right(point vec1,point vec2){
	if(inner_product(vec1,vec2)==0){
		return true;
	}else{
		return false;
	}
}

bool cross_line_segment(line l,point p1,point p2){
	p1=vec_sub(p1,l.s);
	p2=vec_sub(p2,l.s);
	if(outer_product(p1,l.v)*outer_product(p2,l.v)<0){
		return true;
	}else{
		return false;
	}
}



//
int main(){
	int n;
	point p[4];
	cin>>n;
	for(;n--;){
		for(int i=0;i<4;i++){
			cin>>p[i].x;
			cin>>p[i].y;
		}
		p[0]=vec_sub(p[0],p[1]);
		p[2]=vec_sub(p[2],p[3]);
		if(vec_parallel(p[0],p[2])){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		
	}
	return 0;
}

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-9;
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>>y2>>x2>>y2>>x3>>y3>>x4>>y4;
    cout<<((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)?"YES":"NO")<<endl;
  }
  return 0;
}

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

using P = complex<double>;

double cross(P p1, P p2) {
    return (p1.real() * p2.imag() - p1.imag() * p2.real());
}

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

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

using namespace std;
#define EPS 0.0000001
int main(){

	int n; cin >> n;
	double x[4],y[4]; //??\????????§?¨?

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

		if( abs((y[0]-y[1])*(x[3]-x[2]) + (x[0]-x[1])*(y[2]-y[3])) < EPS  ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#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;
    double vx = x2-x1 , vy = y2-y1;
    double ux = x4-x3 , uy = y4-y3;
    if(abs(vx*uy-ux*vy)<1.e-10){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

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


int main(){
  int n; cin >>n;
  for(int i=0; i<n; i++){
    float x1, y1, x2, y2, x3, y3, x4, y4;

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

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