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 <cstdio>
#include <cmath>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> P;
struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a);
        push_back(b);
    }
};

const double EPS = 1e-8;

double dot(const P& a, const P& b)
{
    return real(conj(a) * b);
}

int cross(P a, P b)
{
    return imag(conj(a) * b);
}

bool intersectLL(const L &l, const L &m)
{
    return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS;// || // non-parallel
        //abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}

int main()
{
    int n;

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        P p[4];
        double x, y;

        scanf("%lf %lf", &x, &y);
        p[0] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[1] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[2] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[3] = P(x, y);

        P ab = p[0] - p[1], cd = p[2] - p[3];

        puts(abs(cross(ab, cd)) > EPS ? "NO" : "YES");
    }

    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
bool EQ(double a,double b){
  return abs(a-b)<0.000000000001;
  //  return a-0.0000001<b&&b<a+0.0000001;
}
int main(){
  int n;
  double x[4],y[4];
  cin>>n;
  while(n--){
    for(int j=0;j<4;j++) cin>>x[j]>>y[j];
    if(EQ((y[3]-y[2])*(x[1]-x[0]),(y[1]-y[0])*(x[3]-x[2])))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

struct Pos {
	double x, y;
}a, b, c, d;

int main() {
	int n;
	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;
		Pos e;
		e.x = b.x - a.x;
		e.y = b.y - a.y;
		Pos f;
		f.x = d.x - c.x;
		f.y = d.y - c.y;
		
		double men = e.x * f.y - e.y * f.x;
		double eps = 1e-8;
		if(-eps <= men && men <= eps)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(abs(m1-m2)<1e-10) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

int main()
{
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double dx1,dy1,dx2,dy2;
  int n;
  int i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    dx1=x2-x1;
    dy1=y2-y1;
    dx2=x4-x3;
    dy2=y4-y3;

    if(dx1==0 && dx2==0)
      cout<<"YES"<<endl;
    else if(dx1==0 || dx2==0)
      cout<<"NO"<<endl;
    else if(dy1*dx2 == dy2*dx1)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}

using namespace std;
int main() {
    int n;
    cin >> n;
    rep(j,n) {
        complex<double> a[4];
        rep(i, 4) {
            double x, y;
            cin >> x >> y;
            a[i] = *(new complex<double>(x, y));
        }
        complex<double> vAB = a[0] - a[1];
        complex<double> vCD = a[2] - a[3];
        double m1 = vAB.imag() / vAB.real();
        double m2 = vCD.imag()/ vCD.real();
        cout << ((m1==m2)?"YES":"NO") << endl;
    }
}

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

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 ;
		if(
		if( ((y1-y2)/(x1-x2)) == ((y3-y4)/(x3-x4)) ){
			cout << "YES" << "\n" ;
		}
		else{
			cout << "NO" << "\n" ;
		}
	}
	return 0;
}

C++: #include <stdio.h>

int main(){
    int n,i,j;
    double X[5],Y[5];
    long x[5],y[5];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=1;j<=4;j++){
            scanf("%lf %lf",&X[j],&Y[j]);
            x[j] = (long)(X[j]*100000);
            y[j] = (long)(Y[j]*100000);
        }
        if((x[2]-x[1])*(y[4]-y[3])==(x[4]-x[3])*(y[2]-y[1])){
            if((y[2]-y[1])*(x[3]-x[1])==(x[2]-x[1])*(y[3]-y[1])){
                printf("NO\n");
            }else{
                printf("YES\n");
            }
        }else{
            printf("NO\n");
        }
    }
}

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

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

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

C++: #include <iostream>
#include <cmath>
using namespace std;
class point{ // as necessary
	public:
		static const int COUNTER_CLOCKWISE=1;
		static const int CLOCKWISE=-1;
		static const int ONLINE_BACK=2;
		static const int ONLINE_FRONT=-2;
		static const int ON_SEGMENT=0;
		static const double EPS=1e-10;
		double x;
		double y;
		point(double x=0,double y=0):x(x),y(y){}

		point operator+(point p){return point(x+p.x,y+p.y);}
		point operator-(point p){return point(x-p.x,y-p.y);}
		point operator*(double a){return point(x*a,y*a);}
		point operator/(double a){return point(x/a,y/a);}

		static double dot(const point &p1,const point &p2){
			return p1.x*p2.x+p1.y*p2.y;
		}

		double norm(){
			return x*x+y*y;
		}

		double abs(){
			return sqrt(norm());
		}

		static double cross(point p1,point p2){
			return p1.x*p2.y-p1.y*p2.x;
		}

		static int ccw(point p0,point p1,point p2){
			point a=p1-p0; // ??????p0p1
			point b=p2-p0; // ??????p0p2
			if(cross(a,b)>EPS) return COUNTER_CLOCKWISE; // a????????????b??????????¨?
			if(cross(a,b)<-EPS) return CLOCKWISE; // a????????????b???????¨?
			if(dot(a,b)<-EPS) return ONLINE_BACK; // p2-p0-p1???????????¢???
			if(a.norm(),b.norm()) return ONLINE_FRONT; // p0-p1-p2???????????¢???
			return ON_SEGMENT; // p0-p2-p1???????????¢???
		}
};

int main(void){
	int n;
	double x,y;
	cin>>n;
	while(n--){
		cin>>x>>y;
		point a(x,y);
		cin>>x>>y;
		point b(x,y);
		cin>>x>>y;
		point c(x,y);
		cin>>x>>y;
		point d(x,y);
		if(fabs(point::cross(b-a,d-c))<point::EPS)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(y1==y2){
			if(y3==y4){
				printf("YES\n");
			}
			else printf("NO\n");
		}
		else if(y3==y4){
			printf("NO\n");
		}
		else{
			if((x1-x2)/(y1-y2)==(x3-x4)/(y3-y4)){
				printf("YES\n");
			}
			else printf("NO\n");
		}
	}
	return 0;
}