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")
			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<stdio.h>

int main(void)
{
	double x[4]={0},y[4]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		x1 = x[2]-x[1];   y1 = y[2]-y[1];
		x2 = x[4]-x[3];   y2 = y[4]-y[3];
		if(x1==0 && x2==0)
			printf("YES\n");
		else if(x1==0 || x2==0)
			printf("NO\n");
		else if(y1/x1 == y2/x2)
			printf("YES\n");
		else 
			printf("NO\n");

		i-=1;
	}
 return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

#include <complex>
typedef complex<double> P;

struct L {
	P a, b;
	L(const P &a, const P &b) : a(a), b(b) { }
};

struct C {
	P p; double r;
	C(const P p, double r) : p(p), r(r) { }
};

double dot(P a, P b) {
	return real(conj(a)*b);
}

double cross(P a, P b) {
	return imag(conj(a)*b);
}

bool LLcross(L l1, L l2) {
	return abs(cross(l1.b-l1.a, l2.b-l2.a)) > EPS || abs(cross(l1.b-l1.a, l2.b-l1.a)) < EPS;
}

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

	REP(i, n) {
		double x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		L l1(P(x1, y1), P(x2, y2));

		
		cin >> x1 >> y1 >> x2 >> y2;
		L l2(P(x1, y1), P(x2, y2));

		cout << (LLcross(l1, l2) ? "NO" : "YES") << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll Pow(ll x,ll y){
  ll ans = 1;
  while(y){
    if(y%2) ans *= x;
    x *= x;
    y >>= 1;
  }
  return ans;
}
ll to_decimal(string s,ll B){
  int t = s.find("."),i,n = s.size();
  if(t == string::npos) return -1;
  if(s.size()-t-1 > B) return -1;
  ll ans = 0,x = Pow(10,B+t+1-s.size());
  bool minus = s[0] == '-';
  for(i=s.size()-1;i>=minus;i--){
    if(i == t) continue;
    if(s[i] == '-') ans = -ans;
    else ans += (s[i]-'0')*x;
    x *= 10;
  }
  if(minus) ans = -ans;
  return ans;
}
int main(){
  ll x1,y1,x2,y2,x3,y3,x4,y4;int n,i;
  string a,b,c,d,e,f,g,h;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    x1 = to_decimal(a,5);
    y1 = to_decimal(b,5);
    x2 = to_decimal(c,5);
    y2 = to_decimal(d,5);
    x3 = to_decimal(e,5);
    y3 = to_decimal(f,5);
    x4 = to_decimal(g,5);
    y4 = to_decimal(h,5);
    printf((x2-x1)*(y4-y3) == (x4-x3)*(y2-y1) ? "YES\n":"NO\n");
  }
}

C++: #include <stdio.h>

int main()
{
	int n;
	double x1, x2, x3, x4, y1, y2, y3, y4, l, m;

	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);

		l = (x2-x1)*(y4-y3);
		m = (x4-x3)*(y2-y1);
		if(l == m) puts("YES");
		else puts("NO");
	}

	return 0;
}

C++: n=gets.to_i;n.times{a,b,c,d,e,f,g,h=gets.split.map &:to_f;puts (c-a)*(h-f)-(d-b)*(g-e)==0.0 ?"YES":"NO"}

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
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-8;
const double PI  = acos(-1.0);

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  REP(n,N){
	double x[4], y[4];
	REP(i,4)
	  cin >> x[i] >> y[i];
	x[1] -= x[0], y[1] -= y[0], x[3] -= x[2], y[3] -= y[2];

	if(abs(x[1]*y[3]-x[3]*y[1]) < EPS)
	  cout << "YES" << endl;
	else
	  cout << "NO" << endl;
  }
  
  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
void check(){
    
}

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

C++: #include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <stack>
#include <cstring>

using namespace std;

int main(){
	int n;
	pair<double,double> input[4];
	double kata1,kata2;
	cin >> n;
	while(n--){
		for(int i = 0; i < 4; i++){
			cin >> input[i].first >> input[i].second;
		}

		kata1 = (input[1].second - input[0].second) / (input[1].first - input[0].first);
		kata2 = (input[3].second - input[2].second) / (input[3].first - input[2].first);

		if(kata1 == kata2){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}

	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		double x1,x2,x3,x4,y1,y2,y3,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double v1x = x2-x1;
		double v1y = y2-y1;
		double v2x = x4-x3;
		double v2y = y4-y3;
		double op = v1x*v2y-v1y*v2x;
		if(op<0.00000000001) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}