Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			a := (fpoints[1] - fpoints[3]) / (fpoints[0] - fpoints[2])
			b := (fpoints[5] - fpoints[7]) / (fpoints[4] - fpoints[6])
			if a == b {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

struct Point2D { 
	double x, y;
	Point2D (double a=0, double b=0) { x=a; y=b; }
};

int main() {
	int n; cin >> n;
	
	for (int i=0; i<n; i++) {
		Point2D a, b, c, d;
		
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		
		double p = (a.y-b.y)/(a.x-b.x), q = (c.y-d.y)/(c.x-d.x);
		
		if (p==q) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

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

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

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

using namespace std;

double ESP = 1e-10;

struct point {
  double x, y;
};

int main() {
  int n;
  point P[4];

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

    if(abs((P[1].y - P[0].y)*(P[3].x - P[2].x) - (P[3].y - P[2].y)*(P[1].x - P[0].x)) < ESP) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }

    return 0;
}

C++: ans :: [Double] -> String
ans (x1:y1:x2:y2:x3:y3:x4:y4:_)
  | (y2 == y1) && (x2 == x1) = "NO"
  | (y4 == y3) && (x4 == x3) = "NO"
  | y2 == y1  = if y4 == y3 then "YES" else "NO"
  | x4 == x3  = if x2 == x1 then "YES" else "NO"
  | otherwise = if (y2-y1) * (x4-x3) == (y4-y3) * (x2-x1)
                then "YES"
                else "NO"

main = do
  c <- getContents
  let i = map (map read) $ map words $ drop 1 $ lines c :: [[Double]]
      o = map ans i
  mapM_ putStrLn o

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#define range(s,n) for(int i = s; i < n; i++)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

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

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

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

using namespace std;

int main(){
	int n;
	float x1,x2,x3,x4;
	float y1,y2,y3,y4;
	float a1,a2;
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%f%f%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		a1 = (y2-y1)/(x2-x1);
		a2 = (y4-y3)/(x4-x3);
		if(a1==a2)
		printf("YES\n");
		else
		printf("NO\n");
	}
}

C++: #include<iostream>
using namespace std;
double x[4], y[4], xp[2], yp[2]; int n;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		xp[0] = x[0] - x[1];
		yp[0] = y[0] - y[1];
		xp[1] = x[2] - x[3];
		yp[1] = y[2] - y[3];
		if (yp[0] == 0 && yp[1] == 0) { goto E; }
		if (yp[0] == 0 && yp[1] != 0) { goto F; }
		if (yp[0] != 0 && yp[1] == 0) { goto F; }
		if ((xp[0] / yp[0]) == (xp[1] / yp[1])) { goto E; }
		goto F;
	E:; cout << "YES" << endl;
		goto G;
	F:; cout << "NO" << endl;
	G:;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a;
cin>>a;
double c[8];
for(int b=0;b<a;b++){
    for(int d=0;d<8;d++)scanf("%lf",&c[d]);
    if(c[0]==c[1]&&c[2]==c[3])printf("YES\n");
    else if(abs((c[1]-c[0])*(c[7]-c[6])==(c[3]-c[2])*(c[5]-c[4])))printf("YES\n");
    else printf("NO\n");
    }
}

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

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(void) {
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) {
      cout << "YES";
    } else {
      cout << "NO";
    }
    cout << endl;
  }
  return 0;
}