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>
#include <cmath>
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	double x[4];
	double y[4];

	while(n > 0){
		for(int i = 0; i < 4; ++i){
			cin >> x[i] >> y[i];
		}

		double m1 = (y[1] - y[0]) / (x[1] - x[0]);
		double m2 = (y[3] - y[2]) / (x[3] - x[2]);

		cout << (m1 == m2 ? "YES" : "NO") << endl;

		--n;
	}

	return 0;
}

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

const double EPS = 1e-8;
typedef double D;

struct P {
  D x, y;
  P(D xs, D ys) : x(xs), y(ys) { }
  P() { }
};

P operator -(P a, P b) { return P(a.x - b.x, a.y - b.y); }

struct L {
  P a, b;
  L(P as, P bs) : a(as), b(bs) { }
};

int sign(D a, D b = 0.0) {
  if(a < b - EPS) return -1;
  if(a > b + EPS) return +1;
  return 0;
}

P vec(P from, P to) { return to - from; }
D inp(P a, P b) { return a.x*b.x + a.y*b.y; }
D outp(P a, P b) { return a.x*b.y - a.y*b.x; }

bool iLL(L l, L m) {
  return sign(outp(vec(l.a, l.b), vec(m.a, m.b))) != 0 || // テ・ツケツウティツ。ツ古」ツ?ァテ」ツ?ェテ」ツ??
    sign(outp(vec(l.a, l.b), vec(l.a, m.a))) == 0;   // テ・ツ青古」ツ?佚ァツ崢エテァツキツ?
}

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

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

int dis(float x1, float y1, float x2, float y2)
{
	return (sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
}

int min(int i, int j)
{
	if (i < j){
		return (i);
	}
	
	return (j);
}

int main(void)
{
	int n;
	int ac, ad, bc, bd;
	float coord[2][4];
	int i, j;
	
	scanf("%d", &n);
	while (n){
		for (i = 0; i < 4; i++){
			for (j = 0; j < 2; j++){
				scanf("%f", &coord[j][i]);
			}
		}
		
		ac = dis(coord[0][0], coord[1][0], coord[0][2], coord[1][2]);
		bc = dis(coord[0][1], coord[1][1], coord[0][2], coord[1][2]);
		ad = dis(coord[0][0], coord[1][0], coord[0][3], coord[1][3]);
		bd = dis(coord[0][0], coord[1][0], coord[0][2], coord[1][2]);
		
		if (min(ac, ad) == min(bc, bd)){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

C++: #include <cstdio>

using namespace std;

double x1,y1,x2,y2,x3,y3,x4,y4;
    

int main()
{
    int n; scanf( "%d\n", &n );
    while( n > 0 )
    {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4 );
        double dx1 = x2 - x1, dx2 = x4 - x3, dy1 = y2 - y1, dy2 = y4 - y3, det = dx1 * dy2 - dx2 * dy1;

        if( det < 0.000000001 )
        {
            printf( "YES\n" );
        }
        else
        {
            printf( "NO\n" );
        }

        /* if( (dx1 == 0 && dx2 == 0) || (dy1 == 0 && dy2 == 0 ) )
        {
            printf( "YES\n" );
        }
        else if( dx1 != 0 && dx2 != 0 )
        {
            dy1 /= dx1;
            dy2 /= dx2;
            if( dy1 == dy2 || dy1 == -dy2 )
            {
                printf( "YES\n" );
            }
        }
        else
        {
            printf( "NO\n" );
        }
         */
        n--;
    }
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
  int n,i;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int ans[100];
  
  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);
  
    if( (x2-x1)*(y4-y3)-(x4-x3)*(y2-y1) == 0){
      ans[i] = 1;
    }else{
      ans[i] = 0;
    }
  }

  for(i = 0;i < n;i++){
    if(ans[i] == 1){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
	freopen("testcase.pl", "r", stdin);
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	int i,j;
	for (i = 0; i < n; ++i){
		vector <double> px (4, 0.0);
		vector <double> py (4, 0.0);
		getline (cin, str );
		stringstream ss(str);
		for (j = 0; j < 4; ++j){
			ss >> px[j] >> py[j];
		} // end for
		multimap <double, double> v;

		for (j = 0; j < 2; ++j){
			v.insert (make_pair (px[2*j + 1] - px[2*j], py[2*j + 1] - py[2*j] ) );
		} // end for

		multimap <double, double>::iterator it = v.begin();
		double xp = (*it).first;
		double yp = (*it).second;
		++it;		
		double xa = (*it).first;
		double ya = (*it).second;
		bool found = false;

		if (xp != 0. && yp != 0.){
			if ( fabs( (*it).first/xp - (*it).second/yp ) < 1e-6 ){
				found = true;
			}else{
				found = false;
			} // end if
		}else{	// if (xp == 0. || yp == 0. )
			if (yp != 0. ){ // xp == 0. && yp != 0.
				if (xa == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			}else if (xp != 0.){ // xp != 0. && yp == 0.
				if (ya == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			}else{ // if (xp == 0. && yp == 0.)
				if (xa == 0. &&  ya == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			} // end if
		} // end if

		if (found ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if

	} // end for
		
	return 0;
}

C++: /*****include*****/
#include <iostream>
#include <fstream>
#include <string>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	int n;
	double x[4];
	double y[4];
	double slope_AB;
	double slope_CD;
	/*****処理部*****/
	cin >> n;
	for(int loop=0;loop<n;loop++){
		for(int i=0;i<4;i++){
			cin >> x[i];
			cin >> y[i];
		}
		slope_AB = (y[0] - y[1])/(x[0] - x[1]);
		slope_CD = (y[2] - y[3])/(x[2] - x[3]);
		if(slope_AB == slope_CD)	cout << "YES" << endl;
		else						cout << "NO" << endl;
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}