Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

struct Point2D { 
	double x, y;
	Point2D (double a=0, double b=0) { x=a; y=b; }
};

int main() {
	int n; cin >> n;
	Point2D a, b, c, d;
	
	for (int i=0; i<n; i++) {		
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		
		double p = (a.y-b.y)/(a.x-b.x), q = (c.y-d.y)/(c.x-d.x);
		
		if (fabs(p-q) < 1e-9) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include <iostream>

int main()
{
	int n;
	std::cin >> n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double at_x_zero_ab, at_x_zero_cd;
	double slope_ab, slope_cd;
	for (int i = 0; i < n; i++) {
		std::cin >> x1 >> y1 >> x2 >> y2
                 >> x3 >> y3 >> x4 >> y4;
		slope_ab = (y2 - y1) / (x2 - x1);
		slope_cd = (y4 - y3) / (x4 - x3);
		at_x_zero_ab = y1 - slope_ab * x1;
		at_x_zero_cd = y3 - slope_cd * x3;
		if (slope_ab == slope_cd && at_x_zero_ab != at_x_zero_cd) {
			std::cout << "YES\n";
		} else {
			std::cout << "NO\n";
		}
	}
	return 0;
}

C++: #include <stdio.h>

int main(){
	int num;
	float x1, y1;
	float x2, y2;
	float x3, y3;
	float x4, y4;
	float vxa;
	float vya;
	float vxb;
	float vyb;
	float s;
				
	scanf("%d", &num);	
	for(int i = 0; i < num; i++){
		scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

		vxa = x2 - x1;
		vya = y2 - y1;
		vxb = x4 - x3;
		vyb = y4 - y3;
		s = vxa*vyb - vxb*vya;
		if(-0.000001 < s && s < 0.000001){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	
	return 0;
}

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

using namespace std;

typedef complex<double> xy_t;

double dot_product(xy_t a, xy_t b) {
  return (conj(a)*b).real();
}

double cross_product(xy_t a, xy_t b) {
  return (conj(a)*b).imag();
}

double e = 0.0001;

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;
    xy_t A = xy_t(x2 - x1, y2 - y1);
    xy_t B = xy_t(x4 - x3, y4 - y3);

    double dot_prod =  abs(dot_product(A, B));
    double AB_magnitude = abs(A) * abs(B);
    
    if (dot_prod <= AB_magnitude + e && dot_prod >= AB_magnitude - e) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <stdio.h>
 
int main(void) {
    int kaisu,i,j;
    double x[4],y[4];

    scanf("%d",&kaisu);
    for(i=0;i<kaisu;i++)
	{
        for(j=0;j<4;j++)
		{
			scanf("%lf %lf",&x[j],&y[j]);
			if(-100 > x[j] || 100 < x[j] || -100 > x[j] || 100 < x[j])break;
		}
        if(x[0]==x[1]) 
		{
            if(x[2] == x[3])
				printf("YES\n");
            else 
				printf("NO\n");
        } 
		else if(x[2] == x[3])
			printf("NO\n");
        else 
		{
            if((y[1]-y[0]) / (x[1]-x[0]) == (y[3]-y[2]) / (x[3]-x[2]))
                printf("YES\n");
            else 
				printf("NO\n");
        }
    }
    return 0;
}

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

typedef struct xyz{
    double x;
    double y;
}XYZ;

int main(void){

    int times;
    cin >> times;

    XYZ a,b,c,d;
    double x1,y1,x2,y2;

    while(times > 0){
        cin >> a.x >> a.y;
        cin >> b.x >> b.y;
        cin >> c.x >> c.y;
        cin >> d.x >> d.y;

        x1 = a.x - b.x;
        y1 = a.y - b.y;
        x2 = c.x - d.x;
        y2 = c.y - d.y;

        if((y1 / x1) == (y2 / x2)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

        times--;
    }


    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>

using namespace std;

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

typedef long long ll;

int main(){
	int n;
	
	cin >> n;
	
	while (n--){
		double x1, x2, x3, x4;
		double y1, y2, y3, y4;
		
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		
		double dx12, dy12, dx34, dy34;
		double a12, a34;
		
		if (x1 < x2){
			dx12 = x2 - x1;
			dy12 = y2 - y1;
		}
		else {
			dx12 = x1 - x2;
			dy12 = y1 - y2;
		}
		
		if (x3 < x4){
			dx34 = x4 - x3;
			dy34 = y4 - y3;
		}
		else {
			dx34 = x3 - x4;
			dy34 = y3 - y4;
		}
		
		a12 = dy12/dx12;
		a34 = dy34/dx34;
		
		if (a12 == a34) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}