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>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
typedef pair<double,double> pdd;
int main(){
    pdd no1,no2,no3,no4;
    int n;cin>>n;
    rep(i,n){
        cin>>no1.first>>no1.second>>no2.first>>no2.second>>no3.first>>no3.second>>no4.first>>no4.second;
        double d1=(no2.second-no1.second)/(no2.first-no1.first);
        double d2=(no4.second-no3.second)/(no4.first-no2.first);
        if(d1==d2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <iostream>

using namespace std;
int main(void){
    // Here your code !
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;
if(x1==x2&&x3==x4) cout<<"YES"<<endl;
else if(y1==y2&&y3==y4) cout<<"YES"<<endl;
else if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)  )
cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}

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

typedef struct xyz{
    double x;
    double y;
}XYZ;

int main(void){

    int times;
    cin >> times;

    XYZ a,b,c,d;
    double x1,y1,x2,y2;

    while(times > 0){
        cin >> a.x >> a.y;
        cin >> b.x >> b.y;
        cin >> c.x >> c.y;
        cin >> d.x >> d.y;

        x1 = a.x - b.x;
        y1 = a.y - b.y;
        x2 = c.x - d.x;
        y2 = c.y - d.y;

        

        if(((y1 * x2) - (y2 * x1)) == 0.0){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

        times--;
    }


    return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
typedef complex<double> xy_t;
int main()
{
  int n;
  double x,y;
  queue<string> qs;
  cin >> n;
  for( int i = 0; i < n; ++i){
    xy_t p[4];
    for( int j = 0; j < 4; ++j){
      cin >> x >> y;
      p[j] = xy_t(x,y);
    }
    double S;
    S =(conj(p[0] - p[1])*(p[2] - p[3])).imag();
    if( S == 0) qs.push("YES");
    else qs.push("NO");
  }
  while(!qs.empty()){
    cout << qs.front() << endl;
    qs.pop();
  }
}

C++: #!/usr/bin/env python
n = input()

for loop in range(n):
	S = raw_input().split()
	x1, y1, x2, y2, x3, y3, x4, y4 = map(float, S)

	v1 = [x2 - x1, y2 - y1]
	v2 = [x4 - x3, y4 - y3]

	norm = (v1[0] * v1[0] + v1[1] * v1[1]) * (v2[0] * v2[0] + v2[1] * v2[1])
	inn = v1[0] * v2[0] + v1[1] * v2[1]

	if abs(norm) - inn * inn < 1e-10:
		print "YES"
	else:
		print "NO"

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

using namespace std;

int main()
{
	const int N = 1000;

	double x1[N], y1[N], x2[N], y2[N], x3[N], y3[N], x4[N], y4[N]; int n;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i] >> x3[i] >> y3[i] >> x4[i] >> y4[i];
	}

	for (int i = 0; i < n; i++)
	{
		if ((x2[i] - x1[i]) / (y2[i] - y1[i]) == (x4[i] - x3[i]) / (y4[i] - y3[i]))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y;
  double x1,y1;
  int n;
  int i;
  long long double a,b;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      a=(y1-y)/(x1-x);

      cin>>x>>y>>x1>>y1;
      b=(y1-y)/(x1-x);
	
      if(a==b)
        puts("YES");
      else
        puts("NO");
    }

}