Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                fmt.Scanf("%f %f %f %f %f %f %f %f",
                        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4;
	double r_ab, r_cd, eps;
	
	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;
		
		if(p1.x - p2.x != 0 && p3.x - p4.x != 0){
			r_ab = (p1.y - p2.y) / (p1.x - p2.x);
			r_cd = (p3.y - p4.y) / (p3.x - p4.x);
			if(r_ab == r_cd) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(p1.x - p2.x == 0 && p3.x - p4.x == 0){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}

	return 0;

}

C++: #include<iostream>
#include<vector>
using namespace std;
struct c {
	double x;
	double y;
};
int main() {
	int d;
	cin >> d;
	vector<bool>qq;
	for (int j = 0; j < d; j++) {
		const int num = 4;
		c l[num];
		for (int i = 0; i < num; i++) {
			cin >> l[i].x >> l[i].y;
		}
		if ((l[0].x - l[1].x) / (l[0].y - l[1].y) == (l[2].x - l[3].x) / (l[2].y - l[3].y))
			qq.push_back(true);

		else
			qq.push_back(false);
	}
	for (int i = 0; i < d; i++){
		if (qq[i] == true)cout << "YES";
		else cout << "NO";
		cout << endl;
	}
	char c; 
	cin >> c;
}

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

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;

		double AB = (y2-y1) / (x2-x1);
		double CD = (y4-y3) / (x4-x3);

		if(y2-y1 == 0) AB = 0;
		if(y4-y3 == 0) CD = 0;

		if(AB - CD < 0.0000000001){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}

	}
	return 0;
}

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

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
  int n;
  cin>>n;
  while(n--){
    m1=0;
    m2=0;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if(x1==x2)x2+=1;
      m1 =(y2-y1)/(x2-x1);
    
    if(x3==x4)x4+=1;
      m2 =(y4-y3)/(x4-x3);

    if(m1==m2&&m1!=0&&m2!=0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
  return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>

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

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);

		if((x[1]-x[0])*(y[3]-y[2]) == (y[1]-y[0])*(x[3]-x[2])) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>

double calc(double dx1, double dy1, double dx2, double dy2) {
    dx1 = (dx1 == -0.0? 0.0: dx1);
    dy1 = (dy1 == -0.0? 0.0: dy1);
    dx2 = (dx2 == -0.0? 0.0: dx2);
    dy2 = (dy2 == -0.0? 0.0: dy2);
    dx1 *= 100000.0;
    dy1 *= 100000.0;
    dx2 *= 100000.0;
    dy2 *= 100000.0;
    if(dx1 == 0.0 || dx2 == 0.0) {
        return dx1 == dx2 || (dx1 == 0.0 && dy1 == 0.0) || (dx2 == 0.0 && dy2 == 0.0);
    }
    return (dy1/dx1) == (dy2/dx2);
}

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

    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(calc(x2-x1, y2-y1, x4-x3, y4-y3)) {
            printf("YES\n");
        }else {
            printf("NO\n");
        }
    }

    return 0;
}

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

const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}

bool isParallel(const P &a, const P &b){
    return abs(cross(a,b)) < EPS;
}
int main(){
	int n;
	cin >> n;
	for(int rep=0; rep<n; rep++){
		VP v(4);
		for(int i=0; i<4; i++){
			double x,y;
			cin >> x >> y;
			v[i] = P(x, y);
		}
		if(isParallel(v[1]-v[0], v[3]-v[2])){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

C++: #include <stdio.h>

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

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

using namespace std;

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  cin >> n;
  while(n--){
  cin >>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if((y1 == y2 && y3 == y4)
       ||(x1 == x2 && x3 == x4)){
      cout << "YES" << endl;
      continue;
    } else if(x1 == x2 || x3 == x4 || y1 == y2 || y3 == y4){
      cout << "NO" << endl;
      continue;
    }
    if((y1-y2)*(x3-x4) == (x1-x2)*(y3-y4)){
      cout << "YES" << endl;
    }else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

int main(){
    double EPS = 1e-12;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];


    cout << "NO" << endl;
}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int ans[100]={0};
	int n,i;
	
	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(((y1-y2)/(x1-x2)-(y3-y4)/(x3-x4))==0.0)printf("YES\n");
		else if(((x1-x2)==0) && ((x3-x4)==0))printf("YES\n");
		else printf("NO\n");
	}	
return 0;
}

C++: #include<iostream>

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){
			        cout << "YES" << endl;
			}else{
				cout << "NO" << endl;
			}
			}else{
				if(y[1]/x[1] == y[3]/x[3]){
					cout << "YES" << endl;
				}else{
				        cout << "NO" << endl;
			}
		}
	}
	
	return 0;    
}