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)
		}
		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>

using namespace std;

int main() {
	double x1,x2,x3,x4;
	double y1,y2,y3,y4;
	double incAB, incCD;
	int count=0;
	while(cin>>count, !cin.eof()) {
		for(int i=0; i<count; i++) {
			cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
			incAB = (x2-x1) / (y2-y1);
			incCD = (x4-x3) / (y4-y3);
			if(incAB == incCD) {
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}

		}
	}
	return 0;
}

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


int main() {
  int n;
  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
    if (((x[3] == x[2]) && (y[3] == y[2])) || (y[1] == y[0] && x[1] == x[0])) {
      cout << "YES" << endl;
    } else if ((x[3] == x[2] && y[1] == y[0]) || (x[1] == x[0] && y[3] == y[2])) {
      cout << "NO" << endl;
    }
    else if (abs((y[1] - y[0]) * (x[3] - x[2]) - (y[3] - y[2]) * (x[1] - x[0])) < 1e-15) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    
  }
  return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

int main(){

	int n;
	cin>>n;
	float x1,y1,x2,y2,x3,y3,x4,y4;
	while(n>0){
		
		float a=999999,b=999999;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

		if(x2!=x1){
			a=(y2-y1)/(x2-x1);
		}
		if(x3!=x4){
			b=(y4-y3)/(x4-x3);
		}
		
		if(a==b)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
		n--;
	}
	
	
}

C++: #include <iostream>
using namespace std;
int main(void){
    double x[4],y[4];
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            cin>>x[j]>>y[j];
        }
        double d1,d2;
        d1=(y[1]-y[0])/(x[1]-x[0]);
        d2=(y[3]-y[2])/(x[3]-x[2]);
        if(d1==d2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
    int n,i,j;
    double X[5],Y[5];
    long x[5],y[5];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=1;j<=4;j++){
            scanf("%lf %lf",&X[j],&Y[j]);
            x[j] = (long)(X[j]*100000);
            y[j] = (long)(Y[j]*100000);
        }
        if((x[2]-x[1])*(y[4]-y[3])-(x[4]-x[3])*(y[2]-y[1])==0){
            if((y[2]-y[1])*(x[3]-x[1])-(x[2]-x[1])*(y[3]-y[1])==0){
                printf("NO\n");
            }else{
                printf("YES\n");
            }
        }else{
            printf("NO\n");
        }
    }
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-11
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<double,double> P;
static const int INF=1<<24;

int main(){
	double x[5],y[5];
	int n;
	cin>>n;
	rep(i,n){
		rep(j,4){
			cin>>x[j];
			cin>>y[j];
			//cout<<j<<" = "<<x[j]<<" "<<y[j]<<endl;
		}
		P a=P( x[0]-x[1] ,y[0]-y[1]), b=P( x[2]-x[3] ,y[2]-y[3]);
		bool f;
		if(a.F*b.S==b.F*a.S) f=true;
		else f=false;
		//printf("%.13f %.13f %.13f %.13f\n",a.F,a.S,b.F,b.S);
		//CP c(3.0,2.0);
		//cout<<real(c)<<" "<<imag(c)<<endl;
		//cout<<real(a)<<" "<<imag(a)<<" "<<real(b)<<" "<<imag(b)<<endl;
		if(f) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_*1000000;
                y[i][j] = y_*1000000;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

C++: #include <iostream>

using namespace std;

int main() {
	double x1,x2,x3,x4;
	double y1,y2,y3,y4;
	double incAB, incCD;
	int count=0;
	cin>>count;
	for(int i=0; i<count; i++) {
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		incAB = (x2-x1) / (y2-y1);
		incCD = (x4-x3) / (y4-y3);
		if(incAB == incCD) {
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: //
//  main.cpp
//  main
//
//  Created by h3037175 on 2018/01/22.
//  Copyright © 2018年 h3037175. All rights reserved.
//

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
double zeti(double);
int main() {
    pair<double,double> a;
    pair<double,double> b;
    pair<double,double>c;
    pair<double,double>d;
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a.first,&a.second,&b.first,&b.second,&c.first,&c.second,&d.first,&d.second);
        if(a.first==b.first&&c.first==d.first){
            cout<<"YES"<<endl;
            continue;
        }
        double s1,s2;
        s1=(a.second-b.second)/(a.first-b.first);
        s2=(c.second-d.second)/(c.first-d.first);
        if(s1==s2||1/s1==s2){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}