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[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			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>
using namespace std;
int main(){
    int n;
    cin >> n;
    double x1,x2,x3,x4,y1,y2,y3,y4;
    while(n--){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if (x1==x2){
            if(x3==x4)
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
        }
        else if((y2-y1)*(x4-x3)==(y4-y3)*(x2-x1))
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
    }

}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

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

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

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

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = 99999, b = 99999;
		if (y2 - y1 != 0) {
			a = (y2 - y1) / (x2 - x1);
		}
		if (y4 - y3 != 0) {
			b = (y4 - y3) / (x4 - x3);
		}
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

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

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

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

  for(int i=0;i<n;i++){
    complex<double> v[4];
    for(int j=0;j<4;j++){
      double x,y;
      cin >> x >> y;
      v[j]=complex<double>(x,y);
    }

    if(abs((conj(v[1]-v[0])*(v[3]-v[2])).imag())<0.01)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>
using namespace std;
int main() {
	double x[4],y[4];
	int n;
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 4;j++) {
				cin >> x[j] >> y[j];
		}
		double X1, Y1, X2, Y2;
		X1 = x[1] - x[0];
		X2 = x[3] - x[1];
		Y1 = y[1] - y[0];
		Y2 = y[3] - y[2];
		if (X1*Y2 == X2*Y1) {
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

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

C++: #include<stdio.h>

int main(void){
	double x[4] = { 0 };
	double y[4] = { 0 };
	int n = 0;
	int i;
	scanf("%d", &n);
	while (n-- > 0){
		for (i = 0; i < 4; i++)
			scanf("%lf %lf", &x[i], &y[i]);
		for (i = 0; i < 4; i += 2) {
			x[i] -= x[i + 1];
			y[i] -= y[i + 1];
		}
		if (x[0] == 0 || x[2] == 0){
			if (x[0] == 0 && x[2] == 0)
				printf("YES\n");
			else
				printf("NO\n");
		}
		else if ((y[0] / x[0]) == (y[2] / x[2]))
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 1e9
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
const double eps=1e-10;
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(((abs(y1-y2)/abs(x1-x2))<=(abs(y3-y4)/abs(x3-x4))+eps)&&
((abs(y1-y2)/abs(x1-x2))>=(abs(y3-y4)/abs(x3-x4))-eps))
  cout<<"YES"<<endl;
 else
   cout<<"NO"<<endl;
}
return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
using namespace std;
int main() {
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = 9090909, b = 9090909;
		if(x1!=x2)a = (y1 - y2) / (x1 - x2);
		if(x3!=x4)b = (y3 - y4) / (x3 - x4);
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

int main()
{
	const double EPS = 1e-20;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		double a = arg((A-B)/(C-D));
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "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.000000001;
	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;
}