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 <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 <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

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;
        x1 -= x2; y1 -= y2;
        x3 -= x4; y3 -= y4;
        if(abs(x1*y3 - y1*x3)<1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    typedef pair<double, double>pdd;
    vector<pdd>v(5);
    int n;cin>>n;
    rep(i,n){
        rep(i,4)cin>>v[i].first>>v[i].second;
        double d1=(v[0].second-v[1].second)/(v[0].first-v[1].first);
        double d2=(v[2].second-v[3].second)/(v[2].first-v[3].first);
        if(d1-d2<EPS)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

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

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  int N;
  scanf(" %d ", &N);
  
  for (int i = 0; i < N; i++) {
    coor c[4];
    for (int j = 0; j < 4; j++) {
      int x, y;
      scanf(" %d %d ", &x, &y);
      c[i] = coor(x, y);
    }
    if (cross(c[1] - c[0], c[3] - c[2])) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    complex<double> p[4];
    for (int i = 0; i < 4; ++i) {
      double x, y;
      cin >> x >> y;
      p[i] = complex<double>(x, y);
    }
    complex<double> v1 = p[1] - p[0], v2 = p[3] - p[2];
    double a = abs(v1.real() * v2.imag() - v1.imag() * v2.real());
    cout << ((a < 1e-10) ? "YES" : "NO") << endl;
  }
}

C++: #include<iostream>
#define DFF 1E-19
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double p[4][2],ans;
    for(int i=0; i<4; i++) for(int j=0; j<2; j++) cin >>p[i][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) p[i*2][j]-=p[i*2+1][j];
    ans = p[0][0]*p[2][1]-p[0][1]*p[2][0];
    if(ans>-DFF && ans<DFF) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<complex>
using namespace std;
#define EPS 1e-10

int main(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		complex<double> p1, p2, p3, p4;
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		p1 = complex<double>(x1, y1);
		p2 = complex<double>(x2, y2);
		p3 = complex<double>(x3, y3);
		p4 = complex<double>(x4, y4);
		
		if( (arg(p1-p2) - arg(p3-p4))>-EPS && (arg(p1-p2) - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else if( (arg(p1-p2) + M_PI - arg(p3-p4))>-EPS && (arg(p1-p2) + M_PI - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else if( (arg(p1-p2) - M_PI - arg(p3-p4))>-EPS && (arg(p1-p2) - M_PI - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
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++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((x2-x1)*(y4-y3)-(y2-y1)*(x4-x3)){
			cout<<"NO\n";
		}else{
			cout<<"YES\n";
		}
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(fabs(m1-m2)<1e-6) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: //
//  practise.h
//  c++practise
//
//  Created by Ubnit04 on 2015/06/10.
//
//
#include <iostream>

using namespace std;

void Solution()
{
    int n;
    
    cin>>n;
    
    while(n--)
    {
        float x1, y1;
        float x2, y2;
        float x3, y3;
        float x4, y4;
        
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        
        float ab = (y2 - y1) / (x2 - x1); // when "y / x = " another line's data, it can be seen as parallel
        float cd = (y4 - y3) / (x4 - x3);
        
        if (ab == cd )
        {
            cout<<"YES"<<endl;
        }
        else
        {
            cout<<"NO"<<endl;
        }
    }
}

int main()
{
    Solution();
    return 0;
}

C++: #include <iostream>

int main(){
	
	double a,x1,y1,x2,y2,x3,y3,x4,y4;
	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++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


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

	}
	return 0;

}