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>
#define VLN 0.0000001
using namespace std;

int main(){
	double N,X[5],Y[5];
	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])<VLN){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    typedef pair<double, double>pdd;
    vector<pdd>v(5);
    int n;cin>>n;
    rep(i,n){
        rep(i,4)cin>>v[i].first>>v[i].second;
        if(v[0].first<v[1].first)swap(v[0],v[1]);
        if(v[2].first<v[3].first)swap(v[2],v[3]);
        double d1=(v[0].second-v[1].second)/(v[0].first-v[1].first);
        double d2=(v[2].second-v[3].second)/(v[2].first-v[3].first);
        if(d1==d2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: //Lin Gengxian Shunji
// Parallelism 08-144505
// Not sure if it is correct, the online judge has no test cases

#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 = 1e-11;

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 <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
typedef vector<P> VP;
const D EPS = 1e-9;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

D dot(P a, P b) {
  return (conj(a)*b).X;
}

D cross(P a, P b) {
  return (a.X*b.Y-a.Y*b.X);
}

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;
    P a, b, c, d;
    a = P(x1, y1);
    b = P(x2, y2);
    c = P(x3, y3);
    d = P(x4, y4);
    if (EQ(cross(b-a, d-c), 0)) {
      std::cout << "YES" << std::endl;
    }else {
      std::cout << "NO" << std::endl;
    }
  }

}

C++: #include <iostream>

int main()
{
    int n;
    std::cin >> n;

    while (n--) {
        float x1, y1, x2, y2, x3, y3, x4, y4;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        std::cout << (((x1 - x2) * (y3 - y4) == (y1 - y2) * (x3 - x4))?
                     "YES": "NO") << std::endl;
    }

    return 0;
}

C++: 
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int main(void){
    int n;
    cin >> n;
    rep(j,n) {

    double x[4],y[4],a,b,c,d,p,q,det,ansx,ansy;
    //入力を多少簡略化
    for(int i=0;i<4;i++) {
        cin >> x[i];
        cin >> y[i];
    }
    //(x1,y1)(x2,y2)を結ぶax+by=p の係数
    a = y[0]-y[1];  b = x[1]-x[0];
    //(x3,y3)(x4,y4)を結ぶcx+dy=q の係数
    c = y[2]-y[3];  d = x[3]-x[2];
    //係数についての行列式
    det = a*d-c*b;
    if(det == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    }
}

C++: #include <iostream>
#include <cmath>
 
using namespace std;
 
int main (void) {
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int n;
    
  cin >> n;
   
  for(int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long double t1 = (y1-y2)/(x1-x2);
    long double t2 = (y3-y4)/(x3-x4);
    //cout << t1 << " " << t2 << endl;
    if ( t1 == t2 ) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
   
  return 0;
}

C++: #include<stdio.h>
int main(void) {
	int a, b, c, d;
	double e, f, g, h,x1,x2,x3,x4,y1,y2,y3,y4;
	scanf("%d", &a);
	for (size_t i = 0; i < a; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		e = (y1 - y2) / (x1 - x2);
		f = (y3 - y4) / (x3 - x4);
		if (e==f)
		{
			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++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

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;
		
		//double t1 = (y1-y2)*(x3-x4);
		//double t2 = (y3-y4)*(x1-x2);

		if( (x1-x2)==0 && (x3-x4)==0 ){
			if( (y1-y2)==0 || (y3-y4)==0 || x1==x3){
				cout << "NO" << endl;
			}else{
				cout << "YES" << endl;
			}
		}else if( (x1-x2)==0 || (x3-x4)==0 ){
			cout << "NO" << endl;
		}else{
			double t1 = (y1-y2)/(x1-x2);
			double t2 = (y3-y4)/(x3-x4);
			if(t1==t2){
				cout << "YES" << endl;
			}else{
				cout << "NO" << endl;
			}
		}
	}

	return 0;
}

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

int main()
{
	char dust;
	int n, i, j;
	double x[4], y[4];

	cin >> n;

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < 4; j++)
			cin >> x[j] >> y[j];

		if ((x[1]-x[0])/(y[1]-y[0]) == (x[3]-x[2])/(y[3]-y[2]))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}