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[1] == fpoints[3] {
			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<bits/stdc++.h>
using namespace std;
signed main(void){
	double k1,k2;
	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];
		k1=(y[1]-y[0])/(x[1]-x[0]);
		k2=(y[3]-y[2])/(x[3]-x[2]);
		if(fabs(k1-k2)<=1e-6)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	double a,b,c,d,e,f,g,h;
	int n;
	int x,y;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a>>b>>c>>d>>e>>f>>g>>h;
		x=(d-b)/(c-a);
		y=(h-f)/(g-e);
		if((d-b)/(c-a)==(h-f)/(g-e)){cout<<"YES"<<endl;}
		else {cout<<"NO"<<endl;}
	}
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


int main()
{
	int n;
	cin >> n;
	while (n--){
		double x, X, y, Y;
		cin >> x >> y >> X >> Y;
		double a, b;
		a = (Y - y) / (X - x);
		cin >> x >> y >> X >> Y;

		if (a == (Y - y) / (X - x))cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;

}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    cin >> n;
    rep(j, n)
    {
        double a[8];
        rep(i, 8)
        {
            cin >> a[i];
        }
        double ans = (a[2] - a[0]) * (a[7] - a[5]) - (a[3] - a[1]) * (a[6] - a[4]);
        if (ans < 0.00001)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <complex>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <stdlib.h>

using namespace std;
typedef complex<long> com;

long tri(com a, com b) //triangle size
{
	return(conj(a)*b).imag() / 2;
}

long s_ll(string s) //入力した数字を10*6倍にしてlongとして読み取る
{
	int ssize=s.size();
	int j=6;
	for(int i=0;i<ssize;i++)
	{
		if(s[i]=='.')
		{
			s.erase(i,1);
			j=7-ssize+i;
			break;
		}
	}
	long l;
	l=atoi(s.c_str());
	for(int i=0;i<j;i++)
	{
		l=l*10;
	}
	return l;
}

int n;
string x1, x2, x3, x4, yi, y2, y3, y4;
long  X1, X2, X3, X4, Y1, Y2, Y3, Y4;

int main()
{
	cin >> n;
	while (n--)
	{
		cin >> x1 >> yi >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		X1 = s_ll(x1);
		X2 = s_ll(x2);
		X3 = s_ll(x3);
		X4 = s_ll(x4);
		Y1 = s_ll(yi);
		Y2 = s_ll(y2);
		Y3 = s_ll(y3);
		Y4 = s_ll(y4);
		if (tri(com(X2 - X1, Y2 - Y1), com(X4 - X3, Y4 - Y3)) == 0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
double x[100], y[100];

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

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

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		x1 += 100; x2 += 100; x3 += 100; x4 += 100;
		y1 += 100; y2 += 100; y3 += 100; y4 += 100;
		if (x2 - x1 == 0 && x4 - x3 == 0) {
			cout << "YES" << endl;
			continue;
		}
		double m1 = (y2 - y1) / (x2 - x1);
		double m2 = (y4 - y3) / (x4 - x3);
		if (m1 == m2) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
	double N,xx,yy;
	double X[5],Y[5];
	string res[110];
	cin>>N;
	for(int j=1;j<=N;j++){
		for(int i=1;i<=4;i++){
			cin>>X[i]>>Y[i];
		}
		if((X[2]-X[1])*(Y[4]-Y[3])==(X[4]-X[3])*(Y[2]-Y[1])){
			res[j]="YES";
		}
		else{
			res[j]="NO";
		}
	}
	for(int i=1;i<=N;i++){
		cout<<res[i]<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

    ang_ab = (y1 - y2) / (x1 - x2);
    ang_cd = (y3 - y4) / (x3 - x4);

    if (x1 == x2 && x3 == x4) {
      cout << "YES" << endl;
    } else if (ang_ab == ang_cd) {
      cout << "YES" << endl;
    } else {
      cout << "NO"  << endl;
    }
  }

  return 0;
}

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

using namespace std;

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double deg1, deg2;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		deg1 = atan2(y2 - y1, x2 - x1);
		deg2 = atan2(y4 - y3, x4 - x3);
		if (deg1 == deg2)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;



struct pt {

	double x;

	double y;

};



int main() {

	int num;

	cin >> num;

	while(num--) {

		pt p1, p2, p3, p4;

		cin >> p1.x >> p1.y;

		cin >> p2.x >> p2.y;

		cin >> p3.x >> p3.y;

		cin >> p4.x >> p4.y;

		pt v1 = {p1.x-p2.x, p1.y-p2.y};

		pt v2 = {p3.x-p4.x, p3.y-p4.y};

		if (v1.y==0 && v2.y==0) cout << "YES\n";

		else if (v1.x/v1.y == v2.x/v2.y) cout << "YES\n";

		else cout << "NO\n";

	}

	return 0;

}

C++: #include <iostream>
#include <stdio.h>
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 = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        double D[8];
        for(int j = 0; j < 8; j++){
            D[j] = 0.0;
        }
        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]);
        vec V[4];
    	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;

}