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++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int n;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	cin>>n;
	for(int i=0;i<n;i++){
	    cin>>x1>>x2>>x3>>x4>>y1>>y2>>y3>>y4;


    double a,b;
    a=(y2-y1)/(x2-x1);
    b=(y4-y3)/(x4-x3);
    (a==b)? cout<<"YES"<<endl : cout<<"NO"<<endl;
	}
	return 0;
}

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;
#define EPS 1e-9
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];
//			cout << "p[" << j << "]: (" << px[j] << ',' << py[j] << ')' << endl;
		} // end for
		vector <double> vx (2, 0.);
		vector <double> vy (2, 0.);

		
		for (j = 0; j < 2; ++j){
			vx[j] = px[2*j + 1] - px[2*j];
			vy[j] = py[2*j + 1] - py[2*j];
//			cout << "v[" << j << "]: (" << vx[j] << ',' << vy[j] << ')' << endl;
		} // end for

		double D = vx[0]*vy[1] - vy[0]*vx[1];
		if (fabs(D) < EPS ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if


	} // end for
		
	return 0;
}

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

struct vec {
	double x, y;
};

static vec P(double x, double y){
	vec P = {x, y};
	return P;
}

static vec sub(vec a, vec b){
	return P(a.x - b.x, a.y - b.y);
}

static double cross(vec a, vec b){
	return (a.x * b.y - a.y * b.x);
}

int main(void){
    
    int n;
    cin >> n;
    double D[8];
    vec V[4];
    for(int i = 0; i < n; i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &D[0], &D[1], &D[2], &D[3], &D[4], &D[5], &D[6], &D[7]);
    	for(int j = 0; j < 4; j++){
    		V[j] = P(D[2*j], D[2*j+1]);
    	}
    	vec a = sub(V[0], V[1]);
    	vec b = sub(V[2], V[3]);
    	if (cross(a, b) == 0){
    		cout << "YES" << endl;
    	}
    	else{
    		cout << "NO" << endl;
    	}
    }
    return 0;

}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
#define EPS 0.000000000001

struct Line{
	double x[2],y[2];
};

int main(){
	int N;
	Line l[2];
	cin>>N;
	for(int tc=0;tc<N;tc++){
		for(int i=0;i<2;i++){
			for(int j=0;j<2;j++){
				cin>>l[i].x[j]>>l[i].y[j];
			}
		}
		double a,b;
		if(l[0].x[0]==l[0].x[1] || l[1].x[0]==l[1].x[1]){
			if(l[0].x[0]==l[0].x[1] && l[1].x[0]==l[1].x[1]) a=b=0;
			else a=0,b=1;
		}
		else{
			a = (l[0].y[1]-l[0].y[0])/(l[0].x[1]-l[0].x[0]);
			b = (l[1].y[1]-l[1].y[0])/(l[1].x[1]-l[1].x[0]);
		}
		if(abs(a-b)<EPS) puts("YES");
		else puts("NO");
	}
}

C++: #include<stdio.h>

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

	scanf("%d",&n);
	for(int x=0;x<n;x++)
	{
		for(;;)
		{
			scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
			if(x1>=100||y1>=100||x2>=100||y2>=100||x3>=100||y3>=100||x4>=100||y4>=100)
			{
			}
			else if(x1<=-100||y1<=-100||x2<=-100||y2<=-100||x3<=-100||y3<=-100||x4<=-100||y4<=-100)
			{
			}
			else
			{
				break;
			}
		}

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

		p=x2/x4;
		q=y2/y4;

		if(p==q)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include<cstdio>
using namespace std;
int main()
{
    double x1,x2,x3,x4,y1,y2,y3,y4;
    int i,j;
    scanf("%d",&j);
    for(i=0;i<j;i++)
    {
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3))
            printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

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

struct Point
{
    double x;
    double y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    // std::cerr << GetSlope(l1) << std::endl;
    // std::cerr << GetSlope(l2) << std::endl;
    const double gosa = 1e-10;
    double Slope1 = GetSlope(l1);
    double Slope2 = GetSlope(l2);
    return std::fabs(Slope1 - Slope2) < gosa;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> points = Input(std::cin);
        std::cout << (IsParallel(points) ? "YES" : "NO") << std::endl; 
    }
    return 0;
}

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

typedef long long Int;

int main(){
	int t;
	Int x1, y1, x2, y2, x3, y3, x4, y4;
	double s1, s2, s3, s4, s5, s6, s7, s8;
	scanf("%d", &t);
	while(t--){
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &s1, &s2, &s3, &s4, &s5, &s6, &s7, &s8);
		x1 = s1 * 10000; x2 = s3 * 10000; x3 = s5 * 10000; x4 = s7 * 10000;
		y1 = s2 * 10000; y2 = s4 * 10000; y3 = s6 * 10000; y4 = s8 * 10000;
		printf("%s\n", ((x2 - x1) * (y4 - y3) == (x4 - x3) * (y2 - y1))? "YES" : "NO");
	}
	return 0;
}

C++: #include <stdio.h>
#include <conio.h>

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

	scanf("%d",&num) ;
	for( int i = 0 ; i < num ; i ++ )
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", ax , ay , bx , by , cx , cy , dx , dy ) ;

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

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

int main(){
	int n;
	double x[4], y[4], a[2];
	cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 4; j++)
			cin >> x[j] >> y[j];
		a[0] = (y[0] - y[1]) / (x[0] - x[1]);
		a[1] = (y[2] - y[3]) / (x[2] - x[3]);
		if(a[0] == a[1])
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}