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<iostream>
#include<vector>
using namespace std;

int main() {
	int n;
	double x1, x2, x3, x4, y1, y2, y3, y4;
	vector<double> X1, Y1, X2, Y2;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		X1.push_back(x2 - x1); Y1.push_back(y2 - y1);
		X2.push_back(x4 - x3); Y2.push_back(y4 - y3);
	}
	for (int i = 0; i < n; i++) {
		if (X1[i]*Y2[i]-X2[i]*Y1[i]<1e-10)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include<cstdio>

int main(){
  int n;scanf("%d",&n);
  for(int i=0;i<n;i++){
    double d[8];
    for(int i=0;i<8;i++) scanf("%lf",&d[i]);
    if((d[0]-d[2])*(d[5]-d[7])==(d[4]-d[6])*(d[1]-d[3]))
      puts("YES");
    else
      puts("NO");
  }
}

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

using namespace std;

typedef complex<double> xy_t;

double dot_product(xy_t a, xy_t b) {
  return (conj(a)*b).real();
}

double cross_product(xy_t a, xy_t b) {
  return (conj(a)*b).imag();
}

double e = 0.0001;

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;
    xy_t A = xy_t(x2 - x1, y2 - y1);
    xy_t B = xy_t(x4 - x3, y4 - y3);

    double dot_prod =  dot_product(A, B);
    double AB_magnitude = abs(A) * abs(B);
    
    if (dot_prod <= AB_magnitude + e && dot_prod >= AB_magnitude - e) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

C++: #include<iostream>
#include<complex>
using namespace std;
typedef complex<long long> xy_t;

xy_t P[4];

long long cross(xy_t p,xy_t q){
    return (conj(p)*q).imag();
}

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        for(int j=0;j<4;++j){
            double x,y;
            cin>>x>>y;
            P[j]=xy_t(100000*x,100000*y);
        }
        
        xy_t a[2]={
            P[0]-P[1],
            P[2]-P[3]
        };

        bool flag=abs(cross(a[0],a[1]));

        cout<<(flag?"NO":"YES")<<"\n";

    }
}

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

int main(){
	double x[4], y[4];
	int n, i, j;

	cin >> n;

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

		if(x[1] == 0 || x[3] == 0){
			if(x[1] == 0 && x[3] == 0){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
			}else{
				if(y[1]/x[1] == y[3]/x[3]){
					printf("YES\n");
				}else{
					printf("NO\n");
			}
		}
	}
	
	return 0;    
}

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

using namespace std;

int main() {
  int n;
  double x[5], y[5], ep;
  pair<double, double> AB, CD;
  cin >> n;
  while(n--) {
    for(int i = 1; i <= 4; i++) {
      cin >> x[i] >> y[i];
    }
    AB.first = x[2] - x[1];
    AB.second = y[2] - y[1];
    CD.first = x[4] - x[3];
    CD.second = y[4] - y[3];
    ep = AB.first * CD.second - AB.second * CD.first;
    if (fabs(ep) < 1e-10) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;

typedef complex<double> Point;

const double EPS = 1e-8;

int sign(double x){
    if(x > EPS) return 1;
    if(x < -EPS) return -1;
    return 0;
}
struct Line : public vector<Point> {
    Line(const Point& a, const Point& b) {
        push_back(a); push_back(b);
    }
    Point vector() const {
        return back() - front();
    }
};

double cross(Point a, Point b){
    return imag(conj(a) * b);
}

bool paralell(Line l, Line m){
    return sign(cross(l.vector(), m.vector())) == 0;
}

int main(){
    int N;
    cin >> N;
    while(N--){
        Point p[4];
        REP(i, 4){
            double x, y;
            cin >> x >> y;
            p[i] = Point(x, y);
        }
        Line l1(p[0], p[1]);
        Line l2(p[2], p[3]);
        if(paralell(l1, l2)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   double x1,y1,x2,y2,x3,y3,x4,y4;
   int n;
   cin>>n;
   while(n--)
   {
     cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
     if((x2==x1&&y2==y1)||(x4==x3&&y4==y3)) cout<<"NO"<<endl;     
     else if(x2==x1&&x3==x4) cout<<"YES"<<endl;
     else 
     {
       double k1=(y2-y1)/(x2-x1);
       double k2=(y4-y3)/(x4-x3);
       if(abs(k1-k2)<0.000000000000000001) cout<<"YES"<<endl;
       else cout<<"NO"<<endl;     
     }          
   }
   //while(1);      
   return 0;    
 }

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n;
    cin >> n;
    double x[4], y[4];
    rep(i, 0, n){
        rep(j, 0, 4){
            cin >> x[j] >> y[j];
        }
        double h1, h2;
        h1 = (y[1] - y[0]) / (x[1] - x[0]);
        h2 = (y[3] - y[2]) / (x[3] - x[2]);
        if(abs(h1 - h2) < 1e-8) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include <stdio.h>

int main()
{
	int n;
	double x1, x2, x3, x4, y1, y2, y3, y4;

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

		if((x2-x1)*(y4-y3) == (y2-y1)*(x4-x3)) puts("YES");
		else puts("NO");
	}

	return 0;
}

C++: #include<iostream>

using namespace std;
 
int main(){

    int n;
    double x[4],y[4];
    cin >> n;

    while(n--){
      for(int i = 0 ; i < 4 ; i++ ){
	  cin>>x[i] >> 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;
 
signed main(){
int a;
cin>>a;
double c[8];
for(int b=0;b<a;b++){
    for(int d=0;d<8;d++)scanf("%lf",&c[d]);
    if(abs((c[1]-c[0])*(c[7]-c[6])==(c[3]-c[2])*(c[5]-c[4])))printf("YES\n");
    else printf("NO\n");
    }
}

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

int main(){
  int n;
  cin>>n;
  while(n--){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    long long int xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4;
    xx1 = x1*100000;
    yy1 = y1*100000;
    xx2 = x2*100000;
    yy2 = y2*100000;
    xx3 = x3*100000;
    yy3 = y3*100000;
    xx4 = x4*100000;
    yy4 = y4*100000;

    long long int abx=x1-x2;
    long long int aby=y1-y2;
    long long int cdx=x3-x4;
    long long int cdy=y3-y4;
    if(aby*cdx == cdy*abx)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
  return 0;
}