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(){
  float a,b,c,d,e,f,g,h;
  int t;
  
  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    if((d-b)/(c-a) == (h-f)/(g-e)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
 
  return 0;
}

C++: #include<iostream>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main()
{
          float x1,y1,x2,y2,x3,y3,x4,y4,a,b,c,d,e,f,g,h,i;
          cin>>a;
          for(i=0;i<a;i++)
          {
                    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
                    b=((y2-y1)/(x2-x1));
                    c=((y4-y3)/(x4-x3));
                    if(b==c)
                              cout<<"YES\n";
                    else
                              cout<<"NO\n";
          }
return 0;
}

C++: //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef pair<int, int> pii;

// const ll inf = INT_MAX;
const double eps = 1e-7;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){

	int n;
	scanf("%d\n", &n);
	double x[4], y[4];
	rep(i,n){
		rep(j,4){
			scanf("%lf %lf", &x[j], &y[j]);
		}
		double dx[2], dy[2];
		dx[0] = x[1] - x[0];
		dx[1] = x[3] - x[2];
		dy[0] = y[1] - y[0];
		dy[1] = y[3] - y[2];
		if(std::abs(dy[1]*dx[0] - dy[0]*dx[1]) < eps) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

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

int main() {
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  double d1, d2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if (x2 == x1 && x4 == x3 ){
      cout << "NO" << endl;
    } else {
      d1 = (y2 - y1) / (x2 - x1);
      d2 = (y4 - y3) / (x4 - x3);
      if (d1 == d2) {
        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(abs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) <= 1e-10){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

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

const double EPS = 1e-10;

signed main() {
  int n;

  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; cin >> x[i] >> y[i], i++);
    double vx1 = x[1] - x[0], vy1 = y[1] - y[0],
           vx2 = x[3] - x[2], vy2 = y[3] - y[2];
    if (fabs(vx1 * vy2 - vy1 * vx2) < EPS) {
      puts("YES");
    } else {
      puts("NO");
    }
  }

  return 0;
}

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

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

int main(){
	long double x1,y1,x2,y2;
	long double x3,y3,x4,y4;
	long 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(long double x1,long double y1,long double x2,long double y2){
	return (x1-x2)/(y1-y2);
}

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

#define EPS 1e-5
 
struct point{
	double x;
	double y;
};

struct line{
	double a;
	double b;
};

bool get_line( const point& a , const point& b , line *a_b );
istream& operator >> ( istream& s , point& p );
 
int main(void)
{
	point a, b, c, d;
 
    line a_b, c_d;
 
    bool result1 , result2;
 
    int num;
 
    cin >> num;
 
    for( int i = 0 ; i < num ; i++ )
    {
        cin >> a >> b >> c >> d;
 
        result1 = get_line( a , b , &a_b );
        result2 = get_line( c , d , &c_d );
 
        if( result1 == false && result2 == false )
        {
            cout << "YES" << endl;
        }
        else
        {
            if( fabs(a_b.a - c_d.a) < EPS ) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
 
    return 0;
}

istream& operator >> ( istream& s , point& p )
{
	return s >> p.x >> p.y;
}

bool get_line( const point& a , const point& b , line *a_b )
{
	if( fabs(a.x - b.x) < EPS ) return false;
	else{
		a_b->a = (a.y - b.y)/(a.x - b.x);
		a_b->b = a.y - (a.x * a_b->a);
		return true;
	}
}

C++: // 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;
long double eps = 1e-9;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int t;
	cin >> t;
	while(t--){
		pair<long double, long double> cors[4];
		for(int i = 0; i < 4; i++){
			cin >> cors[i].first >> cors[i].second;
		}
		long double slope1 = (cors[1].second - cors[0].second) * (cors[3].first - cors[2].first);
		long double slope2 = (cors[3].second - cors[2].second) * (cors[1].first - cors[0].first);
		// deb(slope1, slope2);
		if(slope1 - slope2 == 0){
			cout << "YES\n";
		}
		else cout << "NO\n";
	}
	return 0;
}
// Write Here

C++: #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define INF 1e+10

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

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main(void){
	int n;cin>>n;
	while(n--){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double dx1 = x2 - x1;
		double dy1 = y2 - y1;
		double dx2 = x4 - x3;
		double dy2 = y4 - y3;
		double dot = (dx1 * dx2 + dy1 * dy2);
		if(fabs((dx1*dx1 + dx2*dx2)*(dy1*dy1 + dy2*dy2) - dot*dot) < 1e-5) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}