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 <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
#include <cmath>
using namespace std;

#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;

int main() {
  int n;
  scanf("%d", &n);
  double x[4], y[4];
  const double EPS = 1e-12;
  for (int z = 0; z < n; z++) {
    for (int i = 0; i < 4; i++) {
      scanf("%lf%lf", &x[i], &y[i]);
    }
    printf("%s\n", abs((y[1]-y[0])*(x[3]-x[2])-(y[3]-y[2])*(x[1]-x[0])) < EPS ? "YES" : "NO");
  }
}

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

int main()
{
    pair<double,double>a[4];
    for(int i=0;i<4;i++){
        cin>>a[i].first>>a[i].second;
    }
    if((a[1].second-a[0].second)/(a[1].first-a[0].first)!=0)
        cout<<"NO"<<endl;
    else cout<<"YES"<<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];
		double a = (x[1] - x[0])*(y[3] - y[2]), b = (x[3] - x[2])*(y[1] - y[0]);
		if (a == b){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
int main(void){
    // Here your code !
int n;
double x1,x2,x3,x4,y1,y2,y3,y4;
cin>>n;
for(int i=0;i<n;i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
if(x1==x2&&x3==x4) cout<<"YES"<<endl;
else if(y1==y2&&y3==y4) cout<<"YES"<<endl;
else{
    double a,b;
    a=(y2-y1)/(x2-x1);
    b=(y4-y3)/(x4-x3); 
    if( a ==b )
    cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
}
return 0;
}

C++: #include <stdio.h>
struct point{
    double x;
    double y;
};
double abs(double a){
    if(a>0)return a;
    return -a;
}
int main(){
    int n;
    point a[4];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            scanf("%lf%lf",&a[j].x,&a[j].y);
        }
        if(a[1].x==a[0].x){
            if(a[3].x==a[2].x)printf("YES\n");
            else printf("NO\n");
        }
        else  if(a[1].y==a[0].y){
            if(a[3].y==a[2].y)printf("YES\n");
            else printf("NO\n");
        }
        else  if(a[3].x==a[2].x){
            printf("NO\n");
        }
        else if(a[3].y==a[2].y){
            printf("NO\n");
        }
        else if(abs(((a[1].x-a[0].x)*(a[3].y-a[2].y))-((a[3].x-a[2].x)*(a[1].y-a[0].y)))<=1e-9)printf("YES\n");
        else printf("NO\n");
    }
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>
#include <iterator>

#include <cmath>

typedef std::pair<double,double> Vec;
typedef std::pair<Vec,Vec> Line;

Vec operator+(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first+rhs.first, lhs.second+rhs.second);
}

Vec operator-(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first-rhs.first, lhs.second-rhs.second);
}

Vec lineToVec(const Line& l) {
	return l.first - l.second;
}

double cross(const Vec& lhs, const Vec& rhs) {
  return lhs.first*rhs.second - lhs.second*rhs.first;
}

int main(void){
	using namespace std;

	int n;
	cin >> n;

	vector< pair<Line,Line> > input;
	input.reserve(n);

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

		auto AB = make_pair( make_pair(x1,y1), make_pair(x2,y2) );
		auto CD = make_pair( make_pair(x3,y3), make_pair(x4,y4) );

		input.push_back(make_pair(AB,CD));
	}

	for(auto itr=input.begin(); itr!=input.end(); itr++){
		auto AB = itr->first;
		auto CD = itr->second;

		auto cr = cross( lineToVec(AB), lineToVec(CD) );

		if( abs(cr) <1e-10 ){
			cout << "YES";
		}
		else{
			cout << "NO";
		}
		if( distance( itr, input.end() )>1 ){
			cout << endl;
		}
	}
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second)>1e-10)
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }
    return 0;
}

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

int n;

void solve()
{
	long double x[4],y[4],px[2],py[2];


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

	px[0] = x[1] - x[0];
	px[1] = x[3] - x[2];
	py[0] = y[1] - y[0];
	py[1] = y[3] - y[2];



	if(px[0]*py[0] == px[1]*py[1])
		cout << "YES";
	else
		cout << "NO";
	cout << endl;

}

int main(void)
{
	cin >> n;
	for(int i = 0; i < n; i++)
		solve();


	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a;
cin>>a;
double c[8];
for(int b=0;b<a;b++){
    for(int d=0;d<8;d++)cin>>c[d];
    if(c[0]==c[2]&&c[4]==c[6])printf("YES\n");
    else if((c[6]-c[4])/(c[7]-c[5])==(c[2]-c[0])/(c[3]-c[1]))printf("YES\n");
    else printf("NO\n");s
    }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;


int main()
{
	int n;
	cin >> n;
	int x1, y1, x2, y2, x3, y3, x4, y4;
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		int a = (y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1);
		if (a - 1 < EPS )printf("YES\n");
		else printf("NO\n");
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
#define INF 1e+15

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

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void){
    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;
        if(fabs(x2-x1)<0.00001 && fabs(x4-x3)<0.00001)   cout << "YES" <<endl;
        else{
            if(fabs((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3))<0.00001)  cout << "YES" << endl;
            else cout << "NO" << endl;
        }
 
    }
    return 0;
}