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)
		}
		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<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(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;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(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;
		result[i] = x1 == x2 && x3 == x4 || abs((y1 - y2) / (x1 - x2) - (y3 - y4) / (x3 - x4)) < 1.0e-10;
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}
//#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;
//		std::cout << (x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4) ? "YES" : "NO") << std::endl;
//	}
//	return 0;
//}

C++: #include <iostream>

using namespace std;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

double cross_product(Vector& a, Vector& b)
{
  return a.x * b.y - b.x * a.y;
}

int main()
{
  int n;
  Vector A, B, C, D;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if(cross_product(AB, CD) != 0)
      cout << "NO" << endl;
    else 
      cout << "YES" << endl;
  }
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = 99999, b = 99999;
		a = (x2 - x1)*(y4 - y3);
		b = (x4 - x3)*(y2 - y1);
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double xa,ya,xb,yb,xc,yc,xd,yd,a2,a1;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd;
    a1=(yb-ya)/(xb-xa);
    a2=(yd-yc)/(xd-xc);
    if(a1==a2)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

int main(void){
	
	int n;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((int)atan2(y2-y1,x2-x1)*1000000000==(int)atan2(y4-y3,x4-x3)*1000000000){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

int main(){
  int n;
  cin>>n;
  while(n--){
    double x[4];
    double y[4];
    for(int i=0;i<4;i++){
      cin>>x[i]>>y[i];
    }
    x[3]=x[3]-x[2]+x[0];
    y[3]=y[3]-y[2]+y[0];
    double xx=x[3]-x[1];
    double yy=y[3]-y[1];
    if(-1e-10 <= xx && xx <= 1e-10 && -1e-10 <= yy && yy <= 1e-10){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }

  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  int n;
  double x[4],y[4];

  cin >> n;
  while(n--){
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    y[1]-=y[0];
    x[1]-=x[0];
    y[3]-=y[2];
    x[3]-=x[2];
    if(fabs(y[1]*x[3] - y[3]*x[1]) < 10e-12)cout << "YES";
    else cout << "NO";
    cout << endl;
    }
  return 0;
}

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

int main(void)
{
	int i,count=0;
	cin>>i;
	while(count != i)
	{
	float x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

	float ax,ay,bx,by;
	
	if(x2<x1){ax=x1-x2;bx=x3-x4;}
	else{ax=x2-x1;bx=x4-x3;}
	
	if(y2<y1){ay=y1-y2;by=y3-x4;}
	else{ay=y2-y1;by=y4-y3;}

	if(ax==bx&&ay==by)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	count++;
	}
	
	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 <stdio.h>
#include <math.h>

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		
		double x1, y1, x2, y2, x3, y3, x4, y4;
		
		if (sscanf(line, "%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) != 8) {
			return 1;
		}
		
		double ab = INFINITY;
		double cd = INFINITY;

		if (x1 != x2) {
			ab = (y2 - y1)/(x2 - x1);
		}
		if (x3 != x4) {
			cd = (y4 - y3)/(x4 - x3);
		}
		
		printf("%s\n", ((ab == cd) ? "YES" : "NO"));
	}

	return 0;
}

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

#define EPS 1e-10

int main(){
  int n;
  double ax,ay,bx,by,cx,cy,dx,dy;

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
    if( abs(ax-bx)<EPS && abs(cx-dx)<EPS )cout << "YES\n";
    else if( abs(ax-bx)<EPS || abs(cx-dx)<EPS )cout << "NO\n";
    else if( abs( (ay-by)/(ax-bx) - (cy-dy)/(cx-dx) ) < EPS)cout << "YES\n";
    else cout << "NO\n";
  }
}

C++: #include <complex>
#include <iostream>
using namespace std;
 
typedef complex<double> P;
 
// ??¨?±?????????????????
#define EPS (1e-10)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)
 
// ?????? (cross product) : a??b = |a||b|sin??
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
 
// 2???´?????????????????? : a//b <=> cross(a, b) = 0
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}
 
int main(){
    int n;
    double x1,x2,x3,x4,y1,y2,y3,y4;
 
    cin >> n;
    for(int i=0 ; i<n ; i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        P a(x1,y1), b(x2,y2), c(x3,y3), d(x4,y4);
        if( is_parallel(a,b,c,d) ){
            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++){
    float x1, x2, x3, x4, y1, y2, y3, y4, a, b;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    a = (y2 - y1) / (x2 - x1);
    b = (y4 - y3) / (x4 - x3);
    if (a == b) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}