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)
		}
		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>
using namespace std;

int main()
{
	int n,d1,d2;
	double x[4], y[4];
	int ans[100];
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (x[0] > x[2])
			d1 = x[0] - x[2];
		else
			d1 = x[2] - x[0];
		if (x[1] > x[3])
			d2 = x[1] - x[3];
		else
			d2 = x[3] - x[1];
		if (d1 == d2)
			ans[a] = 0;
		else
			ans[a] = 1;
	}
	for (int b = 0; b < n; b++) {
		if (ans[b] == 0)
			cout << "YES" << endl;
		else if (ans[b] == 1)
			cout << "NO" << endl;

	}
}

C++: #include<iostream>
using namespace std;
int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int n,i;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((x1-x2)*(y3-y4)-(x3-x4)*(y1-y2)){
			cout<<"NO\n";
		}else{
			cout<<"YES\n";
		}
	}
}

C++: #include<cstdio>
#include<cmath>
struct Point
{
	double x,y;
};
int main(void)
{
	int num;
	Point a,b,c,d;
	scanf("%d",&num);
	for(int f1=0;f1<num;f1++)
	{
		scanf("%lf %lf",&a.x,&a.y);
		scanf("%lf %lf",&b.x,&b.y);
		scanf("%lf %lf",&c.x,&c.y);
		scanf("%lf %lf",&d.x,&d.y);
		Point vec1,vec2;
		vec1.x=b.x-a.x;vec1.y=b.y-a.y;
		vec2.x=d.x-c.x;vec2.y=d.y-c.y;
		if((float)atan2(vec1.y,vec1.x)==(float)atan2(vec2.y,vec2.x))
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>

using namespace std;

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

	double x1, y1, x2, y2, x3, y3, x4, y4;

	while (n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a, b;
		a = (y2 - y1) / (x2 - x1);
		b = (y4 - y3) / (x4 - x3);
		(a == b) ? cout << "YES" << endl : cout << "NO" << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
#define INF 1e+15

int main(){
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n;
	cin >> n;
	while( n-- ){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double tan1, tan2;
		if( x1 - x2 == 0 ){
			tan1 = INF;
		}else{
			tan1 = (x1-x2)*(y3-y4);
		}
		if( x3 - x4 == 0 ){
			tan2 = INF;
		}else{
			tan2 = (x3-x4)*(y1-y2);
		}
		if( tan1 == tan2 ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  int n; cin >> n;

  while (n--) {

    Real x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    x1 -= x2;
    y1 -= y2;
    x3 -= x4;
    y3 -= y4;

    if (x1 * y3 == y1 * x3) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }

  }

  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <cmath>
#include <sstream>
#define F first
#define S second
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int l = 0; l < n; l++) {
		double x[4], y[4],v[2];
		for (int i = 0; i < 4; i++)cin >> x[i] >> y[i];
		v[0]=(y[1] - y[0]) / (x[1] - x[0]);
		v[1]=(y[3] - y[2]) / (x[3] - x[2]);
		if (x[0] == x[1] && x[2] == x[3]) {
			cout << "YES" << endl;
			continue;
		} else if (v[0]==v[1]) {
			cout << "YES" << endl;	
			continue;
		}
		cout << "NO" << endl;
		continue;
	}
	return 0;
}

C++: //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

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

// const ll inf = INT_MAX;
const double eps = 1e-5;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){
	int n;
	scanf("%d\n", &n);
	double x[4], y[4];
	rep(i,n){
		rep(j,4){
			scanf("%lf %lf", &x[j], &y[j]);
		}
		double dx[2], dy[2];
		dx[0] = x[1] - x[0];
		dx[1] = x[3] - x[2];
		dy[0] = y[1] - y[0];
		dy[1] = y[3] - y[2];
		printf("%lf\n",std::abs(dy[1]*dx[0] - dy[0]*dx[1]));
		if(std::abs(dy[1]*dx[0] - dy[0]*dx[1]) <= eps) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
#define range(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) range(i, 0, n)
const ll INF = 1e10;
#define pb push_back

int main()
{
    int n;
    cin >> n;
    rep(i, n)
    {
        vector<double> x(4), y(4);
        rep(j, 4) cin >> x[j] >> y[j];
        double a = (x[3] - x[2]) * (y[1] - y[0]) - (x[1] - x[0]) * (y[3] - y[2]);
        cout << a << endl;
        if (a != 0) {
            cout << "NO" << endl;
        } else {
            cout << "YES" << endl;
        }
    }
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

struct point {
	double x, y;
};

struct segLine {
	point s, e;	
}segA, segB;

int main() {
	int t;
	scanf ("%d", &t);
	while (t--) {
		scanf ("%lf%lf%lf%lf", &segA.s.x, &segA.s.y, &segA.e.x, &segA.e.y);
		scanf ("%lf%lf%lf%lf", &segB.s.x, &segB.s.y, &segB.e.x, &segB.e.y);
		if ((segA.e.y-segA.s.y)*(segB.e.x-segB.s.x)==(segB.e.y-segB.s.y)*(segA.e.x-segA.s.x))  printf ("YES\n");
		else printf ("NO\n");
	}
	return 0; 
}

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