Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                fmt.Scanf("%f %f %f %f %f %f %f %f",
                        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

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

class vec2d {
public:
  double x,y;
  vec2d() {
    this->x = 0;
    this->y = 0;
  }
  void set(double x,double y) {
    this->x = x - this->x;
    this->y = y - this->y;
  }
  void set(vec2d vec) {
    this->x = vec.x - this->x;
    this->y = vec.y - this->y;
  }
};
double cross(vec2d A,vec2d B) {
  return (A.x*B.y - B.x*A.y);
}
bool is_paralles(vec2d A,vec2d B) {
  if(cross(A,B) == 0.0) return true;
  return false;
}

int main() {
  int n;
  cin >> n;
  while(n--) {
    double x,y;
    vec2d p[4];
    for(int i=0;i<4;i++) {
      cin >> x >> y;
      p[i].set(x,y);
    }
    p[0].set(p[1]);
    p[2].set(p[3]);
    if(is_paralles(p[0],p[2])) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a;
cin>>a;
double c[8];
for(int b=0;b<a;b++){
    for(int d=0;d<8;d++)scanf("%lf",&c[d]);
    if(c[0]==c[1]&&c[2]==c[3])printf("YES\n");
    else if((c[1]-c[0])*(c[7]-c[6])==(c[3]-c[2])*(c[5]-c[4]))printf("YES\n");
    else printf("NO\n");
    }
}

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
		comp l = ps[1]-ps[0], m = ps[3]-ps[2], r = polar(1., PI/360);

		l *= r, m *= r;

		cout << (gaiseki(l, m) == 0 ? "YES" : "NO") << endl;

	}

}

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

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double xa,ya,xb,yb,xc,yc,xd,yd,a2,a1;
  while(cin>>n){
    for(int i=0;i<n;i++){
      cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd;
      a1=(yb-ya)/(xb-xa);
      a2=(yd-yc)/(xd-xc);
      if(a1==a2)cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    }
  }
  return 0;
}

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int n,i;
	cin>>n;
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		if(((x2-x1) * (y4-y3) - (y2-y1) * (x4-x3)) != 0.0){
			cout<<"NO"<<endl;
		}else{
			cout<<"YES"<<endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const double ESP=1e-10;

double x[4],y[4];

int main(){
	int n;
	scanf("%d",&n);
	REP(i,n){
		REP(j,4){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		if (fabs(x[0]-x[1])<=ESP || fabs(x[2]-x[3])<=ESP){
			if (fabs(x[0]-x[1])<=ESP && fabs(x[2]-x[3])<=ESP){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		}
		else{
			if (fabs((y[0]-y[1])/(x[0]-x[1])-(y[2]-y[3])/(x[2]-x[3]))<=ESP){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int t; scanf("%d", &t);
	for(int i = 0; i < t; 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);
		double x5 = x2-x1;
		double y5 = y2-y1;
		double x6 = x4-x3;
		double y6 = y4-y3;
		double det = x5*y6-y5*x6;
		if(fabs(det)<0.00000001) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef complex<double> P;

double const EPS = 1e-10;

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(P const& a1, P const& a2, P const& b1, P const& b2)
{ return abs(cross(a2-a1, b2-b1)) <= EPS; }

int main() {
  
  int N; cin >> N;
  for(int i=0; i<N; i++) {
    P ps[4];
    for(int i=0; i<4; i++)
      cin >> ps[i].real() >> ps[i].imag();
    printf("%s\n", (is_parallel(ps[0], ps[1], ps[2], ps[3]) ? "YES" : "NO" ));
  }
  
  return 0;
}

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

int main(){
	int N;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double dx1, dy1, dx2, dy2;
	
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		dx1 = x2 - x1; dy1 = y2 - y1;
		dx2 = x4 - x3; dy2 = y4 - y3;
		if(dx1 * dy2 == dx2 * dy1) cout << "YES" << endl;
		else cout << "NO" << endl;
		
		//cout << dx1 * dy2 << " " << dx2 * dy1 << endl;
	}
	
	return 0;
}