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<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
#define INF 1<<20

struct edge{
	int to;
	int cost;
	edge() {};
	edge(int a, int b) {
		to = a;
		cost = b;
	}
};

struct Node {
	int pos;
	int cost;
	Node() {};
	Node(int a, int b) {
		pos = a;
		cost = b;
	}
	bool operator <(const Node& rhs) const {
		return cost > rhs.cost;
	}
};

void dijkistra(int st, int TO,int V,vector<vector<edge> > graph) {
	priority_queue<Node> q;
	vector<int> d(V);
	for (int i = 0;i < V;i++) {
		d[i] = INF;
	}
	d[st] = 0;
	q.push(Node(st, 0));
	while (!q.empty()) {
		Node s = q.top(); q.pop();
		int pos = s.pos;
		for (int i = 0;i < graph[pos].size();i++) {
			int to = graph[pos][i].to;
			int cost = graph[pos][i].cost;
			if (d[pos] + cost < d[to]) {
				d[to] = d[pos] + cost;
				q.push(Node(to, d[to]));
			}

		}
	}
	cout << d[TO] << endl;
}
int partition(int A[],int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
		swap(A[i + 1], A[r]);
		return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q-1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[],int n,int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >=0  ) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n,int* v,int* ww) {
	int W[101][10001];
		for (int j = 0;j <= w;j++) {
			W[0][j] = 0;
		}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++){
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int fib(int n) {
	vector<int> v(n+1);
	v[0] = 1;
	v[1] = 1;
	for (int i = 2;i < n+1;i++) {
		v[i] = v[i - 2] + v[i - 1];
	}
	return v[n];
}
int isPrime(int x) {
	if (x <= 1) return false;
	if (x>2 && x % 2 == 0) return false;
	for (int i = 2;i <= sqrt(x);i++) {
		if (x%i == 0) {
			return false;
		}
	}
	if (x == 2) return true;
	return true;
}
int Prime(int x) {
	vector<int> prime(x+1,1);
	int num = 2;
	while (num <= sqrt(x)) {
		for (int i = 2;i <= x / num;i++) {
			prime[num*i] = 0;
		}
		num++;
		while (prime[num] == 0)
			num++;
	}
	int count = 0;
	for (int i = 2;i < x + 1;i++) {
		if (prime[i] == 1) count++;
	}
	return count;
}
int main(){
	double x[4], y[4];
	int n;
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 4;j++) {
			cin >> x[j] >> y[j];
		}
		double X1 = x[1] - x[0];
		double Y1 = y[1] - y[0];
		double X2 = x[3] - x[2];
		double Y2 = y[3] - y[2];
		if (abs(X1*Y2-X2*Y1)<0.00001) cout << "YES"<<endl;
		else cout << "NO"<<endl;
	}
	

}

C++: #include <iostream>

int main(){
	double x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4;
	int n;
	std::cin >> n;
	for(int i=0 ; i<n ; ++i){
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		bool parallel=false;
		if(x1==x2 && x3==x4) {
			parallel=true;
			goto result;
		}
		else if(x1==x2 || x3==x4) {
			goto result;
		}
		else if ((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)) {
			parallel=true;
		}
		result:
		std::cout << ( parallel ? "YES" : "NO") << std::endl;
	}
	return 0; 
}

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

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

C++: #include<cstdio>
#include<cmath>
#include<complex>
#include<string>
#include<map>
#include<iostream>
using namespace std;
typedef complex<double> xy_t;
const double eps=1e-11;
double x[4],y[4];
int N;

int main(){
  cin>>N;
  for(int t=0;t<N;t++){
    for(int i=0;i<4;i++)
      cin >> x[i] >> y[i];
    xy_t a[2]={
      xy_t(x[0],y[0])-xy_t(x[1],y[1]),
      xy_t(x[2],y[2])-xy_t(x[3],y[3])};
    bool p = abs((conj(a[0])*a[1]).imag()) < eps;
    cout << (p ? "YES" : "NO") <<endl;
  }
  return 0;

}

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

bool solve();

int main(){
	int n;cin>>n;
	while(n--){
		cout<< solve()?"YES":"NO" << endl;
	}	
	return 0;
}

bool solve(){
	double x1,x2,y1,y2;
	double vx1,vx2,vy1,vy2;
	
	cin>>x1>>y1>>x2>>y2;
	vx1=x2-x1;vy1=y2-y1;
	cin>>x1>>y1>>x2>>y2;
	vx2=x2-x1;vy2=y2-y1;
	
	//vx1:vy1=vx2:vy2
	return (vx1*vy2==vy1*vx2);
}

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

/* 平面幾何の基本要素 */
 
#define EPS (1e-10)
#define equals(a,b) (fabs((a) - (b)) < EPS )
 
class Point { // 点を表すクラス
public:
  double x,y;
  
  Point(double x=0,double y=0): x(x),y(y) {}
  
  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(a * x, a * y); }
  Point operator / (double a) { return Point(x / a, y / a); }
  
  double abs() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  
  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }
  
  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

typedef Point Vector; // ベクトルを表す構造体

struct Segment { // 線分を表す構造体
  Point p1,p2;
};

typedef Segment Line; // 直線を表す構造体

class Circle { // 円を表すクラス
public:
  Point c;
  double r;
  Circle(Point c = Point(), double r = 0.0): c(c),r(r) {}
};
typedef vector < Point > Polygon; // 多角形

double dot(Vector a, Vector b) {
  return a.x * b.x + a.y * b.y;
}
 
double cross(Vector a, Vector b) {
  return a.x * b.y - a.y * b.x;
}

bool isParallel(Vector a,Vector b){
  return equals(cross(a,b),0.0);
}

bool isParallel(Point a1,Point a2,Point b1,Point b2){
  return isParallel(a1-a2,b1-b2);
}

bool isParallel(Segment s1,Segment s2){
  return equals(cross(s1.p2 - s1.p1,s2.p2 - s2.p1),0.0);
}

int main(){
  int n;
  Point p1,p2,p3,p4;
  cin >> n;
  while(n--){
    cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
    if(isParallel(p1,p2,p3,p4)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x[4],y[4];
  
  while(cin>>n,n){
    for(int i=0;i<n;i++){
      for(int i=0;i<4;i++){
	cin>>x[i]>>y[i];
      }
      if((y[0]-y[1])/(x[0]-x[1])==(y[2]-y[3])/(x[2]-x[3])){
	cout<<"YES"<<endl;
      }
      else{
	cout<<"NO"<<endl;
      }
    }
  }
  return 0;
}