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 <stdio.h>
struct point{
    double x;
    double y;
};
int main(){
    int n;
    point a[4];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            scanf("%lf%lf",&a[j].x,&a[j].y);
        }
        if(a[1].x==a[0].x){
            if(a[3].x==a[2].x)printf("YES\n");
            else printf("NO\n");
        }
        else  if(a[1].y==a[0].y){
            if(a[3].y==a[2].y)printf("YES\n");
            else printf("NO\n");
        }
        else  if(a[3].x==a[2].x){
            printf("NO\n");
        }
        else if(a[3].y==a[2].y){
            printf("NO\n");
        }
        else if(((a[1].x-a[0].x)/(a[1].y-a[0].y))==((a[3].x-a[2].x)/(a[3].y-a[2].y)))printf("YES\n");
        else printf("NO\n");
    }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
#define EPS 1e-10

int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if(fabs((y4-x3)*(x2-x1) - (x4-x3)*(y2-y1)) < EPS) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,i;
	double x1,y1,x2,y2,x3,y3,x4,y4,x;
	scanf("%d",&n);
	for(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==0) || (x4-x3==0))	{
			if((x2-x1==0) && (x4-x3==0))	{
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
		else {
			x=(y2-y1)/(x2-x1)-(y4-y3)/(x4-x3);
			if(x<0.0000001 && x>-0.0000001)	{
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
	}
	return 0;
}

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

struct vec {
	double x, y;
};

static vec P(double x, double y){
	vec P = {x, y};
	return P;
}

static vec sub(vec a, vec b){
	return P(a.x - b.x, a.y - b.y);
}

static double cross(vec a, vec b){
	return (a.x * b.y - a.y * b.x);
}

int main(void){
    
    int n;
    cin >> n;
    double D[8];
    vec V[4];
    for(int i = 0; i < n; i++){
    	for(int j = 0; j < 4; j++){
    		cin >> D[2*j] >> D[2*j+1];
    		V[j] = P(D[2*j], D[2*j+1]);
    	}
    	vec a = sub(V[0], V[1]);
    	vec b = sub(V[2], V[3]);
    	if (cross(a, b) == 0){
    		cout << "YES" << endl;
    	}
    	else{
    		cout << "NO" << endl;
    	}
    }
    return 0;

}

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

using namespace std;

int main(void){
	int n, i;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	scanf("%d%*c",&n);
	for(i = 0;i < n;i++){
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf%*c",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		if((y2 - y1) * (x4 - x3) == (x2 - x1) * (y4 - y3)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

bool parallel(double x1, double y1, double x2, double y2){
	double vec;
	vec = x1*y2 - x2*y1;
	if (vec < 0.0000000001 && vec > -0.0000000001) return true;
	return false;
}

int main(){
    int n;
    double x1, x2, x3, x4, y1, y2, y3, y4;
    cin >> n;
    REP(i, n) {
    	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    	if (parallel(x1-x2, y1-y2, x3-x4, y3-y4)) cout << "YES" << endl;
    	else cout << "NO" << endl;
    }
}

C++: #include<stdio.h>
#include<math.h>
int main(void)
{
	int n;
	int i,j;
	double x[5],y[5];
	double xx,yy;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<4;j++){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		if(x[0]-x[1]==0 || x[2]-x[3]==0){
			if(x[0]-x[1]==0 && x[2]-x[3]==0){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
		else {
			xx=(y[0]-y[1])/(x[0]-x[1]);
			yy=(y[2]-y[3])/(x[2]-x[3]);
//			printf("%lf %lf\n",xx,yy);
			xx=xx-yy;		
			if(xx<0.0000001 && xx>-0.0000001){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
	}	
	return 0;
}

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

using namespace std;

int main(void){
	int n,x[2],y[2];
	pair<int,int> v[2];

	cin >> n;
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			cin >> x[0] >> y[0] >> x[1] >> y[1];
			v[j]=make_pair(x[0]-x[1],y[0]-y[1]);
		}
		cout << (v[0].first*v[1].second-v[0].second*v[1].first?"YES":"NO") << endl;
	}
		
	return 0;
}

C++: #include <stdio.h>

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

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
double x[100], y[100];

int main(){
	cin >> n;
	REP(i, n){
		REP(j, 4) cin >> x[j] >> y[j];
		if (fabs((x[1] - x[0])*(y[3] - y[2]) 
			- (x[3] - x[2])*(y[1] - y[0]))<0.000001){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

using namespace std;

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

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i] >> x3[i] >> y3[i] >> x4[i] >> y4[i];
	}

	for (int i = 0; i < n; i++)
	{
		if (abs(x2[i] - x1[i]) / abs(y2[i] - y1[i]) == abs(x4[i] - x3[i]) / abs(y4[i] - y3[i]))
		{
			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;
	while (n-- != 0){
		for (int i = 0; i < 4; i++)
			cin >> x[i] >> y[i];
		if ((x[0] - x[1]) * (x[2] - x[3]) == (y[0] - y[1]) * (y[2] - y[3]))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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