Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&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)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

typedef double Real;
typedef complex<Real> Point;
typedef pair<Point,Point> Line;

const Real EPS=1e-9;

inline Point vec(const Line& a){
    return a.second-a.first;
}

Real dot(Point a,Point b){
    return (conj(a)*b).real();
}

Real cross(Point a,Point b){
    return (conj(a)*b).imag();
}

inline int sgn(Real a,Real b=0){
    return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;
}

inline bool near(Point a,Point b){
    return !sgn(abs(a-b));
}

inline bool is_orthogonal(Line la,Line lb){
    return !sgn(dot(vec(la),vec(lb)));
}

inline bool is_parallel(Line la,Line lb){
    return !sgn(cross(vec(la),vec(lb)));
}

inline bool is_intersected_line(Line la,Line lb){
    return !is_parallel(la,lb);
}

inline Real arg(const Point& base,const Point& a,const Point& b){
    return arg((b-base)/(a-base));
}

inline Real sr(Real a){
    return sqrt(max(a,(Real)0));
}

inline Real dist(Point a,Point b){
    return abs(a-b);
}

inline Real length(Point a){
    return abs(a);
}

inline Point unit_vector(Point a){
    return a / abs(a);
}


Point rotate(Point x,Real rad){
    return Point(x.real()*cos(rad)-x.imag()*sin(rad),x.real()*sin(rad)+x.imag()*cos(rad));
}                             

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    Point A[4];

    cin>>n;
    for(int i=0;i<n;i++){
        for(auto &t:A){
            double x,y;
            cin>>x>>y;
            t=Point(x,y);
        }

        Line la=make_pair(A[0],A[1]),lb=make_pair(A[2],A[3]);

        cout << (is_parallel(la,lb) ? "YES" : "NO") << endl;
    }

    return 0;
}

C++: #include<iostream>
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;

        if( !((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)) ) cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}

C++: #include

<cstdio>

using

namespace
std;

int
n;

double
x[4],y[4];

int
main()
{

	

scanf(

"%d"
,&n);

	

for
(

int
c = 0; c < n; c++)

	

{

		

for
(

int
i = 0; i < 4; i++)

			

scanf(

"%lf%lf"
,&x[i],&y[i]);

		

puts((y[1]-y[0])/(x[1]-x[0]) == (y[3]-y[2])/(x[3]-x[2])?

"YES"
:

"NO"
);

	

}
}

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

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

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

		if( (ay-by)/(ax-by) == (cy-dy)/(cx-dx) )
		{
			if( ax != cx && bx != dx && ay != cy && by != dy )
			{
				cout << "YES\n" ;
			}
		}
		else cout << "NO\n" ;
	}
	return 0;
}

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

#define eps 1e-5

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

    return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int n;
   long double x[4],y[4];
   cin >> n;
   REP(i,n){
      REP(j,4) cin >> x[j] >> y[j];
      if((x[1]-x[0])/(y[1]-y[0])==(x[3]-x[2])/(y[3]-y[2])) cout << "YES" << endl;
      else cout << "NO" << endl;
   }
}

C++: 
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int main(void){
    int n;
    double x[4],y[4],a,b,c,d,det;
    cin >> n;
    rep(j,n) {

    
    //入力を多少簡略化
    for(int i=0;i<4;i++) {
        cin >> x[i] >> y[i];
    }
    //(x1,y1)(x2,y2)を結ぶax+by=p の係数
    a = y[0]-y[1];  b = x[1]-x[0];
    //(x3,y3)(x4,y4)を結ぶcx+dy=q の係数
    c = y[2]-y[3];  d = x[3]-x[2];
    //係数についての行列式
    det = a*d-c*b;
    if(fabs(det) < 0.0001) cout << "YES" << endl;
    else cout << "NO" << endl;
    }
}

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


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

	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double xa = x2 - x1, ya = y2 - y1;
		double xc = x4 - x3, yc = y4 - y3;
		double cp = xa*yc - xc*ya;
		if(abs(cp) < 0.00001) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}