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 <cstdio>
#include <complex>

using namespace std;
typedef long long ll;

typedef long double R;
typedef complex<R> P;

const R EPS = 1e-13;
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));
}

void solve() {
    P p[4];
    for (int i = 0; i < 4; i++) {
        double x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }
    double r1 = arg(p[1]-p[0]);
    double r2 = arg(p[3]-p[2]);
    if (r1 < 0) r1 += PI;
    if (r2 < 0) r2 += PI;
    if (sgn(r1-r2)) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}

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

C++: // Parallelism
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0021& lang=jp
// https://onlinejudge.u-aizu.ac.jp/#/problems/0021
// 中央×前

#include <iostream>
#include <vector>
#include <string>
#include <complex>
using namespace std;

#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define REP(i,n) for(int i=0;i<n;i++)
#define pb push_back


// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

typedef complex<double> xy_t;
const double eps = 1e-11;

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

double signed_area(xy_t v1, xy_t v2) {
	return cross_product(v1, v2) / 2;
}

bool is_pararell(xy_t a, xy_t b, xy_t c, xy_t d) {
	xy_t v1 = xy_t(b.real()-a.real(), b.imag()-a.imag());
	xy_t v2 = xy_t(d.real()-c.real(), d.imag()-c.imag());

	// cout << signed_area(v1, v2) << endl;

	if (abs(signed_area(v1, v2)) < eps) return true;
	else return false;
}


int main(void) {
	// cin, coutの結びつきを解除し、速くする
	cin.tie(0);
   	ios::sync_with_stdio(false);

	int n; cin >> n;
	vector<string> vs;
	while(n--) {
		double x1, x2, x3, x4;
		double y1, y2, y3, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		xy_t a = xy_t(x1, y1);
		xy_t b = xy_t(x2, y2);
		xy_t c = xy_t(x3, y3);
		xy_t d = xy_t(x4, y4);
		if (is_pararell(a, b, c, d)) vs.pb("YES");
		else vs.pb("NO");
	}

	for (auto v:vs) {
		if (v == "YES") YES;
		else NO;
	}


}

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

using namespace std;

void myswap(double* a,double* b)
{
	double temp=*a;
	*a=*b;
	*b=temp;
}
int main()
{
	double x1,x2,x3,y1,y2,y3,x4,y4;
	int n;
	double AB,CD; 

	cin>>n;

	for(int i=0;i<n;i++)
	{
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1>x2)
		{
			myswap(&x1,&x2);
			myswap(&y1,&y2);
		}
		if(x3>x4)
		{
			myswap(&x3,&x4);
			myswap(&y3,&y4);
		}

		if((x2-x1)==0||(x4-x3)==0)
		{
			if((x2-x1)==0&&(x4-x3)==0)
			{
				cout<<"YES"<<endl;
			}
			else
			{
				cout<<"NO"<<endl;
			}
			continue;
		}
		
		AB=(y2-y1)/(x2-x1);
		CD=(y4-y3)/(x4-x3);
		if(AB<CD)
		{
			myswap(&AB,&CD);
		}

		if((AB-CD)<0.001)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}

	}
	

	return 0;
}

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

int main(){
    double EPS = 1e-12;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];

    if(s * v - t * u > 0){
        double m = s * v - t * u;
    }
    else{
        double m = t * u - s * v;
    }


    cout << "NO" << endl;
}

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

#define m1 (y2 - y1) / (x2 - x1)
#define m2 (y4 - y3) / (x4 - x3)

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

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

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<math.h>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=1e-10;
	bool same(double a,double b){
		if(fabs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	int main(){
	int n;
			double x1,y1,x2,y2,x3,y3,x4,y4,a1,a2;
	cin>>n;
	for(int i=0;i<n;i++){

		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		a1=(y1-y2)/(x1-x2);
		a2=(y3-y4)/(x3-x4);
		if(a1==a2)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

C++: def naiseki(x1,y1,z1,x2,y2,z2)
    if x1-x2+y1-y2+z1-z2 == 0:
        print("YES")
    else:
        print("NO")
f = input().split()
try:
    x1=f[0]
    y1=f[1]
    z1=f[2]
    x2=f[3]
    y2=f[4]
    z2=[f5]
    naiseki(x1,y1,z1,x2,y2,z2)
except:
    print("NO")

C++: #include<iostream>
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;

        if( !((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)) ) cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}

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

#define P complex<double>

// e·éë·Ã
#define EPS (1e-10)
// 2ÂÌXJ[ªµ¢©Ç¤©
#define EQ(a,b) (abs((a)-(b)) < EPS)

// e·éë·Ã
#define EPS (1e-10)
// 2ÂÌXJ[ªµ¢©Ç¤©
#define EQ(a,b) (abs((a)-(b)) < EPS)

// OÏ (cross product) : a~b = |a||b|sinÆ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// 2¼üÌ½s»è : a//b <=> cross(a, b) = 0
bool is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}


int main(){
  int n;
  P a,b,c,d;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> a.real() >> a.imag();
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    cin >> d.real() >> d.imag();

    P x=a-b, y=c-d;
    x = x/abs(x);
    y = y/abs(y);

    if( is_parallel( a,b,c,d ) )
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

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