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

int digit(int i){
  int c=0;
  do{
    c++;
    i*=0.1;
  }while(i!=0);
  return c;
}

int main(){
  int n;
  cin>>n;
  while(n--){
    int xy[8];
    for(int i=0;i<8;i++){
      int j,s;
      scanf("%d.%d",&j,&s);
      xy[i]=j*pow(10,digit(s))+s;
    }

    //   cout<<xy[0]<<" "<<xy[1]<<" "<<xy[2]<<" "<<xy[3]<<" "<<xy[4]<<" "<<xy[5]<<" "<<xy[6]<<" "<<xy[7]<<endl;
    xy[6] = xy[6] - xy[4] + xy[0];
    xy[7] = xy[7] - xy[5] + xy[1];

    //   cout<<xy[0]<<" "<<xy[1]<<" "<<xy[2]<<" "<<xy[3]<<" "<<xy[4]<<" "<<xy[5]<<" "<<xy[6]<<" "<<xy[7]<<endl;
    //    cout<<xy[2]<<" "<<xy[6]<<" "<<xy[3]<<" "<<xy[7]<<endl;
    if(xy[2] == xy[6] && xy[3] == xy[7]){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }


  }
  return 0;
}

C++: #include <complex>
#include <cmath>
#include <iostream>
#include <stdio.h>

using namespace std;
typedef complex<double> xy_t;

const double eps= 0.0000000000001;
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])};
    xy_t x=a[0],y=a[1];
    bool p = abs(x.real()*y.imag()-x.imag()*y.real()) < eps;
    cout << ( p ? "YES" : "NO" ) << endl ;
  }

}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int n;
   long double x[4],y[4];
   cin >> n;
   REP(i,n){
      REP(j,4) cin >> x[j] >> y[j];
      if((x[1]-x[0])/(y[1]-y[0])==(x[3]-x[2])/(y[3]-y[2])) cout << "YES" << endl;
      else if(y[0]==y[1]&&y[2]==y[3]) cout << "YES" << endl;
      else cout << "NO" << endl;
   }
}

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


int main() {
  int n;
  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
    if (abs((y[1] - y[0]) * (x[3] - x[2]) - (y[3] - y[2]) * (x[1] - x[0])) < 1e-15) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    
  }
  return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(){

int n;
double x1,x2,x3,x4,y1,y2,y3,y4;
doubl1 a1=0,a2=0;
scanf("%d",&n);

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

return 0;
}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double a1=0.0,a2=0.0;
	int n,i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		
		a1=(y1-y2)/(x1-x2);
		a2=(y3-y4)/(x3-x4);
		
	if( a1==a2 || ( x1==x2 && x3==x4) || ( y1==y2 && y3==y4) )printf("YES\n");
	else printf("NO\n");
	}
return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

typedef complex<double> CD;
double gosa = 0.0000001;

//平行判定
bool Check_para(CD p1, CD p2, CD q1, CD q2) {
	double a1 = arg(p1 - p2), a2 = arg(q1 - q2);
	return abs(a1 - a2) < gosa || abs(abs(a1 - a2) - pi) < gosa;
}

int main() {
	int n; cin >> n;
	rep(loop, n) {
		vector<double> xy(8); rep(i, 8)cin >> xy[i];
		CD a(xy[0], xy[1]), b(xy[2], xy[3]), c(xy[4], xy[5]), d(xy[6], xy[7]);
		puts(Check_para(a, b, c, d) ? "YES" : "NO");
	}
}

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

int main(){
    double x1, y1, x2, y2, x3, y3, x4, y4, ab, cd;
    int n;

    cin >> n;
    while(n--){
        cin >>x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        ab = (y1 - y2) / (x1 - x2);
        cd = (y3 - y4) / (x3 - x4);

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

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) * (x3 - x4) == (y1-y2) * (y3-y4)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}