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>
using namespace std;

int main(){
  int n;
  double x[4],y[4],dx[2],dy[2];
  cin >> n;
  for(int i=0;i<n;i++){
	for(int j=0;j<4;j++)cin >> 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]*dy[1] == dx[1]*dy[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
  }
  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( abs( atan2( y2-y1, x2-x1 ) - atan2( y4-y3,x4-x3 ) ) < 1e-9 )
      cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
constexpr double EPS = 1e-11;

struct point{
    double x=0,y=0;
    constexpr point(double x=0,double y=0):x(x),y(y){}
    constexpr bool operator==(const point& r)const{return (x==r.x&&y==r.y);};
    constexpr point operator+(const point& r)const{return point(*this)+=r;}
    constexpr point operator+=(const point& r){
        x+=r.x;y+=r.y;
        return *this;
    }
    constexpr point operator-(const point& r)const{return point(*this)-=r;}
    constexpr point operator-=(const point& r){
        x-=r.x;y-=r.y;
        return *this;
    }
    constexpr point operator*(const double& r)const{return point(*this)*=r;}
    constexpr point operator*=(const double& r){
        x*=r;y*=r;
        return *this;
    }
    constexpr point operator/(const double& r)const{return point(*this)/=r;}
    constexpr point operator/=(const double& r){
        x/=r;y/=r;
        return *this;
    }
};

double norm(const point& a){return a.x*a.x+a.y*a.y;}
double abs(const point& a){return sqrt(a.x*a.x+a.y*a.y);}
double dot_product(const point& a,const point& b){return a.x*b.x+a.y*b.y;}
double cross_product(const point& a,const point& b){return a.x*b.y-a.y*b.x;}
point projection(const point& p,const point& b){return b*dot_product(p,b)/norm(b);}
double area(const point& a,const point& b,const point& c){ return cross_product(c-a,c-b)/2.0;}

point Point[4];

int main(){
    int n;
    cin >> n;
    rep(i,n){
        rep(j,4) cin >> Point[j].x >> Point[j].y;
        //rep(j,4) cout << setprecision(10) << Point[j].x << " " << Point[j].y << endl;
        Point[3] = Point[0] + Point[3] - Point[2];
        if(abs(area(Point[0],Point[1],Point[3])) < EPS) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

int n;

void solve()
{
	double x[4],y[4],px[2],py[2];


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

	px[0] = x[0] - x[2];
	px[1] = x[1] - x[3];
	py[0] = y[0] - y[2];
	py[1] = y[1] - y[3];



	if(px[0]*py[0] == px[1]*py[1])
		cout << "YES";
	else
		cout << "NO";
	cout << endl;

}

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


	return 0;
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y,x2,y2;
  double x1,y1,x3,y3;
  int n;
  int i;
  long double a=0,b=0;
  int k=0;
  int j=0;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      cin>>x2>>y2>>x3>>y3;

      if(x>x1)swap(x,x1);
      if(x2>x3)swap(x2,x3);
      if(y>y1)swap(y,y1);
      if(y2>y3)swap(y2,y3);

      a=(y1-y)*(x3-x2);
      j++;

      b=(y3-y2)*(x1-x);
      j++;


      if(a==b || ((x1-x)==0 && (x3-x2)==0) || ((y1-y)==0 && (y3-y2)==0))
        puts("YES");
      else
        puts("NO");
    }

}

C++: #include <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* ?????° {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

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

  int n = in();
  D x[4], y[4];

  while(n--){
    REP(i, 4) cin >> x[i] >> y[i];
    double l1, l2;
    l1 = (y[1] - y[0]) / (x[1] - x[0]);
    l2 = (y[3] - y[2]) / (x[3] - x[2]);
    if ((l1 - l2) < EPS * l1){
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return (0);
}

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

int main()
{
	int n;
	setprecision(5);
	double x[4], y[4],d1,d2,d3,d4;
	int ans[100];
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (x[0] > x[1]) {
			d1 = x[0] - x[1];
			d3 = y[0] - y[1];
		}
		else {
			d1 = x[1] - x[0];
			d3 = y[1] - y[0];
		}
		if (x[2] > x[3]) {
			d2 = x[2] - x[3];
			d4 = y[2] - y[3];
		}
		else {
			d2 = x[3] - x[2];
			d4 = y[3] - y[2];
		}

		if (d3 / d1 == d4 / d2)
			ans[a] = 0;
		else
			ans[a] = 1;
	}
	for (int b = 0; b < n; b++) {
		if (ans[b] == 0)
			cout << "YES" << endl;
		else if (ans[b] == 1)
			cout << "NO" << endl;
	}
}

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

struct Point2D {
    double x, y;

    Point2D() {}
    Point2D(double ax, double ay) {
        x = ax;
        y = ay;
    }
    Point2D operator -(Point2D &p) {
        return Point2D(x - p.x, y - p.y);
    }
    double slope(Point2D &p) {
        double dx = p.x - x;
        return dx ? (p.y - y) / dx : INFINITY;
    }
    double cross(Point2D &p) { // only z
        return x * p.y - y * p.x;
    }
};

namespace std {
    istream &operator>>(istream &is, Point2D &p) {
        is >> p.x >> p.y;
        return is;
    }

    ostream &operator<<(ostream &os, Point2D &p) {
        os << fixed << p.x << " " << p.y;
        return os;
    }
}

int main()
{
    int n;
    cin >> n;
    for (Point2D a, b, c, d; n-- && cin >> a >> b >> c >> d;)
        cout << (a.slope(b) == c.slope(d) ? "YES" : "NO") << endl;

    return 0;
}