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")
			continue
		}
		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 <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <ctime>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <complex>

using namespace std;

typedef complex<double> xy_t;
double x[4], y[4];
int n;
const double eps = 1e-11;

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

int main(void){

	cin >> n;

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

		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])) < eps;
		cout << (p ? "YES" : "NO") << endl;
	}
	
	
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
struct point{
  double x,y;
    };
int main(){
  point p[4];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> p[0].x >> p[0].y>>p[1].x>>p[1].y>>p[2].x>>p[2].y>>p[3].x>>p[3].y;
    if(fabs(((p[1].y -p[0].y)/(p[3].y-p[2].y)) - ((p[1].x-p[0].x)/(p[3].x -p[2].x))) < 1.0e-10){
	cout << "YES" << endl;
      } else {cout << "NO" << endl;}
      
  }
}

C++: #include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <cstdio>
using namespace std;

#define FOR(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long>PLL;
typedef queue<int> QI;
typedef priority_queue<int> maxpq;
typedef priority_queue<int, vector<int>, greater<int> > minpq;

struct edge{int to, cost;};

void begin(){cin.tie(0); ios::sync_with_stdio(false);};
int gcd(int a, int b){if(a%b==0){return(b);}else{return(gcd(b,a%b));}};
int lcm(int m, int n){if((0 == m)||(0 == n)){return 0;} return ((m / gcd(m, n)) * n);};
unsigned long long comb(long n, long m){unsigned long long c = 1; m = (n - m < m ? n - m : m);
    for(long ns = n - m + 1, ms = 1; ms <= m; ns ++, ms ++){c *= ns; c /= ms;} return c;};

// ワーシャルフロイド法
void warshallFloyd(int d[100][100], int n){
    for(int k = 0; k < n; ++k)
        for(int i = 0; i < n; ++i)
            for(int j = 0; j < n; ++j)
                if(d[i][k] != -1 && d[k][j] != -1){
                    if(d[i][j] == -1){
                        d[i][j] = d[i][k] + d[k][j];
                    }else{
                        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                    }
                }
};


// d:隣接行列  n:グラフのサイズ  s:始点  dist:始点からの距離が入る配列
void dijkstra(int d[1000][1000], int n, int s, int dist[1000]){
    FOR(i, n) dist[i] = -1;
    dist[s] = 0;
    priority_queue<PII, vector<PII>, greater<PII> > q;
    q.push(PII(0, s));
    while (!q.empty()) {
        PII p = q.top(); q.pop();
        int i = p.second;
        if(dist[i] < p.first) continue;
        for(int j = 0; j < n; j++){
            if(d[i][j] == -1) continue;
            if(dist[j] == -1){
                dist[j] = dist[i] + d[i][j];
                q.push(PII(dist[j], j));
            }else if(dist[j] > dist[i] + d[i][j]){
                dist[j] = dist[i] + d[i][j];
                q.push(PII(dist[j], j));
            }
        }
    }
};

// 線分の交差判定
bool isCross(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4){
    // 並行な場合
    int m = (x2-x1)*(y4-y3)-(y2-y1)*(x4-x3);
    if(m == 0) return false;
    // 媒介変数の値が0より大きく1以下なら交差する、これは問題の状況によって変わるかも。
    double r =(double)((y4-y3)*(x3-x1)-(x4-x3)*(y3-y1))/m;
    double s =(double)((y2-y1)*(x3-x1)-(x2-x1)*(y3-y1))/m;
    return (0 < r && r <= 1 && 0 < s && s <= 1);
};


bool isParallel(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4){
    if((x2-x1)*(y4-y3)-(y2-y1)*(x4-x3) == 0) return true;
    else return false;
};

int main(int argc, const char * argv[]){
    begin();
    int n; double d[8];
    cin >> n;
    FOR(i, n){
        FOR(j, 6) cin >> d[i];
        cout << (isParallel(d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7]) ? "YES" : "NO") << endl;
    }
}

C++: using System;
class AIDU0021
    {
        public static void Main(){
            double[] facets = new double[8], VAB = new double[2],VCD = new double[2];
            string[] facetstr = new string[8];
            int N=int.Parse(Console.ReadLine()),i=0;
            bool[] result=new bool[N];
            for (int l = 0; l<N; l++) {
                facetstr=Console.ReadLine().Split();
                for (i = 0; i<8; i++) 
                    facets[i]=double.Parse(facetstr[i]);
                for (i = 0; i<2; i++) {
                    VAB[i]=facets[i+2]-facets[i];
                    VCD[i]=facets[i+6]-facets[i+4];
                }
                result[l]= VAB[0]*VCD[1]-VAB[1]*VCD[0]==0.0;
            }
            for (int l = 0; l<N; l++) Console.WriteLine(result[l] ? "YES" : "NO");
        }
    }

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double yoko1,yoko2,tate1,tate2;
	int ans[100];
	int n,i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
	scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&x2,&x3,&x4,&y1,&y2,&y3,&y4);
	yoko1=(x1-x2)*(x1-x2);
	yoko2=(x3-x4)*(x3-x4);
	tate1=(y1-y2)*(y1-y2);
	tate2=(y3-y4)*(y3-y4);
	
	if(sqrt(yoko1+tate1)==sqrt(yoko2+tate2))ans[i]=1;
	else ans[i]=0;
	}
	
	for(i=0;i<n;i++){
		if(ans[i]==1)printf("YES\n");
		else printf("NO\n");
	}
return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
double x[100], y[100];

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

C++: #include <iostream>
 
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;
        double abx = x2 - x1, aby = y2 - y1, cdx = x4 - x3, cdy = y4 - y3;
        if (abx * cdy - aby * cdx == 0.0) std::cout << "YES" << std::endl;
        else std::cout << "NO" << std::endl;
    }
}