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;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

int cross_product(Vector& a, Vector& b)
{
  return int(a.x * b.y * 10000)  - int(b.x * a.y * 10000);
}

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    Vector A, B, C, D;
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if(cross_product(AB, CD) == 0)
      cout << "YES" << endl;
    else 
      cout << "NO" << endl;
  }
}

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

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

C++: #include <stdio.h>
#define EPSIRON (1.0e-30)

int main(void){
    int n;
    double x1, x2, x3, x4, dx1, dx2;
    double y1, y2, y3, y4, dy1, dy2;
    double cp; // cross product
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        cp = dx1 * dy2 - dy1 * dx2;
        printf("%s\n", cp < EPSIRON ? "YES" : "NO");
    }
    
    return 0;
}

C++: #include <iostream>

int main() {
    int n;
    std::cin >> n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < n;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}

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

using namespace std;

int main (void) {
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int n;
   
  cin >> n;
  
  for(int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    double t1 = (y1-y2)/(x1-x2);
    double t2 = (y3-y4)/(x3-x4);
    //cout << t1 << " " << t2 << endl;
    if ( t1 == t2 ) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  return 0;
}

C++: #include <stdio.h>

typedef struct _point {
  double x, y;
} point;

// テ」ツδ凖」ツつッテ」ツδ暗」ツδォa, bテ」ツ?ョテ・ツ、ツ姪ァツゥツ催」ツ?ョテ・ツ、ツァテ」ツ?催」ツ?陛」ツつ津ヲツアツづ」ツつ?」ツつ凝」ツ??
double cross(point a, point b) {
  return a.x * b.y - a.y * b.x;
}

int main() {
  int Tc, tc;
  point A, B, C, D;
  scanf("%d", &Tc);
  for(tc = 0; tc < Tc; ++tc) {
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
          &A.x, &A.y, &B.x, &B.y, &C.x, &C.y, &D.x, &D.y);
    point va, vb;
    va.x = B.x - A.x;
    va.y = B.y - A.y;
    vb.x = D.x - C.x;
    vb.y = D.y - C.y;
    // テ」ツδ凖」ツつッテ」ツδ暗」ツδォa, bテ」ツ?ョテ・ツ、ツ姪ァツゥツ催」ツ?ョテ・ツ、ツァテ」ツ?催」ツ?陛」ツ?? テ「ツ??テ」ツδ凖」ツつッテ」ツδ暗」ツδォa, bテ」ツ?ッテ・ツケツウティツ。ツ?
    if(cross(va, vb) == 0.0) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
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;
		double a,b,c,d;
		a=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
		b=sqrt(pow(x3-x1,2)+pow(y3-y1,2));
		c=sqrt(pow(x4-x3,2)+pow(y4-y3,2));
		d=sqrt(pow(x4-x2,2)+pow(y4-y2,2));
		if(a==c&&b==d){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
    int N;
	cin>>N;
	while(N--){
		bool ans;
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a,b;
		if(x1==x2){
			x3==x4?ans=true:ans=false;
		}else if(x3==x4){
			ans=false;
		}else{
			a=(double)(y1-y2)/(x1-x2);
			b=(double)(y3-y4)/(x3-x4);
			a==b?ans=true:ans=false;
		}
		ans?puts("YES"):puts("NO");
	}
    return 0;
}

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

C++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

const double EPS = 1E-15;

inline bool cmp(double x, double y){
  return abs(x-y) < EPS;
}

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;
    double s=(x1-x2)*(y3-y4), t=(y1-y2)*(x3-x4);
      if(cmp(s, t)) cout << "YES" << endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

using namespace std;

int main(void){
	int n;
	float x[2],y[2];
	pair<float,float> 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?"NO":"YES") << endl;
	}
		
	return 0;
}

C++: #include <iostream>
using namespace std;
int n;
double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;
int main(){
	int i;
	while(cin >> n){
		for(i=0;i<n;i++){
			cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
			ta = xb - xa;
			tb = yb - ya;
			tc = xd - xc;
			td = yd - yc;
			if(tb == td && ta == tc) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main()
{
	int n;
	double x[4], y[4];
	std::cin >> n;
	while( n-- ){
		for( int i = 0; i < 4; i++ ){
	 		std::cin >> x[i] >> y[i];
		}
		
		if( ( x[1] - x[0] ) * ( y[3] - y[2] ) == ( x[3] - x[2] ) * ( y[1] - y[0] ) ) puts("YES");
		else if( x[0] == x[1] && x[2] == x[3] ) puts("YES");
		else if( y[0] == y[1] && y[2] == y[3] ) puts("YES");
		else puts("NO");
	}

 	return 0;
}

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

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

int main()
{
	int N;
	double x[4],y[4];
	ll X[4],Y[4];
	cin >> N;

	for (int i = 0; i < N; ++i)
	{
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		for (int j = 0; j < 4; ++j)
		{
			X[j] = round(x[j] * 1e5);
			Y[j] = round(y[j] * 1e5);
			//cout << X[j] << " " << Y[j] << endl;
		}
		xy_t t1(X[0],Y[0]);
		xy_t t2(X[1],Y[1]);
		xy_t t3(X[2],Y[2]);
		xy_t t4(X[3],Y[3]);

		if (crossPro(t2-t1,t4-t3) == 0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main() {
	double x[4], y[4], m[2];
	int i, n;
	cin >> n;
	while (n--) {
		for (i = 0; i < 4; i++)
			cin >> x[i] >> y[i];
		if (x[0] == x[1] && x[2] == x[3])
			cout << "YES" << endl;
		else if (x[0] == x[1] || x[2] == x[3])
			cout << "NO" << endl;
		else {
			m[0] = (y[0]-y[1]) / (x[0]-x[1]);
			m[1] = (y[2]-y[3]) / (x[2]-x[3]);
			if (m[0] == m[1])
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
	}
	return 0;
}