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>

int
main(void)
{
	int n;

	scanf("%d", &n);

	double x1, y1, x2, y2, x3, y3, x4, y4;
	
	while (n--) {
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

		if ((y2 - y1)/(x2 - x1) == (y4 - y3)/(x4 - x3)) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}

	return 0;
}

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

typedef complex<double> P;

#define EPS 1e-10
#define EQ(a, b) (abs((a)-(b)) < EPS)

double cross(P a, P b){
  return (a.real()*b.imag() - a.imag()*b.real());
}

int is_parallel(P a1, P a2, P b1, P b2){
  return EQ(cross(a1-a2, b1-b2), 0.0);
}

int main(void){
  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;
    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;
    }
  }
  return 0;
}

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

const double EPS = 1e-9;
 
class Vector2{
public:
    Vector2() : x( 0.0 ), y( 0.0 ){}
    Vector2( double aX, double aY ) : x( aX ), y( aY ){}
 
    double cross( Vector2& v ){
    	double ret = ( x * v.y ) - ( y * v.x );
        return ( fabs( ret ) < EPS ) ? 0.0 : ret;
    }
 
    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 <bits/stdc++.h>

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP (i, 0, n)
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;

int main() {
	int n; cin >> n;
	while (n--) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double cx1 = (x3 - x1) / 2.0;
		double cy1 = (y3 - y1) / 2.0;
		double cx2 = (x4 - x2) / 2.0;
		double cy2 = (y4 - y2) / 2.0;
		if (cx1 == cx2 && cy1 == cy2) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  cin>>n;
  rep(i,n){
    double a,b,c,d,e,f,g,h;
    cin>>a>>b>>c>>d>>e>>f>>g>>h;
    double p=(b-d)*(e-g);
    double q=(f-h)*(a-c);
    if(p-q==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

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

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<stdio.h>
#include<math.h>
int main(void)
{
	int n;
	int i,j;
	double x[5],y[5];
	double xx,yy;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<4;j++){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		if(x[0]-x[1]==0 || x[2]-x[3]==0){
			if(x[0]-x[1]==0 && x[2]-x[3]==0){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
		else {
			xx=(y[0]-y[1])/(x[0]-x[1]);
			yy=(y[2]-y[3])/(x[2]-x[3]);
	//		printf("%lf %lf\n",xx,yy);
			if(xx==yy){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
	}	
	return 0;
}

C++: #include<vector>
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int n;
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
      double x1,y1,x2,y2,x3,y3,x4,y4;
      scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
      if(fabs((x2-x1)*(y4-y3)-(y2-y1)*(x4-x3)) <=1e-10) printf("YES\n");
      else printf("NO\n");
    }
}

C++: #include <iostream>
using namespace std;
double EPS=0.00001;
double add(double a, double b)
{
	if(abs(a+b)<EPS*(abs(a)+abs(b))) return 0;
	return a+b;
}

int main()
{
	int n; cin >> n ;
	double x[4],y[4];
	while(n--)
	{
		for(int i=0;i<4;i++) cin >> x[i] >> y[i] ;
		double vx[2],vy[2];
		for(int i=0;i<2;i++) vx[i]=add(x[2*i+1],-x[2*i]), vy[i]=add(y[2*i+1],-y[2*i]);
		if(!add(vx[0]*vy[1],-vy[0]*vx[1])) cout << "YES" << '\n' ;
		else cout << "NO" << '\n' ;
	}
}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4;
	double r_ab, r_cd, eps;
	eps = 0.000001;
	
	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
		
		if(p1.x - p2.x > eps && p3.x - p4.x > eps){
			r_ab = (p1.y - p2.y) / (p1.x - p2.x);
			r_cd = (p3.y - p4.y) / (p3.x - p4.x);
			if(r_ab == r_cd) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(p1.x - p2.x <= eps && p3.x - p4.x <= eps){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}

	return 0;

}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=0.000000001;
	bool same(double a,double b){
		if(abs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	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 a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if(same(a1,a2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}