Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&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)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		int n=sc.nextInt();
		for(int i=0; i<n; i++){
			double x1=sc.nextDouble();
			double y1=sc.nextDouble();
			double x2=sc.nextDouble();
			double y2=sc.nextDouble();
			double x3=sc.nextDouble();
			double y3=sc.nextDouble();
			double x4=sc.nextDouble();
			double y4=sc.nextDouble();

			double vx1=x2-x1;
			double vy1=y2-y1;
			double vx2=x4-x3;
			double vy2=y4-y3;

			double ip=vx1*vx2+vy1*vy2;
			ip*=ip;
			double n1=vx1*vx1+vy1*vy1;
			double n2=vx2*vx2+vy2*vy2;
			println(abs(ip-abs(n1*n2))<EPS?"YES":"NO");
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		new Main().run();
	}
}

C++: #include <iostream>
 
using namespace std;
 
 
 
struct pt {
 
    double x;
 
    double y;
 
};
 
 
 
int main() {
 
    int num;
 
    cin >> num;
 
    while(num--) {
 
        pt p1, p2, p3, p4;
 
        cin >> p1.x >> p1.y;
 
        cin >> p2.x >> p2.y;
 
        cin >> p3.x >> p3.y;
 
        cin >> p4.x >> p4.y;
 
        pt v1 = {p1.x-p2.x, p1.y-p2.y};
 
        pt v2 = {p3.x-p4.x, p3.y-p4.y};
 
        if (v1.y==0 && v2.y==0) cout << "YES\n";
 
        else if (v1.x/v1.y == v2.x/v2.y) cout << "YES\n";
 
        else cout << "NO\n";
 
    }
 
    return 0;
 
}

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;
	
	for (int i=0; i<n; i++) {
		Point2D a, b, c, d;
		
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		
		double p = (a.y-b.y)/(a.x-b.x), q = (c.y-d.y)/(c.x-d.x);
		
		if (p-q < 1e9) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: n = input()+1
for v in range(1,n):
        (x1,y1,x2,y2,x3,y3,x4,y4)=map(int,raw_input().split())
        if x2-x1==0 or x4-x3==0:
                if x2-x1==0 and x4-x3==0:
                        print "YES"
                else:
                        print "NO"
        elif y2-y1==0 or y4-y3==0:
                if y2-y1==0 and y4-y3==0:
                        print "YES"
                else:
                        print "NO"
        else:
                a = (y2-y1)/(x2-x1)
                b = (y4-y3)/(x4-x3)
                if a == b:
                        print "YES"
                else:
                        print "NO"

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <iostream>
#include <sstream>
#include <functional>
#include <utility>

using namespace std;

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

short n, i, j;
double a[4], b[4];
int d[4], e[4];

int main(){
	scanf("%d", &n);
	rep(i, n){
		rep(j, 4){
			scanf("%lf %lf", &a[j], &b[j]);
			d[j] = a[j] * 10000;
			e[j] = b[j] * 10000;
		}
		if(d[1] - d[0] == d[3] - d[2] && e[1] - e[0] == e[3] - e[2]) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ;  i++)
int main(void){
	int n;
	cin>>n;
	rep(k,n){
		double x[4];
		double y[4];
		rep(i,4)cin>>x[i]>>y[i];
    
		if(((y[1]-y[0])/(x[1]-x[0])) == ((y[3]-y[2])/(x[3]-x[2])))cout<<"YES";
		else cout<<"NO";
		cout<<endl;
	}
}

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(abs((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;
double d[8];

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

  for(int i = 0; i < n; i++) {
    for(int j = 0; j < 4*2; j++)
      cin >> d[j];
    double tanAB = (d[3]-d[1])/(d[0]-d[2]);
    double tanCD = (d[7]-d[5])/(d[4]-d[6]);
    if(tanAB == tanCD)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include<iostream>

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

	return 0;
}