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<stdio.h>
#include<math.h>
struct P{double x,y;}p[4],a,b;
P operator-(P l,P r){P a={l.x-r.x,l.y-r.y};return a;}
int main()
{
	int T;
	for(scanf("%d",&T);T--;)
	{
		int i;
		double c;
		for(i=0;i<4;++i)scanf("%lf%lf",&p[i].x,&p[i].y);
		a=p[0]-p[1],b=p[2]-p[3];
		c=a.x*b.y-a.y*b.x;
		puts(fabs(c)<1e-10?"YES":"NO");
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ld = long double;

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) < (ld)1e-11 && dx1 * dx2 + dy1 * dy2 >= (ld)1e-11) {
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

int main(){

	int n;
	cin>>n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	while(n>0){
		
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

		
		if((y4-y3)/(x4-x3)==(y2-y1)/(x2-x1))
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
		n--;
	}
	
	
}

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
double x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4, a, b, c, d;

int x;
int main(){
	cin >> x;
	for(int i = 1; i <= x; i++){
		cin >> x_1 >> y_1 >> x_2 >> y_2 >> x_3 >> y_3 >> x_4 >> y_4;
		a = x_2 - x_1;
		b = y_2 - y_1;
		c = x_4 - x_3;
		d = y_4 - y_3;
		if(a * d == b * c){
			cout << "YES\n";
		}
		else{
			cout << "NO\n";
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

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 t1 = (y1-y2)*(x3-x4);
		//double t2 = (y3-y4)*(x1-x2);

		if( (x1-x2)==0 && (x3-x4)==0 ){
			if( (y1-y2)==0 || (y3-y4)==0 ){
				cout << "NO" << endl;
			}else{
				cout << "YES" << endl;
			}
		}else if( (x1-x2)==0 || (x3-x4)==0 ){
			cout << "NO" << endl;
		}else{
			double t1 = (y1-y2)/(x1-x2);
			double t2 = (y3-y4)/(x3-x4);
			if(t1==t2){
				cout << "YES" << endl;
			}else{
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double a[4][2];
		for (int I = 0; I< 4; I++)
		{
			for (int k = 0; k < 2; k++)
			{
				cin >> a[I][k];
			}
		}
		double x, y;
		x = (a[1][0] - a[0][0]);
		y = (a[3][0] - a[2][0]);
		x = (x) ? (a[1][1] - a[0][1]) / x : 0;
		y = (y) ? (a[3][1] - a[2][1]) / y : 0;
		if (x == y)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

}
/*
		x = (a[1][1] - a[0][1]) / (a[1][0] - a[0][0]);
		y = (a[3][1] - a[2][1]) / (a[3][0] - a[2][0]);*/

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

class Point
{
public:
	double m_X;
	double m_Y;
	Point(double x, double y)
		: m_X( x )
		, m_Y( y )
	{}
};

class LineSegment
{
private:
	Point m_Start;
	Point m_End;
public:
	LineSegment(Point start, Point end)
		: m_Start( start )
		, m_End( end )
	{}
	double CalcSlope()
	{
		if ( m_End.m_Y == m_Start.m_Y)
		{
			return 0.0;
		}

		if (m_End.m_X == m_Start.m_X)
		{
			return 9999999999.0;
		}
	
		return((m_End.m_Y - m_Start.m_Y) / (m_End.m_X - m_Start.m_X));
	}
};

const double EPS = 1e-10;


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

	std::cin >> n;

	for (int data_no = 0; data_no < n; ++data_no)
	{
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		Point start1{ x1, y1 };
		Point end1{ x2, y2 };
		Point start2{ x3, y3 };
		Point end2{ x4, y4 };

		LineSegment line1{ start1, end1 };
		double line1_slope = line1.CalcSlope();

		LineSegment line2{ start2, end2 };
		double line2_slope = line2.CalcSlope();

		if ( std::fabs(line1_slope - line2_slope) < EPS )
		{
			std::cout << "YES" << std::endl;
		}
		else
		{
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

C++: #include <algorithm>
#include <deque>
#include <iostream>
#include <functional>

using namespace std;

int main()
{
	int i,num;
	float x[4],y[4];
	cin >> num;

	for ( i = 0 ; i< num; i++ ) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if( y[0] == y[1] ) {
			
		}


		if( (x[0]-x[1])*(y[2]-y[3]) != (y[0]-y[1])*(x[2]-x[3]) ){
			cout << "NO" << endl;
		}
		else if( y[0] == y[1] ) {
			if( y[2] == y[3] ) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;			
			}
		}
		else if( x[0] == x[1] ) {
			if( x[2] == x[3] ) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;			
			}
		}
		else{
			cout << "YES" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
main(){
	double xy[4][2],p[2],tmp[2];
	int n;
	cin>>n;
	for(int loop=0;loop<n;++loop){
		for(int i=0;i<4;++i){
			for(int j=0;j<2;++j){
				cin>>xy[i][j];
			}
		}
		for(int i=0;i<2;++i){
			tmp[0]=xy[i*2][1]-xy[i*2+1][1];
			tmp[1]=xy[i*2][0]-xy[i*2+1][0];
			p[i]=tmp[0]/tmp[1];
			//cout<<xy[i*2][0]<<" "<<xy[i*2+1][0]<<endl;
		}
		if(p[1]==p[0])cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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-5) cout << "YES" << endl;
        else cout << "NO" << endl;
        */
        if(abs(arg(v1)-arg(v2)) < 1e-7) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main( void )
{
  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;
    if( fabs( atan2( y2-y1, x2-x1 ) - atan2( y4-y3,x4-x3 ) ) < 1e-9 )
      cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

struct vec{
	double x;
	double y;
};

int main(){
	int n;
	cin>>n;
	double x[4],y[4];//0:A 1:B 2:C 3:D
	rep(i,n){
		rep(j,4)cin>>x[j]>>y[j];
		vec ABvec;
		vec CDvec;
		ABvec.x=x[1]-x[0];
		ABvec.y=y[1]-y[0];
		CDvec.x=x[3]-x[2];
		CDvec.y=y[3]-y[2];
		double elmeet=abs(ABvec.x*CDvec.x+ABvec.y*CDvec.y);
		double ABnolme=sqrt(pow(ABvec.x,2)+pow(ABvec.y,2));
		double CDnolme=sqrt(pow(CDvec.x,2)+pow(CDvec.y,2));
		if(abs(ABnolme*CDnolme-elmeet)<10e-10)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}