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 <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }

struct Point2D { 
	double x, y;
	Point2D (double a=0, double b=0) { x=a; y=b; }
};

int main() {
	int n; cin >> n;
	Point2D a, b, c, d;
	
	for (int i=0; i<n; i++) {		
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		cout 
		double p = (a.y-b.y)/(a.x-b.x), q = (c.y-d.y)/(c.x-d.x);
		
		if (fabs(p-q) < 1e-9) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define EPS 1e-9

using namespace std;

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

double dot (double xa, double ya, double xb, double yb )
{
	return (xa*xb + ya*yb );
}

double calc_len (double x, double y )
{
	return sqrt (x*x + y*y );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.Parallelism", "r", stdin );
	int n;
	scanf ("%d", &n );
	rep (i, n ){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double d = dot (x2-x1, y2-y1, x4-x3, y4-y3 );
		double len1 = calc_len (x2-x1, y2-y1 );
		double len2 = calc_len (x4-x3, y4-y3 );

		if (fabs (len1*len2 - fabs(d ) ) < EPS ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if
	} // end loop
		
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){

  int n;
  double p[4][2];

  cin >> n;

  while(n--){

    for(int i = 0; i < 4; ++i){
      for(int j = 0; j < 2; ++j){
	cin >> p[i][j];
      }
    }
    
    if(((p[1][1] - p[0][1]) / (p[1][0] - p[0][0])) == ((p[3][1] - p[2][1]) / (p[3][0] - p[2][0]))) cout << "YES" << endl;
    else cout << "NO" << endl;

  }

}

C++: #include <iostream>
#include <cmath>
#define VLN 0.0000000000001
using namespace std;

int main(){
	double N,X[5],Y[5];
	cin>>N;
	for(int j=1;j<=N;j++){
		for(int i=1;i<=4;i++){
			cin>>X[i]>>Y[i];
		}
		if(abs((X[2]-X[1])*(Y[4]-Y[3])-(X[4]-X[3])*(Y[2]-Y[1]))<VLN){
			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;

}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
typedef pair<double,double> pdd;
int main(){
    pdd no1,no2,no3,no4;
    int n;cin>>n;
    rep(i,n){
        cin>>no1.first>>no1.second>>no2.first>>no2.second>>no3.first>>no3.second>>no4.first>>no4.second;
        double d1=(no2.second-no1.second)/(no2.first-no1.first);
        double d2=(no4.second-no3.second)/(no4.first-no2.first);
        if(d1==d2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <iostream>

using namespace std;
int main(void){
    // Here your code !
int n;
double x1,x2,x3,x4,y1,y2,y3,y4;
cin>>n;
for(int i=0;i<n;i++){
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<cmath>
using namespace std;

typedef struct xyz{
    double x;
    double y;
}XYZ;

int main(void){

    int times;
    cin >> times;

    XYZ a,b,c,d;
    double x1,y1,x2,y2;

    while(times > 0){
        cin >> a.x >> a.y;
        cin >> b.x >> b.y;
        cin >> c.x >> c.y;
        cin >> d.x >> d.y;

        x1 = a.x - b.x;
        y1 = a.y - b.y;
        x2 = c.x - d.x;
        y2 = c.y - d.y;

        

        if(((y1 * x2) - (y2 * x1)) == 0.0){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

        times--;
    }


    return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
typedef complex<double> xy_t;
int main()
{
  int n;
  double x,y;
  queue<string> qs;
  cin >> n;
  for( int i = 0; i < n; ++i){
    xy_t p[4];
    for( int j = 0; j < 4; ++j){
      cin >> x >> y;
      p[j] = xy_t(x,y);
    }
    double S;
    S =(conj(p[0] - p[1])*(p[2] - p[3])).imag();
    if( S == 0) qs.push("YES");
    else qs.push("NO");
  }
  while(!qs.empty()){
    cout << qs.front() << endl;
    qs.pop();
  }
}