Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[4] == fpoints[6] {
			fmt.Println("YES")
			continue
		}
		a := (fpoints[1]-fpoints[3])/(fpoints[0]-fpoints[2])
		b := (fpoints[5]-fpoints[7])/(fpoints[4]-fpoints[6])
		if a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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");
    }

}

C++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

//#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
//#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
//#include <atomic>
#include <chrono>
//#include <condition_variable>
#include <forward_list>
//#include <future>
#include <initializer_list>
//#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
//#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


using namespace std;


class D3
{
public:
	double x;
	double y;
	double z;

	//?????????????????????
	D3 ( double x_ = 0.0 , double y_ = 0.0 , double z_ = 0.0 )
	{
		x = x_;
		y = y_;
		z = z_;
	}

	//??????
	D3 Cross_product ( D3 partner )
	{
		D3 ret ( y*partner.z - z*partner.y , z*partner.x - x*partner.z , x*partner.y - y*partner.x );
		return ret;
	}

	//??????
	double Inner_product ( D3 partner )
	{
		return x*partner.x + y*partner.y + z*partner.z;
	}

	//?????????????????????????????????
	D3 Make_vector ( D3 partner )
	{
		D3 ret ( partner.x - x , partner.y - y , partner.z - z );
		return ret;
	}

	//???????§????2????????????????????¢???????±???????
	double S_vec ( D3 A , D3 B )
	{
		D3 G;
		G = A.Cross_product ( B );
		return sqrt ( G.Inner_product ( G ) ) / 2;
	}

	//??????????????¢???????±???????
	double S_point ( D3 A , D3 B , D3 C )
	{
		return S_vec ( A.Make_vector ( B ) , A.Make_vector ( C ) );
	}

	//???????§????3????????????????????????????±???????
	double V_vec ( D3 A , D3 B , D3 C )
	{
		D3 G;
		G = A.Cross_product ( B );
		return G.Inner_product ( C ) / 6;
	}

	//4???????????????????±???????
	double V_point ( D3 A , D3 B , D3 C , D3 D )
	{
		return V_vec ( A.Make_vector ( B ) , A.Make_vector ( C ) , A.Make_vector ( D ) );
	}

	D3 operator+( D3 partner )
	{
		return D3 ( x + partner.x , y + partner.y , z + partner.z );
	}

	D3 operator-( D3 partner )
	{
		return D3 ( x - partner.x , y - partner.y , z - partner.z );
	}

	bool operator==( D3 partner )
	{
		return x == partner.x&&y == partner.y&&z == partner.z;
	}

	double length ()
	{
		return sqrt ( x*x + y*y + z*z );
	}

	//?????´????????????
	bool Vertical ( D3 partner )
	{
		return ( *this ).Inner_product ( partner ) == 0;
	}

	//??????????????????
	bool Parallel ( D3 partner )
	{
		return abs(abs ( ( *this ).Inner_product ( partner ) ) - abs ( ( *this ).length ()*partner.length () ))-1e-10<0;
	}
};

int main ()
{
	double a[8];
	int N;
	cin >> N;
	for( size_t k = 0; k < N; k++ )
	{
		for( size_t i = 0; i < 8; i++ )
		{
			cin >> a[i];
		}
		D3 A ( a[0] , a[1] ) , B ( a[2] , a[3] ) , C ( a[4] , a[5] ) , D ( a[6] , a[7] );
		D3 AB = B - A , CD = D - C;
		cout << ( AB.Parallel ( CD ) ? "YES" : "NO" ) << endl;
	}
	return 0;
}

C++: #include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed 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 AB=(y2-y1)/(x2-x1);
  double CD=(y4-y3)/(x4-x3);

  AB*=100000;
  AB/=100000.0;
  CD*=100000;
  CD/=100000.0;
  cout<<(AB==CD?"YES":"NO")<<endl;
  
  }
  return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n;
int main() {
    cin>>n;
    double x1,y1;
    double x2,y2;
    double x3,y3;
    double x4,y4;
    rep(i,n) {
        cin>>x1>>y1;
        cin>>x2>>y2;
        cin>>x3>>y3;
        cin>>x4>>y4;
        double tx1 = x2-x1;
        double ty1 = y2-y1;
        double tx2 = x4-x3;
        double ty2 = y4-y3;

        double t1 = tx1*ty2;
        double t2 = tx2*ty1;

        if(t1==t2) {
            cout<<"YES"<<endl;
        }
        else {
            cout<<"NO"<<endl;
        }

    }
    return 0;
}