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[1] == fpoints[3] {
			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 n;
  cin >> n;

  double x1,y1,x2,y2,x3,y3,x4,y4;
  for (int dataset_i = 0; dataset_i < n; dataset_i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if (x2-x1 == 0 && x4-x3 == 0)
      cout << "YES";
    else if (y2-y1 == 0 && y4-y3 == 0)
      cout << "YES";
    else if ((x4-x3)/(x2-x1) == (y4-y3)/(y2-y1))
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }

  return 0;
}

C++: #include <stdio.h>

int
main(void)
{
	int n;

	scanf("%d", &n);

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

	while (n--) {
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

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

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int n;
  double ax,ay,bx,by,cx,cy,dx,dy;
  cin>>n;
  rep(i,n){
    cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;

    if((ax-bx)*(cy-dy)==(cx-dx)*(ay-by))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

int main(){
  int n = 0;
  cin >> n;
  for(int i=0;i<n;i++){

    double x1 = 0.0;
    double y1 = 0.0;
    double x2 = 0.0;
    double y2 = 0.0;
    double x3 = 0.0;
    double y3 = 0.0;
    double x4 = 0.0;
    double y4 = 0.0;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    double a = (y2 - y1) / (x2 - x1);
double c = (y2 - y2) / (x1 - x2);
    double b = (y4 - y3) / (x4 - x3);
    double d = (y3 - y4) / (x3 - x4);
    if(a == b || a == d || c == b || c == d){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }

  return 0;
}

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(abs(vx*ux+vy*uy)-la*lb)<1e-6)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
 
int main(){
    int n;
    double x[4],y[4];
    cin>>n;
    for(;n--;){
        for(int i=0;i<4;i++){
            cin>>x[i];
            cin>>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 <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  string ans[n];
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4) and (y1-y3)/(x1-x3)!=(y1-y2)/(x1-x2) and (y1-y4)/(x1-x4)!=(y1-y2)/(x1-x2) and x1-x2!=0 and x3-x4!=0 and y1-y2!=0 and y3-y4!=0){
      ans[i]="YES";
    }else{
      ans[i]="NO";
    }
  }
  for(int i=0;i<n;i++){
    cout << ans[i] << 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;
  cin >> n;
  for(int i = 0; i < n; i++){
    Vector A, B, C, D;
    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) * 10000.0 == 0)
      cout << "YES" << endl;
    else 
      cout << "NO" << endl;
  }
}

C++: #include <iostream>
#include <math.h>
using namespace std;
//ABCD?????????????????°??????
int main(){
	int n;
	cin >> n;
	while(n--){
		double x[4], y[4], o;
		for(int i = 0; i < 4; i++) cin >> x[i] >> y[i];
		o = (x[1]-x[0])*(y[3]-y[2]) - (y[1]-y[0])*(x[3]-x[2]);
		if(fabs(o) < 1e-10) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
	double x[4], y[4];
	int n;
	cin >> n;
	for( int i=0; i<n; i++ ){
		for( int j=0; j<4; j++ )
			cin >> x[j] >> y[j];
		double ab = (y[1]-y[0])/(x[1]-x[0]);
		double cd = (y[3]-y[2])/(x[3]-x[2]);
		cout << (ab==cd?"YES":"NO") << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>

using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

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);
		
		double dx12, dy12, dx34, dy34;
		double a12, a34;
		
		if (x1 < x2){
			dx12 = x2 - x1;
			dy12 = y2 - y1;
		}
		else {
			dx12 = x1 - x2;
			dy12 = y1 - y2;
		}
		
		if (x3 < x4){
			dx34 = x4 - x3;
			dy34 = y4 - y3;
		}
		else {
			dx34 = x3 - x4;
			dy34 = y3 - y4;
		}
		
		a12 = dy12/dx12;
		a34 = dy34/dx34;
		
		if (a12 == a34) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4, v_ab, v_cd;
	double del, eps;
	eps = 0.000001;
	
	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
	
		v_ab.x = p2.x - p1.x;
		v_ab.y = p2.y - p1.y;
		v_cd.x = p4.x - p3.y;
		v_cd.y = p4.x - p3.y;
		
		del = v_ab.x * v_cd.y - v_ab.y * v_cd.x;
		if(abs(del) < eps) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;

}

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