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")
		} else {
			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 <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
		map <double, double> v;

		for (j = 0; j < 2; ++j){
			v[px[2*j + 1] - px[2*j]] = py[2*j + 1] - py[2*j];
		} // end for
		if (v.size() == 1){
			cout << "YES" << endl;
			continue;
		} // end if
		map <double, double>::iterator it = v.begin();
		double x = (*it).first;
		double y = (*it).second;
		++it;
		if ( fabs( (*it).first/x - (*it).second/y ) < 1e-6 ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if
	} // end for
		
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a;
cin>>a;
double c[8];
for(int b=0;b<a;b++){
    for(int d=0;d<8;d++)scanf("%lf",&c[d]);
    if(c[0]==c[1]&&c[2]==c[3])printf("YES\n");
    else if((c[6]-c[4])/(c[2]-c[0])==(c[7]-c[5])/(c[3]-c[1]))printf("YES\n");
    else printf("NO\n");
    }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		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);
		if(y1==y2){
			if(y3==y4){
				printf("YES\n");
			}
			else printf("NO\n");
		}
		else if(y3==y4){
			printf("NO\n");
		}
		else{
			if((x1-x2)/(y1-y2)+0.000001>=(x3-x4)/(y3-y4)&&(x1-x2)/(y1-y2)-0.000001<=(x3-x4)/(y3-y4)){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

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

#define EPS 1e-10

typedef long long ll;

using namespace std;



/*
class TheKingsArmyDiv2
{
public:
	int getNumber(vector <string> state)
	{

	}
};
*/


double a, b, c, d, e, f, g, h;
double det()
{
	double dx1, dy1, dx2, dy2;
	
	dx1 = a - c;
	dy1 = b - d;
	dx2 = e - g;
	dy2 = f - h;
	
	return dx1*dy2 - dy1*dx2;
}


int main()
{
	int n;
	
	cin >> n;
	while (n--)
	{
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
		cout << (fabs(det()) < EPS ? "YES" : "NO") << endl;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

typedef double Real;
typedef complex<Real> Point;
typedef pair<Point,Point> Line;

const Real EPS=1e-9;

inline Point vec(const Line& a){
    return a.second-a.first;
}

Real dot(Point a,Point b){
    return (conj(a)*b).real();
}

Real cross(Point a,Point b){
    return (conj(a)*b).imag();
}

inline int sgn(Real a,Real b=0){
    return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;
}

inline bool near(Point a,Point b){
    return !sgn(abs(a-b));
}

inline bool is_orthogonal(Line la,Line lb){
    return !sgn(dot(vec(la),vec(lb)));
}

inline bool is_parallel(Line la,Line lb){
    return !sgn(cross(vec(la),vec(lb)));
}

inline bool is_intersected_line(Line la,Line lb){
    return !is_parallel(la,lb);
}

inline Real arg(const Point& base,const Point& a,const Point& b){
    return arg((b-base)/(a-base));
}

inline Real sr(Real a){
    return sqrt(max(a,(Real)0));
}

inline Real dist(Point a,Point b){
    return abs(a-b);
}

inline Real length(Point a){
    return abs(a);
}

inline Point unit_vector(Point a){
    return a / abs(a);
}


Point rotate(Point x,Real rad){
    return Point(x.real()*cos(rad)-x.imag()*sin(rad),x.real()*sin(rad)+x.imag()*cos(rad));
}                             

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

    int n;
    Point A[4];

    cin>>n;
    for(int i=0;i<n;i++){
        for(auto &t:A){
            double x,y;
            cin>>x>>y;
            t=Point(x,y);
        }

        Line la=make_pair(A[0],A[1]),lb=make_pair(A[2],A[3]);

        cout << (is_parallel(la,lb) ? "YES" : "NO") << endl;
    }

    return 0;
}

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

int 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;

        if( !((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)) ) cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}

C++: #include

<cstdio>

using

namespace
std;

int
n;

double
x[4],y[4];

int
main()
{

	

scanf(

"%d"
,&n);

	

for
(

int
c = 0; c < n; c++)

	

{

		

for
(

int
i = 0; i < 4; i++)

			

scanf(

"%lf%lf"
,&x[i],&y[i]);

		

puts((y[1]-y[0])/(x[1]-x[0]) == (y[3]-y[2])/(x[3]-x[2])?

"YES"
:

"NO"
);

	

}
}

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

int main()
{
	int num ;
	float ax, ay, bx, by, cx, cy, dx, dy ;

	cin >> num ;
	for( int i = 0 ; i < num ; i ++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ;

		if( (ay-by)/(ax-by) == (cy-dy)/(cx-dx) )
		{
			if( ax != cx && bx != dx && ay != cy && by != dy )
			{
				cout << "YES\n" ;
			}
		}
		else cout << "NO\n" ;
	}
	return 0;
}

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

#define eps 1e-5

int 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;

        if( !(x2-x1) && !(x4-x3) ) cout << "YES\n";
        else if( fabs((y2-y1)*(x4-x3)-(x2-x1)*(y4-y3)) < eps ) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}