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;

class Vector2{
public:
	Vector2() : x( 0.0 ), y( 0.0 ){}
	Vector2( double aX, double aY ) : x( aX ), y( aY ){}

	double cross( Vector2& v ){
		return ( x * v.y ) - ( y * v.x );
	}

	void operator-=( Vector2& v ){
		x -= v.x;
		y -= v.y;
	}

	double x, y;
};

int main(){
	int n;

	cin >> n;
	Vector2* a = new Vector2[ n ];
	Vector2* b = new Vector2[ n ];
	Vector2* c = new Vector2[ n ];
	Vector2* d = new Vector2[ n ];

	for ( int i = 0; i < n; ++i ){
		cin >> a[ i ].x >> a[ i ].y >> b[ i ].x >> b[ i ].y >> c[ i ].x >> c[ i ].y >> d[ i ].x >> d[ i ].y;
	}

	for ( int i = 0; i < n; ++i ){
		a[ i ] -= b[ i ];
		c[ i ] -= d[ i ];
		cout << ( !a[ i ].cross( c[ i ] ) ? "YES" : "NO" ) << endl;
	}

	delete[] a;
	delete[] b;
	delete[] c;
	delete[] d;

	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
#define INF 1<<20

struct edge{
	int to;
	int cost;
	edge() {};
	edge(int a, int b) {
		to = a;
		cost = b;
	}
};

struct Node {
	int pos;
	int cost;
	Node() {};
	Node(int a, int b) {
		pos = a;
		cost = b;
	}
	bool operator <(const Node& rhs) const {
		return cost > rhs.cost;
	}
};

void dijkistra(int st, int TO,int V,vector<vector<edge> > graph) {
	priority_queue<Node> q;
	vector<int> d(V);
	for (int i = 0;i < V;i++) {
		d[i] = INF;
	}
	d[st] = 0;
	q.push(Node(st, 0));
	while (!q.empty()) {
		Node s = q.top(); q.pop();
		int pos = s.pos;
		for (int i = 0;i < graph[pos].size();i++) {
			int to = graph[pos][i].to;
			int cost = graph[pos][i].cost;
			if (d[pos] + cost < d[to]) {
				d[to] = d[pos] + cost;
				q.push(Node(to, d[to]));
			}

		}
	}
	cout << d[TO] << endl;
}
int partition(int A[],int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
		swap(A[i + 1], A[r]);
		return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q-1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[],int n,int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >=0  ) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n,int* v,int* ww) {
	int W[101][10001];
		for (int j = 0;j <= w;j++) {
			W[0][j] = 0;
		}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++){
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int fib(int n) {
	vector<int> v(n+1);
	v[0] = 1;
	v[1] = 1;
	for (int i = 2;i < n+1;i++) {
		v[i] = v[i - 2] + v[i - 1];
	}
	return v[n];
}
int isPrime(int x) {
	if (x <= 1) return false;
	if (x>2 && x % 2 == 0) return false;
	for (int i = 2;i <= sqrt(x);i++) {
		if (x%i == 0) {
			return false;
		}
	}
	if (x == 2) return true;
	return true;
}
int Prime(int x) {
	vector<int> prime(x+1,1);
	int num = 2;
	while (num <= sqrt(x)) {
		for (int i = 2;i <= x / num;i++) {
			prime[num*i] = 0;
		}
		num++;
		while (prime[num] == 0)
			num++;
	}
	int count = 0;
	for (int i = 2;i < x + 1;i++) {
		if (prime[i] == 1) count++;
	}
	return count;
}
int main(){
	double x[4], y[4];
	int n;
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 4;j++) {
			cin >> x[j] >> y[j];
		}
		if ((x[1] - x[0])*(y[3] - y[2])==(y[1] - y[0])*(x[3] - x[2])) cout << "YES"<<endl;
		else cout << "NO"<<endl;
	}
	

}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<cfloat>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

#define PI (3.1415926535)
#define EPS (1e-10)

int main(){
  int n; cin>>n;
  while(n-->0){
    P p[4];
    REP(i,4) cin>>p[i].real()>>p[i].imag();
    P a,b;
    a = p[0] - p[1];
    b = p[2] - p[3];
    
    if(abs((a/b).imag()/abs(a/b)) < EPS)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
      
  }
  
  return 0;
}

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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    scanf(
        "%lf %lf %lf %lf %lf %lf %lf %lf",
        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

    double v1x = x1 - x2, v1y = y1 - y2;
    double v2x = x3 - x4, v2y = y3 - y4;
    double prod = v1x * v2x + v1y * v2y;
    if (prod < 0.0) { prod *= -1; }

    double z1 = sqrt(v1x * v1x + v1y * v1y);
    double z2 = sqrt(v2x * v2x + v2y * v2y);

    puts(abs(prod - z1 * z2) < 0.00001 ? "YES" : "NO");
  }

  return 0;
}

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

using namespace std;

int main() {

	int n;
	double x[4] = { 0 }, y[4] = { 0 }, slope[2] = { 0 };
	bool ans[100];

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		slope[0] = (y[1] - y[0]) / (x[1] - x[0]);
		slope[1] = (y[3] - y[2]) / (x[3] - x[2]);

		if (slope[0] == slope[1])
			ans[i] = true;
		else
			ans[i] = false;
		slope[0] = slope[1] = 0;
	}

	for (int i = 0; i < n; i++) {
		if (ans[i])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

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

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

C++: #include <stdio.h>

int main(){
	int num;
	float x1, y1;
	float x2, y2;
	float x3, y3;
	float x4, y4;
	float vxa;
	float vya;
	float vxb;
	float vyb;
	float s;
				
	while(scanf("%d", &num) != EOF){	
		for(int i = 0; i < num; i++){
			scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

			vxa = x2 - x1;
			vya = y2 - y1;
			vxb = x4 - x3;
			vyb = y4 - y3;
			s = vxa*vyb - vxb*vya;
			if(-0.00001 < s && s < 0.00001){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#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){
		 scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		//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;
		}
	}
	return 0;
}