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 <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k,T;
  cin>>T;
  while(T--){
    double xx,yy;
    ll x[4],y[4];
    rep(i,4){
      cin>>xx>>yy;
      x[i]=xx*1e6;
      y[i]=yy*1e6;
      //   cout<<x[i]<<","<<y[i]<<endl;
    }
    rep(i,2){
      x[i*2+1]-=x[i*2];
      y[i*2+1]-=y[i*2];
    }
    cout<<(x[1]*y[3]==x[3]*y[1]?"YES":"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];
    for(int i=0;i<4;i++) cin >> x[i] >> y[i]; 
    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;
  }
}

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;
        if(v[0].first<v[1].first)swap(v[0],v[1]);
        if(v[2].first<v[3].first)swap(v[2],v[3]);
        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&&(v[0].first-v[1].first!=0))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    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;
 
 
    double a,b;
    a=(y2-y1)/(x2-x1);
    b=(y4-y3)/(x4-x3);
    (a==b)? cout<<"YES"<<endl : cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;


int main()
{
	int n;
	cin >> n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = (y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1);
		if (fabs(a) < EPS )printf("YES\n");
		else printf("NO\n");
	}
	
	return 0;
}

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

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

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

int main(){
	int n;cin >> n;
	float a[8], x1, x2, y1, y2, ans;
	while(n--){
		for(int i = 0;i < 8;i++)cin >> a[i];
		y1 = a[3]-a[1];x1 = a[2]-a[0];
		y2 = a[7]-a[5];x2 = a[6]-a[4];
		ans = y1*x2-y2*x1;
		if(ans == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double EPS = 1e-12;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];

    if(s * v - t * u > 0){
        double m = s * v - t * u;
    }
    else{
        double m = t * u - s * v;
    }

    cout << "NO" << endl;
}

C++: #include<iostream>
#include<vector>
struct Coordinate {
	double x;
	double y;
};
std::vector<bool>l;
int main() {
	Coordinate A, B, C, D;
	double Inclination_of_AB;
	double Inclination_of_CD;
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++){
		std::cin >> A.x >> A.y >> B.x >> B.y;
		Inclination_of_AB = (B.x - A.x) / (B.y - A.y);
		std::cin >> C.x >> C.y >> D.x >> D.y;
		Inclination_of_CD = (D.x - C.x) / (D.y - C.y);
		if (Inclination_of_AB == Inclination_of_CD)
			l.push_back(true);
		else l.push_back(false);
	}
	for (bool i : l) {
		if (i)std::cout << "YES";
		else std::cout << "NO";
		std::cout << std::endl;
	}
	char c;
	std::cin >> c;
}