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>
#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
typedef pair<double,double> pdd;
int main(){
    pdd no1,no2,no3,no4;
    int n;cin>>n;
    rep(i,n){
        cin>>no1.first>>no1.second>>no2.first>>no2.second>>no3.first>>no3.second>>no4.first>>no4.second;
        double d1=(no2.second-no1.second)/(no2.first-no1.first);
        double d2=(no4.second-no3.second)/(no4.first-no3.first);
        if(d1==d2&&d1!=0))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(void)
{
  int n;
  int i;
  cin>>n;
  rep(i,n){
    double x1,x2,x3,x4;
	double y1,y2,y3,y4;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
	if(abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

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

int main()
{
	float ax,ay,bx,by,cx,cy,dx,dy;
	double katamuki[2];
	short n;
	cin>>n;
	
	for(int i=1;i<=n;i++){
		cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
		katamuki[0]=(by-ay)/(bx-ax);
		katamuki[1]=(dy-cy)/(dx-cx);
		cout<<((katamuki[0]==katamuki[1])?"YES":"NO")<<endl;
	}
	
	return 0;
}

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

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

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <complex>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
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)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

// 点の進行方向
int ccw(P a, P b, P c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}

/* 交差判定　直線・線分は縮退してはならない。接する場合は交差するとみなす。isecはintersectの略 */

// 直線と点
bool isecLP(P a1, P a2, P b) {
  return abs(ccw(a1, a2, b)) != 1;  // return EQ(cross(a2-a1, b-a1), 0); と等価
}

// 直線と直線
bool isNotParallel(P a1, P a2, P b1, P b2) {
  return !isecLP(a2-a1, b2-b1, 0);
}

int main() {
  int n;
  cin >> n;
  rep(_,n) {
    VP ps(4);
    rep(i,4) {
      D x,y;
      cin >> x >> y;
      ps[i] = P(x,y);
    }
    cout << (isNotParallel(ps[0], ps[1], ps[2], ps[3]) ? "NO" : "YES") << endl;
  }
  return 0;
}

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

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

C++: #include<iostream>
using namespace std;
int main(){
	int n=0,ax[100],ay[100],bx[100],by[100],cx[100],cy[100],dx[100],dy[100];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ax[i]>>ay[i]>>bx[i]>>by[i]>>cx[i]>>cy[i]>>dx[i]>>dy[i];
	}
	for(int i=0;i<n;i++){
		int A=0,B=0;
		A=ax[i]*by[i]-bx[i]*ay[i];
		B=cx[i]*dy[i]-dx[i]*cy[i];
		if(A==B){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n; cin >> n;
  for (int _ = 0; _ < n; ++_) {
    double xa, ya, xb, yb; cin >> xa >> ya >> xb >> yb;
    double th0 = atan2(yb - ya, xb - xa);
    double xc, yc, xd, yd; cin >> xc >> yc >> xd >> yd;
    double th1 = atan2(yd - yc, xd - xc);
    cout << (abs(th1 - th0) < 1e-10 ? "YES" : "NO") << '\n';
  }
}

C++: //#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	int n;
	double p[8];
	double k1, k2;
	bool ans = false;

	cin >> n;

	while (n--){
		ans = false;
		for (int i = 0; i < 8; i++){
			cin >> p[i];
		}

		if (p[0] == p[2] || p[4] == p[6]){
			if (p[0] == p[2] && p[4] == p[6])ans = true;
		}
		else{
			k1 = (p[3] - p[1]) / (p[2] - p[0]);
			k2 = (p[7] - p[5]) / (p[6] - p[4]);
			if (k1 == k2)ans = true;
			if (k1 > k2 && (k1 -k2 ) < 0.000000001) ans = true;
			if (k2 > k1 && (k2 - k1) < 0.000000001) ans = true;
		}

		cout << (ans ? "YES" : "NO") << endl;
	}


	return 0;
}

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