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

int main(){

  int num;
  cin >> num;

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

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

 
  return 0;
}

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

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-12;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
		}
		xy_t a[2] = {
					xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
					xy_t(x[2],y[2]) - xy_t(x[3],y[3])
				};
		bool p = abs(cross_product(a[0],a[1])/2) < eps;
		cout << ( p ? "Yes" : "No") << endl;
	}
}

C++: #include<iostream>
using namespace std;
 
int main(void)
{
	double xa,ya,xb,yb,xc,yc,xd,yd;
	int n;
	cin >> n;

	while( --n >=0)
	{
		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
 
		if( (yb - ya)/(xb - xa) == (yd - yc)/(xd - xc))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

C++: #include <complex>
#include <cmath>
#include <iostream>
#include <stdio.h>

using namespace std;
typedef complex<double> xy_t;

const double eps= a1e&#8722;11;
double x[4], y[4];
int N;
int main(){
  cin >> N;
  for(int t= 0; t<N; ++i){
    for (int i = 0; i < 4; ++i) cin >> x[i] >> y[i];
    xy_t a[2]={xy_t(x[0],y[0])-xy_t(x[1],y[1]), xy_t(x[2],y[2])-xy_t(x[3],y[3])};
    xy_t x=a[0],y=a[1];
    bool p = abs(x.real()*y.imag()-x.imag()*y.real()) < eps;
    cout << ( p ? ”YES” : ”NO” ) << endl ;
  }

}

C++: #include <stdio.h>
#include <math.h>
int main(void){
double p[4][2],a;
int n,i,j;
scanf("%d",&n);
while(n--){
for(i=0;i<4;i++)
for(j=0;j<2;j++)
scanf("%lf",&p[i][j]);
a=(p[2][0]-p[3][0])*(p[0][1]-p[1][1])-(p[0][0]-p[1][0])*(p[2][1]-p[3][1]);
if(fabs(a)<1e-5)
puts("YES");
else
puts("NO");
}
return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

void q21() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		double ax, ay, bx, by, cx, cy, dx, dy;
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
		if (bx - ax == 0 || dx - cx == 0) {
			if (bx - ax == dx - cx) {
				cout << "YES" << endl;
				continue;
			}
		}
		else if (abs((by - ay) / (bx - ax) - (dy - cy) / (dx - cx)) <= 0.00001 ){
			cout << "YES" << endl;
			continue;
		}
		cout << "NO" << endl;
	}
}

int main() {
	q21();
	return 0;
}

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

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

C++: #include <bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	double x[4], y[4];
	cin >> n;

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

		double l1, l2;
		l1 = (y[1] - y[0]) / (x[1] - x[0]);
		l2 = (y[3] - y[2]) / (x[3] - x[2]);
		if (l1 == l2){
			cout << "YES" << endl;
		}

		else {
			cout << "NO" << endl;
		}
	}
	return (0);
}

C++: #include <stdio.h>
 
int main(void) {
    int kaisu,i,j;
    double x[4],y[4];

    scanf("%d",&kaisu);
    for(i=0;i<kaisu;i++)
	{
        for(j=0;j<4;j++)
		{
			scanf("%lf %lf",&x[j],&y[j]);
			if(-100 > x[j] || 100 < x[j] || -100 > x[j] || 100 < x[j])break;
        if(x[0]==x[1]) 
		{
            if(x[2] == x[3])
				printf("YES\n");
            else 
				printf("NO\n");
        } 
		else if(x[2] == x[3])
			printf("NO\n");
        else 
		{
            if((y[1]-y[0]) / (x[1]-x[0]) == (y[3]-y[2]) / (x[3]-x[2]))
                printf("YES\n");
            else 
				printf("NO\n");
        }
    }
    return 0;
}

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

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

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int n,AB,CD;
double ax,ay,bx,by,cx,cy,dx,dy,ab,cd,abx,aby,cdx,cdy,abC,cdC;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		AB=CD=0;
		cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
		abx=(ax-bx);
		cdy=(cy-dy);
		aby=(ay-by);
		cdx=(cx-dx);
		if(abx==0.0&&aby==0.0)AB=1;
		if(cdx==0.0&&cdy==0.0)CD=1;
		if(AB==1||CD==1){
			cout<<"NO"<<endl;
			continue;
		}
		if(abx!=0&&cdx!=0){
			ab=aby/abx;
			cd=cdy/cdx;
			abC=ay-ab*ax;
			cdC=cy-cd*cx;
			if(ab==cd&&abC!=cdC){
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}
		}else{
			if(abx==cdx&&ax!=cx){
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>

using namespace std;

void myswap(double* a,double* b)
{
	double temp=*a;
	*a=*b;
	*b=temp;
}
int main()
{
	double x1,x2,x3,y1,y2,y3,x4,y4;
	int n;
	double AB,CD; 

	cin>>n;

	for(int i=0;i<n;i++)
	{
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1>x2)
		{
			myswap(&x1,&x2);
			myswap(&y1,&y2);
		}
		if(x3>x4)
		{
			myswap(&x3,&x4);
			myswap(&y3,&y4);
		}

		if((x2-x1)==0||(x4-x3)==0)
		{
			if((x2-x1)==0&&(x4-x3)==0)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
			continue;
		}
		
		AB=(y2-y1)/(x2-x1);
		CD=(y4-y3)/(x4-x3);

		if((fabs(AB-CD))<0.00001)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;


	}
	

	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cmath>
 
using namespace std;
 
#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)
 
#define EPS 1e-10
#define EQUAL(a, b) (fabs((a)-(b))<EPS)
 
typedef vector<int> vi;
 
int main()
{
    int n;
    scanf("%d", &n);
    rep(i, n){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        puts(EQUAL((x2-x1)*(y4-y3), (y2-y1)*(x4-x3)) ? "YES" : "NO");
    }
 
    return 0;
}

C++: #include <iostream>
#include <cstdio>
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 ((y[1] - y[0]) / (x[1] - x[0]) - (y[3] - y[2]) / (x[3] - x[2]) < EPS) {
      puts("YES");
    } else {
      puts("NO");
    }
  }

  return 0;
}