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 <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>
#include <iterator>

#include <cmath>

typedef std::pair<double,double> Vec;
typedef std::pair<Vec,Vec> Line;

Vec operator+(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first+rhs.first, lhs.second+rhs.second);
}

Vec operator-(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first-rhs.first, lhs.second-rhs.second);
}

Vec lineToVec(const Line& l) {
	return l.first - l.second;
}

double cross(const Vec& lhs, const Vec& rhs) {
  return lhs.first*rhs.second - lhs.second*rhs.first;
}

int main(void){
	using namespace std;

	int n;
	cin >> n;

	vector< pair<Line,Line> > input;
	input.reserve(n);

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

		auto AB = make_pair( make_pair(x1,y1), make_pair(x2,y2) );
		auto CD = make_pair( make_pair(x3,y3), make_pair(x4,y4) );

		input.push_back(make_pair(AB,CD));
	}

	for(auto itr=input.begin(); itr!=input.end(); itr++){
		auto AB = itr->first;
		auto CD = itr->second;

		auto cr = cross( lineToVec(AB), lineToVec(CD) );

		if( abs(cr) <10e-300 ){
			cout << "YES";
		}
		else{
			cout << "NO";
		}
		if( distance( itr, input.end() )>1 ){
			cout << endl;
		}
	}
}

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

const double eps=1e-10;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    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(fabs((x2-x1)*(y4-y3)-(y2-y1)*(x4-x3))<eps) cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

C++: //二次元幾何ライブラリ
#include <iostream>
#include <cstdio>
#include <complex>
#include <map>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define MC make_pair
#define ML make_pair 
#define X real()
#define Y imag()
typedef double D;
typedef bool B;
typedef complex<D> P;   //点
typedef complex<D> V;   //ベクトル
typedef pair<P,P>  L;   //直線
typedef pair<P,D>  C;   //円
typedef vector<P>  Pol; //多角形

//変数名定義
const D INF = 1e100;
const D EPS = 1e-12;
const D PI = acos(-1);

template<class T> bool operator==(T a, T b){return abs(a - b )< EPS;}
template<class T> int sig(T r) {return (r==0||r==-0) ? 0 : r > 0 ? 1 : -1;}

P p3,p4;
int num;

// ベクトルaの絶対値を求める
// D Length = abs(a);

// 2点a,b間の距離を求める
// D Distance = abs(a-b); 

// 内積 (Inner Product) : a・b = |a||b|cosθ 1
D IP(V a, V b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}

// 外積 (Exterior Product) : |a×b| = |a||b|sinθ 2
D EP(V a, V b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}

// 点の進行方向について 3
int ccw(P a, P b, P c) {              //点aと点bが与えられた問いに
  b -= a; c -= a;
  if (EP(b, c) > 0)   return +1;      // counter clockwise
  if (EP(b, c) < 0)   return -1;      // clockwise
  if (IP(b, c) < 0)     return +2;    // c--a--b on line
  if (norm(b) < norm(c)) return -2;   // a--b--c on line
  return 0;                           // a--c--b on line  aとbの線分判定はこれ
}

// 2直線の垂直判定 : a⊥b <=> IP(a, b) = 0 4needs1
B IsVecular(L l1, L l2) {
	return IP(l1.first-l1.second, l2.first-l2.second)==0.0;
}

// 2直線の平行判定 : a//b <=> EP(a, b) = 0 5needs2
B IsParallel(L l1, L l2) {
	return abs(EP(l1.first-l1.second, l2.first-l2.second))<EPS;
}


//example : v1 = V(5.0,-3.0) p1=P(0.0,4.0)
int main(void){
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		P points[4];
		for(int j=0;j<4;j++)
			cin >> points[j].X >> points[j].Y;
		L l1,l2;
		l1=ML(points[0],points[1]);
		l2=ML(points[2],points[3]);
		if(IsParallel(l1,l2))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(abs(m1-m2)<1e-7) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

int main() {
	int n;
	xy a, b, c, d;

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

		xy s = a - b, t = c - d;
		if ((conj(s)*t).imag() == 0.0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;

}

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( (a).real() , (b).real() ) && EQ( (a).imag(), (b).imag() ) )

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  cin>>n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if( abs( (y2-y1)/abs(x2-x1) - (y4-y3)/abs(y4-y3)) <= EPS ){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

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

int main()
{
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		if ((x2 - x1)*(y4 - y3) - (x4 - x3)*(y4 - y3))
		{
			printf("NO\n");
		}
		else
		{
			printf("YES\n");
		}
	}
	return 0;
}

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

int main(){
  int n;
  float x1,y1,x2,y2,x3,y3,x4,y4;
  cin>>n;
  while(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 <stdio.h>

int main(){
	int num;
	double x1, y1;
	double x2, y2;
	double x3, y3;
	double x4, y4;
	long long ax, ay;
	long long bx, by;
	long long s;
			
	scanf("%d", &num);	
	for(int i = 0; i < num; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		
		ax = (x2 - x1)*1000000;
		ay = (y2 - y1)*1000000;
		bx = (x4 - x3)*1000000;
		by = (y4 - y3)*1000000;
		s = ax*by - ay*bx;
		if(s == 0){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	
	return 0;
}

C++: //0021 Parallelism

//x1,y1,x2,y2,x3,y3,x4,y4ª^¦çê½Æ«A_1,2ðÊé§íÆ_3,4ðÊé¼üª½s©»èµÈ³¢
//È¨A_ÌÀWÍ»ê¼ê|100Èã100ÈºÌÀÆ·é


#include<iostream>
#include<cmath>
using namespace std;

struct Point
{
	Point(){}
	Point(double x, double y):x(x),y(y){}
	double x, y;
};

int main(void)
{
	int n;
	int i;
	const int N = 4;
	Point p[N];

	cin >> n;
	while(n--)
	{
		for(i = 0; i < N; i++)
			cin >> p[i].x >> p[i].y;

		//2ÂÌ_ÌÊuxNgÌ·ðæé
		Point v1(p[0].x-p[1].x, p[0].y-p[1].y),
			v2(p[2].x-p[3].x, p[2].y-p[3].y);

		//KÉë·àe
		if( abs(v1.x*v2.y - v1.y*v2.x) < 0.001)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}