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 <iostream>
#include <string>
#include <cctype>
#include <vector>
#include <complex>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;
typedef long long ll;
typedef complex<double> vec;

double cross(const vec& a, const vec& b) {
  return imag(conj(a)*b);
}

int main(){
    int n;
    cin >> n;
    rep(_,n){
        double x1,y1,x2,y2,x3,y3,x4,y4;
        cin >> x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        vec a(x1-x2, y1-y2);
        vec b(x3-x4, y3-y4);
        double x = cross(a,b);
        if(abs(x)<1e-7){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

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

using namespace std;

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

	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		complex<double> a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
		complex<double> n(a - b), m(c - d);
		complex<double> r(n.real()*m.imag() - m.real()*n.imag());

		if (abs(r - 0.0) < 1e-10) {
			cout << "YES";
		}
		else {
			cout << "NO";
		}
		cout << endl;
	}
	return 0;
}

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

int main()
{
	const double EPS = 1e-3;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		complex<double> e1 = A-B;
		complex<double> e2 = C-D;
		if ( arg(e1/e2)>PI/2 )
			e1 = -e1;
		double a = arg(e1/e2);
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
	}
	return 0;
}

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

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double e = 0.0000001;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    double m;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];

    if(s * v - t * u > 0){
        double m = s * v - t * u;
    }
    else{
        double m = t * u - s * v;
    }

    if(m < e){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

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

int main(){

  int num;
  cin >> num;

  float x[4], y[4];
  int i = 0;

  while( i < num ){
    for( int j = 0; j < 4; j++ ){
      cin >> x[j] >> y[j];
    }
    float comp1 = (y[1]- y[0]) / (x[1] - x[0]) ;
    float comp2 = (y[3] - y[2]) / (x[3] - x[2]);
    //cout << comp1 << ", "<< comp2 << endl;
    if( x[1] - x[0] != 0 ||  x[3] - x[2] != 0){
      if(comp1 == comp2 || comp1 * (-1) == comp2 ){
	cout <<"YES"<< endl;
      }else{
	cout <<"NO"<< endl;
      }
    }else{
      cout <<"NO"<< endl;
    }

      i++;
  }

  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef complex<double> P;

double const EPS = 1e-10;

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(P const& a1, P const& a2, P const& b1, P const& b2)
{ return abs(cross(a2-a1, b2-b1)) < EPS; }

int main() {
  
  int N; cin >> N;
  for(int i=0; i<N; i++) {
    P ps[4];
    for(int i=0; i<4; i++)
      cin >> ps[i].real() >> ps[i].imag();
    printf("%s\n", (is_parallel(ps[0], ps[1], ps[2], ps[3]) ? "YES" : "NO" ));
  }
  
  return 0;
}