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)
		}
		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++: #include <iostream>

using namespace std;

class Vector3{
public:
	double x,y;

	double operator*( Vector3 hoge ){
		return x * hoge.y - y * hoge.x;
	}

	void operator-=( Vector3 hoge ){
		x -= hoge.x;
		y -= hoge.y;
	}

};

int main(int argc, char const* argv[])
{
	Vector3 A,B,C,D;
	int n;

	cin >> n;

	for( int i = 0;i < n;i++ ){
		cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;

		B -= A;
		D -= C;

		double answer = B * D;

		if( answer == 0 ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}


	return 0;
}

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

class Point
{
public:
	double m_X;
	double m_Y;
	Point(double x, double y)
		: m_X( x )
		, m_Y( y )
	{}
};

class LineSegment
{
private:
	Point m_Start;
	Point m_End;
public:
	LineSegment(Point start, Point end)
		: m_Start( start )
		, m_End( end )
	{}
	double CalcSlope()
	{
		if ( m_End.m_Y == m_Start.m_Y)
		{
			return 0.0;
		}

		if (m_End.m_X == m_Start.m_X)
		{
			return DBL_MAX;
		}
	
		return((m_End.m_Y - m_Start.m_Y) / (m_End.m_X - m_Start.m_X));
	}
};

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

	std::cin >> n;

	for (int data_no = 0; data_no < n; ++data_no)
	{
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		Point start1{ x1, y1 };
		Point end1{ x2, y2 };
		Point start2{ x3, y3 };
		Point end2{ x4, y4 };

		LineSegment line1{ start1, end1 };
		double line1_slope = line1.CalcSlope();

		LineSegment line2{ start2, end2 };
		double line2_slope = line2.CalcSlope();

		if (line1_slope == line2_slope)
		{
			std::cout << "YES" << std::endl;
		}
		else
		{
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

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

#define EPS 1e-9
using namespace std;

typedef complex<double> P;


double cross(P p1,P p2){
	return p1.real()*p2.imag()-p1.imag()*p2.real();
}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		P p[2];
		for(int i=0;i<2;i++){
			P tp[2];
			for(int j=0;j<2;j++){
				cin>>tp[j].real()>>tp[j].imag();
			}
			p[i]=tp[1]-tp[0];
		}
		if(abs(cross(p[0],p[1]))<=EPS)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4,ans1,ans2;
  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(x1==x2||y1==y2||x3==x4||y3==y4) cout << "NO" << endl;

    else {
      ans1 = (y1-y2)/(x1-x2);
      ans2 = (y3-y4)/(x3-x4);
      
      if(ans1==ans2) cout << "YES" << endl;
      else cout << "NO" << endl;
    }
  }
  
  return (0);
}

C++: #include<iostream>
using namespace std;
int main()
{
	long double x1,y1,x2,y2,x3,y3,x4,y4;
	int n;
	cin>>n;
	int N[100];
for(int i=0;i<n;i++)
{
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
	if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))
	{
	N[i]=1;
	}
	else
	{
	N[i]=0;
	}
}
for(int j=0;j<n;j++)
{
	if(N[j]==1)
	{
		cout<<"YES"<<endl;
	}
	else if(N[j]==0)
	{
		cout<<"NO"<<endl;
	}
}
return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int n;
   long double x[4],y[4];
   cin >> n;
   REP(i,n){
      REP(j,4) cin >> x[j] >> y[j];
      if((x[1]-x[0])/(y[1]-y[0])==(x[3]-x[2])/(y[3]-y[2])) cout << "YES" << endl;
      else if(y[0]==y[1]&&y[2]==y[3]) cout << "NO" << endl;
      else cout << "NO" << endl;
   }
}

C++: w#include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<array>

using namespace std;

int main()
{
  array<double, 4> x;
  array<double, 4> y;

  int n;
  cin >> n;

  for ( auto j = 0; j < n; ++j )
    {
      for ( auto i = 0; i < 4; ++i )
        {
          cin >> x[i];
          cin >> y[i];
        }
      
      double abx = x[1] - x[0];
      double aby = y[1] - y[0];
      double cdx = x[3] - x[2];
      double cdy = y[3] - y[2];
      
      if ( abx * cdy - aby * cdx == 0 )
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  
  return 0;
}