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 <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
double x1,y1,x2,y2,x3,y3,x4,y4;
while(~scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4){
P a(x2-x1,y2-y1);
P b(x4-x3,y4-y3);
double cr = imag(conj(a)*b);
if(abs(cr)<1e-9){
  cout<<"YES"<<endl;
}else{
  cout<<"NO"<<endl;
}
}
  return 0;
}

C++: #include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define endl '\n'

typedef long long ll;
typedef long double lb;
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;}

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  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;
    if ((x1 == x2 && x3 == x4) || (((y2 - y1) / (x2 - x1)) == ((y4 - y3) / (x4 - x3)))) cout << "YES" << endl;

    else cout << "NO" << endl;
  }
  return (0);
}

C++: #include <cstdio>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> P;
struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a);
        push_back(b);
    }
};

const double EPS = 1e-8;

double dot(const P& a, const P& b)
{
    return real(conj(a) * b);
}

int cross(P a, P b)
{
    return imag(conj(a) * b);
}

bool intersectLL(const L &l, const L &m)
{
    return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS;// || // non-parallel
        //abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}

int main()
{
    int n;

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        P p[4];
        double x, y;

        scanf("%lf %lf", &x, &y);
        p[0] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[1] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[2] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[3] = P(x, y);

        P ab = p[0] - p[1], cd = p[2] - p[3];

        puts(dot(ab, cd) < EPS ? "NO" : "YES");
    }

    return 0;
}

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	int n;
	cin >> n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	REP(i,n){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y1-y2)*(x3-x4) == (x1-x2)*(y3-y4) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map> // pair
#include <set>
#include <string>

#define MAXSIZE 200000
#define PI 3.141592653589
using namespace std;

template<typename T>
T add(T a,T b){
  return a+b;
}

namespace A
{
  int f(void){
    return 1;
  }
}


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;

    if(abs((x1-x2)*(y3-y4)-(x3-x4)*(y1-y2))<1.0e-10){
      std::cout << "YES" << '\n';
    }else{
      std::cout << "NO" << '\n';
    }
  }
}

C++: #include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  // ifstream cin("../test.txt");
  int n;
  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; i++) {
      cin >> x[i] >> y[i];
    }

    string res;
    double d = (x[1] - x[0]) * (y[3] - y[2]) - (x[3] - x[2]) * (y[1] - y[0]);
    if (d > -0.000001 && d < 0.000001) {
      res = "YES";
    } else {
      res = "NO";
    }
    cout << res << endl;
  }
}

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

typedef struct vec{
    double x;
    double y;
}vec_s;

int main(void){
    int n = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        double Point[8];
        for(int j = 0; j < 8; j++){
            Point[j] = 0;
        }
        for(int j = 0; j < 8; j++){
            cin >> Point[j];
        }
        vec_s V0 = {Point[0], Point[1]};
        vec_s V1 = {Point[2], Point[3]};
        vec_s V2 = {Point[4], Point[5]};
        vec_s V3 = {Point[6], Point[7]};
        vec_s a = {(V0.x - V1.x), (V0.y - V1.y)};
	    vec_s b = {(V2.x - V3.x), (V2.y - V3.y)};
	    if ((a.x * b.y - a.y * b.x) == 0){
	    		cout << "YES" << endl;
	    	}
	    	else{
	    		cout << "NO" << endl;
	    	}
    }
}

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

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n; cin>>n;
  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    double tanAB = (y2-y1)/(x2-x1);
    double tanCD = (y4-y3)/(x4-x3);
    if(tanAB == tanCD)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
double zeti(double);
int main() {
    pair<double,double> a;
    pair<double,double> b;
    pair<double,double>c;
    pair<double,double>d;
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a.first,&a.second,&b.first,&b.second,&c.first,&c.second,&d.first,&d.second);
        if(a.first==b.first&&c.first==d.first){
            cout<<"YES"<<endl;
            continue;
        }
        double s1,s2;
        if(zeti(a.first*c.second-a.second*c.first)<=0.000001){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}
double zeti(double a){
    if(a<0){
        a*=-1;
    }
    return a;
}

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

using namespace std;
const double eps = 1e-11;

typedef complex<double> xy_t;

double dotProduct(xy_t a, xy_t b){
	return (conj(a) * b).real();
}

double crossProduct(xy_t a, xy_t b){
	return (conj(a) * b).imag();
}

xy_t projection(xy_t p, xy_t b){
	return b*dotProduct(p,b)/norm(b);
}

int main (){
	int N;
	double X[4],Y[4];
	cin >> N;
	for(int t = 0; t < N; ++t){
		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]),
		};
		cout << ((abs(crossProduct(a[0],a[1])) < eps) ? "YES" : "NO") << endl;
	}
	return 0;
}