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++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    int n; cin>>n;
    rep(_,n){
        double x_,y_;
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                cin >> x_ >> y_;
                x[i][j] = x_*100000;
                y[i][j] = y_*100000;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[1][0]-y[1][1];
        ll dx2=x[0][0]-x[0][1], dy2=y[1][0]-y[1][1];
        puts(dx1*dy2==dx2*dy1 ? "NO" : "YES");
    }
}

C++: #include <iostream>
struct IVect2
{
    double x,y;
    IVect2(double _x, double _y)
    {
        x = _x;
        y = _y;
    }
};

bool isParallel(IVect2 a, IVect2 b)
{
    if(a.x == 0 || b.x == 0)
    {
        if(a.x == 0 && b.x == 0)
            return true;
        else
            return false;
    }
    
    if(a.y/a.x == b.y/b.x)
        return true;
    else
        return false;
}

int main()
{
    int n;
    std::cin >> n;
    for(int i=0; i<n; ++i)
    {
        double x1, y1, x2, y2, x3, y3, x4, y4;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        IVect2 a = IVect2(x2-x1, y2-y1);
        IVect2 b = IVect2(x4-x3, y4-y3);
        if(isParallel(a, b))
        {
            std::cout << "YES" << std::endl;
        }
        else
        {
            std::cout << "NO" << std::endl;
        }
    }
    
    return 0;
}

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

int main(void)
{
	int i,count=0;
	cin>>i;
	while(count != i)
	{
	float x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

	float ax,ay,bx,by;
	
	if(x2<x1){ax=x1-x2;bx=x3-x4;}
	else{ax=x2-x1;bx=x4-x3;}
	
	if(y2<y1){ay=y1-y2;by=y3-x4;}
	else{ay=y2-y1;by=y4-y3;}

	if(ax==bx&&ay==by)puts("YES");
	else puts("NO");
	count++;
	}
	
	return 0;
}

C++: // J4180449 三宅亮輔
// 問題名
// - Parallelism
// 問題URL
// - https://onlinejudge.u-aizu.ac.jp/#/problems/0021
// 所要時間
// - 45分
// 学んだこと
//
//
//

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

typedef long long ll;
typedef pair<double, double> P;

int n;

vector<P> p;

const double eps = 1e-10;

void solve() {
    P a1, a2, a3, a4;
    cin >> a1.first >> a1.second >> a2.first >> a2.second >> a3.first >>
        a3.second >> a4.first >> a4.second;
    P b1 = P(a2.first - a1.first, a2.second - a1.second);
    P b2 = P(a4.first - a3.first, a4.second - a3.second);
    if(abs(b1.second) < eps || abs(b2.second) < eps) {
        if(abs(b1.second - b2.second) < eps)
            puts("YES");
        else
            puts("NO");
    } else if(abs((b1.first / b1.second) - (b2.first / b2.second)) < eps) {
        puts("YES");
    } else {
        puts("NO");
    }
}

int main() {
    cin >> n;
    for(int i = 0; i < n; i++)
        solve();
}

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

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

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

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
		}
		xy_t a[2] = {
					xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
					xy_t(x[2],y[2]) - xy_t(x[3],y[3])
				};
		bool p = abs(cross_product(a[0],a[1]))/2 < esp;
		cout << ( p ? "YES" : "NO") << endl;
	}
}

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

#define EPS 1.0e-7

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

    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = (x_ - 1e-8)*100000;
                y[i][j] = (y_ - 1e-8)*100000;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}