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 <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

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;
        x1 -= x2; y1 -= y2;
        x3 -= x4; y3 -= y4;
        if(fabs(x1/y1 - x3/y3)<1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include <cstring>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <bitset>
 
#define rep(i,a) for(int i = 0;i < (a); i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())
#define pb push_back
#define mp make_pair
#define INF 1e8
#define EPS 1e-10
#define PI acos(-1.0)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef complex<double> P;
typedef vector<P> G;
 
int main(){
    int n;
    cin >> n;
    while(n--){
        G p(4);
        rep(i,4) cin >> p[i].real() >> p[i].imag();
        if(p[0].real() == p[1].real()){
            cout << (p[2].real() == p[3].real()? "YES": "NO") << endl;
        }else if(p[2].real() == p[3].real()){
            cout << "NO\n";
        }else{
            cout << ((p[0].imag()-p[1].imag())/(p[0].real()-p[1].real()) == 
                     (p[2].imag()-p[3].imag())/(p[2].real()-p[3].real())? "YES": "NO") << endl;
        }
    }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n,x[4],y[4];

	cin >> n;

	for(int i = 0;i < n;i++){
		for(int j = 0;j < 4;j++){
			scanf("%d.%d",&x[j],&y[j]);
		}

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

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

int main(){
  int n;
  cin>>n;
  while(n--){
    double x[4];
    double y[4];
    for(int i=0;i<4;i++){
      cin>>x[i]>>y[i];
    }

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

    double xx=x[1]-x[3];
    double yy=y[1]-y[3];

    if(-1e-5 < xx && xx < 1e-5 && -1e-5 < yy && yy < 1e-5 ){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }

  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <complex>

using namespace std;
typedef long long ll;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

double cross(const P &a, const P &b) { return imag(conj(a)*b); }
double dot(const P &a, const P &b) { return real(conj(a)*b); }

void solve() {
    P p[4];
    for (int i = 0; i < 4; i++) {
        R x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    if (!sgn(cross(p[0]-p[1], p[2]-p[3]))) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 9999999;
double EPS = 1e-9;
// BEGIN //////////////////////////////////////////////////////////////


int main() {
	int N;
	scanf("%d", &N);
	double x1, y1, x2, y2, x3, y3, x4, y4;
	REP(i, N) {
		 scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		 double s = x2 - x1, t = y2 - y1, u = x4 - x3, v = y4 - y3;
		 if (s * v - t * u < EPS) {
			 PRINT("YES");
		 } else {
			 PRINT("NO");
		 }
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

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

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

int main() {
	int n; cin >> n;
	while (n--) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>

using namespace std;

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

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

  return 0;
}

C++: #include<iostream>
using namespace std;
 
int main(void){
  double xa,ya,xb,yb,xc,yc,xd,yd;
  int n;
  cin >> n;
  while( --n >=0){
    cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
 
    if( (yb - ya)/(xb - xa) == (yd - yc)/(xd - xc))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(abs(m1-m2)<1e-12) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}