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<iostream>
#define EPS 0.000000000001
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];
		if ((x[1] - x[0]) * (y[3] - y[2]) - (x[3] - x[2]) * (y[1] - y[0]) < EPS)
			cout << "YES" << endl;
		else if (x[0] - x[1] < EPS && x[2] - x[3] < EPS)
			cout << "YES" << endl;
		else if (y[0] - y[1] < EPS && y[2] - y[3] < EPS)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

using namespace std;

int main(){

	int n; cin >> n;
	double x[4],y[4]; //??\????????§?¨?

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

		if( (y[0]-y[1])*(x[3]-x[2]) + (x[0]-x[1])*(y[2]-y[3])  == 0){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}

	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define INF 0x7FFFFFFF
const double EPS = 1e-10;

inline bool eq(double a, double b) { return fabs(b - a) < EPS; }

int main(){
  int n;
  cin>>n;
  while(n){
    n--;
    vector<double> x(4,0);
    vector<double> y(4,0);
    for(int i=0;i<4;i++){
      cin>>x[i]>>y[i];
    }
    double xa,xb,ya,yb;
    xa=x[1]-x[0];
    xb=x[3]-x[2];
    ya=y[1]-y[0];
    yb=y[3]-y[2];
    double a;
    a=xa*yb-xb*ya;
    if(eq(0.0,a)){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }
  }
}

C++: #include <iostream>
#include <cfloat>
#include <cmath>
using namespace std;
 
 
//0021
int main(){
    double xA, yA, xB, yB, xC, yC, xD, yD;
    char ch;
	int n;

	cin >> n;
    for(int i=0; i<n; ++i){
		cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD;
        double x1,y1,x2,y2;
        y1=yB-yA;
        x1=xB-xA;
        y2=yD-yC;
        x2=xD-xC;
 
        if(fabs((x1*y2)-(x2*y1)) <= DBL_EPSILON){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
 
    }
 
}

C++: #include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define repf(i, f, l) for(int i = f; i < (int)l; ++i)

#ifdef ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif

#define pb emplace_back
#define lb lower_bound
#define ul unsigned long
#define ull unsigned long long
#define ll long long
#define INF 1000000007
#define MOD 1000000007
#define fs first
#define sd second

#define ALL(c) (c).begin(),(c).end()

#define DBG0(x)    {if(DEBUG){ cout << #x << ": " << x << "\t"; }}
#define DBG(x)     {if(DEBUG){DBG0(x); cout << endl;}}
#define DBG2(x, y) {if(DEBUG){DBG0(x); DBG(y);}}
#define DBG3(x, y, z) {if(DEBUG){DBG0(x); DBG2(y, z);}}
#define DBG4(w, x, y, z) {if(DEBUG){DBG0(w); DBG3(x, y, z);}}

const double EPS = 1.0e-11;
template <class T>
ostream& operator<<(ostream& os, vector<T> xs){ for(T x: xs) os << x << ' '; return os; }
template <class S, class T>
ostream& operator<<(ostream& os, pair<S,T> st){ os << "(" << st.first << "," << st.second <<")"; return os; }

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef vector<bool> vbl;
typedef pair<int, int> pii;

typedef complex<double> Point;
istream& operator>>(istream& is, Point &pt){
    double a, b;
    is >> a >> b;
    pt.real(a); pt.imag(b);
    return is;
}

ostream& operator<<(ostream& os, const Point &pt){
    os << make_pair(pt.real(), pt.imag());
    return os;
}

inline double cross(const Point &a, const Point &b){
    return (a.real()*b.imag() - a.imag()*b.real());
}

inline double myarg(Point &a){
    double ret = arg(a);
    return (ret >= 0 ? ret : ret + 2*M_PI);
}

inline double signed_area(const Point &a, const Point &b, const Point &c){
    Point ab = b - a;
    Point ac = c - a;
    return cross(ab, ac) / 2.0;
}

inline bool intersect(const Point &a1, const Point &a2, const Point &b1, const Point &b2) {
    return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS) &&
            (cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS));
}

void sort_by_arg(vector<Point> &pts){
    sort(pts.begin(), pts.end(), [](Point a, Point b){ return (myarg(a) < myarg(b)); });
}

double area(vector<Point> &vs){
    int n = vs.size();
    vector<Point> pts(n - 1);
    rep(i, n - 1) pts[i] = vs[i + 1] - vs[0];
    sort_by_arg(pts);
    double ans = 0.0;
    rep(i, n - 1) ans += cross(vs[i], vs[i + 1]);
    return ans / 2.0;
}

int main(void){

    int n;
    cin >> n;
    while(n-->0){
        Point a,b,c,d;
        cin >> a >> b >> c >> d;
//        DBG4(a, b, c, d);
//        DBG(cross(b - a, d - c));
        if((cross(b - a, d - c)) <= EPS)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
	double x1, x2, x3, x4, y1, y2, y3, y4;
	double m1, m2;
	int n;
	
	scanf("%d", &n);
	while (n > 0){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
	
		m1 = (y2 - y1) / (x2 - x1);
		m2 = (y4 - y3) / (x4 - x3);
	
		if (m1 == m2){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
		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_*100000 + (x_ > 0 ? 1e-6 : -1e-6);
                y[i][j] = y_*100000 + (y_ > 0 ? 1e-6 : -1e-6);
            }
        }
        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");
    }
}