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++: /*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A&lang=jp
所要時間は15分程度。一つ目の例題をACしてしまえばやるだけといいった印象。
着席位置は{中央x中央}
*/


#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<complex>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;
using std::abs;
using std::complex;

#define INF 999999999;
#define MOD 1000000007

using ulli = unsigned long long int;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

using Comp = complex<double>;

int n;
double x1, y1n, x2, y2, x3, y3, x4, y4;

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

    scanf("%d", &n);
    for(int i = 0; i < n; i++){
            scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1n, &x2, &y2, &x3, &y3, &x4, &y4);
            //printf("%f %f %f %f %f %f %f %f", x1, y1n, x2, y2, x3, y3, x4, y4);
            Comp ab = Comp(x2-x1, y2-y1n);
            Comp cd = Comp(x4-x3, y4 - y3);
            double s = ab.real() * cd.imag() - ab.imag()*cd.real();
            //dbug(s)
            if(abs(s) < 0.0000000001) printf("YES\n");
            else printf("NO\n");
    }

    return 0;
}

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

using namespace std;

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

typedef complex<double> P;
struct Line : public vector<P>
{
  Line(P a=P(), P b=P()) {
    push_back(a); push_back(b);
  }
};

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

bool is_parallel(Line const& s, Line const& t) {
  return abs(cross(s[1]-s[0], t[1]-t[0])) < 1e-5;
}

int main() {
  int N; cin >> N;
  rep(tc, 2) {
    P ps[4]; rep(i, 4) cin >> ps[i].real() >> ps[i].imag();
    cout << (is_parallel(Line(ps[0], ps[1]), Line(ps[2], ps[3])) ? "YES\n" : "NO\n");
  }
}

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

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

C++:  #include <functional>
 #include <algorithm>
 #include <iostream>
 #include <numeric>
 #include <iomanip>
 #include <utility>
 #include <cstdlib>
 #include <sstream>
 #include <bitset>
 #include <vector>
 #include <cstdio>
 #include <ctime>
 #include <queue>
 #include <deque>
 #include <cmath>
 #include <stack>
 #include <list>
 #include <map>
 #include <set>
 
 using namespace std;
 
 typedef vector<int> VI;
 typedef pair<int,int> pii;
 typedef long long ll;
 
 #define dump(x)  cerr << #x << " = " << (x) << endl
 #define rep(i,n) for(int i=0;i<(n);i++)
 #define ALL(a)  (a).begin(),(a).end()
 #define PB push_back
 #define sz size()
 
 const double EPS = 1e-10;
 const int INF = 100000000;
 
 
 
 int main(){
 int n;
 cin>>n;
 double a,b,c,d, e,f,g,h;
 rep(i,n){
 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 <iostream>
#include <complex>
using namespace std;

#define P complex<double>

int main(){
  int n;
  P a,b,c,d;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> a.real() >> a.imag();
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    cin >> d.real() >> d.imag();

    P x=a-b, y=c-d;
    x = x/abs(x);
    y = y/abs(y);

    if( abs( x-y ) < 1.0e-4 || abs( x+y )<1.0e-4 )
      /*
      abs(x.real()-y.real()) < 1.0e-4  &&
	abs(x.imag()-y.imag()) < 1.0e-4  )
      */
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

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

int main()
{
	int n;
	cin >> n;
	
	float point[4][2];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 2; k++) {
				cin >> point[j][k];
			}
		}

		if ((point[1][1] - point[0][1]) / (point[1][0] - point[0][0]) == ((point[3][1] - point[2][1]) / point[3][0] - point[2][0]))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double a1,a2;
	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(((y1-y2)*(x3-x4))==((y3-y4)*(x1-x2)))printf("YES\n");
		else printf("NO\n");
	}
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.000000000){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}

}

C++: #include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(void)
{
    double x1,x2,x3,x4,y1,y2,y3,y4,p1,p2;
    int n;
    
    cin >> n;
    
    rep(i,n)
    {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        p1 = (y2-y1)/(x2-x1);
        p2 = (y4-y3)/(x4-x3);
        if(p1 == p2)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    
    return 0;
}

C++: #include<iostream>
#include<cmath>
#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(){
	double x[4],y[4],n;
	cin>>n;
	rep(i,n){
		rep(i,4)cin>>x[i]>>y[i];
		double vx=x[1]-x[0],vy=y[1]-y[0],ux=x[3]-x[2],uy=y[3]-y[2];
		double la=sqrt(vx*vx+vy*vy),lb=sqrt(ux*ux+uy*uy);
		if(abs(abs(vx*ux+vy*uy)-la*lb)<1e-4)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}