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], a, b;
	
	cin >> n;
	while(n--){
		for(int i = 0; i < 4; i++){
			cin >> x[i] >> y[i];
		}
		
		if(x[0]-x[1] == 0){
			if(x[2]-x[3] == 0){
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else {
			a = (y[0]-y[1])/(x[0]-x[1]);
			b = (y[2]-y[3])/(x[2]-x[3]);
			if(a == b){
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	
	return 0;
}

C++: #include <iostream>
#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){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a0 = (y2-y1) / (x2-x1), a1 = (y4-y3) / (x4-x3);
		if(a0 == a1){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#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;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
int main()
{
  int n;
  double x,y;
  queue<string> qs;
  cin >> n;
  for( int i = 0; i < n; ++i){
    complex<double> p[4];
    for( int j = 0; j < 4; ++j){
      cin >> x >> y;
      p[i] = complex<double>(x,y);
    }
    int S =(conj(p[1] - p[2])*(p[3] - p[4])).imag();
    if( S == 0) qs.push("YES");
    else qs.push("NO");
  }
  while(!qs.empty()){
    cout << qs.front() << endl;
    qs.pop();
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    int n;
    double x_1,y_1,x_2,y_2,x_3,y_3,x_4,y_4,slope_1,slope_2;
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x_1,&y_1,&x_2,&y_2,&x_3,&y_3,&x_4,&y_4);
        
        if(x_1==x_2){
            
            if(x_3==x_4)
                puts("YES");
            else
                puts("NO");
            
            continue;
        }
        
        slope_1=(y_1-y_2)/(x_1-x_2);
        slope_2=(y_3-y_4)/(x_3-x_4);
        
        if(abs(slope_1-slope_2)<1e-7)
            puts("YES");
        else
            puts("NO");
    }
    
    return 0;
}

C++: #include <cstdio>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-5;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}

int main() {
  int n;
  scanf("%d",&n);
  REP(i,n) {
    double x,y;
    P a,b,c,d;
    scanf("%lf %lf", &x, &y);
    a = P(x,y);
    scanf("%lf %lf", &x, &y);
    b = P(x,y);
    scanf("%lf %lf", &x, &y);
    c = P(x,y);
    scanf("%lf %lf", &x, &y);
    d = P(x,y);
    
    if(EQ(cross(a-b, c-d),0))printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

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

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

inline double RoundOff(double a, const int n) {

	for (int i = 0; i < n - 1; i++) { a *= 10; }

	if (a > 0) { a += 0.5; }
	else { a -= 0.5; }

	a = static_cast<int>(a);

	for (int i = 0; i < n - 1; i++) { a /= 10; }

	return a;
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	int n = 0;
	std::cin >> n;

	double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
	double slope1 = 0, slope2 = 0;
	std::vector<std::string> ans(n);

	for (int i = 0; i < n; i++) {
		std::cin >> x1 >> y1 >> x2 >> y2;
		slope1 = RoundOff((y2 - y1) / (x2 - x1), 6);
		std::cin >> x1 >> y1 >> x2 >> y2;
		slope2 = RoundOff((y2 - y1) / (x2 - x1), 6);

		if (slope1 == slope2) {
			ans[i] = "YES";
		}
		else {
			ans[i] = "NO";
		}
	}

	for (int i = 0; i < n; i++) {
		std::cout << ans[i] << std::endl;
	}

}

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

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

    cin >> num;

    for(i = 0; i < num; i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        cross = (x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3);
        if(cross == 0){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

int main(){

  const double EPS = 1e-10;

  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( abs( (y2-y1)*(x4-x3) - (y4-y3)*(x2-x1)) < EPS )
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

C++: #include <iostream>
using namespace std;
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;
    if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include <iostream>

const int NUM = 8;

bool isParallel(const double* point);

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

	double point[n][NUM];
	bool isParallelArray[n];

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < NUM; j++) {
			std::cin >> point[i][j];
		}
	}
	for (int i = 0; i < n; i++) {
		if ( isParallel(point[i]) ) {
			std::cout << "YES" << std::endl;
		} else {
			std::cout << "NO" << std::endl;
		}
	}
}

bool isParallel(const double* point) {
	return (point[3] - point[1]) / (point[2] - point[0]) == (point[7] - point[5]) / (point[6] - point[4]);
}