Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                fmt.Scanf("%f %f %f %f %f %f %f %f",
                        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	while(n-- >0 ){
            vector<double>x(4),y(4);
            for(int i=0;i<4;i++)
	             cin>>x[i]>>y[i];
	    if( fabs((x[1]-x[0])*(y[3]-y[2]) - (x[3]-x[2])*(y[1]-y[0])) <1.0e-10  )          
			cout << "YES" << endl;
            else
                       cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;
int main(){
	double a,b,c,d,e,f,g,h;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b>>c>>d>>e>>f>>g>>h;
		if((d-b)/(c-a)==(h-f)/(g-e)){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>

#define rep(i, n) for(int i=0; i<(int)(n); i++)

int main() {
	int n;
	scanf("%d", &n);
	rep(q, n) {
		double x[4], y[4];
		rep(i, 4) scanf("%lf%lf", x+i, y+i);
		double x1=x[1]-x[0], x2=x[3]-x[2], y1=y[1]-y[0], y2=y[3]-y[2];
		if(x1*y2-x2*y1==0) printf("YES\n");
		else printf("NO\n");
	}
}

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

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		
		double x1, y1, x2, y2, x3, y3, x4, y4;
		
		if (sscanf(line, "%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) != 8) {
			return 1;
		}
		
		double a = INFINITY;
		double b = INFINITY;

		if (x1 != x2) {
			a = (y2 - y1)/(x2 - x1);
		}
		if (x3 != x4) {
			b = (y4 - y3)/(x4 - x3);
		}
		
		printf("%s\n", ((a == b) ? "YES" : "NO"));
	}

	return 0;
}

C++: #include<complex>
#include<iostream>
int main(){const double E=1e-10;int n;double x1,y1,x2,y2,x3,y3,x4,y4;std::cin>>n;while(n--){std::cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;std::cout<<(std::abs((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1))<E)?"YES\n":"NO\n";}}

C++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

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

  return 0;
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y;
  double x1,y1;
  int n;
  int i;
  long double a,b;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      a=(y1-y)/(x1-x);

      cin>>x>>y>>x1>>y1;
      b=(y1-y)/(x1-x);
	
      if(a==b)
        puts("YES");
      else
        puts("NO");
    }

}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double a1=0.0,a2=0.0;
	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(x1!=x2)a1=(y1-y2)/(x1-x2);
			if(x3!=x4)a2=(y3-y4)/(x3-x4);
		
			if( a1==a2 && x1!=x2 && x3!=x4)printf("YES\n");
			else if(x1==x2 && x3==x4)printf("YES\n");
			else printf("NO\n");
			a1=0;
			a2=0;
	}
return 0;
}

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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);

  for (int c = 0; c < n; ++c) {
    double input[8];
    for (int i = 0; i < 8; ++i) {
      scanf("%lf", &input[i]);
    }
    double k1 = (input[3] - input[1]) / (input[2] - input[0]);
    double k2 = (input[7] - input[5]) / (input[6] - input[4]);

    if (k1 == k2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    const double EPS = 1e-12;
    double x[5];
    double y[5];
    double s;
    double t;
    double u;
    double v;
    double m;
    int n;
    cin >> n;

    for(int i = 0;i < n;i++){
        cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

        s = x[1] - x[0];
        t = y[1] - y[0];
        u = x[3] - x[2];
        v = y[3] - y[2];

        if(s * v - t * u > 0){
            m = s * v - t * u;
        }
        else{
            m = t * u - s * v;
        }

        if(m < EPS){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

#define EPS 1e-7
#define EQUAL(a, b) (fabs((a)-(b))<EPS)

typedef vector<int> vi;

int main()
{
	int n;
	scanf("%d", &n);
	rep(i, n){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		puts(EQUAL((x2-x1)*(y4-y3), (y2-y1)*(x4-x3)) ? "YES" : "NO");
	}

	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(){
  int N; cin >> N;
  for(;--N;){
	double x[4], y[4];
	REP(i,4)
	  cin >> x[i] >> y[i];
	//x[0] -= x[1], y[0] -= y[1], x[2] -= x[3], y[2] -= y[3];

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