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>
using namespace std;

int main(){
	int n;
	double x[4], y[4];
	cin >> n;
	while (n-- != 0){
		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<algorithm>
#include<vector>
#include<cassert>
#include<string>

using namespace std;

long long N, X[4], Y[4];

string parallel_judge(){
	if ((X[1] * 100000 - X[0] * 100000)*(Y[3] * 100000 - Y[2] * 100000) == (Y[1] * 100000 - Y[0] * 100000)*(X[3] * 100000 - X[2] * 100000)){
		return "YES";
	}
	else{
		return "NO";
	}
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++){
		for (int j = 0; j < 4; j++){
			cin >> X[j] >> Y[j];
		}
		cout << parallel_judge() << endl;
	}
}

C++: #include <iostream>
using namespace std;
#define INF 1e+15

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

C++: #include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  for(int i = 0; i < n; ++i) {
    double x1, x2, x3, x4;
    double y1, y2, y3, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    double dx1 = x1 - x2;
    double dy1 = y1 - y2;
    double dx2 = x3 - x4;
    double dy2 = y3 - y4;
    if(dx1 == 0 && dx2 == 0) {
      cout << "YES" << endl;
    } else {
    if(dy1 / dx1 == dy2 / dx2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    }
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

int main(){
	double p[8];
	int n;
	cin >> n;

	REP(i, n){

		REP(i, 8){
			cin >> p[i];
		}

		string ans = abs((p[3] - p[1])*(p[6] - p[4]) - (p[7] - p[5])*(p[2] - p[0])) <= 0.0000005 ? "YES" : "NO";


		cout << ans << endl;
	}
	return 0;
}

C++: 
#include<iostream>
#include <string>
#include<stdio.h>

using namespace std;

int main(int argc, char* argv[])
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int tendAB, tendCD;
	int num;

	cin >> num;
	while (num--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		tendAB = (y1 == y2) ? 0 : (x2 - x1) * 100000 / (y2 - y1);
		tendCD = (y3 == y4) ? 0 : (x4 - x3) * 100000 / (y4 - y3);
		if (tendAB == tendCD) cout << "YES" << endl; else cout << "NO" << endl;
	}

	return 0;
}

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

int main(){
  int n;
  cin >> n;

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

    if((conj(v[1]-v[0])*(v[3]-v[2])).imag()==0.0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.pl", "r", stdin);
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	int i,j;
	for (i = 0; i < n; ++i){
		vector <double> px (4, 0.0);
		vector <double> py (4, 0.0);
		getline (cin, str );
		stringstream ss(str);
		for (j = 0; j < 4; ++j){
			ss >> px[j] >> py[j];
		} // end for
		map <double, double> v;

		for (j = 0; j < 2; ++j){
			v[px[2*j + 1] - px[2*j]] = py[2*j + 1] - py[2*j];
		} // end for
		if (v.size() == 1){
			cout << "YES" << endl;
			continue;
		} // end if
		map <double, double>::iterator it = v.begin();
		double x = (*it).first;
		double y = (*it).second;
		++it;
		if ((*it).first/x == (*it).second/y){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if
	} // end for
		
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;

int main() {
    int n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> n;
    while(n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        cout << (fabs((x2-x1)*(y4-y3) - (x4-x3)*(y2-y1)) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n;
	pair<double,double> p[4],vec[2];
	cin>>n;
	rep(j,n){
		rep(i,4)cin>>p[i].first>>p[i].second;
		rep(i,2){
			vec[i].first=p[i*2].first-p[i*2+1].first;
			vec[i].second=p[i*2].second-p[i*2+1].second;
		}
		double check=vec[0].first*vec[1].second-vec[0].second*vec[1].first;
		if(abs(check)<1e-6)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			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 dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3) == 0.0){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

  return 0;

}

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

const double EPS = 1e-10;

signed main() {
  int n;

  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; cin >> x[i] >> y[i], i++);
    if (fabs((y[1] - y[0]) / (x[1] - x[0]) - (y[3] - y[2]) / (x[3] - x[2])) <= EPS) {
      puts("YES");
    } else {
      puts("NO");
    }
  }

  return 0;
}