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 <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cctype>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <complex>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const double PI = 3.141592653589793238462643383279502884L;
const int LARGE_PRIME = 1000000007;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i,a,cont,next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i,a,b,s) repfn(i,a,i<b,i+s)
#define repab(i,a,b) repby(i,a,b,1)
#define rep(i,b) repab(i,0,b)
#define pb push_back
#define sz(c) int((c).size())

typedef complex<double> P;

bool parallel(P a, P b)
{
  return (arg(a) == arg(b)) || arg(a) == arg(-b);
}

int main(int argc, char **argv)
{
  vector<P> v(4);
  double x, y;
  int n;
  cin >> n;
  while (n--) {
    rep (i, 4) {
      cin >> x >> y;
      v[i] = P(x, y);
    }
    P p = v[1] - v[0];
    P q = v[3] - v[2];
    if (parallel(v[1] - v[0], v[3] - v[2]))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: from fractions import Fraction
def sroap(x1,y1,x2,y2):
	if x2 - x1 == 0:
		return float("inf")
	else:
		return Fraction(y2 - y1,x2 - x1)
		
N = int(input())
for n in range(N):
	Ax,Ay,Bx,By,Cx,Cy,Dx,Dy = map(lambda x: round(x * 10 ** 5),(map(float,input().split())))
	if sroap(Ax,Ay,Bx,By) == sroap(Cx,Cy,Dx,Dy):
        ????????????print("YES")
	else:
		print("NO")

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

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

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

return 0;
}

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

int main()
{
	int N; cin >> N;
	while(N--)
	{
		double x1,x2,x3,x4,y1,y2,y3,y4;
		cin >> x1 >> y1 >> x2 >> y2;
		cin >> x3 >> y3 >> x4 >> y4;

		x2 -= x1; y2 -= y1;
		x4 -= x3; y4 -= y3;

		cout << (x2*y4-x4*y2<1e-7 ? "YES" : "NO") << endl	;
	}
}

C++: #include <iostream>
 
int main(){
     
    double x1,y1,x2,y2,x3,y3,x4,y4;
int a;
    std::cin>>a;
    for(int 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++: //
//  main.cpp
//  main
//
//  Created by h3037175 on 2018/01/22.
//  Copyright © 2018年 h3037175. All rights reserved.
//

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
double zeti(double);
int main() {
    pair<double,double> a;
    pair<double,double> b;
    pair<double,double>c;
    pair<double,double>d;
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a.first,&a.second,&b.first,&b.second,&c.first,&c.second,&d.first,&d.second);
        if(a.first==b.first&&c.first==d.first){
            cout<<"YES"<<endl;
            continue;
        }
        double s1,s2;
        s1=(a.second-b.second)/(a.first-b.first);
        s2=(c.second-d.second)/(c.first-d.first);
        if(s1==s2||1/s1*-1==s2){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
    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>
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=0.00000001;
	bool same(double a,double b){
		if(fabs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	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;
		double a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if(same(a1,a2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

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

using namespace std;


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

		}

		
	}
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
      
int main() {
    int n;
    std::cin >> n;
    while(n--){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        int ix1 = round(x1*100000), iy1 = round(y1*100000),
            ix2 = round(x2*100000), iy2 = round(y2*100000),
            ix3 = round(x3*100000), iy3 = round(y3*100000),
            ix4 = round(x4*100000), iy4 = round(y4*100000);
        int a = iy1 - iy2, b = ix2 - ix1, c = iy3 - iy4, d = ix4 - ix3;
        if(!((long long int)a*d - (long long int)b*c))
            std::cout << "YES" << std::endl;
        else
            std::cout << "NO" << std::endl;
        }
    return 0;
}

C++: #include<iostream>
#include<cstdio>

using namespace std;

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

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

	while (n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

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

int main(){
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double abx,aby,cdx,cdy,abr,cdr;
  int n;
  cin>>n;

  for(int i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    abx=x1-x2;
    aby=y1-y2;
    cdx=x3-x4;
    cdy=y3-y4;
    
    abr=sqrt(abx*abx+aby*aby);
    cdr=sqrt(cdx*cdx+cdy*cdy);

    abx=abx/abr;
    aby=aby/abr;
    cdx=cdx/cdr;
    cdy=cdy/cdr;

    if(abx==cdx&&aby==cdy)
      cout<<"YES\n";
    else if(abx==-1*cdx&&aby==-1*cdy)
      cout<<"YES\n";
    else
      cout<<"NO\n";
  }
  return 0;
}