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[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		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<vector>
#include<cmath>
using namespace std;

#define eps 0.00001

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;
    
        vector<double> v1, v2;
        v1.push_back(x2 - x1);
        v1.push_back(y2 - y1);
        v2.push_back(x4 - x3);
        v2.push_back(y4 - y3);
    
        double r1, r2;
        r1 = v1.at(1)/v1.at(0);
        r2 = v2.at(1)/v2.at(0);

        if( fabs(r1-r2) < eps ) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

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

int main(){
  int num;
  cin >> num;
  for(int i= 0; i<num ; i++){
    double x[4];
    double y[4];
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    double AB, CD;
    AB =(y[1]-y[0]) / (x[1]-x[0]);
    CD =(y[3]-y[2]) / (x[3]-x[2]);
    if(AB == CD)cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

C++: #include <iostream>

using namespace std;

int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	double veku1[2];
	double veku2[2];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;
		if (veku1[0]*veku2[1]-veku1[1]*veku2[0] <= 0.0000001) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-10;
const int MOD = 1000000007;

#define X real()
#define Y imag()

typedef complex<double> P;
struct L{
	P p1, p2;
	L(P p1, P p2):p1(p1), p2(p2){}
	L(){}
};
istream& operator>>(istream &is, P &p) {
	double x, y;
	is >> x >> y;
	p = P(x, y);
	return is;
}
inline int sig(double x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); }
inline double norm(const P &p){return p.X*p.X+p.Y*p.Y;}
inline double inp(const P& a, const P& b){return (conj(a)*b).X;}
inline double outp(const P& a, const P& b){return (conj(a)*b).Y;}


int T;

int main(){
	ios::sync_with_stdio(false);
	cin >> T;
	while(T--){
		P p1, p2, p3, p4;
		cin >> p1 >> p2 >> p3 >> p4;
		puts(!sig(inp(p2-p1, (p4-p3)*P(0, 1))) ? "YES" : "NO");
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
 
struct cd{ //coordinate : 座標
    double x,y;
};
 
int main(){
    int n;
    struct cd a[4];
 
    cin>>n;
    for(int i=0; i<n; i++){
        for(int i=0; i<4; i++){
            cin>>a[i].x>>a[i].y;
        }
 
        //tilt : 傾き
        double tilt1=(a[1].y-a[0].y) / (a[1].x-a[0].x);
        double tilt2=(a[3].y-a[2].y) / (a[3].x-a[2].x);
 
        if(tilt1==tilt2) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
     
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
typedef long double LD;

int main() {
	int n;
	cin >> n;
	for (int x = 0;x < n;x++) {
		LD a, b, c, d, e, f, g, h;
		cin >> a >> b >> c >> d >> e >> f >> g >> h;

		LD i = (c - a)*(h - f);
		LD j = (d - b)*(g - e);

		if (i - j == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<iostream>

using namespace std;
double cross(double x1,double y1,double x2,double y2);

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


double cross(double x1,double y1,double x2,double y2){
	return (x1-x2)/(y1-y2);
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	double n,x[4],y[4];
	bool a[100];
	cin>>n;
	for(int i=0;i<n;i++){
		for(int i=0;i<4;i++)
			cin>>x[i]>>y[i];
		double f,g;
		f=(x[0]-x[1])/(y[0]-y[1]);
		g=(x[2]-x[3])/(y[2]-y[3]);
		if(f==g)
			a[i]=true;
		else
			a[i]=false;
	}
	for(int i=0;i<n;i++){
		if(a[i]==true)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	return 0;
}

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


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