Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&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)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

int main(){
    int n;
    cin >> n;
    while(n--){
        double x1,y1,x2,y2,x3,y3,x4,y4,ll,lll;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        ll = (y1-y2)/(x1-x2);
        lll = (y4-y3)/(x4-x3);
        cout << ((ll == lll)? "YES" : "NO") << endl;
    }
}

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

int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	double veku1[2];
	double veku2[2];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;
		if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
			veku1[0] = x3 - x1;
			veku1[1] = y3 - y1;
			veku2[0] = x4 - x1;
			veku2[1] = y4 - y1;
			if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
				cout << "NO" << endl;
			} else {
				cout << "YES" << endl;
			}
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
 
int main(){
  double a,b,c,d,e,f,g,h;
  int t;
  
  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    cout << ((d-b)/(c-a) == (h-f)/(g-e) ? "YES" : "NO") << endl;
  }
 
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
// const double eps = 1e-9;
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;
        x1 -= x2;
        y1 -= y2;
        x3 -= x4;
        y3 -= y4;
        cout << (x1 * y3 - y1 * x3 == 0 ? "YES" : "NO") << endl;
    }
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if((a[1].first-a[0].first)==0&&(a[3].first-a[2].first)==0)
            cout<<"NO"<<endl;
        else if((a[1].second-a[0].second)/(a[1].first-a[0].first)!=(a[3].second-a[2].second)/(a[3].first-a[2].first))
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

class vec2d {
public:
  double x,y;
  void set(double x=0,double y=0) {
    this->x = x;
    this->y = y;
  }
};
double cross(vec2d A,vec2d B) {
  return (A.x*B.y - B.x*A.y);
}
bool is_paralles(vec2d A,vec2d B) {
  if(cross(A,B) < 1e-9) return true;
  return false;
}

int main() {
  int n;
  cin >> n;
  while(n--) {
    double x1,y1,x2,y2;
    vec2d p[2];
    for(int i=0;i<2;i++) {
      cin >> x1 >> y1 >> x2 >> y2;
      p[i].set(x2 - x1,y2 - y1);
    }
    if(is_paralles(p[0],p[1])) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <iostream>
using namespace std;
void judge(double,double,double,double,double,double,double,double);

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

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

void judge(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
	double abx = x2 - x1;
	double aby = y2 - y1;
	double cdx = x4 - x3;
	double cdy = y4 - y3;
	if (aby / abx == cdy / cdx) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return;

}

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

using namespace std;

typedef complex<double> Point;

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];

        double dot = v1.real()*v2.real() + v1.imag()*v2.imag();
        double n = norm(v1) * norm(v2);
        if(abs(dot*dot - n) < 1e-9) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include<string>
#include<cstdio>
#include<iostream>
 
using namespace std;
  
int main(){
    int n;
    double x[6],y[6];
 
    cin >>n;
    while(n--){
        cin >>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3];
         
        x[4]=x[0]-x[1];
        y[4]=y[0]-y[1];
        x[5]=x[2]-x[3];
        y[5]=y[2]-y[3];
 
        if(x[4]*y[5]-x[5]*y[4]) cout<< "NO" << endl;
        else cout<<"YES" << endl;
    }
  
    return 0;
}

C++: #include<stdio.h>

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

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

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