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[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			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 <complex>
using namespace std;

// ?¨±?????????????????
#define EPS (1e-10)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)

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

int is_parallel(complex<double> a1, complex<double> a2, complex<double> b1, complex<double> b2){
	return EQ(cross(a1 - a2, b1 - b2), 0.0);
}

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

	int n;
	cin >> n;

	double x1, y1, x2, y2, x3, y3, x4, y4;

	while(n > 0){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		complex<double> a(x1, y1);
		complex<double> b(x2, y2);
		complex<double> c(x3, y3);
		complex<double> d(x4, y4);

		cout << (is_parallel(a, b, c, d) ? "YES" : "NO") << endl;

		--n;
	}

	return 0;
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   double x1,y1,x2,y2,x3,y3,x4,y4;
   int n;
   cin>>n;
   while(n--)
   {
     cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
     if((x2==x1&&y2==y1)||(x4==x3&&y4==y3)) cout<<"YES"<<endl;     
     else if(x2==x1&&x3==x4) cout<<"YES"<<endl;
     else 
     {
       double k1=(y2-y1)/(x2-x1);
       double k2=(y4-y3)/(x4-x3);
       if(abs(k1-k2)<0.000000000000000001) cout<<"YES"<<endl;
       else cout<<"NO"<<endl;     
     }          
   }
   //while(1);      
   return 0;    
 }

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>

#define pow(a) ((a)*(a))
#define eps 1.0e-10

using namespace std;

int main(void){
    int n;
    while(scanf("%d", &n),n>0){
        double x[4]={0};
        double y[4]={0};

        for(int i = 0; i < 4; i++){
            scanf("%lf %lf",&x[i], &y[i]);
        }

        double a = ((x[0]-x[1])/(y[0]-y[1]));
        double b = ((x[2]-x[3])/(y[2]-y[3]));

        if(b-eps <= a && a<=b+eps)
            puts("YES");
        else
            puts("NO");

    }

    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 <complex>
#include <iostream>
#include <cmath>
using namespace std;

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		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(cross_product(a[0],a[1])/2) < eps;
		cout << ( p ? "Yes" : "No") << endl;
	}
}

C++: /*

Parallelism(https://onlinejudge.u-aizu.ac.jp/problems/0021)
前

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
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;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

//外積を計算する関数
double gaiseki(comp a, comp b)
{
	return (conj(a)*b).imag();
}

void solve(void){

	int N;
	cin >> N;
	while(N--)
	{

		double xs[4], ys[4];
		rep(4, i)
		{
			cin >> xs[i] >> ys[i];
		}

		vector <comp> ps(4);
		rep(4, i)
		{
			ps[i] = comp(xs[i], ys[i]);
		}

		//直線AB,CDに対応するベクトルl,m　回転用のr
		comp l = ps[1]-ps[0], m = ps[3]-ps[2], r = polar(1., PI/180);

		l *= r, m *= r;

		cout << (abs(gaiseki(l, m)) < EPS ? "YES" : "NO") << endl;

	}

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

double ESP = 1e-10;

struct point {
  double x, y;
};

int main() {
  int n;
  point P[4];

  cin >> n;
  while(n){
    for(int i = 0; i < 4; i++){
      cin >> P[i].x >> P[i].y;
    }

    if(abs((P[1].y - P[0].y)*(P[3].y - P[2].y) - (P[3].x - P[2].x)*(P[1].x - P[0].x)) < ESP) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    n--;
  }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double a[2],b[2],c[2],d[2];
    cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>d[0]>>d[1];
    if((b[0]-a[0])*(d[1]-c[1])-(b[1]-a[1])*(d[0]-c[0]) == 0) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}