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;
 
class Vector2{
public:
    Vector2() : x( 0.0 ), y( 0.0 ){}
    Vector2( double aX, double aY ) : x( aX ), y( aY ){}
 
    double cross( Vector2& v ){
        return ( x * v.y ) - ( y * v.x );
    }
 
    void operator-=( Vector2& v ){
        x -= v.x;
        y -= v.y;
    }
 
    double x, y;
};
 
int main(){
    int n;
 
    cin >> n;
    Vector2* a = new Vector2[ n ];
    Vector2* b = new Vector2[ n ];
    Vector2* c = new Vector2[ n ];
    Vector2* d = new Vector2[ n ];
 
    for ( int i = 0; i < n; ++i ){
        cin >> a[ i ].x >> a[ i ].y >> b[ i ].x >> b[ i ].y >> c[ i ].x >> c[ i ].y >> d[ i ].x >> d[ i ].y;
    }
 
    for ( int i = 0; i < n; ++i ){
        a[ i ] -= b[ i ];
        c[ i ] -= d[ i ];
        cout << ( !a[ i ].cross( c[ i ] ) ? "YES" : "NO" ) << endl;
    }
 
    delete[] a;
    delete[] b;
    delete[] c;
    delete[] d;
 
    return 0;
}

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

typedef complex<double> P;

// ?¨±?????????????????
#define EPS (1e-10)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)

// ?????? (cross product) : a??b = |a||b|sin??
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// 2??´?????????????????? : a//b <=> cross(a, b) = 0
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}

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

	cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		P a(x1,y1), b(x2,y2), c(x3,y3), d(x4,y4);
		if( is_parallel(a,b,c,d) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;
int main(){
	double a,b,c,d,e,f,g,h;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b>>c>>d>>e>>f>>g>>h;
		if(c-a==g-e&&d-b==h-f){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdlib>
using namespace std;
#define EPS 1e-10
double x1,y1,x2,y2,x3,y3,x4,y4;
int det(){
	double dx1,dy1,dx2,dy2;
	dx1 = x1-x2;
	dy1 = y1-y2;
	dx2 = x3-x4;
	dy2 = y3-y4;
	return dx1*dy2 - dy1*dx2;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
	}
	return 0;
}

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

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

	for (; n--;){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		
		double a, b;

		a = (y2 - y1) / (x2 - x1);
		b = (y4 - y3) / (x4 - x3);

		cout << ((a == b) ? "YES\n" : "NO\n");
	}
	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 ((x2-x1)==0 && (x4-x3)==0)
            cout << "YES" << endl;
        else {
            int d = abs((y2-y1)*(x4-x3) - (y4-y3)*(x2-x1));
            cout << ((d <= 1e-10)? "YES" : "NO") << endl;
        }
    }
    return 0;
}

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

#define P complex<double>

int main(){
  int n;
  P a,b,c,d;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> a.real() >> a.imag();
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    cin >> d.real() >> d.imag();

    P x=a-b, y=c-d;
    x = x/abs(x);
    y = y/abs(y);

    if( x==y )
      /*
      abs(x.real()-y.real()) < 1.0e-4  &&
	abs(x.imag()-y.imag()) < 1.0e-4  )
      */
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  double ax,ay,bx,by,cx,cy,dx,dy,ans1,ans2,x,y;
   for(int i=0;i<n;i++){
     cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
     x = ax - bx;
     y = ay - by;
     ans1 = y / x;
     x = cx - dx;
     y = cy - dy;
     ans2 = y / x;
     if(ans1==ans2) cout << "YES" << endl;
     if(ans1!=ans2) cout << "NO" << endl;
   }

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

const double EPS= 1e-12;

struct zahyo{
	double x;
	double y;
};


int main(){
	zahyo a , b , c , d , ab , cd;
	int n;
	std::cin >> n;
	for(int i=0 ; i<n ; ++i){
		std::cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		ab.x=b.x-a.x;
		ab.y=b.y-a.y;
		cd.x=d.x-c.x;
		cd.y=d.y-c.y;
		if (abs(ab.x*cd.y-ab.y*cd.x)<EPS){ //gaiseki
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}			
	}
	return 0;
}

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

using namespace std;

int main() {
    double ax,ay,bx,by,cx,cy,dx,dy;
    int n;
    cin>>n;
    
    while(cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy){
        if((ax-bx)==0&&(cx-dx)==0){
            cout<<"YES"<<endl;
        }else if((ax-bx)!=0.0 && (cx-dx)!=0.0){
            double a = (ay-by)/(ax-bx);
            double c = (cy-dy)/(cx-dx);
            if(a==c){
                cout<<"YES"<<endl;
            }else{
                cout<<"NO"<<endl;
            }
        }else{
            cout<<"NO"<<endl;
        }
        

    }
    return 0;
}

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

bool solve();

int main(){
	int n;cin>>n;
	while(n--){
		if(solve()){
			cout<<"YES";
		}else{
			cout<<"NO";
		}
		cout<<endl;
	}	
	return 0;
}

bool solve(){
	double x1,x2,y1,y2;
	double vx1,vx2,vy1,vy2;
	
	cin>>x1>>y1>>x2>>y2;
	vx1=x2-x1;vy1=y2-y1;
	cin>>x1>>y1>>x2>>y2;
	vx2=x2-x1;vy2=y2-y1;
	
	//vx1:vy1=vx2:vy2
	return abs(vx1*vy2-vy1*vx2)<0.0001;
}

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

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

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

int main()
{
	const double EPS = 1e-10;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		double a = arg((A-B)/(C-D));
		//cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
		cout << ( abs(a)==0 || abs(a)==PI ? "YES" : "NO" ) << endl;
	}
	return 0;
}