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 <stdio.h>
int main() {int N;double x1,x2,x3,x4,y1,y2,y3,y4;scanf("%d",&N);while (N--) {scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);if (((x2-x1)==(x3-x4) && (y1-y2)==(y4-y3)) || ((y1-y2)==(y3-y4) && (x2-x1)==(x4-x3))) puts("YES"); else puts("NO");}return 0;}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  double x1,x2,x3,x4;
  double y1,y2,y3,y4;
  int n;
  cin >> n;
  while(n--){
    cin >> x1>> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
  if(fabs((x2 - x1)*(y4 - y3) - (y2 - y1)*(x4 - x3) ) < 10e-12) cout << "YES"<<endl;
  else cout << "NO" << endl;
}
  return 0;
}

C++: #include <iostream>
#include <cmath>
     
int main() {
    int n;
    std::cin >> n;
    while(n--){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		int ix1 = round(x1*100000), iy1 = round(y1*100000),
			ix2 = round(x2*100000), iy2 = round(y2*100000),
			ix3 = round(x3*100000), iy3 = round(y3*100000),
			ix4 = round(x4*100000), iy4 = round(y4*100000);
		int a = iy1 - iy2, b = ix2 - ix1, c = iy3 - iy4, d = ix4 - ix3;
		if(!((long long int)a*d - (long long int)b*c))
			std::cout << "YES" << std::endl;
		else
			std::cout << "NO" << std::endl;
		}
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
  int n,i;
  long double x1,y1,x2,y2,x3,y3,x4,y4;
  int ans[100];
  
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf("%Lf %Lf %Lf %Lf %Lf %Lf %Lf %Lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
  
    if( (y2-y1)*(x4-x3) == (y4-y3)*(x2-x1) ){
      ans[i] = 1;
    }else{
      ans[i] = 0;
    }
  }

  for(i = 0;i < n;i++){
    if(ans[i] == 1){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

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

int main() {
	int N;
	cin>>N;
	for(;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 <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* ?????° {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

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

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
}

bool isecLP(P a1, P a2, P b) {
  return abs(ccw(a1, a2, b)) != 1;  // return EQ(cross(a2-a1, b-a1), 0); ??¨??????
}

bool isecLL(P a1, P a2, P b1, P b2) {
  return !isecLP(a2-a1, b2-b1, 0) || isecLP(a1, b1, b2);
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n = in();
  P xy[4];

  while(n--){
    REP(i, 4) cin >> xy[i].X >> xy[i].Y;
    if (xy[0] == xy[2] && xy[1] == xy[3]){
      cout << "YES" << endl;
      break;
    }
    if(isecLL(xy[0], xy[1], xy[2], xy[3])){
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
    

  return (0);
}

C++: #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <cmath>
#include <sstream>
#define F first
#define S second
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int l = 0; l < n; l++) {
		double X[4], Y[4];
		int x[4],y[4],v[2];
		for (int i = 0; i < 4; i++) {
			cin >> X[i] >> Y[i];
			X[i]*=100000;
			Y[i]*=100000;
			x[i]=(int)X[i];
			y[i]=(int)Y[i];
		}
		
		if (x[0] == x[1] && x[2] == x[3]) {
			cout << "YES" << endl;
			continue;
		}
		if (x[0] == x[1] || x[2] == x[3]) {
			cout << "NO" << endl;
			continue;
		}
		v[0] = (y[1] - y[0]) / (x[1] - x[0]);
		v[1] = (y[3] - y[2]) / (x[3] - x[2]);
		if (v[0] == v[1]) {
			cout << "YES" << endl;
			continue;
		}
		cout << "NO" << endl;
		continue;
	}
	return 0;
}

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

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	int n;
	cin>>n;
	while (n--){
		vector<pair<double, double>> pos(4);
		REP(i, 4){
			cin >> pos[i].first >> pos[i].second;
		}

		if (abs((pos[1].first - pos[0].first)*(pos[3].second - pos[2].second) - (pos[1].second - pos[0].second)*(pos[3].first - pos[2].first))<=0.00001)
			cout << "YES"<<endl;
		else
			cout << "NO"<<endl;
		
	}
}

C++: #include<stdio.h>
int main(){
  int n;
  double x[4],y[4];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    
    for(int j=0;j<4;j++)
      scanf("%lf %lf",&x[j],&y[j]);
    
    puts( (y[0]-y[1])*(x[2]-x[3])==(y[2]-y[3])*(x[0]-x[1])?"YES":"NO");
    
  }
  return (0);
}