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)
		}
		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 <bits/stdc++.h>
using namespace std;

int main(){
  int n;cin>>n;
  for(int i=0;i<n;++i){
    vector<pair<double, double>> coordinates;
    for(int j=0;j<4;++j){
      double a,b;cin>>a>>b;
      coordinates.emplace_back(make_pair(a,b));
    }
    int tan1,tan2;
    tan1 =10000*fabs((coordinates[2].second-coordinates[1].second)/(coordinates[2].first-coordinates[1].first));
    tan2 =10000*fabs((coordinates[4].second-coordinates[3].second)/(coordinates[4].first-coordinates[3].first));
   // cout<<tan1<<" "<<tan2<<endl;
    tan1 == tan2 ? cout<<"YES"<<endl : cout<<"NO"<<endl;
  }
  return EXIT_SUCCESS;
}

C++: 
#include<cstdio>
#include<cstdlib>
#include<cmath>
 
using namespace std;
int main(void)
{
    int n;
    double x[4],y[4];
    double k[2];
    scanf("%d",&n);
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < 4;j++) scanf("%lf%lf",&x[j],&y[j]);
        k[0] = (y[0]-y[1])/(x[0]-x[1]);
        k[1] = (y[2]-y[3])/(x[2]-x[3]);
        if(k[0] == k[1]) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

C++: #include <stdio.h>
#include<cmath>
using namespace std;

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int n;
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);

		if(abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < 0.0000000001){ //I copied yutaka watabe's code here
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
    return 0;
}

C++: #include <stdio.h>
#include <math.h>

const double eps = 1e-7;

int n;
//math.hライブラリでy1, y2...とかって変数名が使われてるらしい
double ix1, ix2, ix3, ix4;
double iy1, iy2, iy3, iy4;

//増加率を見る方法
int solve1() {
    double r1 = (iy2-iy1)/(ix2-ix1);
    double r2 = (iy4-iy3)/(ix4-ix3);
    return (fabs(r1-r2) < eps);
}

int main() {
    scanf("%d", &n);
    for(int i=0; i<n; ++i) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ix1, &iy1, &ix2, &iy2, &ix3, &iy3, &ix4, &iy4);
        if(solve1()) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
}

C++: #include <iostream>

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 ( ( (x1==x2) && (y1==y2) ) || ( (x3==x4) && (y3==y4) ) ) {
			cout << "NO" << endl;
			continue;
		}
		
		double LHS = (100000.0 * (y2 - y1)) * (x4 - x3);
		double RHS = (100000.0 * (y4 - y3)) * (x2 - x1);
		//cout << LHS << " " << RHS << endl;
		//if ( (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1) ) cout << "YES" << endl;
		if ( LHS == RHS ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
		
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
 
  double ax,ay,bx,by,cx,cy,dx,dy;
  double n,s,t;
 
  cin >> n;
 
  for(int i=0;i<n;i++){
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
 
    s = (ay - by) / (ax - bx);
    t = (cy - dy) / (cx - dx);
 
    if(s == t) cout << "YES" << endl;
    else cout << "NO" << endl;
 
  }
}

C++: #include <iostream>

int main() {
    int n;
    std::cin >> n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < n;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}

C++: #include <bits/stdc++.h>

using namespace std;

#define EQ(x, y) (abs(x - y) < 0.000001)

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

  double cx[4], cy[4];
  for (int i = 0 ; i < n; ++i) {
    for (int j = 0; j < 4; j++)
      cin >> cx[j] >> cy[j];
    
    if (EQ(cx[1], cy[0]) && EQ(cx[3], cx[2])) {
      if (EQ(cy[1], cy[0]) || EQ(cy[3], cy[2])) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    } else if (EQ(cx[1], cx[0]) || EQ(cx[3], cx[2])) {
      cout << "NO" << endl;
    } else if (!EQ(cx[1], cx[0]) && !EQ(cx[3], cx[2])) {
      double k1 = (cy[1] - cy[0]) / (cx[1] - cx[0]);
      double k2 = (cy[3] - cy[2]) / (cx[3] - cx[2]);
      if (EQ(k1, k2)) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
}

C++: #include<iostream>
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
    //if(a[0]-b[0]==0&&c[0]-d[0]==0) cout << "YES" << endl;
    //else if(a[1]-b[1]==0&&c[1]-d[1]==0) cout << "YES" << endl;
    //else if(a[0]-b[0]==0||c[0]-d[0]==0) cout << "NO" << endl;
    if((b[1]-a[1])*(d[0]-c[0])==(d[1]-c[1])*(b[0]-a[0])) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

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

int main(void){
  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( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)n; i++)
#define PI 3.14159265358979323846
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define pll pair<long long, long long>
using namespace std;
using ll = long long;
using ld = long double;

// ----本問について----
// 問題：
// 問題文URL：
// 所要時間：
// 学んだこと：
// ------------------

// ----ここから本問のソースコード----

// グローバル変数（入力）
ld x[4],y[4];

void solve() {
  if ((y[1]-y[0])*(x[3]-x[2])==(x[1]-x[0])*(y[3]-y[2])){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

int main() {
  ll n;
  cin >> n;
  rep(i,n){
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    solve();
  }
  return 0;
}

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

int main(){
  int n = 0;
  cin >> n;
  for(int i=0;i<n;i++){

    double x1 = 0.0;
    double y1 = 0.0;
    double x2 = 0.0;
    double y2 = 0.0;
    double x3 = 0.0;
    double y3 = 0.0;
    double x4 = 0.0;
    double y4 = 0.0;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    double a = (y2 - y1) / (x2 - x1);
    double b = (y4 - y3) / (x4 - x3);
    double d = (y3 - y4) / (x3 - x4);
    double x = (y3 - y1) / (x3 - x1);

    if((a == b || a == d) && (a != x)){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }

  return 0;
}