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 <map>

using namespace std;

int main(void){
	int n,x[2],y[2];
	pair<int,int> v[2];

	cin >> n;
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			cin >> x[0] >> y[0] >> x[1] >> y[1];
			v[j]=make_pair(x[0]-x[1],y[0]-y[1]);
		}
		cout << (v[0].first*v[1].second-v[0].second*v[1].first?"YES":"NO") << endl;
	}
		
	return 0;
}

C++: #include <stdio.h>

int main(void){
  int i, j, n;
  double dx[2], dy[2], x[4], y[4];

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    for(j = 0; j < 4; j++){
      scanf("%lf%lf", &x[j], &y[j]);
    }
    dx[0] = x[1] - x[0];
    dx[1] = x[3] - x[2];
    dy[0] = y[1] - y[0];
    dy[1] = y[3] - y[2];
    if(dx[0] == 0 || dx[1] == 0){
      if(dx[0] == dx[1]){
        printf("YES\n");
      }
    }else if(dy[0]/dx[0] == dy[1]/dx[1]){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
double x[100], y[100];

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

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

using namespace std;

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

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i] >> x3[i] >> y3[i] >> x4[i] >> y4[i];
	}

	for (int i = 0; i < n; i++)
	{
		if (abs(x2[i] - x1[i]) / abs(y2[i] - y1[i]) == abs(x4[i] - x3[i]) / abs(y4[i] - y3[i]))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
	double a = 99999, b = 99999;
	if (x2 - x1 != 0) {
		a = (y2 - y1) / (x2 - x1);
	}
	if (x4 - x3 != 0) {
		b = (y4 - y3) / (x4 - x3);
	}
	if (a == b) cout << "YES" << endl;
	else cout << "NO" << endl;
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-10;
const int MOD = 1000000007;

#define X real()
#define Y imag()

typedef complex<double> P;
struct L{
	P p1, p2;
	L(P p1, P p2):p1(p1), p2(p2){}
	L(){}
};
istream& operator>>(istream &is, P &p) {
	double x, y;
	is >> x >> y;
	p = P(x, y);
	return is;
}
inline int sig(double x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); }
inline double norm(const P &p){return p.X*p.X+p.Y*p.Y;}
inline double inp(const P& a, const P& b){return (conj(a)*b).X;}
inline double outp(const P& a, const P& b){return (conj(a)*b).Y;}


int T;

int main(){
	ios::sync_with_stdio(false);
	cin >> T;
	while(T--){
		P p1, p2, p3, p4;
		cin >> p1 >> p2 >> p3 >> p4;
		puts(!sig(inp(p2-p1, (p4-p3)*P(0., 1.))) ? "YES" : "NO");
	}
	return 0;
}

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

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

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

int main()
{
	int num ;
	double 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( ((by-ay)/(bx-ax)) == ((dy-cy)/(dx-cx)) ) cout << "YES\n" ;
		else cout << "NO\n" ;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main( void )
{
  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( (y2-y1)*(x4-x3) - (x2-x1)*(y4-y3) == 0 )
      cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}