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>
using namespace std;
int main(){
  int n;
  cin >> n;
  double ax,ay,bx,by,cx,cy,dx,dy,ans1,ans2,x,y;
   for(int i=0;i<n;i++){
     cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
     x = ax - bx;
     y = ay - by;
     ans1 = y / x;
     x = cx - dx;
     y = cy - dy;
     ans2 = y / x;
     if(ans1==ans2) cout << "YES" << endl;
     if(ans1!=ans2) cout << "NO" << endl;
   }
   return 0;
}

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

int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	cin >> n;
	for (int i = 0 ; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double t_AB, t_CD;
		t_AB = (y2 - y1) / (x2 - x1);
		t_CD = (y4 - y3) / (x4 - x3);
		if (abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1))<1e-10) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;

}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4,lI,lII;
  cin >> n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    cout << (abs((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3)) < 1e-10 ? "YES" : "NO") << endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-10

using namespace std;

typedef long long ll;

int n;
double x[5];
double y[5];

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

		double k = (x[1] - x[0])*(y[3] - y[2])-(x[3] - x[2])*(y[1] - y[0]);
		if (fabs(k)< EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.pl", "r", stdin);
	string str = "";
	int n;

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

	int i,j;
	for (i = 0; i < n; ++i){
		vector <double> px (4, 0.0);
		vector <double> py (4, 0.0);
		getline (cin, str );
		stringstream ss(str);
		for (j = 0; j < 4; ++j){
			ss >> px[j] >> py[j];
		} // end for
		multimap <double, double> v;

		for (j = 0; j < 2; ++j){
			v.insert (make_pair (px[2*j + 1] - px[2*j], py[2*j + 1] - py[2*j] ) );
		} // end for

		multimap <double, double>::iterator it = v.begin();
		double xp = (*it).first;
		double yp = (*it).second;
		++it;		
		double xa = (*it).first;
		double ya = (*it).second;
		bool found = false;

		if (xp != 0. && yp != 0.){
			if ( fabs( (*it).first/xp - (*it).second/yp ) < 1e-6 ){
				found = true;
			}else{
				found = false;
			} // end if
		}else{	// if (xp == 0. || yp == 0. )
			if (xp == 0. && yp != 0. ){ // xp == 0. && yp != 0.
				if (xa == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			}else if (xp != 0. && yp == 0.){ // xp != 0. && yp == 0.
				if (ya == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			}else{ // if (xp == 0. && yp == 0.)
				if (xa == 0. &&  ya == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			} // end if
		} // end if

		if (found ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if

	} // end for
		
	return 0;
}

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

int main(){
	int n;
	double a1,a2,b1,b2;
	double c1,c2,d1,d2;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a1>>a2>>b1>>b2>>c1>>c2>>d1>>d2;
		if( (b2-a2)/(b1-a1) == (d2-c2)/(d1-c1) )
			cout<<"YES"<<endl;
		else 
			cout<<"NO"<<endl;
	}

}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  cin>>n;
  while(n--){
    double x[4];
    double y[4];
    rep(i,4)cin>>x[i]>>y[i];
    if(abs((y[1]-y[0])*(x[3]-x[2])-(y[3]-y[2])*(x[1]-x[0]))<ESP)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	double x[4],y[4];

	cin >> n;

	for(int i = 0;i < n;i++){
		for(int j = 0;j < 4;j++){
			scanf("%lf",&x[j]);
		}

		for(int j = 0;j < 4;j++){
			scanf("%lf",&y[j]);
		}

		int a1 = (y[2]-y[1])/(x[2]-x[1]);
		int a2 = (y[4]-y[3])/(x[4]-x[3]);

		if(a1 == a2){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}