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

struct Point
{
  double x;
  double y;
};

//              --class Line
class Line
{
  public:
    Line(Point p1, Point p2);

  public:
    bool parallel(Line other); // 平行か

  private:
    Point m_p1;
    Point m_p2;
    double m_slope;     //  傾き
};

Line::Line(Point p1, Point p2)
{
  m_p1 = p1;
  m_p2 = p2;
  m_slope = ( p2.y - p1.y ) / ( p2.x - p1.x );
}

bool Line::parallel(Line other)
{
  return abs(m_slope - other.m_slope) < 0.000001;
}

int main(void)
{
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i)
  {
    Point p1, p2, p3, p4;
    cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
    Line line1(p1, p2);
    Line line2(p3, p4);
    cout << (line1.parallel(line2) ? "YES" : "NO") << endl;
  }
  return 0;
}

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

int main()
{
	const double EPS = 1e-5;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		double a = arg((A-B)/(C-D));
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
	}
	return 0;
}

C++: #include <cstdio>

int main(){
	int n;
	double a1, a2, x[4], y[4];
	
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
			&x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);
		a1 = (y[0] - y[1]) *(x[0] - x[1]);
		a2 = (y[2] - y[3]) * (x[2] - x[3]);
		if(a1 == a2) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
signed main(void){
	double x[4],y[4];
	int T;
	cin>>T;
	for(int t=1;t<=T;t++){
		for(int i=0;i<4;i++)
			cin>>x[i]>>y[i];
		if(abs((y[1]-y[0])*(x[3]-x[2])-(x[1]-x[0])*(y[3]-y[2]))<0.0000001) 
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cmath>
#include <utility>
#include <queue>
#include <stdio.h>
#include <string>
#include <map>
#include <stack>
#include <complex>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000007
using namespace std;
typedef long long int ll;
typedef complex<double> xy;

int main(){
    int n;
    cin >> n;
    for (int j=0; j<n; j++) {
        vector<xy> inp;
        double x,y,z,w;
        for (int i=0; i<2; i++) {
            cin >> x >> y >> z >> w;
            inp.push_back(xy(x-z,y-w));
        }
        double ans;
        ans =((conj(inp[0])*inp[1]).imag());
        if(abs(ans)<=0.0000001){
            cout << "YES"<<endl;
        }else{
            cout << "NO"<<endl;
        }
    }
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#define range(s,n) for(int i = s; i < n; i++)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

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

	while(cin >> n){
		range(0,n){
			cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
			if( (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3) )
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
	}
}

C++: #include <stdio.h>

int main(){
    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);

    x2 -= x1;
    y2 -= y1;
    x4 -= x3;
    y4 -= y3;

    if(x2 == 0 || x4 == 0){
        if(x2 == 0 && x4 == 0){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }else{
        if(y2/x2 == y4/x4){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }

    return 0;
}

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

using namespace std;

int main(void) {
	int ds;
	cin >> ds;
	
	for(int i = 0; i < ds; i++) {
		double X[4], Y[4];
		double a1, a2;
		double b1, b2;
		
		for(int j = 0; j < 4; j++) {
			cin >> X[j] >> Y[j];
		}
		a1 = abs(Y[1] - Y[0]);
		b1 = (X[1] - X[0]);
		
		a2 = abs(Y[3] - Y[2]);
		b2 = (X[3] - X[2]);
		
		a1 /= b1;
		a2 /= b2;
		
		if(a1 == a2) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

using namespace std;


#define rep(i,n) for(int i=0;i<(n);i++)

const double EPS = 1e-6;
const double INF = 100000000;

bool solve(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
    double ax,ay,bx,by;
    ax=x2-x1;ay=y2-y1;
    bx=x4-x3;by=y4-y3;
    double A=ay/ax;
    double B=by/bx;
    
    
    if(A-B < EPS)return true;
    else return false;
    
}



int main(){
    int n;
    cin>>n;
    rep(i,n){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        cout<<(solve(x1, y1, x2, y2, x3, y3, x4, y4)? "YES":"NO")<<endl;
        
    }

    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#define swap(a,b) {a=a+b; b=a-b; a=a-b;}
#define abs(a) (a > 0 ? a:-a)

using namespace std;


void q21() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		double ax, ay, bx, by, cx, cy, dx, dy;
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
		if (bx - ax == 0 || dx - cx == 0) {
			if (bx - ax == dx - cx) {
				cout << "YES" << endl;
				continue;
			}
		}
		else if (abs((by - ay) / (bx - ax) - (dy - cy) / (dx - cx)) <= 0.001 ){
			cout << "YES" << endl;
			continue;
		}
		cout << "NO" << endl;
	}
}

int main() {
	q21();
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>
#include <iterator>

#include <cmath>

typedef std::pair<double,double> Vec;
typedef std::pair<Vec,Vec> Line;

Vec operator+(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first+rhs.first, lhs.second+rhs.second);
}

Vec operator-(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first-rhs.first, lhs.second-rhs.second);
}

Vec lineToVec(const Line& l) {
	return l.first - l.second;
}

double cross(const Vec& lhs, const Vec& rhs) {
  return lhs.first*rhs.second - lhs.second*rhs.first;
}

int main(void){
	using namespace std;

	int n;
	cin >> n;

	vector< pair<Line,Line> > input;
	input.reserve(n);

	double x1,y1,x2,y2,x3,y3,x4,y4;
	while(cin
		>> x1 >> y1
		>> x2 >> y2
		>> x3 >> y3
		>> x4 >> y4){

		auto AB = make_pair( make_pair(x1,y1), make_pair(x2,y2) );
		auto CD = make_pair( make_pair(x3,y3), make_pair(x4,y4) );

		input.push_back(make_pair(AB,CD));
	}

	for(auto itr=input.begin(); itr!=input.end(); itr++){
		auto AB = itr->first;
		auto CD = itr->second;

		auto cr = cross( lineToVec(AB), lineToVec(CD) );

		if( abs(cr) <10e-200 ){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}