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[1] == fpoints[3] {
			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 <stdio.h>
int main(void)
{
    double x1,y1,x2,y2,x3,y3,x4,y4,AB,CD;
    int n,i;
    
    scanf("%d",&n);
    {
        for(i=0;i<n;i++)
        {
            scanf("%lf",&x1); scanf("%lf",&y1);
            scanf("%lf",&x2); scanf("%lf",&y2);
            scanf("%lf",&x3); scanf("%lf",&y3);
            scanf("%lf",&x4); scanf("%lf",&y4);
            
            AB=(y2-y1)/(x2-x1);
            CD=(y4-y3)/(x4-x3);
            
            if(AB==CD) printf("YES\n");
            else printf("NO\n");
        }
    }
    
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }
 
#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-12
 
template<class T> T add(T x, T y){ if(abs(x+y) < EPS*(abs(x)+abs(y))) return 0; return x + y; }
template<class T> inline bool semieq(T x, T y){ return abs(x - y) < EPS; }
template<class T> inline bool semige(T x, T y){ return x - y > -EPS; }
template<class T> inline bool semile(T x, T y){ return y - x > -EPS; }
 
template<class Type> struct Line;
 
template<class Type>
struct P
{
  friend struct Line<Type>;
private:
  complex<Type> z;
 
public:
  P(const Type x = 0, const Type y = 0) : z(complex<Type>(x, y)) { }
  void setter(Type x, Type y) { z = complex<Type>(x, y); }
  Type getX(){ return z.real(); }
  Type getY(){ return z.imag(); }
  inline double getSlope(){ return tan(z.arg()); }
  inline double getSlope(P<Type> p){ return (this - p).getSlope(); }
 
  bool operator == (const P<Type> p){ return  semieq(z.real(), p.real()) &&  semieq(z.imag(), p.imag()); }
  bool operator != (const P<Type> p){ return !semieq(z.real(), p.real()) || !semieq(z.imag(), p.imag()); }
  Type operator * (const P<Type> p){ return (z * p.z).real(); }
  Type operator / (const P<Type> p){ return (z * p.z).imag(); }
};
 
template<class Type>
struct Line
{
private:
  P<Type> S, T;
 
public:
  Line(const Type sx, const Type sy, const Type tx, const Type ty) : S(sx, sy), T(tx, ty) {}
  Line(const P<Type> S, const P<Type> T) : S(S), T(T) {}
  inline P<Type> getS(){ return S; }
  inline P<Type> getT(){ return T; }
  inline double getSlope(){ return S.getSlope(T); }
  inline bool isParallel(Line<Type> L){ return semieq(((L.S.z - L.T.z) / (S.z - T.z)).imag(), 0.0); }
  inline bool isVertical(Line<Type> L){ return semieq(((L.S.z - L.T.z) / (S.z - T.z)).real(), 0.0); }
};
 
typedef double Point;
 
int n;
P<Point> A[4];
Point x, y;
 
int main()
{
  cin >> n;
 
  while(n--){
    rep(i, 4){
      cin >> x >> y;
      A[i].setter(x, y);
    }
    Line<Point> AB(A[0], A[1]);
    Line<Point> CD(A[2], A[3]);
    puts(AB.isParallel(CD) ? "YES" : "NO");
  }
 
  return 0;
}

C++: #include <iostream>

int main(){
	
	double a,x1,y1,x2,y2,x3,y3,x4,y4;
	std::cin>>a;
	for(double s=0;s<a;s++){
		std::cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)){
			std::cout<<"YES"<<std::endl;
		}else{
			std::cout<<"NO"<<std::endl;
		}
		
    }
    return 0;
}

C++: #include<stdio.h>
#include <math.h>

int main(void)
{
	double x[4]={0},y[4]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		if(fabs(x[0])>100 ||fabs(y[0])>100 ||fabs(x[1])>100 ||fabs(y[1])>100 ||
			fabs(x[2])>100 ||fabs(y[2])>100||fabs(x[3])>100||fabs(y[3])>100)break;
		x1 = x[1]-x[0];   y1 = y[1]-y[0];
		x2 = x[3]-x[2];   y2 = y[3]-y[2];
		if(x1==0 && x2==0)
			printf("YES\n");
		else if(x1==0  || x2==0)
			printf("NO\n");
		else if((y1/x1) == (y2/x2))
			printf("YES\n");
		else 
			printf("NO\n");

		i-=1;
	}
 return 0;
}

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

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

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

	REP(i, n){

		double p[8];
		REP(i, 8){
			cin >> p[i];
		}

		string ans = ((p[3] - p[1])/(p[2] - p[0]) == (p[7] - p[5])/(p[6] - p[4])) ? "YES" : "NO";


		cout << ans << endl;
	}
	return 0;
}

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

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

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

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

C++: #include <iostream>
#include <cstdio>
#include <complex>
#define EPS 1e-10
#define EQ(a, b) (abs((a) - (b)) < EPS)
using namespace std;

typedef complex<double> P;

double cross(P a, P b) {
    return(a.real() * b.imag() - a.imag() * b.real());
}

int isPalallel(P a,P a2, P b, P b2) {
    return(EQ(cross(a-a2, b-b2), 0.0));
}

int main(void) {
    int num; cin >> num;
    
    for(int r = 0; r < num; r++) {
        double x1, y1, x2, y2, x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        P a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
        if(isPalallel(a, b, c, d)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return(0);
}