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 <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

using namespace std;

typedef complex<double> point;
typedef pair<int, int> paii;
typedef long long ll;

double cross(point va, point vb){
	return real(va) * imag(vb) - imag(va) * real(vb);
}

int is_parallel(point a1, point a2, point b1, point b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}

int main()
{
	int n;
	cin >> n;
	
	FOR(i, 0, n)
	{
		double x, y;
		point pt[4];
		
		FOR(j, 0, 4)
		{
			cin >> x >> y;
			pt[j] = point(x, y);
		}
		
		if( is_parallel(pt[0], pt[1], pt[2], pt[3]) )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	
	return 0;
}

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

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
double x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4, a, b, x;
double gradien(double x_1, double y_1, double x_2, double y_2){
	double m = 0;
	m = (y_1 - y_2)/(x_1 - x_2);
	
	return m;
}
int main(){
	cin >> x;
	for(int i = 1; i <= x; i++){
		cin >> x_1 >> y_1 >> x_2 >> y_2 >> x_3 >> y_3 >> x_4 >> y_4;
		a = gradien(x_1, y_1, x_2, y_2);
		b = gradien(x_3, y_3, x_4, y_4);
		if(a == b){
			cout << "YES\n";
		}
		else{
			cout << "NO\n";
		}
	}
	return 0;
}

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

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	int n;
	cin>>n;
	while (n--){
		vector<pair<double, double>> pos(4);
		REP(i, 4){
			cin >> pos[i].first >> pos[i].second;
		}

		if (abs((pos[1].first - pos[0].first)*(pos[3].second - pos[2].second) - (pos[1].second - pos[0].second)*(pos[3].first - pos[2].first))<=0.000001)
			cout << "YES"<<endl;
		else
			cout << "NO"<<endl;
		
	}
}

C++: #include <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> xy_t;

double cross_product(xy_t a, xy_t b) {
	return (conj(a) * b).imag();
}

const double eps = 1e-11;

int main() {
	int n;
	double x[4];
	double y[4];
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		bool result = abs(cross_product(xy_t(x[0], y[0]) - xy_t(x[1], y[1]), 
						xy_t(x[2], y[2]) - xy_t(x[3], y[3]))) < eps;
		cout << (result ? "YES" : "NO") << endl;
	}
}

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

using namespace std;

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double deg1, deg2;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		deg1 = atan2(x2 - x1, y2 - y1);
		deg2 = atan2(x4 - x3, y4 - y3);
		if (deg1 == deg2)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

C++: #include<iostream>
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;
    long long int xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4;
    xx1 = x1*100000;
    yy1 = y1*100000;
    xx2 = x2*100000;
    yy2 = y2*100000;
    xx3 = x3*100000;
    yy3 = y3*100000;
    xx4 = x4*100000;
    yy4 = y4*100000;

    long long int abx=x1-x2;
    long long int aby=y1-y2;
    long long int cdx=x3-x4;
    long long int cdy=y3-y4;
    if(abx == 0 && cdx == 0){
      cout<<"YES"<<endl;
    }
    else if(abx == 0 || cdx == 0){
      cout<<"NO"<<endl;
    }else if(aby*cdx == cdy*abx)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <cstdio>

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

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=1e-10;
	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;
}