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>
#include <iostream>

using namespace std;

int main() {
	int k;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double veku1[2];
	double veku2[2];
	double veku3[2];
	double t;
	double m;
	cin >> k;

	for (int i = 0; i < k; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;

		t = veku1[0] * veku2[0] + veku1[1] * veku2[1];

		if (t * t != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku2[0] * veku2[0] + veku2[1] * veku2[1])) {
			cout << "NO" << endl;
		} else {
			/*veku3[0] = x3 - x1;
			veku3[1] = y3 - y1;
			m = veku1[0] * veku3[0] + veku1[1] * veku3[1];
			if (m * m != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku3[0] * veku3[0] + veku3[1] * veku3[1])) {*/
				cout << "YES" << endl;
		/*	} else {
				cout << "NO" << endl;
			}*/
		}
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }


struct Point2D { 
	double x, y;
	Point2D (double a=0, double b=0) { x=a; y=b; }
};

typedef Point2D Vector2D;

double dist2D(const Point2D& a, const Point2D& b) { return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ); }

Vector2D sub_vector2D(const Vector2D& a, const Vector2D& b) {
	Vector2D ret;
	ret.x = a.x - b.x; ret.y = a.y - b.y;
	return ret;
}

double cross_product(const Vector2D& a, const Vector2D& b) { return a.x*b.y - a.y*b.x; }

double inner_product(const Vector2D& a, const Vector2D& b) { return a.x*b.x + a.y*b.y; }

int main() {
	int n; cin >> n;
	Point2D a, b, c, d;
	Vector2D x, y;
	
	for (int i=0; i<n; i++) {		
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		
		x = sub_vector2D(b, a); y = sub_vector2D(d, c);
		
		if (cross_product(x, y)) cout << "NO" << endl;
		else cout << "YES" << endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	double x1[100], y1[100], x2[100], y2[100], x3[100], y3[100], x4[100], y4[100]; int n;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i] >> x3[i] >> y3[i] >> x4[i] >> y4[i];
	}

	for (int i = 0; i < n; i++)
	{
		if ((x2[i] - x1[i]) / (y2[i] - y1[i]) == (x4[i] - x3[i]) / (y4[i] - y3[i]))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include <stdio.h>

/* 2ツ点ツづーツ津環づゥツ陳シツ静シツづ個傾ツつォツづーツ仰づ淞づゥ */
void calc_slope(double x1, double y1, double x2, double y2, double* a, double* b)
{
  *a = (y2 - y1) / (x2 - x1);
  *b = y1 - ((*a) * x1);
  return;
}

int main(void)
{
  int n, i;
  double x[4], y[4], a[2], b[2];
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      int i;
      for(i = 0; i < 4; i++)
	{
	  scanf("%lf", x + i);
	  scanf("%lf", y + i);
	}
      for(i = 0; i < (4 / 2); i++)
	{
	  calc_slope( x[i*2], y[i*2], x[i*2+1], y[i*2+1], &a[i], &b[i]);
	}
      if((a[0] == a[1]) &&  (b[0] != b[1]))
	{
	  printf("YES\n");
	}
      else
	{
	  printf("NO\n");
	}
    }
  return 0;
}

C++: #include<iostream>
#define DFF 1e-9
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double p[4][2],ans;
    for(int i=0; i<4; i++) for(int j=0; j<2; j++) cin >>p[i][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) p[i*2][j]-=p[i*2+1][j];
    ans = p[0][0]*p[2][1]-p[0][1]*p[2][0];
    if(ans>-DFF && ans<DFF) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include<cstdio>
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        double x1,y1,x2,y2,x3,y3,x4,y4;
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)) printf("YES\n");
        else printf("NO\n");
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
using namespace std;
int main() {
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = 9090909, b = 9090909;
		if(x1!=x2)a = (y1 - y2) / (x1 - x2);
		if(x3!=x4)b = (y3 - y4) / (x3 - x4);
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	cin >> n;
}