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

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
		}
		xy_t a[2] = {
					xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
					xy_t(x[2],y[2]) - xy_t(x[3],y[3])
				};
		bool p = abs(cross_product(a[0],a[1]))/2 == 0;
		cout << ( p ? "Yes" : "No") << endl;
	}
}

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

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

int main(void){
	double x1=101,y1=101,x2=101,y2=101,x3=101,y3=101,x4=101,y4=101;
	double abConcurrentX,abConcurrentY,cdConcurrentX,cdConcurrentY;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
	if(x1==101 or y1==101 or x2==101 or y2==101 or x3==101 or y3==101 or x4==101 or y3==101){
		return 0;
	}
	abConcurrentX = x1-x2;
	abConcurrentY = y1-y2;
	cdConcurrentX = x3-x4;
	cdConcurrentY = y3-y4;
	if((abConcurrentX == cdConcurrentX or abConcurrentX == -abConcurrentX) and (abConcurrentY == cdConcurrentY or abConcurrentY == -cdConcurrentY)){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
typedef pair<double,double> pdd;
int main(){
    pdd no1,no2,no3,no4;
    int n;cin>>n;
    rep(i,n){
        cin>>no1.first>>no1.second>>no2.first>>no2.second>>no3.first>>no3.second>>no4.first>>no4.second;
        double d1=(no2.second-no1.second)/(no2.first-no1.first);
        double d2=(no4.second-no3.second)/(no4.first-no3.first);
        if(d1==d2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ld = long double;
const ld eps = 1e-14;

int main()
{
	int n;
	ld x1, x2, x3, x4, y1, y2, y3, y4;
	cin >> n;
	while (n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		ld dx1 = x2 - x1, dy1 = y2 - y1;
		ld dx2 = x4 - x3, dy2 = y4 - y3;
		if (abs(dx1 * dy2 - dy1 * dx2) < eps && dx1 * dx2 + dy1 * dy2 > -eps) {
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	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(fabs((y1-y2)*(x3-x4)-(x1-x2)*(y3-y4))<10e-12){
      cout << "YES" << endl;
    }else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

int main(int argc, const char * argv[]) {
    std::vector<int> r;
    int num;
    std::cin >> num;
    int xa,ya,xb,yb,xc,yc,dx,dy;
    int a,b;
    for(int i = 0;i < num;i++){
        std::cin >> xa >> ya>> xb >> yb >> xc >> yc >> dx >> dy;
        a = (yb - ya) / (xb - xa);
        b = (dy - yc) / (dx - xc);
        if(a == b){
            printf("YES");
        }else{
            printf("NO");
        }
    }
    
    }

C++: #include <iostream>
using namespace std;
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(o < 1e-10) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <list>
#include <cstdlib>
#include <cmath>
#define _USE_MATH_DEFINES

using namespace std;

int main() {

	int n;
	double x[4] = { 0 }, y[4] = { 0 };
	double slope1, slope2;

	cin >> n;

	while (n) {

		for (int i = 0; i < 4; i++) {
			cin >> x[i] >> y[i];
		}

		slope1 = (y[1] - y[0]) / (x[1] - x[0]);
		slope2 = (y[3] - y[2]) / (x[3] - x[2]);

		if (slope1 == slope2) {
			cout << "YES" << endl;
		}
		else
			cout << "NO" << endl;
			n--;
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
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, a1, a2;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        a1 = (y1-y2)/(x1-x2);
        a2 = (y3-y4)/(x3-x4);
        if(a1==a2)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
}

C++: #include<iostream>

using namespace std;


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

C++: #include<iostream>

using namespace std;

int main(){
  double x1, x2, x3, x4, y1, y2, y3, y4;
  double a1, a2, b1, b2;
  int n;
  cin >> n;
  for(int i =0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    
    a1 = x2 - x1;
    a2 = x4 - x3;
    b1 = y2 - y1;
    b2 = y4 - y3;
    
    if (b2 == a2 * b1 / a1) cout << "YES"<< endl;
    else cout << "NO" << endl;
  }
}

C++: #include <stdio.h>
struct point{
    double x;
    double y;
};
double abs(double a){
if(a>0)return a;
return -a;
}
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(abs(((a[1].x-a[0].x)*(a[3].y-a[2].y))-((a[3].x-a[2].x)*(a[1].y-a[0].y)))<=0.001)printf("YES\n");
        else printf("NO\n");
    }
}