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 <iostream>
#include <vector>

int main(int argc, const char * argv[]) {
    std::vector<int> r;
    int num;
    std::cin >> num;
    double xa,ya,xb,yb,xc,yc,dx,dy;
    double a,b;
    for(int i = 0;i < num;i++){
        std::cin >> xa >> ya>> xb >> yb >> xc >> yc >> dx >> dy;
        a = (yb - ya) / (xb - xa);
        b = (dy - yc) / (dx - xc);
        if(a == b){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
}

C++: #include <iostream>
using namespace std;
int n;
double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;
int main(){
	int i;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
		ta = xa - xb;
		tb = ya - yb;
		tc = xc - xd;
		td = yc - yd;
		if(tb == td || ta == tc) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
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>
using namespace std;
int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4,a,b,n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    a = (y2-y1) / (x2-x1);
    b = (y4-y3) / (x4-x3);
    a == b ? cout << "YES" << endl : cout << "NO" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n;
	pair<long double,long double> p[4],vec[2];
	cin>>n;
	rep(j,n){
		rep(i,4)cin>>p[i].first>>p[i].second;
		rep(i,2){
			vec[i].first=p[i*2].first-p[i*2+1].first;
			vec[i].second=p[i*2].second-p[i*2+1].second;
		}
		double check=vec[0].first*vec[1].second-vec[0].second*vec[1].first;
		if(check==0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	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;

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

}

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

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

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}
using namespace std;
int main() {
    int n;
    cin >> n;
    rep(j,n) {
        complex<double> a[4];
        rep(i, 4) {
            double x, y;
            cin >> x >> y;
            a[i] = *(new complex<double>(x, y));
        }
        complex<double> vAB = a[0] - a[1];
        complex<double> vCD = a[2] - a[3];
        double m1 = arg(vAB);
        double m2 = arg(vCD);
        cout << ((m1==m2) ? "YES" : "NO") << endl;
    }
}

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

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		long double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>
??
using namespace std;
??
inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}
??
typedef long long ll;
??
int main()
{
????????int num;
????????double sx1, sy1, sx2, sy2;
????????double ex1, ey1, ex2, ey2;
??
????????cin >> num;
??
????????for(int i = 0; i < num; i++)
????????{
????????????????cin >> sx1 >> sy1 >> sx2 >> sy2 >> ex1 >> ey1 >> ex2 >> ey2;
??
????????????????if( (sy2-sy1)/(sx2 - sx1) == (ey2-ey1)/(ex2-ex1))
????????????????{
????????????????????????cout << "YES" << endl;
????????????????}
????????????????else
????????????????{
????????????????????????cout << "NO" << endl;
????????????????}
????????}
}

C++: #include <iostream>
using namespace std;
int n;
double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;
int main(){
	int i;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
		ta = xb - xa;
		tb = yb - ya;
		tc = xd - xc;
		td = yd - yc;
		if(tb == td && ta == tc) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cassert>
#include<cstdlib>
using namespace std;
#define EPS 0.0000001
 
 
int main(){
  int tcase;   cin >> tcase;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  for ( int i = 0; i < tcase; i++ ){
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
   
      if ( abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < EPS ) cout << "YES" << endl;
      else cout << "NO" << endl;
  }
  return 0;
}