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 <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> comp;

const double EPS = 1e-10;

int main(){
  int n;
  cin >> n;
  while(n--){
    comp p[4];
    for(int i=0; i<4; i++){
      double x,y;
      cin >> x >> y;
      p[i] = comp(x,y);
      p[i] -= p[i/2*2]*(double)(i%2);
    }
    if(abs(sin(arg(p[1]/p[3]))) < EPS)
      cout << "YES";
    else cout << "NO";
    cout << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        double x1,y1,x2,y2,x3,y3,x4,y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(((x1-x2)*(y1-y2))-((x3-x4)*(y3-y4))==0||((x1-x2)*(y1-y2))-((x3-x4)*(y3-y4))==-0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void) {
    int n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    double EPS = 1e-10;
    cin>>n;
    for (int i=0;i<n;i++) {
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if ( abs((y4-y3)*(x2-x1)-(y2-y1)*(x4-x3))<EPS ) {
            cout<<"YES"<<endl;
        } else {
            cout<<"NO"<<endl;
        }
    }
}

C++: #include<iostream>
using namespace std;
int main(){
	double x1, y1, x2, y2, x3, y3, x4, y4, p1, p2;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		p1 = (y2 - y1) / (x2 - x1);
		p2 = (y4 - y3) / (x4 - x3);
		if(p1 == p2)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;	
	}
}

C++: #include <iostream>
#include <complex>
 
using namespace std;
 
typedef complex<double> P;
 
#define EPS (1e-10)
#define EQ(a, b) (abs((a) - (b)) < EPS)
#define EQV(a, b) ((EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()))
 
double cross(P a, P b) 
{
    return (a.real() * b.imag() - a.imag() * b.real());
}
 
bool is_parallel(P a1, P a2, P b1, P b2) 
{
    return EQ(cross(a1 - a2, b1 - b2), 0.0);
}
 
 
int main()
{
    int num;
    double  x1, y1, x2, y2, x3, y3, x4, y4;
     
    cin >> num;
    for (int i = 0; i < num; i++) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
         
        if (is_parallel(P(x1, y1), P(x2, y2), P(x3, y3), P(x4, y4)))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
 
    return 0;
}

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

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

int main()
{
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		if ((x2 - x1)*(y4 - y3) - (x4 - x3)*(y4 - y3) == 0)
		{
			printf("NO\n");
		}
		else
		{
			printf("YES\n");
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;
const double eps = 1e-11;

int main(){
	int N;
	vd a(8);
	cin >> N;
	rep(i,N){
		rep(i,8){
			cin>>a[i];
		}
		if(abs((a[1]-a[3])*(a[4]-a[6])-(a[5]-a[7])*(a[0]-a[2]))< eps){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}

}

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

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

  for(int i = 0; i < n; i++) {
    double d[8];
    for(int j = 0; j < 4*2; j++)
      cin >> d[j];
    double tanAB = (d[3]-d[1])/(d[0]-d[2]);
    double tanCD = (d[7]-d[5])/(d[4]-d[6]);
    if(tanAB == tanCD)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include <cstdio>
#include <cmath>

int main(){
 int n;
 scanf("%d\n",&n);
 for(int i = 0;i < n;i++){
  float x1,x2,x3,x4,y1,y2,y3,y4;
  scanf("%f %f %f %f %f %f %f %f\n",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
  if(atan((y1 - y2) / (x1 - x2)) == atan((y3 - y4) / (x3 - x4))){
   printf("YES\n");
  }else{
   printf("NO\n");
  }
 }
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

C++: #include <stdio.h>

int main(void)
{
  int n,i;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int ans[100];
  
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
  
    if( (y2-y1)*(x4-x3) == (y4-y3)*(x2-x1) ){
      ans[i] = 1;
    }else{
      ans[i] = 0;
    }
  }

  for(i = 0;i < n;i++){
    if(ans[i] == 1){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}