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

using P = complex<long long>;

int cross(P p1, P p2) {
    return (p1.real() * p2.imag() - p1.imag() * p2.real());
}

int main() {
    int n;
    cin >> n;
    while (n--) {
	double x[4], y[4];
	for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
	P pp[4];
	for (int i = 0; i < 4; i++) pp[i] = P(x[i] * 100000, y[i] * 100000);
	if (cross(pp[1] - pp[0], pp[3] - pp[2]) == 0) {
	    cout << "YES" << endl;
	}
	else {
	    cout << "NO" << endl;
	}
    }
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double a[4][2];
		for (int I = 0; I< 4; I++)
		{
			for (int k = 0; k < 2; k++)
			{
				cin >> a[I][k];
			}
		}
		double x, y;
		x = (a[1][1] - a[0][1]) / (a[1][0] - a[0][0]);
		y = (a[3][1] - a[2][1]) / (a[3][0] - a[2][0]);
		if (x == y)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

}

C++: #include<iostream>
#include<cmath>
#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(){
	double x[4],y[4],n;
	cin>>n;
	rep(i,n){
		rep(i,4)cin>>x[i]>>y[i];
		double vx=x[1]-x[0],vy=y[1]-y[0],ux=x[3]-x[2],uy=y[3]-y[2];
		double la=sqrt(vx*vx+vy*vy),lb=sqrt(ux*ux+uy*uy);
		if(abs(vx*ux+vy*uy-la*lb)<1e-6)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-9;
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag();
		P one = a-b;
		P two = c-d;
		bool f = false;
		if( abs(one.real()) < EPS || abs(two.real()) < EPS ){
			f = abs(one.real()) < EPS && abs(two.real()) < EPS;
		}else{
			f = abs(one.imag()/one.real() - two.imag()/two.real()) < EPS;
		}
		cout << (f?"YES":"NO") << endl;
	}
}

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

using namespace std;

int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		double x[4],y[4];
		for(int j=0;j<4;j++)
			cin>>x[j]>>y[j];
		if(abs((x[3]-x[2])*(y[1]-y[0])-(x[1]-x[0])*(y[3]-y[2]))<1e-10)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	
	return 0;
}

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

C++: #include <stdio.h>

#define ABS(X) ((X)<0 ? -(X) : (X))
int main(){
    int n;
    double x1, y1, x2, y2;
    double x3, y3, x4, y4;
    double dx1, dy1, dx2, dy2;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        if (ABS(dx1*dy2 - dx2*dy1) < 0.001){
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return 0;
}

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

using namespace std;
typedef complex<double> P;

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

C++: #include<iostream>
using namespace std;
int main(){
    int n;
    double x1,y1,x2,y2,x3,y3,x4,y4,a,b;
    cin>>n;
    while(n>0){
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        a=(y1-y2)/(x1-x2);
        b=(y3-y4)/(x3-x4);
        if(a==b)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        n--;
    }
}

C++: #include <iostream>
using namespace std;
int main()
{
    int n;cin>>n;
    for(int i=0;i<n;++i){
        double abdx,abdy,cddx,cddy;
        double x[4];
        double y[4];
        for(int j=0;j<4;++j){
            cin>>x[j]>>y[j];
        }
        abdx=x[0]-x[1];
        cddx=x[2]-x[3];
        abdy=y[0]-y[1];
        cddy=y[2]-y[3];
        if(abdy/abdx==cddy/cddx)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

using namespace std;

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

    double x1,x2,x3,x4;
    double y1,y2,y3,y4;

    scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ){
      printf("YES\n");
    }
    else printf("NO\n");
  }
}

C++: n = input()+1
for v in range(1,n):
        (x1,y1,x2,y2,x3,y3,x4,y4)=map(int,raw_input().split())
        if x2-x1=0 or x4-x3=0:
                if x2-x1=0 and x4-x3=0:
                        print "YES"
                else:
                        print "NO"
        elif y2-y1=0 or y4-y3=0:
                if y2-y1=0 and y4-y3=0:
                        print "YES"
                else:
                        print "NO"
        else:
                a = (y2-y1)/(x2-x1)

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

typedef long long ll;
using namespace std;

int main()
{
	double pos[8];

	for(int i=0;i<8;i++){
		scanf("%lf",pos+i);
	}

	if((pos[1]-pos[3])/(pos[0]-pos[2])==(pos[1+4]-pos[3+4])/(pos[0+4]-pos[2+4])){
		cout << "YES" << endl;
	}else
	{
		cout << "NO" << endl;	
	}
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		long 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 <cstdio>
#include <cstdlib>
using namespace std;

const double EPS = 1e-9;

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;
}